Lab 05a: Power

Spring 2019

The questions below are due on Thursday March 07, 2019; 10:00:00 PM.
You are not logged in.

If you are a current student, please Log In for full access to the web site.
Note that this link will take you to an external site ( to authenticate, and then you will be redirected back to this page.

Music for this Lab


You will not have an assigned partner today. Sit at a table with a soldering iron, and wait for someone else to show up and sit there. Then get started.

Goals:Today, we'll be integrating our battery management board into our system. We'll be soldering a few parts together to get the working system.

This is the day you get your Lithium Polymer Battery. This is the reason we have those awesome lunchboxes—they can suppress fire. Treat your battery with care. Make sure you see the lecture notes from this past week on battery safety.

1) Soldering

You will be soldering with your partner today, taking turns, and helping eachother. A quick guide to soldering is included here1. Read pages 11 to 16 and pages 21-22. These will form a good reference for you about how to solder!

A couple of additional notes for our soldering party today:

  • You must wear safety goggles at all times!
  • You must solder on the ceramic hot-tile at all times to avoid damaging the tables
  • If cutting/nipping short pieces of wire, point the board downwards so the wires chunks fly towards the floor.
  • You must wear safety googles at all times!
  • You should wash your hands when you're done since the solder has some lead in it.
  • No food nearby when soldering.
  • You must wear safety googles at all times!

You must wear safety-goggles at all times in the lab while soldering is going on! This is not up for debate.

2) Getting Started

There is no code we'll be writing today, though there is a script you'll run at the very end. Instead we're building something real and lasting: our power board. Roughly speaking we'll be building up one of those USB charger batteries people often takes with them on trips and which get handed out to you at career fair. At a high level these things are made of the following:

High-Level Schematic of our Power Board

The system works based on the following:

  • An external USB source power source provides roughly 5V to a TP4056 lithium-polymer-ion battery charger and isolation unit (when charging).
  • The TP4056 uses this power source to correctly and efficiently charge a 18650 Lithium Polymer Battery, while monitoring how much current is going in and out of the battery to prevent potentially damaging usage.
  • The battery stores energy, and while its voltage is "nominally" 3.7V, in reality it ranges from 3.2V to 4.2V as it goes from nearly empty to fully charged.
  • The battery output is converted back to a clean, USB-compatible 5V using a Boost converter, which itself has a USB-type A connector on it so that we can plug our USB cable into it to power our ESP32.

On top of this basic schematic, we'll actually add a few more pieces in order to let us turn enable/disable the battery connection to the boost board, and to monitor the battery's voltage. A full cartoon-schematic of the system is shown below with some real-life photos of parts is shown.

A more detailed schematic

3) The Power Board

Instead of wiring up this circuit in our breadboard, we'll use a custom Printed Circuit Board (PCB) which takes care of most of the wiring for us (permanent wires are on the board, which you can see). We still need to insert components into the board and fuse them with the PCB using soldering, however, which is what we'll be doing next. In doing this we'll make a permanent, robust, and safe power board that will allow us to utilize our battery as needed.

Parts for the Power Module.

The individual pieces are described briefly below roughly in the order that we'll use them in construction:

  • A- 18650 Battery Holder: Used for holding the battery
  • B- Hookup Wire: Used for connecting battery holder to printed circuit board
  • C- Printed Circuit Board (PCB): Holds the parts and connects them for us
  • D- Bare Wire: Used for connecting Charger/Protection Board and Boost Board to main PCB. Note this is not solder. The solder is sitting at the soldering stations around the room.
  • E- Charger/Protection Board: Used to charge battery and protect battery from extreme usage
  • F- 5.2V USB Boost Converter: Converts varying output voltage of battery to slightly above USB standard voltage
  • G- Three Pin Header: Forms Part of our On/Off Switch
  • H- Pin Jumper: Forms other part of our on/off switch
  • I- Two Pin Header: Used to connect power board's sense circuit to breadboard
  • J- Two 10-KOhm resistors: Used for sensing battery voltage
  • K- 18650 Battery: Lithium Polymer Battery (approx. 1500 mAH)

Go to the front and get a bag of parts that contains everything except for your actual battery)

4) Assembly

We will assemble everything in steps. Do not move on and/or skip steps. Please pay careful attention to what is going on in the pictures. Direction on some stuff matters and on other things it doesn't.

4.1) Battery Holder and Wires

Take your two hookup wires, split them apart, and expose about 1/8th of an inch of wire on both ends of each. Place the battery holder so that its pins are up and, making note of which side is the positive and which is the negative (positive denoted by "+" symbol and negative denoted by "-" symbol), twist and then solder the wires onto the two pins like shown in the figure below. Do not stray from this color code. Red is positive, black is negative. You can express yourself later using the electrical tape, but for now we need to know which end is which on the battery. When completed put this part aside.

The battery holder being assembled (it has not been soldered yet). Once it looks like this, solder it. Pay close attention to what wires go where (red to positive, black to negative. There is no debate on this. This is power convention for the purpose of safety.)

4.2) Charger/Protection Board and Boost Board

Next up we will attach the Charger/Protection Board and the Boost Board. Keep track of which is which. Position them on the board as shown below and use small pieces of the exposed metal wire to clip it into place as shown (use the wire cutters and diagonal cutters as needed). Carefully flip the PCB over and solder the six connections on the bottom, before flipping the board over and soldering those six connections on the top as shown below.

Direction matters! the two boards need to be mounted on the correct side of the PCB! Do NOT use the header pins for this step!

A: insert small wire linkers into the boards and PCB. B: solder them to the PCB and the boards on the bottom. C: Continue onto the top. D: When complete, trim any excess wires.

Checkoff 1:
Show your soldering so far to a staff member. Fix any problems. Staff will talk with you about how to mount the header pins in the next step.

4.3) On/Off Jumper and Header Pins

Take the three-pin header and insert it so that the long-side of the pins are facing upwards (the jumper can either be on or off at this is up to you). The jumper must sit on the long side of the pins. Flip the board over and solder the three pins in place. Try as hard as possible to keep these three pins normal to the PCB board.

A: Insert the three pin header into the PCB, and solder it in place on the back side.

4.4) Resistors

Grab the two resistors, and insert them like shown below. Direction of resistors does not matter.

A: Insert the resistors like shown. B: Solder the leads in place on the back side. C: Trim any excess wire.

4.5) Breadboard Pins

Grab the two-pin header and insert it so that the long side of the pins is facing down (opposite of the three pin header from earlier.). Solder it on the top of the board as shown below.

A: Solder the two-pin header as shown.

4.6) Attach Battery Holder

Attach the battery holder to the breadboard, making sure the red/positive wire is connected to connection J1 and the black/negative wire is connected to connection J2.

It is absolutely critical that you ensure the red wire (connected to positive the on the battery holder) is connected to pin J1 and the black wire (connected to the negative terminal on the battery holder) is connected to J2.

Attach the battery holder to your board as shown. Red (positive side of battery) must go to J1. Black (negative side of battery) must go to J2.

4.7) Testing the Board

The jumper on your board connects the battery to the boost converter.

  • When to the left it is OFF
  • When to the right it is ON. This is verified by a red LED on the boost converter emitting if the battery has any charge in it. When ON, your Boost output (the large USB socket) will have 5V present on it.

Plug in your charger board to your computer to verify that it is working properly. You should see a blue LED and orange LED on your charger board, and, depending on the jumper position, a red LED on your boost board.

There are three LEDs on the two boards. The bright blue LED indicates the battery is charged (or there is nothing to charge as is the case right now since you don't have a battery as shown in A and B here). When the battery is charging, the blue LED will be off (C and D), but the orange one on the 4056 charger board will stay illuminated. When the jumper is to the right (B and D), the red LED on the boost board will be on indicating there is 5V output present on the Boost.

Checkoff 2:
With a staff member present, verify that your system lights up the appropriate LEDs in the different states of the jumper switch. Verify that all solder joints look good. Verify that the battery holder is connected correctly, with the red wire going to J1 and the black wire to J2. If everything passes, your staff member will take your boards up to a TA/instructor who will hot glue certain areas of your board to insulate things. Then with the staff member, you will insert your battery tape it into place with electrical tape.

4.8) Mount to Board and Tape it Up

There are two downward facing pins on your board at J4 that we won't use today, but will in a future lab. We need them to be accesible. When looking at the board as shown in the pictures below, the left pin should go to ground (GND), and the right pin (the one that is highlighted with the square box) should have a wire connected to it that goes somewhere on your breadboard that is accessible so we can use it later.

Complete the wiring of your board as shown below, You will be given a 4 inch piece of double-sided tape. Use approximately two inches to secure your battery holder to the back of your breadboard mount as shown and use the rest to secure your battery board onto your breadboard in a secure fashion. Use the figures for reference!

I set up my wiring so that the left pin is connected to ground and the right pin is broken out to an unused portion of the breadboard which we will use in a future lab. This unused pin measures the battery's voltage through a **voltage divider**.

How my board looks (note I did not tape my battery into its holder. YOU WILL TAPE YOUR BATTERY INTO PLACE!)

Once everything is in place, plug in your battery board so the battery starts charging for a few minutes. The orange light, but not the blue should come on. You'll now answer a few questions about the board. When done, you'll then run one final script to ensure your battery has held charge some charge and get a final checkoff.

While charging the charger board will get pretty warm. It is actually going to burn off as much as 2W while charging your battery and that is a lot of energy to be emitted from such a little tiny chip so don't be too alarmed!

5) Review

Which statement correctly describes when you should remove your 18650 battery from its battery holder?
whenever I feel like it

Which jumper pin connection connects the battery to the Boost converter?
the left
the right

The Boost Converter is active when:
the blue LED on the charger board is on
the red LED on the boost is on
the orange LED is on

The battery is fully charged when
the blue LED on the charger board is on
the red LED on the boost is on
the orange LED is on

I am to take good care of my 6.08 kit since there is a battery in it
this is a true statement
this is a false statement

I am to store my labkit in my labkit safety pouch...
on alternating Tuesdays

When these questions are answered, if it has been about five minutes, stop charging your battery, and use the cable to upload the code below to your ESP32. Then once uploaded, unplug your device from your computer, and plug it into your boost output. The code should run. Turn the system on/off by moving your jumper.

#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include <SPI.h> //Used in support of TFT Display
#include <string.h>  //used for some string handling and processing.

TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h

const int LOOP_PERIOD = 100; //periodicity of getting a number fact.
uint32_t last_time; //used for timing

void setup(){
  tft.setTextColor(TFT_GREEN, TFT_BLACK);
  Serial.begin(115200); //begin serial
  delay(100); //wait a bit (100 ms)

void loop(){
  tft.setCursor(0,0,2); //set cursor at top left of screen, and set font size to 1
  tft.println("I'm"); //print a whole line.
  tft.println("battery"); //print some text 
  tft.println("powered"); //continue printing from cursor
  tft.println(millis()); //print something that is changing so we can at least feel alive
  while (millis()-last_time < LOOP_PERIOD); //loop until LOOP_PERIOD has passed
  last_time = millis();

Checkoff 3:
Discuss your system with a staff member. Show how you can run everything and be mobile. Turn on and off your system using the jumper. When done, turn off your system. Pack it up safely in your Lithium Polymer bag, and go in peace when done.

That's it for lab! Exercises for Week 5 are due Sunday night (11:59 PM) as usual. Consider doing a design exercise if you didn't do one last week. Next week we'll be adding our last module, the microphone.


1From awesome MIT-spawned company Adafruit! (click to return to text)

This page was last updated on Thursday March 07, 2019 at 07:39:45 AM (revision 87d9392).
Course Site powered by CAT-SOOP 14.0.4.dev5.
CAT-SOOP is free/libre software, available under the terms
of the GNU Affero General Public License, version 3.
(Download Source Code)
CSS/stryling from the Outboxcraft library Beauter, licensed under MIT
Copyright 2017