Description
HC-12 are cheap 433MHz wireless serial port communication modules with a range up to 1800m in open space. They are SI4463 based. 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 built in microcontroller, can be configured using AT commands and allows to use an 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 the following baud rates:
- 1200bps
- 2400bps
- 4800bps
- 9600bps (default)
- 19200bps
- 38400bps
- 57600bps
- 115200bps
Each HC-12 can work in one of the 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 airspeed is lower than port speed, only small packets can be sent: max 60 bytes with the 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.
Configuration
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:
USB-To-Serial | HC-12 |
---|---|
Vcc | Vcc |
GND | GND |
TX | RX |
RX | TX |
GND | SET |
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 enter very fast. So the best option here is to open a text editor, type commands there and then copy them one by one into the serial software.
Most important commands:
AT
– test command. It will returnOK
if AT interface is enabledAT+Bxxxx
– set serial port baud rate. For example,AT+B57600
set the baud rate to 57600bpsAT+Cxxx
– set radio channel. Channels start at001
at 433,4MHz. Each next channel adds 400kHz. Channel100
is 473,0MHz.AT+C002
will set a frequency to 433,8MHz. Two HC-12 devices that create a wireless link have to operate on the same frequencyAT+FUx
– set device mode: FU1, FU2, FU3 or FU4. Two HC-12 devices that create a wireless link have to use the same modeAT+Px
– set device transmitting power. For exampleAT+P2
sets power to 2dBm (1.6mW)- -1dBm (0.8mW)
- 2dBm (1.6mW)
- 5dBm (3.2mw)
- 8dBm (6.3mW)
- 11dBm (12mW)
- 14dBm (25mW)
- 17dBm (50mW)
- 20dBm (100mW)
AT+RX
– retrieve all parameters: mode, channel, baud rate, powerAT+V
– retrieve module versionAT+DEFAULT
– reset module parameters to default settings
You can get HC-12 433MHz serial wireless modules from Banggood and Aliexpress
Cool! This is going to be my choice for telemetry!
This is exactly why I put my interest on them. Just waiting for a weather to test quality and range
Hello,
thanks for writing this.
Do you know what happens if one tries to use several of these HC-12 modules (like sensor nodes) which try to communicate with one module (master receiver) at the same time. Is there any kind of built-in protocol that handles this?
If not, do you have an idea how to solve this, so the packets don’t get lost?
Thanks
Hi,
Did not tested that yet. But they are rather one-to-one devices and more than two on one channel would probably break the transmission.
The Si4463 has Listen-before-talk to avoid collisions. This will be useful in mesh network like what you described. but I am not sure if the standard firmware running in the STM8 CPU configures the RF chip that way. If not you will have to implement some kind of stop-and-wait datalink protocol in the application. Here again this will work assuming you dont have long packet transmission times and reasonable number of nodes. You can refer to some ALOHA theory to get an idea on this CSMA scheme.
Thanks Sundar! A bit too much for me right now, but I will look into what you mentioned here! Regards
Hello!
Is there any way to change some parameters of the HC-12? For example decrease frequency step from 400kHz and specify GFSK modulation of the Si5563? Could you please provide any information (link) on how to reprogram MCU firmware?
Thanks!
Hey. I can not understand why data packets are lost at a distance of more than 10 m. It is adjusted to the speed of 9600, an external antenna is connected.
In the application, at a distance of 10-20m there are messages “not received data” 🙁
Maybe it’s hardware fault? Or maybe both modules are not talking the same channel?
I have already replaced 4 modules. Constantly the same thing. It is adjusted to the speed of 9600 FU3. Antenna standard spring on quadrocopter and large dipole on the receiver. 🙁
hi alexandr, i have the samen problem. wasted days on this. turns out to be (ham?) interference in de air; using better antenna’s (away from the hc12 logic board) was my solution.
Hi, I see this question asked before but it is yet to be answered.
Can we create mesh networks with this HC-12 module?
Secondly, what is the maximum number of nodes we can connect to a central controller over this (presumed) mesh network?
Thanks.
No, those are point-to-point devices only, no networking possible
Hi,
I fly with Orange open LRS RX and TX. Can I use this HC12 modul together with Open LRS, without any interference?
And I use IOS with Mobile Flight app, but I plan to use Laptop with Windows Op. S. Could you pls suggest any application for laptop?
Br. Zs
They might interfere. both use the same band. Of course you can setup channels in open lrs and on HC-12 to minimise chance of interference
Tell me how to communicate Arduino and Raspberry pi usgin HC 12? Please help me out. Thank you!