Add more info to README
This commit is contained in:
36
README.md
36
README.md
@@ -1,4 +1,20 @@
|
|||||||
# Why are there two microcontrollers?
|
# About
|
||||||
|
|
||||||
|
While setting up some basic home automation, I realized that there things that I'd like to track simply by pressing a button. For example, has anyone fed the dog this morning? She's more than willing to ask for breakfast even if she's already eaten it :)
|
||||||
|
|
||||||
|
While searching for a good product for this, I couldn't find one, so I decided to make my own. The primary goals are:
|
||||||
|
|
||||||
|
1. It must be cheap, ideally around \$5.
|
||||||
|
2. It must be reasonably manufacturable (on the order of 10s to 100s).
|
||||||
|
3. It must be re-useable, no tossing it when the battery dies!
|
||||||
|
4. It must reasonably small and inoffensive.
|
||||||
|
5. It must integrate with HomeAssistant, ideally with minimal configuration.
|
||||||
|
|
||||||
|
Unfortunately, shortly after I ordered my first rev of PCBs, Ikea released the $10 [Shortcut Button](https://www.ikea.com/ca/en/p/tradfri-shortcut-button-white-20356382/) which meets most of my criteria. Falling victim to the sunk cost fallacy, I plan to see it through to making a few of these.
|
||||||
|
|
||||||
|
# Q&A
|
||||||
|
|
||||||
|
## Why are there two microcontrollers?
|
||||||
|
|
||||||
Cost and ease of development.
|
Cost and ease of development.
|
||||||
|
|
||||||
@@ -15,17 +31,29 @@ 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
|
Hence, the ATTINY is used to capture the wakeup and inform the ESP8266, who does
|
||||||
the heavy lifting.
|
the heavy lifting.
|
||||||
|
|
||||||
## What about ESP32?
|
### What about ESP32?
|
||||||
|
|
||||||
The cheapest modules I can find at the time of writing are around \$3.50 apiece,
|
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
|
and they can be power hungry (spikes up to 750mA compared to 400mA, from what I
|
||||||
read).
|
read).
|
||||||
|
|
||||||
## What about ESP32-S2?
|
### What about ESP32-S2?
|
||||||
|
|
||||||
They appear promising and are only \$2 per module on Digikey at the time of
|
They appear promising and are only \$2 per module on Digikey at the time of
|
||||||
writing, however they are not supported by platformio yet.
|
writing, however they are not supported by platformio yet.
|
||||||
|
|
||||||
## What about ...?
|
### What about ...?
|
||||||
|
|
||||||
I probably wasn't aware that it exists.
|
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:
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|||||||
@@ -73,7 +73,9 @@ void setup() {
|
|||||||
// pinMode(BTN_PIN, INPUT);
|
// pinMode(BTN_PIN, INPUT);
|
||||||
// bool btn_value = digitalRead(BTN_PIN);
|
// bool btn_value = digitalRead(BTN_PIN);
|
||||||
|
|
||||||
|
#if defined(DEBUG_SKETCH_TIMING)
|
||||||
unsigned long startTimingMillis = millis();
|
unsigned long startTimingMillis = millis();
|
||||||
|
#endif
|
||||||
|
|
||||||
pinMode(RED_LED_PIN, OUTPUT);
|
pinMode(RED_LED_PIN, OUTPUT);
|
||||||
pinMode(BLUE_LED_PIN, OUTPUT);
|
pinMode(BLUE_LED_PIN, OUTPUT);
|
||||||
|
|||||||
Reference in New Issue
Block a user