Introduction: Remote Control: ESP8266 With Coin Cell
The big problem using the ESPs is the power consumption when Wifi "goes up", about 100-200mA, peak up to 300mA. Normal coincells deliver a few mA, peak up to 20-40mA. But for the ESPs the voltage will collapse. We need "a little help of my friend": the supercap. These capacitors deliver enough current for power up the Wifi and sending a message, in this case the switch command. Another option is a datalogger that have to wake up every few hours for a couple of seconds.
In this instructable i use the Esp8266 to build a remote control for phillips hue lights.
Step 1: The Solution
First of all we have to know that it is no good idea to connect the battery and cap simply parallel.
The charging current from cell to cap has to be reduced with a resistor. The specs for my coin cell tell us a peak current of 25mA.
Ohm's law: R=U/I -> 3V/25mA= 120 Ohm.
The supercap has enough capacity to power the ESP for 10-20 seconds. If you use a static ip address like i do, the ESP only wake up for 1-2 seconds sends/receive its message and fall into "deepsleep" until the reset button is pressed.
Two options for the schematic:
1. Connect the supply directly and use the reset switch for action, see picture. In this case we have to make sure that the wemos needs as little power as possible, so we may have to remove the 3.3V regulator and the supply for the uart-ic.
2. We use a button switch that seperates the supply from the wemos. The downside is that you have to press the button for 1-2 seconds until the action is done. (lights on or off)
Step 2: Part List
Step 3: 3d Printed Case
Here are some stl files for a small case into which the board fits exactly
I use normal print settings with an infill of 30% and 0.2mm layer height.
The knob is also printed so you can use the reset button for action and don't has to use an extra button.
Use skirt and brim for the knob because the object is very small
Step 4: Coding the Esp8266
First you need the Arduino IDE.
Then you have to install the library for Esp8266.
For a faster connecting/switching we use a static ip adress.
After opening the attached sketch with the Arduino IDE you have to do some settings depending to you local WIFI.
ip adress of you local wifi router where the hue bridge is connected
IPAddress ip(192, 168, 178, 216);
Ip adress of your switch, be aware of using a high adress in the range of 200-250 that is not used for other devices
int light = 2;
the number of your light that is switched
const char hueHubIP = "192.168.178.57";
the ip adress of the hue bridge
const char hueUsername = "hue bridge username"
you have to create an authorized username in the hue bridge, look at this tutorial
const int hueHubPort = 80;
const char ssid = "SSID"; // network SSID (name)
const char pass = "password";// network password
finally SSID and password of your wifi
After changing these settings you are ready for upload !
Step 5: Final Steps and Thoughts
Be sure to pre-charge the cap before connecting to wemos because the Esp8266 immediately start to make a wifi connection after reset/connect power.
See assembly in video
to save energy disconnect pin 4 and 16 of uart-ic and remove the
voltage regulator, please note after that it's no longer possible to program the wemos via USB !!