Tiny ESP8266 Dash-Button (Re-Configurable)


5,211

20

36

Electronics and Software Hobbyist. Let's see what I come up with... into #DoctorWho, #ESP8266, #A...

This is a tiny ESP8266 based dash-button. It stays in deep sleep, once you press the button it performs a GET request to the specified URL and if configured also passes the supply voltage as a variable. The best part is that by simply bridging two pins you can make it enter configuration mode. Allowing you to change all the settings without reprogramming.

For following along this instructable I am assuming you know some things, like; how to solder, how to follow a schematic and how to upload a program and SPIFFS data to an ESP.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials and Tools Needed

For this project you will need:

  • An ESP-01 (Obviously)
  • A 50mAh or similar Li-Po Battery
  • 2x1 female pin header
  • A 3.3V LDO (Highly recommend the HT-7333A, It has an excellent standby current of 4uA and 170mV dropout)
  • A tiny push button
  • Some thin wire (Wire wrapping wire works great)

You will also need:

  • An ESP programming board
  • A soldering iron / solder / flux
  • A desoldering pump
  • Tweezers and/or wire strippers
  • Sandpaper
  • Superglue

Step 2: Programming

This project is fully open source, if you want to modify the code it's on my GitHub. But there is no need to. This button can be reconfigured without reprogramming.

You can download the pre-compiled code here.

Just plug in your ESP programmer and your ESP8266(Remember to connect GPIO_02 to GND to enter programming mode) and upload the .bin file and the SPIFFS data.

It's very important to upload the SPIFFS data folder, without it the code will not boot. And after removing the pin headers having to go back to reprogram will be very tedious.

Step 3: How the Code Works (If You're Interested, Otherwise Just Skip)

When the ESP boots up, it reads and parses the 'config.jsn' file from the SPIFFS file system using the ArduinoJSON library. This loads up all the configurable settings into variables.

Then it checks to see if GPIO_03[RX] is connected to ground if it is it will enter configuration mode.

If it is not it will attempt to connect to WiFi and then the server. It completes a GET request and enters deep sleep to conserve power.

In configuration mode, you can set all the settings. (more on this on step 13)

Since saving power is essential here, if anything takes too long or if connecting to wifi/server fails, it will simply blink five times fast and then a long blink to indicate an error and return to deep sleep.

If it all goes right, it will do a short blink then a long blink. To show it succeed. Then enter deep sleep.

Still curious? have a look on my GitHub.

Step 4: Schematic

This should help you build it, during the next few steps.

Step 5: Desolder the Pin Header

First, be 100% sure that you programmed the ESP8266 correctly and 100% sure you uploaded the SPIFFS data.

Then the first step is to desolder the 2x4 pin header, this will let us make our button smaller. But it also means you can't reprogram without resoldering it. Make sure the program and SPIFFS are flashed.

You will still be able to reconfigure the settings.

This is a lot easier with a pointy soldering iron tip and a desoldering pump. My strategy is to first bridge all the eight pins with solder, then heat all of them at once and yank the header out with some tweezers. Then after removing the excess solder, I poke the holes from the top with the iron and suck the solder out with my pump through the bottom.

Step 6: Solder the Switch

Next, you will want to solder your push switch between GND and RST. In my case the button pins were just a bit too thick, so I had to cut them a bit thinner with some snips. Make sure the button sits flush with the board, otherwise it might break over time with the stress of being pushed.

Step 7: Connect CH_PD to VCC

To allow the ESP to run the code, don't forget to connect CH_PD to VCC.

Step 8: Remove the Power LED

The button needs to consume as little power as possible. And since it is always on, the power led would always be consuming ~4mA. This would reduce the battery life to twelve hours. So desolder it or snap it off.

Step 9: Solder Configuration Switch

To enter configuration mode, GPIO_03[RX] needs to be connected to GND. To make it easy to do so I soldered a little lever that can be pushed to the side to make the connection.

Step 10: Add the Power Supply, Regulator and Connector

This is the longest part of the build. You will need to solder the battery, voltage regulator and the charging connector according to the schematic.

To make it all fit within the tiny space under the ESP-01 I had to sand down the voltage regulator's TO92 package. Make sure to plan your layout before soldering, it will be very tight but should be still do-able.

If your battery is too big, you might choose to omit the voltage regulator. This will work but will risk damaging the ESP8266. It is only rated to go up to a maximum of 3.6V, but a fully charged LiPo outputs 4.2V. Proceed at your own risk.

Step 11: Superglue It Toghether

The last step to keep everything in place is to superglue everything in place.

Step 12: Charging

To charge your button you will need some sort of LiPo charger, I simply use a generic USB Li-Po charger board connected to the button via the charging connector. Be careful not to switch the polarity around.

Step 13: Configure

You are almost ready to use your button for the first time.

To enter configuration mode you need to connect GPIO_03[RX] to GND, this will be easier if you soldered a lever like in step 9. Then by pressing the button to reset the ESP, it should enter configuration mode. You can now disconnect the lever.

Then you can simply:

  1. Connect to 'ESP_Button' WiFi Access Point, with the password 'wifibutton'
  2. Visit http://192.168.4.1 to open the configuration page.
  3. After setting your values, click on the 'Save' button then the 'Restart'
  4. Your button will restart, perform the request and enter deep sleep.

Make sure to only type the hostname in the host field, no http:// or https:// and separate the rest of the URL in the URI fields.

Step 14: Try It Out

You should be all good to go, pressing the button will make your GET request.

The video above is my button connecting to my website and IFTTT, posting a custom generated tweet.

Setting up the GET request is out of the scope of this instructable, but you should easily be able to connect this to IFTTT or any other service. If you are willing to write some custom PHP code and host it on your own website like I did you might even be able to monitor the battery.

If you have any issues or need help troubleshooting please leave a comment down below.

Anyone is welcome to give ideas on how to improve this, like maybe a case? xD

Leave a comment if you are a Doctor Who fan.

Cheers!

Step 15: Update: 3D Printed Case

After some time using the dash button i've decided to make a case for it. STL and Fusion 360 files attached.

Epilog Challenge 9

Participated in the
Epilog Challenge 9

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    36 Discussions

    0
    None
    Dimosap

    3 months ago

    I made your job. My 150mA battery lasts less than 1 day:(

    7 replies
    0
    None
    Luigi PizzolitoDimosap

    Reply 3 months ago

    Maybe it's not entering deep sleep? Mine lasts for around a month on a 50mAh battery.

    Have you tried measuring the current drawn? It should be around 70-300mA while operating and only 20uA in deep sleep.

    0
    None
    DimosapLuigi Pizzolito

    Reply 3 months ago

    I use an esp8266 12e module and I have followed your schematic. I also have the impression that it does not fall into deep sleep but I do not know why. Unfortunately I can not count Amps. I love your job.

    0
    None
    Luigi PizzolitoDimosap

    Reply 3 months ago

    You could try adding a Serial.print statement after the line that says ESP.deepSleep . If the serial does print, then you know that it's not going into deep sleep.
    It's hard to know what's going on without measuring the current...

    0
    None
    DimosapLuigi Pizzolito

    Reply 3 months ago

    It goes into deep sleep but still has a lot of consumption. I tried to rebuild it from the beginning and with different batteries but I have the same results. My battery will last for a few hours. I may have a bad esp.

    1
    None
    DimosapDimosap

    Reply 2 months ago

    Hello again,
    i replaced esp12e with esp 01 and i still have the same problem with battery life. While working properly and getting into deep sleep mode, the battery lasts a few hours.
    My voltage regulator is LD33 and I have removed the red light from esp 01.
    What could go wrong?

    0
    None
    Luigi PizzolitoDimosap

    Reply 2 months ago

    I think it is your voltage regulator then:
    I looked at the datasheet for LD33 (https://www.sparkfun.com/datasheets/Components/LD1117V33.pdf) and the quiescent current (current when not doing anything) is 10mA! that's a lot!
    I used a HT7333 LDO and looking at it's datashet (http://www.angeladvance.com/HT73xx.pdf) it only has a quiescent current of 4-8µA That's a big difference...

    A 50mAh battery would last for only 5 hours with the LD33 (50/10=5), but with the HT7333 it would last over six thousand hours! (50/0.008=6,250)

    0
    None
    DimosapLuigi Pizzolito

    Reply 2 months ago

    Thank you very much for your help. At local stores here in Athens there is no HT7333. I have made an order from China and will have to wait. I'll keep you informed

    0
    None
    mickaelmo

    3 months ago

    I have this error:

    Button Booting...
    SPIFFS Content:
    FS File: /index.htm.gz, size: 1.51KB
    FS File: /config.jsn, size: 195B

    Failed to parse config file

    3 replies
    0
    None
    mickaelmoLuigi Pizzolito

    Reply 3 months ago

    I did not edit the config.jsn.
    Probably an error with the SPIFFS ? It's my first time...
    Please help :)

    0
    None
    fahima23

    7 months ago

    error fail to open config file in serial motnitor display
    i have uploaded bin fine with ESPflasher

    2 replies
    0
    None
    fahima23fahima23

    Reply 6 months ago

    Thanks, now I understand how upload data to esp8266 with spiffs tool, now my project is working fine

    0
    None
    Luigi Pizzolitofahima23

    Reply 7 months ago

    Maybe I forgot to include the SPIFFS data on the bin file. Could you try compiling the code with Arduino IDE and make sure to upload the SPIFFS folder?

    0
    None
    ShaunM57

    1 year ago

    Could this be set to send a message to a MQTT broker?

    1 reply
    0
    None
    Luigi PizzolitoShaunM57

    Reply 1 year ago

    Yes that should work, you just have to replace the part of the code that completes the GET request with some code that sends a message to a MQTT broker.

    0
    None
    2BECKHAM2

    1 year ago

    Excellent project Ploopy.

    1) I've uploaded the .bin file from github to ESP01.

    2) Soldered CH_PD to VCC

    3) Connected Rx to GND and powered on ESP01.

    The blue led is blinking at the same time not able to view the 'ESP_Button' WiFi Access Point for me to configure.

    Please help. - Thanks in advance.

    2 replies
    0
    None
    Luigi Pizzolito2BECKHAM2

    Reply 1 year ago

    Hi,
    Glad to know you are giving it a try.
    From my code, the ESP8266 only blinks the led if its trying to connect. When it enters configuration mode the led should stay on, without blinking.
    Double check your connection from Rx to GND.

    If that does not work I would try to compile and upload the .ino sketch and open the serial monitor to see what is going on. I hope it works!