HC12 - Long Range RF Wireless SERIAL Module
HC-12 wireless serial port communication module is a new-generation multichannel embedded wireless data transmission module.
Its wireless working frequency band is 433.4-473.0MHz, multiple channels can be set, with the stepping of 400 KHz, and there are totally 100 channels.
The maximum transmitting power of module is 100mW (20dBm), the receiving sensitivity is -117dBm at baud rate of 5,000bps in the air, and the
communication distance is 1,000m in open space.
There is MCU inside the module, and user don’t need to program the module separately, and all transparent transmission mode is only responsible for
receiving and sending serial port data, so it is convenient to use. The module adopts multiple serial port transparent transmission modes, and user could
select them by AT command according to use requirements.
The average working current of three modes FU1, FU2 and FU3 in idle state is 80μa, 3.6mA an 16mA respectively, and the maximum working current
is 100mA (in transmitting state). This module can not work individually, at least 2 pcs would be needed to create the communication.
Please also note that this module do not work with the 434Mhz Serial RF Module HC-1
• Long-distance wireless transmission (1,000m in open space/baud rate 5,000bps in the air)
• Working frequency range (433.4-473.0MHz, up to 100 communication channels)
• Maximum 100mW (20dBm) transmitting power (8 gears of power can be set)
• Three working modes, adapting to different application situations
• Built-in MCU, performing communication with external device through serial port
• The number of bytes transmitted unlimited to one time
• Working frequency: 433.4MHz to 473.0MHz
• Supply voltage: 3.2V to 5.5VDC
• Communication distance: 1,000m in the open space
• Serial baud rate: 1.2Kbps to 115.2Kbps（default 9.6Kbps）
• Receiving sensitivity: -117dBm to -100dBm
• Transmit power: -1dBm to 20dBm
• Interface protocol: UART/TTL
• Operating temperature: -40℃ to +85℃
• Dimensions: 27.8mm x 14.4mm x 4mm
DOWNLOAD USER MANUAL
Enter the command mode:
The first entry mode - normal use (has the power) in the first 5-pin "SET" is set low;
The second mode of entry - power, 5th pin "SET" again first set low on power.
Both methods can make the module into AT command mode, release ("SET" pin is not connected low) to exit command mode. After the exit command mode,
if you change the module function, the function will be cut to the appropriate state.
The second way is fixed in serial format 9600, N, 1 into the AT.
Example: Send module commands "AT", the module returns "OK".
2. AT + Bxxxx
Change the serial port baud rate command. You can set the baud rate is 1200bps, 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, 57600bps and 115200bps. The factory default is 9600bps.
Example: Set the module serial port baud rate is 19200bps, please send module command "AT + B19200", the module returns
"OK + B19200".
3. AT + Cxxx
Change the wireless communication channel, selectable from 001 to 127 (more than 100 radio channels after the communication distance not guaranteed). The default value is 001 radio channels, operating frequency is 433.4MHz. Step channel is 400KHz, the operating frequency of the channel 100 is 473.0 MHz.
Set module to channel 21, please send module command "AT + C021", the module returns "OK + C021".
After exiting the command mode, the module in the first 21 channels, operating frequency is 441.4 MHz.
Note: Because the wireless receiver module sensitivity HC-12 is relatively high, the baud rate is greater than when air 58000 bps, 5 must be shifted to the adjacent channel use. When the air baud rate is not greater than 58000 bps, if the short distance (10 meters) communication, but also need to stagger five adjacent channel use.
4. AT + FUx
Change the module serial pass-through mode, there FU1, FU2 and FU3 three modes. Module default mode is FU3, two serial pass-through mode module must be set to the same communication. See detailed above, "wireless serial pass-through" part.
Example: Send module commands "AT + FU1", the module returns "AT + OK".
5. AT + Px
The default setting is 8, maximum transmit power, communication distances. Transmit power level is set to 1, the minimum transmission power. In general, the transmission power of each drop 6dB, communication distance will be reduced by half.
Example: Send module commands "AT + P 5", the module returns "OK + P5". After exiting the command mode, the module transmit power is +11 dBm.
To use with an Arduino, the connections are simple. Apply power using the Vcc and Gnd pins
Connect the Rxd and Txd pins to the UART/Serial pins of the Arduino.
In the example below, softwareserial was used on pins 5 and 6. Connect the Set pin to any free digital input pin on your Arduino.
The code is even more simplier, sending data is done using the Serial.print() or Serial.write() and receiving is done using the Serial.read().
Note that you may use software serial too. The basic code below configures the module to channel 1 and then allows you to communicate
with another HC-12 using the Serial monitor.
Upload the code and then open your serial monitor.
Set the baud rate to 9600. Whatever you type next on the serial port is received by HC-12 modules with the same channel setting.
So, if you have two of the above setup,you could send data back and forth using the serial monitor.
SoftwareSerial hc12(6, 5);
digitalWrite(7,LOW); // enter AT command mode
hc12.print(F("AT+C001")); // set to channel 1
digitalWrite(7,HIGH);// enter transparent mode