Arduino radio hc-12: Difference between revisions
From wikiluntti
 (→Set)  | 
				 (→Set)  | 
				||
| Line 19: | Line 19: | ||
* '''RXD''' -> 10  | * '''RXD''' -> 10  | ||
The syntax of the softaware serial is:  | |||
<syntaxhighlight lang="C">  | <syntaxhighlight lang="C">  | ||
SoftwareSerial(rxPin, txPin, inverse_logic)  | SoftwareSerial(rxPin, txPin, inverse_logic)  | ||
Revision as of 16:52, 20 January 2025
Introduction
LoRa, hc12, hc-12
- Frequency band is from 433.4 MHz to 473.0 MHz
 - 100 channels with a stepping of 400 KHz between each channel
 - Transmitting power is from -1dBm (0.79mW) to 20dBm (100mW). A half-duplex 20 dBm (100 mW) transmitter
 - Receiving sensitivity is from -117dBm (0.019pW) to -100dBm (10pW)
 
Connect a 22 µF to 1 mF reservoir capacitor in parallel with the HC-12 "Gnd" and "Vcc" pins.
Set
Pins:
- Set pin of the module to Ground (set the pin to low logic level).
 - Vcc 3.3V and GND to GND
 - TXD -> 11
 - RXD -> 10
 
The syntax of the softaware serial is:
SoftwareSerial(rxPin, txPin, inverse_logic)
AT commands. The most important commands are
- AT – test command. It will return OK if AT interface is enabled
 - AT+Bxxxx – set serial port baud rate. For example, AT+B57600 set baud rate to 57600bps
 - AT+Cxxx – set radio channel. Channels start from 001 at 433,4MHz. Each next channel adds 400kHz. Channel 100 is 473,0MHz. AT+C002 will set frequency to 433,8MHz. Two HC-12 devices that creates a wireless link have to operate on the same frequency
 - AT+FUx – set device mode: FU1, FU2, FU3 or FU4. Two HC-12 devices that creates a wireless link have to use the same mode
 - AT+Px – set device transmitting power. For example AT+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, power
 - AT+V – retrieve module version
 - AT+DEFAULT – reset module parameters to default settings