-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
Follow this sequence:
- Install the dependencies
- Prepare setup to program ESP-01 and HC-12
- Program two HC-12 modules with "rfconf" sketch
- Program ESP-01S (remote module) with "nowifi" sketch
- Program ESP-01S (remote module) with "mailbox" sketch
- Upload icon file to ESP-01 (local module)
- Program ESP-01 (local module) with "mailbox" sketch
- Power up and register the mailbox
- Setup Google Assistant Relay
The mailbox sketch is a pretty complex program, so several dependencies are needed:
Library | Last Version Tested | Remark |
---|---|---|
Arduino IDE | 1.8.13 | |
ESP8266 Core for Arduino | 2.7.4 | Install via Arduino Boards Manager |
ESP8266 LittleFS plugin | 2.6.0 | Only if you need a web site icon |
ESP-DS-System | 1.0.0 | Included with the sketch; no need to install separately |
WiFiManager | 0.15.0 | Install via Arduino Library Manager |
JLED | 4.5.2 | Install via Arduino Library Manager |
AceButton | 1.6.1 | Install via Arduino Library Manager |
LinkedList | 1.2.3 | Install via Arduino Library Manager |
Uptime-Library | 1.0.0 | Install via Arduino Library Manager |
ArduinoJson | 5.13.5 | v6 will not work. Only if you need Telegram interface. Install via Arduino Library Manager |
UniversalTelegramBot | 1.1.0 | Only if you need Telegram interface. Install via Arduino Library Manager |
For Google Assistant support no specific Arduino library is needed, but you will need to install a separate relay in your network.
See Schematics for sample connections using Arduino Uno.
The rfconf sketch is made for Arduino Uno, so you need to select this board in Arduino IDE. If you are not using Arduino Uno, it could be equally run from some ESP8266 development board, like NodeMCU, but you will need to adapt wiring and PIN_HC12_TX
, PIN_HC12_RX
settings in the sketch.
Note that serial console speed for diagnostic output of this sketch is 9600 bod, not 115200. Somehow, when I set it to 115200, it does not seem to work.
The sketch sends several commands to HC-12, but only two of them are important:
Command | Meaning |
---|---|
AT+FU4 |
Set ultra long distance communication mode |
AT+C007 |
Set communication channel #7 (435.8 MHz) |
If you want to change these defaults for whatever reason, I recommend you going through the HC-12 user manual for the options available (look for the latest 2.4 version). Changing communication mode from FU4 to something else will likely require changing various delays hardcoded into mailbox's Transmitter.cpp file, as well as adaptations in RF_*
macros in Transceiver.h. Changing communication channel from #7 to something else will need adaptations in antennas (see Antennas for more details). The configuration must be identical for both HC-12 modules, otherwise they will not be able to communicate.
The sketch, when run, displays commands sent and replies received (replies start with OK+...
). If you do not see the commands sent, check your serial console settings. If you see the commands sent but not the replies, check your wiring and power on sequence, as specified in Schematics.
The nowifi sketch is optional. This one-line program will turn the Wi-Fi circuit on remote module off, because it is of no use there. Turning it off helps reducing battery power consumption of the remote module during cold start. Cold start is a rare event, happening in situations like when replacing a battery. On warm start (normal mode) the remote module wakes up with the RF module already turned off, so the Wi-Fi settings do not matter. The setting is persistent, so this sketch needs to be loaded only once before uploading the actual remote module program. If, for whatever reason, you overwrite the entire flash of ESP-01S, you will need to reload this sketch again.
The reason this one-liner is made as a separate sketch is to avoid linking into remote module program the entire Wi-Fi support stack for the sole reason of turning it off on start.
To activate compilation of remote module code, go to MySystem.h
and uncomment the DS_MAILBOX_REMOTE
macro. If you want the remote module to report to the receiver other than default #1, go to Transceiver.h
and change the RECEIVER_ID
macro. Normally, no other changes are needed.
Once this is done, set the following settings in Arduino IDE, then compile and flash the program:
Setting | Value |
---|---|
Board | Generic ESP8266 Module |
Flash Size | 1MB (FS:none) |
Flash Mode | QIO (fast) |