HC-12 433MHz wireless serial communication module configuration
HC-12 are cheap 433MHz wireless serial port communication modules with a range up to 1800m in open space. Each costs about $5 when bought from China, and 2 of them can create wireless UART link that can be used, for example, to transfer telemetry data from UAV. Or drive IoT device. Or connect sensors. Or whatever else one can think of.
It is based on SI4463 RF chip, has build in microcontroller, can be configured using AT commands and allows to use external antenna. Working frequency is divided into 100 channels starting from 433,4MHz up to 473,0MHz with 400kHz channel separation. Maximum output power is 100mW (20dBm) and receiver sensitivity differs from -117dBm to -100dBm, depending on transmission speed. It accepts 3,2V-5,5V power supply and can be used with 3.3V and 5V UART voltage devices (5V safe).
HC-12 serial port supports following baud rates:
- 9600bps (default)
Each HC-12 can work in one of following modes:
- FU1 – moderate power saving mode with 250000bps “over the air” baud rate. Serial port baud rate can be set to any supported value
- FU2 – extreme power saving mode with 250000bps “over the air” speed. Serial port rate is limited to 1200bps, 2400bps, 4800bps
- FU3 – default, general purpose mode. “Over the air” speed differs depending on serial port speed. The same goes for maximum range:
* 1200bps ~ 1000m
- 2400bps ~ 1000m
- 4800bps ~ 500m
- 9600bps ~ 500m
- 19200bps ~ 250m
- 38400bps ~ 250m
- 57600bps ~ 100m
- 115200bps ~ 100m
- FU4 (available in version 2.3 or newer) – long range mode. “Over the air” speed is limited to 500bps and serial port speed to 1200bps. Because air speed is lower than port speed, only small packets can be send: max 60 bytes with interval of 2 seconds. In this mode range is increased to 1800m.
Pair of HC-12 that creates a wireless link has to work in the same mode (FU1, FU2, FU3, FU4) and with the same speed.
HC-12 can be configured using AT command. The best way to do it, is to use USB-to-serial converter like CP2102. To put HC-12 into AT mode, pull SET pin to GND like this:
Then, telnet to device:
- Linux and Mac usually has preinstalled screen command that does that. In my case (Macbook Pro) syntax was:
screen /dev/tty.usbserial-A50285Bl 9600
- In case of Windows machines you can use excellent Putty and open serial port (COM1-COM4 depending on your setup) with speed 9600bps
Now we can start sending commands. The only problem here is that you can not just type them. Wireless module will expect that each command will entered very fast. So the best option here is to open text editor, type commands there and then copy them one by one into serial software.
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw