Introduction: IoT Push Button (D1 Mini)
I made an IoT Push Button (Think of those Amazon Dash things) that you can use to push notifications to your phone (to request drink refills when relaxing in the garden for instance). You could easily re-configure to interact with many other devices and smart home appliances using IFTTT.
This project uses a D1 Mini micro-controller and should run for months on a single battery using the deep sleep feature. A 3D-printable housing is used to complete the project.
You will need:
3.7 Li-ion 14500 battery (https://www.banggood.com/custlink/Gv3vPToo9Y)
AA style Battery Holder (https://www.banggood.com/custlink/DKvDHTOOIt)
Push Button and cap (https://www.banggood.com/custlink/3KvDFuajZC)
3D-Printable housing Some short lengths of wire and a glue gun to fix
Step 1: Putting Together the Circuit
The circuit is very simple to put together, simply use some short sections of wire to connect all the components as shown in the schematic being careful to note the common pins on the push button (use a multimeter to confirm if you're not sure).
The D1 mini will enter deep sleep mode after pushing a notification. Depending on use, the battery should last many months. It will need to be remove and recharged/replaced when it runs out.
Step 2: Assemble Within the Housing
Download and print the 3D-printable housing. You can make do without but if you have access to a printer it will certainly look neater.
Insert a battery into the holder and assemble the components within the housing, use hot glue to hold everything in place. The lid should hold firm by itself but you may want to add a small amount of glue to make sure.
Step 3: Setup Notifications Via IFTTT
Notifications will arrive via the IFTT app. Download it to your phone if you don't have it already, it is available at the Google Play (https://play.google.com/store/apps/details?id=com.ifttt.ifttt&hl=en_GB) and Apple App Store (https://apps.apple.com/gb/app/ifttt/id660944635).
Create an account and in the app configure a new applet. For the IF function select Webhooks as the trigger service, set the web request event name to push_button_pressed. For the THAT function select notifications as the action service. Type in your own message i.e. "More drinks in the garden please".
For the next section you will need your unique IFTT key, it can be accessed from within the app by navigating to the services tab under the My Applets section, find the Webhooks service and click Documentation. Copy your unique key ready to paste in the Arduino code in the next section.
Step 4: Configure and Upload the Arduino Code
Download the Arduino sketch and open in the Arduino IDE. Ensure that the ESP8266Wifi libraries are installed. Update the sketch with your own WiFi SSID, password and IFTTT key retrieved in the previous section.
Ensure that the D1 mini is selected under the tools menu and attach the Push Button to the PC using the micro-usb. Compile and upload the sketch.
Step 5: Test
Push the button and test the sketch. The device should take about 5-10 seconds to connect to the WiFi and send the notification. If you encounter any problems, re-attach the micro-usb cable and try diagnose using the serial monitor accessed within the Arduino IDE.
Step 6: Reconfigure!
You can easily reconfigure your new button to control a whole range of smart devices, such as your central heating, lighting and more. Relax in your garden and let everything else work for you! Have fun...