After being frustrated testing Tuya "Smart Life" IoT buttons I realised Tuya don't currently make it possible for these buttons to trigger external actions, other than via sending an SMS, outside of their Tuya ecosystem (even when used in conjunction with the excellent SEQUEmatic) :(. Instead, I decided to build my own button. See also: In-Car Social Media Detox (Blocker).
It is assumed that the reader is already familiar with the basics of the WeMos D1 Mini and Arduino IDE, if not - please see https://microdigisoft.com/getting-started-with-wemos-d1-mini-esp8266-board/.
The main hardware components required for this build are:
1 x 190mm x 115mm x 65mm Project box/enclosure
1 x Toggle Switch, to allow SocialsDetox to be enabled or disabled using The Big Red Button
1 x 10K Resistor for the toggle switch above
1 x USB Battery Pack, for use when placing the enclosure away from a USB power source
1 x Sticker/Label
The Arduino Fetch library used in this project: https://github.com/instanceofMA/arduino-fetch
Pin numbering for WeMos D1 Mini (ESP8266): https://chewett.co.uk/blog/1066/pin-numbering-for-wemos-d1-mini-esp8266/
ESP8266 Deep Sleep & External Wake Up: https://microcontrollerslab.com/esp8266-deep-sleep-wake-up-sources-arduino-ide/
ESP8266 & Switches/Buttons: https://diyi0t.com/switches-tutorial-for-arduino-and-esp8266/
When initially ordering I couldn't identify the depth required, once the big red button was mounted, to allow for clearance inside the enclosure:
It is ~45mm:
Thankfully this allowed me to re-purpose a project box that I already owned (used for a previous project):
The wooden jig, for the box to sit on during cutting & drilling, being assembled:
Cutting a hole for the big red button:
Drilling a hole for the toggle switch:
Big red button and toggle switch mounted:
Breadboard wired up:
|WeMos D1 Mini Pin||Wire Colour in Breadboard Photos|
If you only wish to enable SocialsDetox via The Big Red Button, or do not have or utilise the toggle switch to allow you to also disable it, you can remove the purple, grey and white wires, and the right-most resistor. The code in the Arduino sketch does not need to be changed and will work as-is.
The full code for this project's Arduino sketch can be found here.
Coming soon: The Medium Green Button* for Social Media...
*Seeed Studio's ReButton