HC-12 module has three kinds of serial transmission mode, with FU1, FU2 and FU3 said. Use, various modes are just send and receive serial data can be, do not control the air wireless transmission part. By default, the system works in FU3 full-speed mode. This mode automatically adjusts the air baud rate according to the baud rate of the serial port and the farthest communication distance at a low baud rate. Different modes can not transmit data to each other, users can choose the best mode according to the actual situation.
When used generally not limited to a continuous serial port to send the number of bytes. However, due to environmental interference and other factors, a large number of continuous data transmission, there may be some loss of bytes. Therefore, the PC is best to have mechanisms such as response and re-issued to avoid the loss of information.
6mA 左右. This mode is more power-saving mode, this module idle current is 3. 6mA or so. In this mode, the module can also set the 8 serial port baud rates as shown in the following table, but the air baud rate is uniform at 250,000 bps.
This mode is power saving mode. At this time, the idle working current of the module is about 80μA. The module only supports this mode
1200 bps, 2400 bps and 4800 bps serial baud rate, the air baud rate unified 250000bps. Set to other
Serial baud rate, the module can not communicate properly. In the meantime, when set to FU2 mode in FU1 and FU3 mode, the serial port baud rate exceeding 4800 bps will be automatically reduced to 4800 bps. (After testing, there is a little bugs when transferring data in this mode, we do not suggest users to use FU2 mode for the moment, we will modify the bugs for the first time and update the programs.)
These modules operate at full speed, idle work as the current is about 16mA. In this mode, the module will automatically adjust the wireless transmission air baud rate according to the baud rate of the serial port, the corresponding relationship is shown in the following table:
Serial port baud rate
Air baud rate
In order to make the communication distance as far as possible, you can set the serial port baud rate to low baud rate. If it is a short transfer large amounts of data, put the serial port baud rate is set high baud rate, but at the expense of the communication distance.
The receiving sensitivity of the module under different air baud rates is shown in the following table:
|Air baud rate||5000bps||15000bps||58000bps||236000bps|
|Wireless receiver sensitivity||-117dBm||-112dBm||-107dBm||-100dBm|
Generally speaking, the receiving sensitivity drops 6dB, the communication distance can be reduced by half.
Here are some of the characteristic references for each mode:
|Idle current||3.6mA||80uA||16mA||average value|
|Transmission delay||4 ~ 80mS||500mS||4 ~ 80mS||Send a byte|
|Loopback test 1||31mS||Serial port baud rate 9600, send a byte|
|Loopback test 2||31mS||Serial port baud rate 9600, send ten bytes|
Note: loopback delay refers to the short circuit of a module TX and RX pins, send serial data to another module, from the beginning to send data from the serial port to another module appears on the TX pin to return the data of this paragraph time.
Module parameters set the AT command
The AT command is used to set the parameters of the module and the function of the switching module. After setting, the AT command needs to exit the setting status to take effect. The sametime, modify parameters and functions, power-down is not lost.
(1) Command mode entry
The first way to enter – normal use (has been powered), the fifth pin “SET” set low;
The second way to enter – off, pin 5 “SET” first set low and re-power.
Both methods can make the module into AT command mode, release ( “SET” pin is not connected low) exit means the order mode. After exiting command mode, if the module function is changed, it will be cut to the corresponding function mode.
The second way fixed to 9600, N, 1 serial format into the AT.
The module command “AT” is issued and the module returns “OK”.
② AT + Bxxxx
Change serial port baud rate command. You can set the baud rate to 1200bps, 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, 57600bps and 115200bps. The factory default is 9600bps.
Set the serial port baud rate of the module to 19200bps, please send the module instruction “AT + B19200”, the module returns
“OK + B19200”.
③ AT + Cxxx
Change the wireless communication channel, from 001 to 127 optional (over 100 after the wireless channel, communication distance is not guaranteed). The default value of wireless channel is 001 and the working frequency is 433.4MHz. The step of the channel is 400KHz and the frequency of the channel 100 is 473.0 MHz.
Set the module to work in channel 21, please send module command “AT + C021”, the module returns “OK + C021”.
After exiting command mode, the module operates on channel 21 and operates at 441.4 MHz.
Note: Due to the high wireless reception sensitivity of the HC-12 module, it is necessary to stagger 5 adjacent channels when the air baud rate is greater than 58000 bps . When the air baud rate is not greater than 58000 bps, if the short distance ( within 10 meters ) communication, but also need to stagger the use of five adjacent channels.
④ AT + FUx
Change the module serial port transparent mode, there are FU1, FU2 and FU3 three modes. The default mode is the module FU3, dies serial block transparent mode must be set to the same communication. For details, please see the above “Wireless Serial Interface” section introduction.
The module command “AT + FU1” is issued and the module returns “AT + OK”.
⑤ AT + Px
Set the module’s transmit power level, x can be 1-8, the corresponding module transmit power is as follows:
|Module transmit power (dBm)||-1||2||5||8||11||14||17||20|
The default setting is 8, the maximum transmission power, communication distance farthest.Transmission power level is set to 1, transmit power most small. In general, every drop of transmit power by 6dB, the communication distance will be reduced by half.
The module command “AT + P 5” is issued and the module returns “OK + P5”. After exiting command mode, the module transmit power is +11 dBm .