Announce the doorbell on Alexa using ESP-12E WiFi module from a 15V AC or DC power supply.
A practical teaching project to learn electronics and coding with my kid: "It's like a puzzle that when you complete, your life get's an upgrade"
Designing the high-level program flow using PlantUML, then generating the state machine C++ abstract classes allows very simple program design around the setup() loop() Arduino paradigm.
FloHsm is used to convert the PlantUML source used to crete the diagram above to generate C++ abstract classes. The details of the states, events and actions are then implemented in a concrete subclass, e.g.
Here, the state case statement is called in every time loop() runs, so on each loop, the code checks to see it the button is pressed. If so, the event triggers and we move to the next state.
case StateId_Sense:
if (!digitalRead(4)) {
SwitchIsPushed(); //Trigger an event
}
break;
void NotifyAlexa() override {
Serial.printf("NotifyAlexa() called\r\n");
...
}
..
WiFi Connecting
...
Sensing
______
Reporting
- Install Arduino IDE and ESP8266 Suport
- Visual Studio Code
- Install Plugin: "Arduino" by Microsoft
- Regenerate state machine template code if the state diagram has changed
- Run from folder src\esp-12e-alexa-door-bell
Using FloHsm by tzijnge
- FloHsm.py fsm.plantuml
docker run -v $(pwd):/run tekkiesuk/flohsm:latest fsm.plantuml
- A couple or warnings is normal
- Open the .ino file
- Ctrl + Shift + P, Arduino: Select Serial Port
- Ctrl + ALT + U
- Alternative: Ctrl + Shift + P, Arduino: Upload
- Select Board NODEMCU 1.0
- Select Port
- Sketch, Upload
- Open the .ino file
- Close the serial monitor if you have it open, otherwise the debugger will not be able to connect
- First Build & Deploy
- Remember to redeploy if you change the code
- Ctrl + Shift + P, Arduino: Upload
- Place a breakpoint inside
loop()
- Press F5
- CAVEAT: It appears only one breakpoint can be set at a time due to hardware limitations
Built standing on the shoulders of these giants: