Updated: Sep 16
IoT button is a small, self-contained wirelessly-enabled device which triggers a defined action(s) when is pressed. It is widely used to automate many of our everyday tasks. We can make it to turn on/off our smart home appliances (e.g., Philips Hue light), send notification or email, unlock or start a car, open your garage door, call a taxi or order your favourite pizza and many more!
The best part is, we will make it from scratch, including 3D printing, in a few hours.
With the latest technology anyone can make it without any hassle. Without programming and having in-depth electronics experience. Some basic soldering might be the only skills required. In this project we are going step by step to make this IOT Button from scratch. It will be powered on a battery and communicate over WiFi so we do not need to have any extra devices and IOT hubs.
Before we start let's make sure we have all components:
12x12x4.3 Tactile Button (other will require 3D print design change)
22x17mm TP4056 Li-ion Charger Module (other will require 3D print design change)
Rechargeable Li-ion Battery (30x26 or 37.5x16.5 or smaller)
A Silicon Diode (e.g., 1N4148)
Access to a 3D Printer
Download the 3D design file from the following LINK and print all the files. 20% infill, 0.1mm quality is ok for printing and no support is required. You may require some sanding depending on the printing quality.
We need to solder all the components according to the schematic below. The Cricket can operate from 1 V to 3.5 V. A li-ion battery has maximum 4.2 V output when connected to a charger or fully charged. In order to protect Cricket from a high voltage, we can use a general-purpose Si diode to make a 0.7 V drop which will result in maximum 3.5 V for Cricket in this setup.
Cricket's WAKE_UP pin is connected to the battery through a tactile button. When the button is pressed voltage is applied on the pin and Cricket wakes up, does its normal operation (e.g., sending MQTT message) and enters to the zero-power mode (sleep) again. Let's keep all wires short because we don’t have enough space inside the button case.
For soldering the wires to Cricket don’t use castellated pads, use through hole pads instead. It will help to avoid any adjustment problem while placing the Cricket inside the 3D printed case.
Step 1: Place the Cricket inside main base keeping shielded side down. Align the antenna side with the antenna mark on the base
Step 2: Place the li-ion charger module in the right position following the hole for the micro-USB port in the base. Before placing it mask the PCB side of the Cricket with insulating tape to avoid any short circuit with the charger module. After placing the charger module place the charger cap to keep it fixed in its place.
Step 3: Now, place the battery inside the main-base at the top of the charger cap.
Step 4: Place the button base on the top of the main-base and place the tactile button in the room for the button.
Step 5: Place the button cap on the button.
Step 6: Finally, place the top-cover keeping the charging hole align with the base hole. Congratulation! Your IoT button is ready to configure and use.
Our button is re-chargeable and we can do it simply with a USB cable without opening the casing.
Our IoT button can be reconfigured at anytime without any programming. We can connect it to any WiFi network and set it up to send events to almost any software and internet service via either MQTT or HTTP(S) protocols. To do this we need to open Cricket's configuration panel and configure our device. We have to press the tiny built-in configure button on the Cricket for at least 5 seconds. You can access the button through the hole from the back side as shown in the following image. We can use a pin to press it.
After that Cricket should have opened its own toe_device wifi hotspot. Note: the hotspot is active for about 1 minute or so and then it shuts down. If it shuts down we have to repeat the process and press the button for 5 seconds again.
So let's connect to it straight away either from a phone or laptop to the "toe_device" network. The configuration panel should be automatically opened, if not open a web browser and type the following address manually: http://192.168.4.1
Connect to our WiFi network by either selecting our WiFi network or typing manually the name of our WiFi. Then type a password and press CONNECT button. It may take a few seconds, if the connection is successful we get a status showing CONNECTED.
Now we can we can go to the CONFIG panel and configure what we want to happen when the button is pressed. As it is not possible to demonstrate all possible integrations we will stick to a simple example of sending HTTP command to the RequestBin service. It should give you a solid idea how you can integrate the button to any other services.
1) Go to the following web page: https://scribe-bin.herokuapp.com/
2) Go to Cricket's configuration the CONFIG panel and paste the URL address, which you obtained from RequestBin website. Your link will be different as it has a unique key at the end. In the payload, you can type some message which you would like to be displayed in RequestBin website when you press your button.
Once you are ready press the power off button in the right-top corner of the Cricket configuration.
If you need more information please follow more detailed steps how to configure Cricket and send HTTP / MQTT commands: HERE
Our button is ready! We can press it and the message will appear on RequestBin website (do not forget to refresh the page).
I have shown how you can make a general purpose IOT button, which can be connected directly to WiFi network without proprietary IOT hub. Thanks to Cricket WiFi module, this button can be integrated to a huge ecosystem of software and internet services by using either MQTT or standard HTTP requests, which works for various automation systems.
Thank you for getting up to here! I hope you enjoyed this tutorial.
Md Khairul Alam