2022-04-10 04:29:58 +00:00
2022-04-10 04:29:58 +00:00
2021-09-06 23:21:12 -04:00
2022-04-10 04:29:58 +00:00

Overview

IoTButton is a low-cost, low-powered, WiFi-enabled button targetting simple home automation use-cases. The Button integrates simply into HomeAssistant's device discovery mechanism, making integration with the rest of the Home Assistant ecosystem straightforward.

The button combines an ESP8266 for WiFi connectivity, and an ATTINY85 for low-power monitoring and triggering the ESP8266.

Image of the button

FAQ

Why are there two microcontrollers?

Cost and ease of development.

Both ESP8266 and ATTINY(2/4/8)5 modules can be had for around $1 each, and there are retail programming jigs available. I have a kid now and don't want to spend my time making a programming board.

The ESP8266 alone cannot really wake from multiple sources and know trap the source of the interrupt- there is only one pin that can wake up the micro from deep sleep, and that same pin needs to be used if you want to use the RTC as a wake source. Sure, you could use an OR-gate and also wire each source to a GPIO, but you might miss the source by the time the ESP wakes up to check the pins.

Hence, the ATTINY is used to capture the wakeup and inform the ESP8266, who does the heavy lifting.

What about ESP32?

The cheapest modules I can find at the time of writing are around $3.50 apiece, and they can be power hungry (spikes up to 750mA compared to 400mA, from what I read).

What about ESP32-S2?

They appear promising and are only $2 per module on Digikey at the time of writing, however they are not supported by platformio yet.

What about ...?

I probably wasn't aware that it exists.

Development

The standard PlatformIO tooling should work. However, here's a bit of setup I had to do in order to make emacs+clangd happy:

cd <PROJECT_DIR>
# Create the compile_commands.json
pio build -t compiledb
# Link the compile_commmands.json from the git root, which is where tools are expecting it
ln ./.pio/build/<ENV>/compile_commands.json ../../compile_commands.json
Description
An Amazon Dash-style battery-operated IoT button. Friendly for DIY/makers with MQTT notifications.
Readme 552 KiB
Languages
C++ 94.2%
C 5.8%