DIY Dashbutton for the Internet of Things

23,237

238

27

About: Hey! I'm a maker and an electrical engineering student from germany

Hey makers, it's maker moekoe!

In this Instructable I want to show you how to bring more comfort and luxury to your homes. When reading the title, you may guess what we gonna build here. Everyone who visits the amazon online shop at least once, will be confronted with this little thing called amazon dashbutton. With these battery powered devices, which you can stick everywhere in your home, it's possible to reorder a specified product by a single button press.

In this how to we are going to make something similar, but without to reorder anything on amazon. We gonna control the Internet of Things or let us call this the Things of Internet - just because IoT is in everybodys mouth and Toi sounds more special to me... And what the Things of Internet could be is up to you. You could possibly control everything which has at least a wifi connection. In my case, I want to control my smart home devices such as lights, radiators and scenes by connecting it to my existing Apple HomeKit framework.

So actually, the goal of this project is to build an electronic device with self-designed PCB which occupies following aspects:

  • as simple as possible by containing only one control button
  • as small as possible
  • as fast as possible to minimize latencies
  • as portable as possible, or let us call it battery powered
  • and as... well, it should have a wifi connection

The result in general consists out of a PCB with a voltage regulating unit, a microcontroller, a LiPo battery and a simple button. During a short period of time I optimize the dashbutton PCB twice, so that we are at the third version of the PCB until now.

When you want see the behavior of this little thing, then check out this video on my Instagram. There are plenty videos of the dashbuttons in action and how they are built. So, for all of you who want to see more, you can find everything here @maker.moekoe.

Step 1: Things You Will Need

To build your own IoT dashbutton you only need a few components. Even though there are slight differences from version to version, the voltage regulating part stays the same. For all versions you will need:

  • MCP1700 3,3v LDO voltage regulator
  • 2x 1µF 1206 SMD capacitors

Additionally for the round or the rect version (left part of the picture above):

  • PCB (version 1 or 2)
  • ESP8285-M3
  • JST PH-2 90° Lipo connector
  • 100mAh Lipo battery with dimensions of 25x12mm
  • 3x6mm SMD button

Or additionally for the coin cell version (right part of the image above):

  • PCB (version 3)
  • ESP8266-07S
  • WS2812b rgb(w) LED
  • 0,1µF 1206 SMD capacitor
  • 6x6mm SMD button
  • 2450 coin cell holder
  • LIR2450 coin cell battery

Of course, you can think about a small housing for the dashbutton. A simple idea can be found in the fifth step of this Instructable.

Step 2: Printed Circuit Board

When I started with this dashbutton thing, I created the pcb version one without any specials - only connecting the few parts with electrical traces. I wouldn't recommend this version because it was the first draft and it is not developed like the others. Here is a small summary of all three versions:

Version 1 was my first final draft which has some things to optimize. Maybe I will update it in the future but it is working already. The PCB has the outer dimensions of 24x32mm. It is powered by a small LiPo battery and has just a voltage regulating unit for powering the ESP8285-M3. The battery sticks with some doublesided tape on the bottom of the dashbutton.

Version 2 consists of another outer shape of the PCB. It is round with a diameter of 30 mm and includes a ground plane over two-thirds of the area. The other third is the antenna of the microcontroller and shouldn't be overlapped with any of the traces or ground signals to reduce interferences. The schematic is the same as version one. And just as version one it is based on an ESP8285-M3.

Version 3 has another outer shape as well. Main difference is that it is powered by a standard LIR2450 battery which can be replaced easily if it's getting empty and therefore the PCB has to be a little bit bigger than the other versions. Additionally, it consists of an WS2812b rgb(w) led to inform on different things. Furthermore and in contrast to the other two versions it is based on an ESP8266-07S.

So just choose a version from the attached files and place your order at your favourite PCB company.

I definitely recommend version two, because it is the most developed of all and the small size of just 30mm is very handy in my opinion. When you want to have more features in that little thing, then refer to version three, but this version is still a work in progress and may has to be optimized in some aspects...

Step 3: Complete Your PCB

If you're holding your PCB in your hands, it is time to solder the components to it. To do so, you can use whatever technology you like. In my case I soldered the components with solder paste and reflow technology. For this you will need some solder paste in a syringe, a reflow soldering station (or something like a hot air gun) or a oven. Like shown in this video (for version two) or the video above (for version three), you have to dispense a little bit of the solder paste to every smd wire pad before you place the components to its provided space. In the video for version two it is shown with a semi-automatic dispenser and placer but the applied components are big enough to solder them completely manually like shown in the upper video for version three.

After this you can put the PCB into the oven or solder them with your chosen technology. This process is also shown as a timelapse in the upper video.

Of course, this should be possible with a normal soldering iron as well, but I think that won't be the easiest way and you have to be very patient.

Step 4: Flashing the ESP

Flashing the microcontroller on the pcb may not the easiest part. But thererfore that the dashbutton should be as small as possible, there are also as less as possible components on it. To flash it, there are three important things which you should make use of.

  • The GPIO0 (PROG for version three) wire pad jumper should be shortened to put the ESP in programming mode. Have in mind, that the microcontroller won't start as usual with a shortened GPIO0/PROG wire pad.
  • You have to connect the four wire pads (3,3v - gnd - rx - tx) to an external FTDI adapter. Doing so, you don't have to solder some wires to it. Because I have aligned the four wire pads in the 2,54 mm, grid you can take a 4-pin pinheader, connect it with jumper cables to the FTDI adapter and press it against the wire pads while uploading the sketch. And because a picture is worth than thousand words, I added one showing this process.
  • Right after the uploading message inside the Arduino IDE appears, you have to press the reset button once (it is THE button - the only button on the dashbutton). After this the blue led on the ESP should flash a few times until it flashes constantly while the uploading bar inside the Arduino IDE fills up.

My dashbutton is integrated into Apples HomeKit framework to control different things in my home. I won't go into detail how to install it or how it works because this would go beyond the scope. If you want to do it the same way you can refer to the awesome work of KhaosT, who worked on a node.js implementation of the HomeKit accessory server, which I used as well. For those who gonna use it I attached the Dashbutton_accessory.js file.

However it is possible to integrate the dashbuttons into another existing smart home application, or even more. The attached Arduino code is working with MQTT, which will operate with nearly every smart home implementation.

When you want to start with the attached Arduino code, then simply add your wifi credentials and the MQTT brokers IP address in the following code lines:

const char* ssid = "XXX";
const char* password = "XXX";
const char* mqtt_server = "192.168.2.120";

The sketch simply wakes up the ESP from deepsleep mode when the reset button is pressed once. After this it will connect to the specified wifi network as well as to the MQTT broker, before it publishes a simple message (like a single '1') to the defined topic. Afterwards the ESP goes back into deepsleep mode. Should your network be unreachable for the ESP, it will go back to deepsleep mode after six seconds, but of course without publishing anything. This is just to prevent the battery gets empty very fast.

Step 5: Print a Housing

The dashbutton should be already working when you have reached this step. But it should get a small case to prevent some damages to the PCB or to the electronics. Of course this is the creative part of this Instructable. So, if you want, you can design your own housing and print it on your 3d printer like I did. You can start from scratch or you can use my case and add some modifications. Obviously, the housing can be found on Thingiverse, but I have attached the files here as well.

The case or - to be more accurate - the lid for version 3 is not ready yet, but I will update it as soon as possible.

Step 6: Have Fun and Be Creative

So, hopefully you're able to switch your lights by a single button press now!

At least, my calculations have shown that the battery capacity of version one and two will reach up to 150 days with following values:

  • LiPo capacity of 105mAh
  • load current of 70mA
  • deepsleep current of 20µA
  • time for publishing of 3 seconds
  • button intervall of 2 per hour (that is more than it will ever reach, I guess)
  • battery loss factor of 30% (which is very high as well)

The battery lifetime of version 3 should be at least the same, whereas it has 120 mAh capacity. However, it has the ws2812 led on board, which will draw some current as well.

Now it's up to you! Hope that you enjoyed reading this Instructable or maybe enjoyed building such a nice little thing.

This and even other cool projects can be found on my GitHub Page makermoekoe.github.io. For recent updates you can follow me on Instagram.

If you have any suggestions or if something is unclear to you, then feel free to ask me in the comments below or write me a short message.

Regards

maker moekoe

Share

    Recommendations

    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure

    27 Discussions

    0
    None
    Lars-GöranL

    7 weeks ago on Step 6

    Very nice projekt, exactly what I need.
    Do you think it should be possible to adapt it for Mozilla lot Things. I really love their gateway application but all switches I found (IKEA, Osram, Phillips) don't work with the gateway.

    0
    None
    robsbots

    2 months ago

    Hey @moekoe
    I love this project. It's just what I have been looking for. I have boards on order for V2 and V3, and the components are starting to arrive for V2. Do you have a link for the battery used on the V2 board. This is the last component I have to track down before I can start building.
    This is a great project and I can't wait to start playing with it. Thanks for all your work.

    0
    None
    cburg

    3 months ago

    Thank You, Thank You, Thank You!!!
    I have been looking for a button like this for years. I own a large building that I have wanted to add a "Button" to turn on the lights. The switch is located 75ft away from the main door. I knew that the ESP286 was the answer but I could never find what I was looking for. You have helped me find half the hardware. Now I just need to figure out what to use to turn on a 17amp load (lots of lights)

    I think it would great if you would write the other end of your project and show us how you got the button to turn on your lights.

    Thank You Again!

    2 replies
    0
    None
    ChrisL75cburg

    Reply 2 months ago

    Consider a contactor, basically a really heavy duty relay. You’ll find them in the HVAC circles as they use contactors to let your thermostat turn on large air conditioners etc. They carry them for as small as 120V 20Amp all the way up to 480V 50Amp three phase etc applications.

    They’re switchable by a 24VAC input control voltage which is still a lot for a computer controlled system. You could have a 120v step down transformer to 24v and switch the power to the contactor safely with a 5v 2amp relay controlled by an Arduino/raspberry pi/some other IoT device capable of signaling a small relay.

    I’ve seen massive stadium lights lit up at the click of a mouse run by this setup. Just add ferrite cores to the 24v lines going to the small relay to reduce noise from the AC line interference.

    Good luck!

    0
    None
    moekoecburg

    Reply 3 months ago

    Wow, thanks a lot for the warming words! Nice to hear that I could help someone with this.
    17amp light is very much, but there should be at least a big relay which is able to do this.
    Ok, when you're interested in this I could write it down by time. :)

    1
    None
    BerenV

    3 months ago

    Nice project! You could also use a MOSFET circuit to control power to the ESP8266, where the button push turns on the power, and the first thing the microcontroller does is pull an IO connected to the MOSFET gate high, essentially latching itself on. Then, as soon as it successfully completes its publish, it can turn the MOSFET off. This type of circuit uses zero power when not in use, which is far less than the ESP's deep sleep mode. Just my two cents ;)

    I used this circuit in my mailbox notifier, which theoretically should run for years on 2x Energizer Ultimate Lithium AA batteries. A button cell would of course have a shorter life, but you can save a ton of battery with this type of circuit if it's on standby for most of the time.

    3 replies
    0
    None
    moekoeBerenV

    Reply 3 months ago

    Hey BerenV! Thanks a lot for your comment. I have tested exactly that procedure with a SIL relay instead of a mosfet. You can see how it works in this video:
    https://www.instagram.com/p/BlaQTKpnZpU/?utm_sourc...
    The mosfet idea is even better! But at every time I am searching for a mosfet I didn't find the right one whichs works for my purpose... So maybe you can tell me which mosfet you are using :)
    Regards!

    0
    None
    BerenVmoekoe

    Reply 2 months ago

    Well, I actually used an FQP27P06 (which only comes in a huge TO220 package) because I was using perfboard, but I would recommend trying the AO3401A as an SMD replacement. I'm not 100% sure if all the obscure specs match, but it looks like it can handle the current the ESP8266 draws. Nice job on the PCBs btw!

    0
    None
    moekoeBerenV

    Reply 2 months ago

    Yeah okay I will have a look and compare these fets. would be nice if it works. :)

    0
    None
    MarcoB102

    3 months ago

    Hi @moekoe and thanks for a well documentation, about this project.
    A question: who is the manufacturer, where did you send , the gerber files?

    Thanks in advance
    Bye
    Marco

    1 reply
    0
    None
    moekoeMarcoB102

    Reply 3 months ago

    Hey MarcoB102! Thanks for your positiv feedback!
    The PCB manufactory I used is a german one called Aisler, which have very decent prices which are only addicted to the size of the pcb. (...much smaller is nearly impossible :D)
    Regards!

    0
    None
    GeorgeInst

    3 months ago

    Hi. Congratulations for the project. Take a look at the LiFePo batteries, you would avoid the use of the LDO (Iq).
    Would it be possible to acquire your PCBs?

    1 reply
    0
    None
    moekoeGeorgeInst

    Reply 3 months ago

    Hey GeorgeInst! Thanks a lot. I've heard about the LiFePo batteries but they doesn't excist in the right dimensions for my purpose :(

    The board files are accessible in this Instructable or on my GitHub Page:
    https://github.com/makermoekoe/Smarthome-dashbutto...
    I am currently not selling these with presoldered components.

    0
    None
    AndrewP264

    3 months ago on Step 6

    Thanks for the clear, well documented instructable and the very professional looking results.
    I noticed you're not using an external antenna for the ESP-07s - do you get enough range like that?

    2 replies
    0
    None
    moekoeAndrewP264

    Reply 3 months ago

    Hey AndrewP! Thanks a lot! I'm currently not using an external antenna. I have had problems to program the ESP8266 because of the LED.. Just have to figure out what's the problem..
    After this I will do a range test with and without antenne :)

    0
    None
    AndrewP264moekoe

    Reply 3 months ago

    Thanks, I'm planning a similar project and would be very interested to see your results.

    0
    None
    gdriver

    3 months ago

    Nice looking, but from what I have read -
    GPIO 0 should be high on normal boot, you have it floating
    GPIO 15 should be low at power-up, again floating
    EN should be pulled high through a ressitor not tied directly to Vcc

    These things can lead to unreliable operation (alledgedly)

    2 replies
    0
    None
    moekoegdriver

    Reply 3 months ago

    Hey gdriver! You're correct, but GPIO0 could be floating as well, it doesn't need to be pulled HIGH for normal mode.
    On version three the GPIO15 is connect with ground plane, so it's always pulled down. The ESP8285-M3 from version one and two doesn't have this GPIO15 pin, it is pulled low inside the metal housing.
    For EN you are right, maybe I will add a 0603 resistor. I was just to lazy because it works :D

    0
    None
    gdrivermoekoe

    Reply 3 months ago

    Looking at https://www.tinyosshop.com/datasheet/ESP-07S_User_... I see that the can of the 07S is slightly bigger than that of the 07 so I am wondering if the required resistors are now inside the can?

    Someone queried the the absence of ext antenna - on the ESP07 there was the option of using an on-board ceramic antenna. This seems to have vanished on the S so I guess an external antenna is required - as per document.

    Your LiR2450 is rated at 3.7V nominal and 200mA maximum. The ESP tpically draws over 250mA peak during transmit unless you add 1000uF or so across the 3.3V rail.

    The regulator drops 200mV at 200mA, so 3.3V+0.2V=3.5V -- not a lot of headroom here. http://ww1.microchip.com/downloads/en/DeviceDoc/20... fig. 2.20 shows a 2.8V output dropping by 200mV with a 200mA step load. The capacitor will prevent this. Microchip do not show a 3.3V regulator operating with an input voltage as low as of 3.7V.

    You might like to look at https://www.youtube.com/watch?v=heD1zw3bMhw

    Also on V3 you might like to consider that the quiescent current of the LED is typically 0.7mA - your battery will last only a few days - maybe add a high-side switch along the lies of FDC6329L https://www.mouser.sg/ds/2/149/FDC6329L-1007185.pd...

    0
    None
    DmitryP2

    3 months ago on Step 6

    Did you test other RF interfaces like Lora or BT BLE for power consumptions?
    Maybe NB-IoT module will be more economic (SIM holder will eat some space)?