-
Notifications
You must be signed in to change notification settings - Fork 1
HC 12
This was my first radio-based project, so I looked at some (few) alternatives: 433 MHz HC-12, 868 MHz RFM95W (LoRa), 2.4 GHz nRF24L01. With the distance and obstacles I had to shine through, lower frequencies looked like a more viable alternative (even though I am quite confident that things like LoRa would work too). HC-12 was the first module I got a hand on. I put up together a "ping" (sending one byte at one Hz) prototype on breadboard with spring antennas, and ran a test. That seemed to work well, but covered only part of the required distance. Hooking the receiver up to a TV antenna on the roof (not particularly suitable for this) did allow for the full range, so I put aside other alternatives and focused on HC-12. Antennas proved to be a separate, non-trivial subject, but in the end things worked out.
HC-12 supports four different transmission modes, dubbed FU1 to FU4. Refer to the user manual for explanation of modes. Because I had a distance problem, and a small packet to transmit, from the beginning I opted for FU4 slow "ultra long distance" mode.
One can also vary the transmission power, but the max power (20 dBm) is the default, and I did not change it for the same sake of getting the max communication distance. Note that in some countries transmitting at 20 dBm might be illegal.
One has to configure HC-12 before it could be used (default settings are quite OK, but not suitable for this project). For information on HC-12 programming, see the corresponding Getting Started section. This has to be remembered if HC-12 module, for some reason, needs to be replaced in the local or remote mailbox module.
HC-12 requires that certain delays for some operations are respected. User manual tries to explain these, but, sometimes, unclearly. Naturally, one would like to minimize these delays, in order to have faster signalling and lower battery consumption. The delays were tuned to be as follows:
Parameter | Value | Remarks |
---|---|---|
SET wakeup pulse length | 10 ms | |
Time to become operational after deep sleep | 400 ms | |
Delay before sending AT+SLEEP command | 250 ms | |
Delay for AT+SLEEP to arrive to HC-12 | 250 ms | |
Delay to transmit 8 bytes in FU4 mode | 1500 ms | Calculation shows that it should be much less, but user manual asks for 1 s at least. To be further tested |
Note that with careful setup and measurement one could probably further decrease these numbers.
One of the "lessons learned" is that having a "smart" radio module separate from MCU module requires extra effort to control it, put in sleep mode, etc, and one is never sure what is going on inside of that "black box". Even though HC-12 proved itself to be highly reliable, for this project, perhaps, some integrated solution would be more preferable.