Introduction: Battery Powered ESP IoT
This instructables show how to make a Battery Powered ESP IoT base on the design in my previous instructables.
Step 1: Power Saving Design
Power consumption is a big concern for a battery powered IoT device. In order to total eliminate the long term power consumption (few mA) from the unnecessary component while running, this design decouple all those parts and shift to a development dock.
- USB to TTL chip
- RTS/DTR to EN/FLASH signal converting circuit
- Lipo charger module
The development dock only be required while development and always connecting to the computer, so size and portable is not a big concern. I would like to use a more fancy method to make it.
- ESP32 module
- Lipo battery
- 3v3 LDO circuit
- Power switch (optional)
- LCD module (optional)
- LCD power control circuit (optional)
- button for wake up from deep sleep (optional)
- other sensors (optional)
The second concern for a battery powered IoT device is compact in size and sometimes also concern portability, so I will try to use smaller components (SMD) to make. At the same time, I will add a LCD to make it more fancy. The LCD also can demonstrate how to cut the power consumption while deep sleep.
Step 2: Preparation
- USB to TTL module (broken out RTS and DTR pins)
- Small pieces of acrylic board
- 6 pins male header
- 7 pins round male header
- 2 NPN transistors (I am using S8050 this time)
- 2 resistors (~12-20k should be ok)
- Lipo Charger module
- Some breadboard wires
- 7 pins round female header
- ESP32 module
- 3v3 LDO regulator (I am using HT7333A this time)
- SMD capacitors for power stability (It depends on the device peak current, I am using 1 x 10 uF and 3 x 100 uF this time)
- Power switch
- ESP32_TFT_Library supported LCD (I am using JLX320-00202 this time)
- SMD PNP transistor (I am using S8550 this time)
- SMD resistors ( 2 x 10 K Ohm)
- Lipo battery (I am using 303040 500 mAh this time)
- Push button for trigger wake up
- Some copper tapes
- Some coated copper wires
Step 3: RTS & DTR Break Out
Most USB to TTL module that support Arduino have DTR pin. However, there are not too much modules broken out RTS pin.
There are 2 ways to make it:
- Buy a USB to TTL modules with RTS and DTR break out pins
- If you fulfill all the following criteria, you can break out RTS pin yourself, in most chips, RTS is pin 2 (you should double confirm with your datasheet).
- you already have a 6 pins USB to TTL module (for Arduino)
- the chip is in SOP but not QFN form factor
- you really trust you own soldering skill (I have blow away 2 modules before success)
Step 4: Development Dock Assembly
Building a visualizable circuit is a subjective art, you may find more detail in my previous instructables.
Here are the summary of the connection:
TTL pin 1 (5V) -> Dock pin 1 (Vcc) -> Lipo Charger module Vcc pin TTL pin 2 (GND) -> Dock pin 2 (GND) -> Lipo Charger module GND pin TTL pin 3 (Rx) -> Dock pin 3 (Tx) TTL pin 4 (Tx) -> Dock pin 4 (Rx) TTL pin 5 (RTS) -> NPN transistor 1 Emitter -> 15 K Ohm resistor -> NPN transistor 2 Base TTL pin 6 (DTR) -> NPN transistor 2 Emitter -> 15 K Ohm resistor -> NPN transistor 1 Base NPN transistor 1 Collector -> Dock pin 5 (Program) NPN transistor 2 Collector -> Dock pin 6 (RST) Lipo Charger module BAT pin -> Dock pin 7 (Battery +ve)
Step 5: Optional: Breadboard Prototyping
The soldering work in IoT device part is a little bit difficult, but it is not essential. Base on the same circuit design, you can simply use a breadboard and some wire to do your prototype.
Attached photo is my prototype test with Arduino Blink test.
Step 6: IoT Device Assembly
For compact size, I choose many SMD components. You can simply switch them to breadboard friendly components for easy prototyping.
Here are the summary of the connection:
Dock pin 1 (Vcc) -> Power switch -> Lipo +ve -> 3v3 LDO Regulator Vin Dock pin 2 (GND) -> Lipo -ve -> 3v3 LDO Regulator GND -> capacitor(s) -ve -> ESP32 GND Dock pin 3 (Tx) -> ESP32 GPIO 1 (Tx) Dock pin 4 (Rx) -> ESP32 GPIO 3 (Rx) Dock pin 5 (Program) -> ESP32 GPIO 0 Dock pin 6 (RST) -> ESP32 ChipPU (EN) Dock pin 7 (Battery +ve) -> Lipo +ve 3v3 LDO Regulator Vout -> ESP32 Vcc -> 10 K Ohm resistor -> ESP32 ChipPU (EN) -> PNP transistor Emittor ESP32 GPIO 14 -> 10 K Ohm resistor -> PNP transistor Base ESP32 GPIO 12 -> Wake button -> GND ESP32 GPIO 23 -> LCD MOSI ESP32 GPIO 19 -> LCD MISO ESP32 GPIO 18 -> LCD CLK ESP32 GPIO 5 -> LCD CS ESP32 GPIO 17 -> LCD RST ESP32 GPIO 16 -> LCD D/C PNP transistor Collector -> LCD Vcc -> LED
Step 7: Power Usage
What is the actual power usage of this IoT device? Let's measure with my power meter.
- All components on (CPU, WiFi, LCD), it can use around 140 - 180 mA
- Turned off WiFi, continue display photo in LCD, it use around 70 - 80 mA
- Turned off LCD, ESP32 goes deep sleep, it use around 0.00 - 0.10 mA
Step 8: Happy Developing!
It's time to develop your own Battery Powered IoT device!
If you can't wait coding, you may try compile and flash my previous project source:
Or if you want to taste the power down feature, try my next project source:
Step 9: What's Next?
As mentioned at previous step, my next project is an ESP32 Photo Album. It can download new photos if connected WiFi and save to the flash, so that I can always view the new photo on the road.
Step 10: Optional: 3D Printed Case
If you have a 3D printer, you may print the case for your IoT device. Or you may put it in a transparent sweet box just like my previous project.