Project

# Understanding and Implementing the HC-12 Wireless Transceiver Module

November 02, 2016 by Mark Hughes

## The HC-12 is a 100mW multi-channel wireless transceiver you can use in your projects to transmit and receive serial information.

Learn about the HC-12 transceiver module and how to use it to transmit and receive digital data.

The HC-12 is a half-duplex wireless serial communication module with 100 channels in the 433.4-473.0 MHz range that is capable of transmitting up to 1 km. This project will begin by using the HC-12 to create a wireless link between two computers and end with a second article that creates a simple wireless GPS tracker.

### Parts Required

HC-12 transceiver (x2)$4Datasheet IPEX-to-SMA adapter (optional)$3Specification
Arduino Uno R3 (or compatible)$10Reference GPS Receiver (x2)$16Datasheet
or Adafruit GPS Logger Shield (x2)$45Project Guide 433MHz antenna$2-$5Datasheet Search ### About the HC-12 The HC-12 is a half-duplex 20 dBm (100 mW) transmitter paired with a receiver that has -117 dBm (2×10-15 W) sensitivity at 5000 bps. Paired with an external antenna, these transceivers are capable of communicating up to and possibly slightly beyond 1 km in the open and are more than adequate for providing coverage throughout a typical house. ##### The HC-12 circuit board. Image courtesy of Seeed. This image has been digitally manipulated to enhance chip markings. The HC-12 circuit board is built around the STM8S003F3 microcontroller and the Si4463 transceiver. #### The Si4463 Transceiver The Si4463 provides the wireless communication in this circuit. It has a maximum transmit power of 20 dBm (100 mW) and receive sensitivity of -129 dBm. Two 64-byte Rx and Tx FIFO memories are built into the chip along with a great many advanced features that are not implemented in the HC-12 design. See the datasheet for more information on multiband operation, frequency hopping, etc. #### The STM8S003FS Microcontroller This is an 8-bit microcontroller with 8 kB of flash memory, 128 bytes of EEPROM, and a 10-bit ADC. It supports UART, SPI, and I²C and has multiple I/O pins. It offers many of the same capabilities as its ATMega and XMC counterparts. It is programmed to control the Si4463 as well as handle the UART communication between the HC-12 and whatever it is connected to on the other end. #### The HC-12 Transceiver Module Combined with other components, the Si4463 and STM8S003 create the HC-12 transceiver, which provides a 4-pin TTL-level UART interface (Vcc, Gnd, Tx, Rx), with a 5th pin that is used to enter "command" mode for changing the module's configuration. The HC-12 has 100 supported channels spaced 400 kHz apart, eight transmit levels, eight supported baud rates, and three different working modes. The 5th pin on the HC-12 is labeled "Set" and, when driven to logic low, allows various settings to be selected on the HC-12 using AT commands sent to the "RXD" pin. The default configuration of the HC-12 is FU3—on Channel 1, FU3 is a fully automatic and transparent (to other devices) setting that adapts to the transmission rate of the connected device (although 9600 baud is still required to program it in Command mode). Note that as the transmission rate increases, the sensitivity of the receiver decreases. You can return to the default state by sending AT+DEFAULT once in command mode. Serial Port Baud RateOver-the-Air Baud RateReceiver Sensitivity 1200 bps5000 bps-117 dBm 2400 bps5000 bps-117 dBm 4800 bps15000 bps-112 dBm 9600 bps15000 bps-112 dBm 19200 bps58000 bps-107 dBm 38400 bps58000 bps-107 dBm 57600 bps236000 bps-100 dBm 115200 bps236000 bps-100 dBm In "HC12 Send/Recieve Example Program 1," the HC-12s are used in their default state (FU3: 20mW transmit, 9600 bps, Channel 001) to create a wireless bridge between the serial ports of two computers. The transceivers must be physically separated by at least 1.5 meters to function. This program will allow messages to be sent between two computers via the HC-12 transmitters. Text typed on one computer will be displayed on the serial monitor of the second computer. Begin by connecting the HC-12 transceivers to each Arduino: • Connect the HC-12 "Set" pin to Arduino pin 6 • Connect the HC-12 "RXD" pin to Arduino pin 4 • Connect the HC-12 "TXD" pin to Arduino pin 5 • Per the datasheet, connect a 22 µF to 1 mF reservoir capacitor in parallel with the HC-12 "Gnd" and "Vcc" pins • Connect HC-12 "Gnd" and "Vcc" to a 3.2 V to 5.5V 200mA source. Per the datasheet, if powering the HC-12 with more than 4.5V, place a 1N4007 diode in series with the HC-12 "Vcc" pin Upload the following code and open the serial port monitor in the Arduino IDE to send/receive messages. The functions "*.available()" reads the number of bytes stored in the Arduino's Serial or SoftwareSerial FIFO buffers. As long as there is a non-zero value returned by "*.available()", the "*.read()" function pulls one byte out of the buffer and the "*.write()" function sends that byte along to the other serial port to be read by either the computer or the HC-12. The Arduino UART has a 64-byte receive buffer built into the hardware so any bytes of data that exceed the 64-byte limit will be discarded. The software serial also has a 64-byte buffer; however, the SoftwareSerial library can be modified to increase that, if required. /* HC12 Send/Receive Example Program 1 By Mark J. Hughes for AllAboutCircuits.com Connect HC12 "RXD" pin to Arduino Digital Pin 4 Connect HC12 "TXD" pin to Arduino Digital Pin 5 Connect HC12 "Set" pin to Arduino Digital Pin 6 Do not power over USB. Per datasheet, power HC12 with a supply of at least 100 mA with a 22 uF - 1000 uF reservoir capacitor. Upload code to two Arduinos connected to two computers. Transceivers must be at least several meters apart to work. */ #include <SoftwareSerial.h> const byte HC12RxdPin = 4; // Recieve Pin on HC12 const byte HC12TxdPin = 5; // Transmit Pin on HC12 SoftwareSerial HC12(HC12TxdPin,HC12RxdPin); // Create Software Serial Port void setup() { Serial.begin(9600); // Open serial port to computer HC12.begin(9600); // Open serial port to HC12 } void loop() { if(HC12.available()){ // If Arduino's HC12 rx buffer has data Serial.write(HC12.read()); // Send the data to the computer } if(Serial.available()){ // If Arduino's computer rx buffer has data HC12.write(Serial.read()); // Send that data to serial } } "HC12 Send/Recieve Example Program 2" remains backward-compatible with "HC12 Send/Recieve Example Program 1." However, two significant changes have been made in the way data is handled by the Arduino. In the first program, single bytes were detected and read from the serial buffer and software serial buffer and immediately written to the other serial port. The following program will read entire strings of data from the serial buffers and store it until a newline character is detected at which point it will write out the entire buffer. The first program had no way to enter command mode and change the settings of the HC-12 transceiver. The following program can detect command sequences and change the settings of remote and local transceivers (provided they are running the newer version of the code). Note that it is important to change the settings of the remote transceiver first and then change the settings of the local transceiver to match, as any initial changes to the local transceiver will interrupt communication between the two. The Arduino will collect strings from the serial port and software serial port. Once the new line has been detected, there is a check to confirm if the string is a command sequence (commands begin with AT+). If a command sequence is present, the local chip executes the command and transmits the command to the remote chip for execution there. The code keeps the HC12s on the same channel at same power levels during testing. Use caution as it is possible to accidentally lower the remote power level to a point that the remote transceiver can no longer communicate with the local transceiver. This is quickly fixed by broadcasting a new power level. Changing the baud rate can disable communication between the HC-12 and the Arduino unless the Arduino baud rate is changed at the same time. /* HC12 Send/Receive Example Program 2 By Mark J. Hughes for AllAboutCircuits.com This code will automatically detect commands as sentences that begin with AT and both write them and broadcast them to remote receivers to be written. Changing settings on a local transceiver will change settings on a remote receiver. Connect HC12 "RXD" pin to Arduino Digital Pin 4 Connect HC12 "TXD" pin to Arduino Digital Pin 5 Connect HC12 "Set" pin to Arduino Digital Pin 6 Do not power HC12 via Arduino over USB. Per the data sheet, power the HC12 with a supply of at least 100 mA with a 22 uF to 1000 uF reservoir capacitor and connect a 1N4007 diode in series with the positive supply line if the potential difference exceeds 4.5 V. Upload code to two Arduinos connected to two computers that are separated by at least several meters. */ #include <SoftwareSerial.h> const byte HC12RxdPin = 4; // "RXD" Pin on HC12 const byte HC12TxdPin = 5; // "TXD" Pin on HC12 const byte HC12SetPin = 6; // "SET" Pin on HC12 unsigned long timer = millis(); // Delay Timer char SerialByteIn; // Temporary variable char HC12ByteIn; // Temporary variable String HC12ReadBuffer = ""; // Read/Write Buffer 1 for HC12 String SerialReadBuffer = ""; // Read/Write Buffer 2 for Serial boolean SerialEnd = false; // Flag to indicate End of Serial String boolean HC12End = false; // Flag to indiacte End of HC12 String boolean commandMode = false; // Send AT commands // Software Serial ports Rx and Tx are opposite the HC12 Rx and Tx // Create Software Serial Port for HC12 SoftwareSerial HC12(HC12TxdPin, HC12RxdPin); void setup() { HC12ReadBuffer.reserve(64); // Reserve 64 bytes for Serial message input SerialReadBuffer.reserve(64); // Reserve 64 bytes for HC12 message input pinMode(HC12SetPin, OUTPUT); // Output High for Transparent / Low for Command digitalWrite(HC12SetPin, HIGH); // Enter Transparent mode delay(80); // 80 ms delay before operation per datasheet Serial.begin(9600); // Open serial port to computer HC12.begin(9600); // Open software serial port to HC12 } void loop() { while (HC12.available()) { // While Arduino's HC12 soft serial rx buffer has data HC12ByteIn = HC12.read(); // Store each character from rx buffer in byteIn HC12ReadBuffer += char(HC12ByteIn); // Write each character of byteIn to HC12ReadBuffer if (HC12ByteIn == '\n') { // At the end of the line HC12End = true; // Set HC12End flag to true } } while (Serial.available()) { // If Arduino's computer rx buffer has data SerialByteIn = Serial.read(); // Store each character in byteIn SerialReadBuffer += char(SerialByteIn); // Write each character of byteIn to SerialReadBuffer if (SerialByteIn == '\n') { // Check to see if at the end of the line SerialEnd = true; // Set SerialEnd flag to indicate end of line } } if (SerialEnd) { // Check to see if SerialEnd flag is true if (SerialReadBuffer.startsWith("AT")) { // Has a command been sent from local computer HC12.print(SerialReadBuffer); // Send local command to remote HC12 before changing settings delay(100); // digitalWrite(HC12SetPin, LOW); // Enter command mode delay(100); // Allow chip time to enter command mode Serial.print(SerialReadBuffer); // Echo command to serial HC12.print(SerialReadBuffer); // Send command to local HC12 delay(500); // Wait 0.5s for a response digitalWrite(HC12SetPin, HIGH); // Exit command / enter transparent mode delay(100); // Delay before proceeding } else { HC12.print(SerialReadBuffer); // Transmit non-command message } SerialReadBuffer = ""; // Clear SerialReadBuffer SerialEnd = false; // Reset serial end of line flag } if (HC12End) { // If HC12End flag is true if (HC12ReadBuffer.startsWith("AT")) { // Check to see if a command is received from remote digitalWrite(HC12SetPin, LOW); // Enter command mode delay(100); // Delay before sending command Serial.print(SerialReadBuffer); // Echo command to serial. HC12.print(HC12ReadBuffer); // Write command to local HC12 delay(500); // Wait 0.5 s for reply digitalWrite(HC12SetPin, HIGH); // Exit command / enter transparent mode delay(100); // Delay before proceeding HC12.println("Remote Command Executed"); // Acknowledge execution } else { Serial.print(HC12ReadBuffer); // Send message to screen } HC12ReadBuffer = ""; // Empty buffer HC12End = false; // Reset flag } }  ##### Data transmitted by a remote HC-12 transmitter is received and decoded as "AllAboutCircuits.com" by a local HC-12 receiver. Note the delay before the .com was transmitted, which might be due to the data handling of the Si4463 (see page 39 of the Si4463 datasheet) or to some aspect of the program running on the STM8S003FS. The previous code, if uploaded to both boards, allows you to program both the local and remote transceiver at the same time. Here are some other commands for your reference: Valid Baud Rate Commands: AT+B1200, AT+B2400, AT+B4800, AT+9600, AT+19200, AT+38400, AT+57600, AT+115200 Valid Channel Commands: AT+C001, AT+C002, AT+C0xx, ... , AT+C099, AT+C100. Per its datasheet, if using multiple HC-12s on different channels, stagger adjacent channels at least five apart $$\frac{40\;\text{kHz}}{\text{1 channel}}\times\text{5 channels}=200\;\text{kHz}$$ Valid Transmit Power Commands: AT+P1 (-1 dBm), AT+P2 (2 dBm), AT+P3 (5 dBm), AT+P4 (8 dBm), AT+P5 (11 dBm), AT+P6 (14 dBm), AT+P7 (17 dBm), AT+P8 (20 dBm) Return to default settings: AT+DEFAULT Additional commands are available; refer to the user manual for more information. ### Conclusion The HC-12 is a capable transceiver with an impressive range (up to 1 km). It is satisfactory for most hobby and even some industrial applications. It is an important alternative to the very inexpensive, low-power, but short-range nRF24L01. Though a bit more expensive than the nRF24L01, its range and simplicity of use make the HC-12 an excellent choice for projects involving tracking. In the next article we will explore using the HC-12 in a GPS (Global Positioning System) application. Give this project a try for yourself! Get the BOM. ### Learn More About: • Share ### You May Also Like 71 Comments • Wiky5 November 03, 2016 Hi, Is it possible to program the microcontroller on the HC12 board to directly read simple inputs such as switches or a voltage and send a signal by itself? Or maybe pull up or down a pin when certain command is received? Great article! Regards, Willy Like. • Mark Hughes November 03, 2016 Hi @Wiky5 (Willy), The short answer is possibly, but it’s not worth the time or energy required to attempt it. The microcontroller on the HC12 board is the Si4463 (datasheet is in the article), which has five GPIO pins, a couple of which might work as inputs / switches for your purpose—but there’s no real way to access them—this chip is the size of the nub on the end of an AA battery, and the manufacturers didn’t provide access to the extra pins on the circuitboard. Even if you manage to solder some wires to them, there’s a decent chance they have been tied to Vdd or Gnd. It would be much simpler, and much quicker to add a microcontroller (for example, the ATTIny 85. If you’d like to post your project idea in the Forums, I’m sure there are some site users that can help advise you. And if you do choose to do that, ping me and I’ll try to help too. Thanks, Mark Like. • Wiky5 November 04, 2016 Thank you for your answer, Mark. The thing is I'm not comfortable with solving problems by just adding more microcontrollers, even though they are dirt cheap. I feel like I'm wasting processing power which could be better used elsewhere. Anyway, I guess I'll just have to come to good terms with the idea and go for the easy way. After all, the time used to solve that problem would cost way more than the uC and the power it'll use during its whole life. Regards, Willy Like. • Mark Hughes November 04, 2016 @Wiky5 I know how you feel. Over the course of many years, I've developed the extraordinary ability to find$100 solutions to $20 problems. Like. • wesbflyer November 04, 2016 Just a slight corretion Mark. The micro is the STM8. I agree with your recommendation for using another micro in this application . Wes Like. • john p November 07, 2016 This is a useful article for me right now, as I’ve just invested a magnificent$21 in buying 5 HC-12 boards from a Chinese vendor via eBay, and they arrived 2 days ago. I set up 2 units and so far I’ve demonstrated that they work right out of the package, and then I tried changing the baud rate from 9.6K to 115.2K, and they worked that way too. Nobody told me that “The transceivers must be physically separated by at least 1.5 meters to function” and I started with them side by side on a breadboard and they were fine! Then I moved them apart and they certainly work from downstairs to upstairs in a wooden house. I’ve been thinking of ways to test them over longer range.

Something I’ve noticed looking at the output of the receiving unit with a scope is that the operation seems to be time-sliced. That is, you send data in at one end, and the bytes come out at the other end, but it’s as if everything that’s collected in an interval of time gets sent in a burst, then there’s a pause and if anything didn’t make it into the first burst it comes in the next one. It seemed to me (very roughly) that the interval was 18msec at 9.6KB, and something like 4msec at 115.2KB. Does this make sense? It does appear that there’s a significant (but not consistent) delay between input at one end, and output at the other. That might be a problem in some applications.

Now I’m wondering if it’s possible to use multiple HC-12 units in a common network, instead of just two. It would have to be set up so that only one unit transmitted at a time, and I could imagine doing that by using a master-slave protocol. The master would send a packet addressing a single slave, and although all would receive it, only one would respond. Or could it be that two units automatically link up even if nothing is being sent, and the presence of a third unit would somehow disrupt communication? I’ll have to try it.

Like.
• Mark Hughes November 07, 2016
Hello @John P, glad you find the article useful. I'm glad you're having such early success with the HC12s. I'm also glad you didn't have any trouble getting them working side by side on a breadboard. That was an early trouble I had. If you get a chance, take a look at What is happening in an antenna wire and you'll see that the electric field close to a transmitting antenna is exceedingly complex. It doesn't begin to behave as one might expect an antenna to until around 1-2 wavelengths away -- which is around 0.7 m away. So if you're ever playing with any transceivers in the future, and you aren't getting success, separate them. Now to your second issue -- you've scoped the output and noticed the same pause in the transmission I did. I believe it has to do either with the Si4464 packet handling (look at page 39) or the programming of the microcontroller that runs the show. Why it's happening is out of our control. But if it's a problem for your application, throw a fifo buffer into your circuit using a microcontroller. Your master-slave protocol should be possible through programming. If you do find that the slave units compete with one another, a second option would be to use multiple channels, with each slave assigned their own separate channel and the master changing channels to communicate with them (obviously not ideal -- but potentially workable). Happy adventuring. Mark
Like.
• Mark Hughes November 10, 2016
@john p, What a cool project. I'm glad that you're enjoying yourself. While it certainly doesn't sound like you need any help, perhaps I could encourage you to post your in-progress or final project in the forums. I'm sure other enthusiasts could benefit from your expertise. And who knows -- it might motivate me to reclaim my collection of trains from a friend who "borrowed" them about 15 years ago ;) Mark
Like.
• john p November 09, 2016

I think I just proved that the HC-12 can work in a multi-unit network, if you can tolerate fairly slow timing. What I’ve done is connect my computer via a USB-to-serial converter to an HC-12. Mostly using software I wrote for an earlier project, I made the computer send a packet of 5 data bytes out of the port at 115.2KB, sending the packets 4 times a second. Let’s call that setup unit A.

Then upstairs, I put 2 HC-12’s side by side on a breadboard; let’s call them units B and C. Unit B is wired with RX and TX connected together, so it re-transmits anything it receives. Unit C isn’t wired to transmit anything; it’s just an “observer”. First of all, the packets that the computer sends via unit A are received back again from unit B, so I clearly have bidirectional communication. I connected a scope probe to the TX of unit C, and it shows the packet twice, exactly as one would expect: once transmitted by unit A downstairs, and then again by unit B. The lag between the two was quite consistent but quite lengthy, at 10msec.

What I think this shows is that the HC-12 devices don’t suffer any problems from multiple units in the same waveband, i.e. three of them can coexist. Also, although we’re told that they are half-duplex, that isn’t true as far as RX and TX are concerned; you can feed data into RX at the same time as receiving it on TX. (RX and TX here are in the frame of reference of the HC-12, and that’s the way they’re labeled on the circuit board.) I think it’s obvious that my unit C could transmit equally well as unit B, and its data would be received by unit A in the same way. I didn’t try making unit C re-transmit also, because unit B would receive the same data and would re-transmit it, and I’d get a single message bouncing between them forever! However, that 10msec lag between data being received, and the same unit being able to transmit, could well be a problem in actual use. It would depend on what the system requirements were.

Like.
• Mark Hughes November 09, 2016
That's some mighty fine work John! If you don't mind me asking -- what are you making with yours? Sounds like you're having a ton of fun! Mark
Like.
• john p November 10, 2016
I'm in a model railroad club, and we use "cabs", which are devices with which to control a train. Ours need 2-way communication, with a speed pot and a keypad for user input, and a display, a beeper and signal lights for feedback to the user. At present you designate one cab to run your train, and then you can plug it in at various points around the room, and your train keeps moving when you unplug your cab, and you can resume control when you reconnect. It would be more convenient, and safer, if the cabs could be radio-linked, so a train would never be out of the operator's control. The reason I've been interested in master-slave operation is that I'm seeing this as a way to get all the cabs connected to one serial line, which is possible because the actual amount of data that's involved isn't very large. If each cab ended up connected to its own serial line, it might still work, but then we'd have to figure out a way to interface with each serial line separately, which is a little awkward. Yes, it's definitely fun!
Like.
• Mark Hughes November 30, 2016
So, @john p, where are you with your project? Are we going to take the model train community by storm?
Like.
• Erik84750 June 15, 2017
Funny, I found this page for exactly the same reason as john p did: model railroad control. Here too the purpose is to allow multiple individual handheld wireless controllers to command a number of different model traisn. And it works with this HC-12. Thank you john for your very usefull input! Erik
Like.
• M
Maksim February 06, 2017

Hello everybody. I have a problem with my hc-12 modules. I’ve tried to test a maximum transmission distance and i have only 60-70 meters. transmission mode is FU4, i used antennas that was in the hc-12 pack(metal spiral(welding). What is the problem? How can i increase distance by cheapest way? Sorry for my English.

Like.
• Mark Hughes February 06, 2017
Hi Maksim, What are you calling mode FU4? The datasheet only has FU1, FU2, and FU3. To get the greatest distance, you have to decrease serial rate to 1200 or 2400 bps. Try different channels and check the power supply -- make sure you have enough current at the proper voltage. Lastly, try a module from a different distributor. It is possible that you have a defective product. Unfortunately, you likely do need to replace the provided antenna and work at the slowest speed to achieve the >1-km range, and that assumes a direct line of sight (nothing other than air is between the transmitter and receiver). Do you have on oscilloscope available? I could let you know some things to look for. Mark
Like.
• M
Maksim February 09, 2017
Thank you very much for your answer. There is a "• Long-distance wireless transmission (FU3: 1000m in open space, baud rate 5000bps in the air. FU4: 1800m in open space, baud rate 500bps in the air)" in user manual. I used "AT+FU4" to setup this mode. It choses speed to 1200 automatically. A few days ago i've tested transmission range with larger antennas. They were helical, 9 santimeters long instead provided antennas(about 2 santimeters) and it was more than 350 meters. It is better. Which antennas do you recommend for hc-12? I've seen UFL antenna connecter here. Maybe i can use SMA - UFL adapter and another antenna. And i don't have an oscilloscope yet, but i maybe can get it. What should i look for by using oscilloscope?
Like.
• Mark Hughes February 09, 2017
Like.
• ASm73 February 15, 2017

This is a variation of Wiky5’s question of 11/3/16.  I had thought the HC-12 would simply transmit a signal while the RX pin was pulled low and pull the TX pin low as long as a signal was received.  That being said, by attaching a telegraph key to RX and a transistor amplifier/signal light/buzzer to TX, one should be able to send and receive Morse Code without attaching to an Arduino or equivalent at all.  OK, that doesn’t work.  Using the Arduino, I can make a transmission (presence of output signal audible on a separate receiver listening on 433.400 MHZ).  However, at this point, I am not receiving that signal through my HC12/Arduino combination.  That is not the subject of a question at this time

.  In any event, what am I missing about the data transmissions?  Does the HC12 only accept ASCII characters?  I had thought the Arduino was originating the ASCII coding and the HC12 was just passing on what it saw on RXD.

Like.
• Mark Hughes February 15, 2017
Hi @ASm73, Yes, I initially misinterpreted his original question. The HC12 is the combination of the Si4463 Transceiver and the STM8S003FS Microcontroller. Together, the two components create the HC12, which is a half-duplex wireless serial communication module. UART requires an agreed upon timing scheme and data structure (for example, 2400 bits each second separated into 8 data bits, 1 stop bit, no parity -- see https://www.allaboutcircuits.com/technical-articles/back-to-basics-the-universal-asynchronous-receiver-transmitter-uart/). As to your second question -- does the HC12 only accept ASCII characters? Yes, I am unaware of any additional functionality. Even the transceiver this module is based on -- the Si4463 Transceiver, is meant to operate with SPI (see https://www.allaboutcircuits.com/technical-articles/spi-serial-parallel-interface/), so I don't think you will even be able to bypass the STM8S003FS to create a continuous wave transmitter. What problem are you trying to solve? Or project are you trying to make? Post it over in the forum, and ping me and I'll try to help you out. Mark
Like.
• ASm73 February 17, 2017
I thought an HC12 pair would make an interesting demonstration at our local ham club. Also, the small size would make it easy to conceal as the transmitter in a "foxhunt" (direction finding) contest. Adding the Arduinos won't make either of these less interesting, however the Arduino will take a little more effort to conceal for a foxhunt. I'm beginning to suspect that I have damaged both of my HC12 by omitting the series diode on the receiving unit since the instructions mentioned doing this for transmit conditions. Of course, when the receiver failed, I swapped the units as a test and now neither work. I know a unit was working for a while in transmit as I could monitor the signal with a separate receiver on 433.400 MHZ. I'll do a re-recheck, but think I had better order several more.
Like.
• M
manukanz February 22, 2017

Although PICAXE micro orientated, check their popular forum for EXTENSIVE HC-12 slanted discussions & hands- on experiences => http://www.picaxeforum.co.uk/showthread.php?28893-HC-11-and-HC-12-transceiver-modules
Rob. Rozee, a fellow Kiwi, has penned a marvellous HC-12 Windows config. GUI that makes their setup a breeze.

Like.
• Dao Tri April 15, 2017

Hi,
can you send me the code for stm8s003f3? (spi to uart), I want a DIY version for my project, I made a pcb but cant found code for this module.  Or have any way to readback the code from a hc-12 module?

Like.
• Mark Hughes April 16, 2017
Hi @Dao Tri, Sorry, I do now have the code either. You might reach out to the manufacturers and see if they are willing to share it with you, Mark
Like.
• Mark Hughes April 16, 2017
Hi @Dao Tri, Sorry, I do now have the code either. You might reach out to the manufacturers and see if they are willing to share it with you, Mark
Like.
• U
unixoidal April 23, 2017
Hi Dao Tri! Have you found the way to reprogram stm8s003f3 firmware? Thanks!
Like.
• Galamat Berdibekov June 06, 2017

Hi, Mark.
I want to make device that receves and tranceives exactly at 452 MHz. Is HC-12 module capable to work at 452 MHz?
Thanks,
Galamat

Like.
• Mark Hughes June 06, 2017
Hi Galamat -- the HC12 datasheet indicates 100 channels spaced 400 kHz apart, starting at 433.8 MHz and ending at 473 MHz. Starting at 433.8 MHz and addingh 400 kHz each time gives: {433.8MHz,434.2MHz,434.6MHz,435.MHz,435.4MHz,435.8MHz,436.2MHz,436.6MHz,437.MHz,437.4MHz,437.8MHz,438.2MHz,438.6MHz,439.MHz,439.4MHz,439.8MHz,440.2MHz,440.6MHz,441.MHz,441.4MHz,441.8MHz,442.2MHz,442.6MHz,443.MHz,443.4MHz,443.8MHz,444.2MHz,444.6MHz,445.MHz,445.4MHz,445.8MHz,446.2MHz,446.6MHz,447.MHz,447.4MHz,447.8MHz,448.2MHz,448.6MHz,449.MHz,449.4MHz,449.8MHz,450.2MHz,450.6MHz,451.MHz,451.4MHz,451.8MHz,452.2MHz,452.6MHz,453.MHz,453.4MHz,453.8MHz,454.2MHz,454.6MHz,455.MHz,455.4MHz,455.8MHz,456.2MHz,456.6MHz,457.MHz,457.4MHz,457.8MHz,458.2MHz,458.6MHz,459.MHz,459.4MHz,459.8MHz,460.2MHz,460.6MHz,461.MHz,461.4MHz,461.8MHz,462.2MHz,462.6MHz,463.MHz,463.4MHz,463.8MHz,464.2MHz,464.6MHz,465.MHz,465.4MHz,465.8MHz,466.2MHz,466.6MHz,467.MHz,467.4MHz,467.8MHz,468.2MHz,468.6MHz,469.MHz,469.4MHz,469.8MHz,470.2MHz,470.6MHz,471.MHz,471.4MHz,471.8MHz,472.2MHz,472.6MHz,473.MHz,473.4MHz}. So the answer to your question is a yes and a no -- yes, your desired frequency is within the HC12 frequency range, but no, the HC12 skips right over 452 MHz by ± 200 kHz.
Like.
• Mark Hughes June 06, 2017
Hi Galamat—the HC12 datasheet indicates 100 channels spaced 400 kHz apart, starting at 433.8 MHz and ending at 473 MHz. Starting at 433.8 MHz and adding 400 kHz each time gives: 433.8MHz, 434.2MHz, 434.6MHz, 435.MHz, 435.4MHz, 435.8MHz, 436.2MHz, 436.6MHz, 437.MHz, 437.4MHz, 437.8MHz, 438.2MHz, 438.6MHz, 439.MHz, 439.4MHz, 439.8MHz, 440.2MHz, 440.6MHz, 441.MHz, 441.4MHz, 441.8MHz, 442.2MHz, 442.6MHz, 443.MHz, 443.4MHz, 443.8MHz, 444.2MHz, 444.6MHz, 445.MHz, 445.4MHz, 445.8MHz, 446.2MHz, 446.6MHz, 447.MHz, 447.4MHz, 447.8MHz, 448.2MHz, 448.6MHz, 449.MHz, 449.4MHz, 449.8MHz, 450.2MHz, 450.6MHz, 451.MHz, 451.4MHz, 451.8MHz, 452.2MHz, 452.6MHz, 453.MHz, 453.4MHz, 453.8MHz, 454.2MHz, 454.6MHz, 455.MHz, 455.4MHz, 455.8MHz, 456.2MHz, 456.6MHz, 457.MHz, 457.4MHz, 457.8MHz, 458.2MHz, 458.6MHz, 459.MHz, 459.4MHz, 459.8MHz, 460.2MHz, 460.6MHz, 461.MHz, 461.4MHz, 461.8MHz, 462.2MHz, 462.6MHz, 463.MHz, 463.4MHz, 463.8MHz, 464.2MHz, 464.6MHz, 465.MHz, 465.4MHz, 465.8MHz, 466.2MHz, 466.6MHz, 467.MHz, 467.4MHz, 467.8MHz, 468.2MHz, 468.6MHz, 469.MHz, 469.4MHz, 469.8MHz, 470.2MHz, 470.6MHz, 471.MHz, 471.4MHz, 471.8MHz, 472.2MHz, 472.6MHz, 473.MHz, 473.4MHz So the answer to your question is a yes and a no—yes, your desired frequency is within the HC12 frequency range, but no, the HC12 skips right over 452 MHz by ± 200 kHz. But I feel that there is something else at play here -- like you are trying to interface with another device that has a set frequency -- and the HC12 is not designed to work like that. Heck, it doesn't even work with the HC11 transceiver. Good luck! Mark
Like.
• L
Laram October 08, 2017

Dear Mark,
I have purchased 2 HC 12 after going through your tutorial. I found your tutorial “Understanding and Implementing the HC-12 Wireless Transceiver Module” very easy and helpful. Before I connect the circuit to the PC I want to clear the following doubts. As indicated by you, to connect to enternal 5 V (Do not power over USB.), I am using 9V battery fed to 1117 5V module to give 5V regulated supply to Arduino and the HC 12. I’ll also be connecting a 1N4007 between the 5V and the Vcc of the HC 12 and a 1000uf capacitor between Vcc and Gnd. My doubt is as I’ll be connecting the USB cable from PC to Arduino for Send Receive sketch (Serial Monitor to type), Do I need to connect the Gnd of the battery and Gnd of Arduino to the Gnd of the USB port for common ground?  I a new to this, kindly help me. Is there a way to upload an image? Thanks!! Laram

Like.
• Mark Hughes October 08, 2017
Hi @Laram, It's difficult to have a decent back and forth in the comments section -- to post photos and get a ton of people to jump in and help, it's best to go to our forums and create a conversation there. Be sure to ping me @Mark Hughes so I can jump in too. I'd like to see a photograph of your setup before I give a definite answer, but f I understand the situation correctly, you do not need to run a ground wire from the battery to the Arduino because the Arduino board should already have those grounds tied together. I'd really suggest that you post a forum topic where I can give a more thorough answer. I think you'll like the community here. Mark
Like.
• L
Laram October 09, 2017
Dear Mark, Thank you so much for replying!! Appreciate your help. As suggested, I have posted it in the forum. I don't know how to ping you @ Mark Hughes. Below is the link https://forum.allaboutcircuits.com/threads/arduino-hc-12-power-supply.140881/ Thanks a Ton!! :)
Like.
• Mark Hughes October 09, 2017
Hi @Laram, That works. I'll see you in forums! (Depending on complexity, I might have to wait until a bit later tonight). Mark
Like.
• R
rlbrinkman October 23, 2017

Mark,
Great posting - worked beautifully!

first, a note - has anybody mentioned that the text of the article mentions using pins 10, 11 and 12 but the picture and the code use pins 4, 5 and 6?

Now, my problem.  Everything worked fine until I wanted to use a higher baud rate to send data faster.  I typed the command AT+28400 (notice the typo, it should have been AT+38400) and the devices have not responded to each other since.  I’ve tried AT+DEFAULT and stepping through each baud rate (including the erroneous one) with no luck.  And, when I type AT+RX I would at least expect the originating unit to respond with all its module parameters but it doesn’t.  It only echoes the command, with no response listing parameter values.

A general but related question is: if I change the HC-12’s baud rate wouldn’t I need to change the baud rate of the Arduino code to match?  If so, and if the Arduino is already running a sketch can the baud rate be changed on-the-fly?

Best Regards,
Ron Brinkman

Like.
• Mark Hughes October 24, 2017
Like.
• R
rlbrinkman October 24, 2017
Thanks Mark, That was it. The HC12s shifted baud rates and the Arduino didn't (my bad). Your method of hunting worked and got them back in sync. Ron
Like.
• Andreas Weidlinger November 24, 2017

Does anyone have the same problem like me?
I have ordered 18 HC-12 this year and got them with firmware v2.3
The last three i’ve ordered last month came with firmware v2.4
It seems i have about 80% packet loss between v2.3 and v2.4 ones, where v2.3 to v2.3 is something <5% packet loss.
Now i have no idea if its a software issue or if the hardware of all 3 modules is faulty.

Like.
• Andreas Weidlinger January 02, 2018
Problem solved, just got fake modules. I've ordered some direct from the manufacturer hc01.com and they work as expected with v2.4
Like.
• Mark Hughes January 02, 2018
Hi @Andreas Weidlinger, Sorry that I didn't see your initial comment -- but I'm quite happy that you were able to solve the problem -- that would have been a difficult thing to diagnose over the internet (and still very difficult to diagnose in person).
Like.
• R
raholt December 03, 2017

Hi Mark, I’m very new to Arduino’s and HC-12’s.

I’m trying to read current remotely and send it back to my PC in real time. I’ve been trawling the internet and I’ve found many useful leads on communicating via HC-12’s. I’ve had success in connecting two modules up and sending info via the serial monitors but it only sends via the Send button and not as a live stream. I’ve rigged up a simple potentiometer connected to A0 as my variable input as my current sensor has yet to arrive. I’ve attached the sketch I’m using. Any assistance in getting this live stream working would be greatly appreciated.

https://gist.github.com/anonymous/c122d53c04ef2f1cac3a7684c7866edc

Many thanks

Robin

Like.
• R
raholt December 03, 2017

Hi Mark, I’m totally new to using Arduino’s and now HC-12’s. I’m trying to measure DC Current remotely and ping it back to my PC via the HC-12’s. I’ve scoured the internet and I can now link the HC-12’s to my Arduino uno’s and send data between then via the serial monitor. The problem I face is streaming continuous live data to my serial monitor. I can only get data to transmit via the send button. I have rigged up a simple potentiometer which I am using as my current sensor has yet to arrive. I have attached the sketch I have been trying to use. Any ideas would be greatly received.

Many thanks

Robin

/*  HC12 Send/Receive Example Program 1
By Mark J. Hughes

Connect HC12 “RXD” pin to Arduino Digital Pin 4
Connect HC12 “TXD” pin to Arduino Digital Pin 5
Connect HC12 “Set” pin to Arduino Digital Pin 6

Do not power over USB.  Per datasheet,
power HC12 with a supply of at least 100 mA with
a 22 uF - 1000 uF reservoir capacitor.
Upload code to two Arduinos connected to two computers.

Transceivers must be at least several meters apart to work.

*/
int potPin = A0;
int value = 0;

#include <SoftwareSerial.h>

const byte HC12RxdPin = 4;            // Recieve Pin on HC12
const byte HC12TxdPin = 5;            // Transmit Pin on HC12

SoftwareSerial HC12(HC12TxdPin,HC12RxdPin); // Create Software Serial Port

void setup() {
Serial.begin(9600); // Open serial port to computer
HC12.begin(9600); // Open serial port to HC12
}

void loop() {
if(HC12.available()){ // If Arduino's HC12 rx buffer has data
Serial.write(HC12.read()); // Send the data to the computer
}
if(Serial.available()){ // If Arduino's computer rx buffer has data
HC12.write(Serial.read()); // Send that data to serial
}

Serial.print (3.5);
Serial.print (” “);
Serial.print (0);
Serial.print (” “);
Serial.println(sensorValue/292);
delay(50);
}

Like.
• Mark Hughes December 03, 2017
Like.
• FlyingCow January 03, 2018

Hi Mark,
I am having difficulty getting off the ground with these. My plan is to use multiple HC12’s as transmitters and a single as a receiver to create a wireless alarm system. I need to get PIR coverage for up to 350 yards so these will work great. My plan is to set each transmitter to send just a single character as identification and the receiver can sort it out from there. My problem is that I cannot get any HC12s to work in any fashion. I have an assortment of HC12s from 2 different manufactures. I have a variety of knockoff nano’s, a couple of uno’s, and a mega 2560. I cut and paste your sketch, then compile and upload it. Then nothing. I have tried several different sketches off the internet but I have yet to see any traffic in the serial monitor. If I send AT, I get nothing in return. I have tried every baud rate as well. I have not yet tried to incorporate the PIR into the sketch, I am just trying to establish communications first. I did go backward though just to see if I could see something in the serial monitor and with a PIR attached, I can see 1’s and 0’s as I should. I am using the 5v out with a decoupling cap and also a 1N4007 even though most tutorials I see don’t mention them. I’m just trying to cover all my bases and eliminate any possible cause for failure. I am also using external antennas on 3 of them so that would eliminate any possible bad soldering or heat issue associated with the included antenna.Also, if I type anything in the command line nadn hit enter, I cna see the receive led light up on the nano. Any ideas where to start or how I can check things? I am a pretty new to the HC12 but have done a few simple things in the past with both arduino’s and Rpi. My background is an electrician with a good knowledge of electronics. Thanks for any help you can provide.

Like.
• Mark Hughes January 03, 2018
@FlyingCow, That's a tough one. My gut is that something isn't wired correctly. Usually when I have symptoms like that I start tracing nets and verify there is electrical connectivity from point to point in the circuit. One time I found an Arduino clone that was missing a pin in a female header. Even if you just had one HC12 and one Uno, and you load the second sketch, you should be able to send AT and get something back in the serial monitor. That you don't see anything indicates lack of UART communication. If you have an oscilloscope available to you, let me know, as it is the tool to use in this type of situation. I'll assume that you don't have one. 1) Set aside the HC12s for a moment and use two Aruinos with the first sketch. Where the HC12s would go, run cross-over wires (Rx->Tx, Tx->Rx). This should allow you to confirm that your UNOs, compiler, software are all running correctly as text typed in one serial monitor will show up at the other serial monitor. Make life simple, set all baud rates at 9600 everywhere (in the sketch, in the serial monitor). Assuming that all works, next start inserting a single HC12 into the mix using the second sketch. Remember that you only need one board and one HC12 at a time. Get AT+DEFAULT sent in and an AT+OK response from a couple different modules before trying to connect them wirelessly. I've seen enough other comments mention that they've received bad modules that you might need to consider that as well -- although that is impossible for you to deduce without a functioning oscilloscope. If you continue to struggle, please start a forum post and let me know -- then we can have you upload some photos and some of our contributors (who know far more about Arduinos than I do) can join the fun as well. Mark
Like.
• FlyingCow January 03, 2018
Mark, Thanks so much. I do have a scope and I can check things that way tomorrow. I will also check the two arduino boards as you have suggested. Those are basic things, but I just couldn't seem to come up with a plan by myself. I'll let you know what I have found. I ordered the second batch of boards from a different vendor in hoping it the problem would solve itself.
Like.
• FlyingCow January 05, 2018
Hello Mark, I thought this needed it's own thread so I started one yesterday. I am new to the forum and I can not figure out how to contact you to ask you to look at my thread. I hope this gets the job done. I would appreciate your help. Thanks, Mitch
Like.
• Kanar LeCanard March 15, 2018

Hello,

The project is super cool it works perfectly! but..
I would have liked to know how you decode. Is the modulation FSK2?
When I decode I have a sync time with sinusoidal patterns and then probably the binary but impossible to find the correct frame. Can you help me ?

Like.
• Mark Hughes March 15, 2018
Hello @Kanar LeCanard, Thanks for joining the site! The possible modulation schemes for the Si4463 are, according to the datasheet: "Gaussian frequency shift keying (GFSK), frequency-shift keying (FSK), four-level GFSK (4GFSK), four-level FSK (4FSK), and on-off keying (OOK). Minimum shift keying (MSK) can also be created by using GFSK settings." Based on the image in the above article, and the slope, I'd suspect GFSK instead of FSK. And while I could have taken a longer integration time to confirm, it appears that there are two peaks rather than four, so I'd suspect GFSK over 4GFSK. That preamble that you are seeing is likely just a "wake up" signal and can be anywhere between 1 and 255 bytes (according to datasheet). If it were me playing around with my scope (and yours might be different), I'd enable one-shot mode and start moving the trigger delay further and further along until I saw the sync word and start inspecting there. See page 39 of the Si4463 datasheet for the packet structure. Hope this helps! Best, Mark P.S. If you require further assistance, please create a forum post as the comment section is quite limited in it's abilities.
Like.
• Kanar LeCanard March 16, 2018
Hello, thank you for your response so fast! Thanks for the information about modulations, Here I show you the spectrum analyzer with frequency peaks: https://gyazo.com/f5776797100d83a070e8b2e6c37e0472 And here: the train decode after a FSK2 demod: https://gyazo.com/f961b377e8f935dca8fd081f2828d4be Did you also have this kind of binary train? Thanks again, I'll post a little topic I think. Have a good day
Like.
• Mark Hughes March 16, 2018
We've reached max comment depth. Please create a forum post and ping me @Mark Hughes and we can discuss your project further. Thanks, Mark
Like.
• Kanar LeCanard March 15, 2018

Hello,

The project is super cool it works perfectly! but..
I would have liked to know how you decode. Is the modulation FSK2?
When I decode I have a sync time with sinusoidal patterns and then probably the binary but impossible to find the correct frame. Can you help me ?

Like.
• Kanar LeCanard March 15, 2018

Hello,

The project is super cool it works perfectly! but..
I would have liked to know how you decode. Is the modulation FSK2?
When I decode I have a sync time with sinusoidal patterns and then probably the binary but impossible to find the correct frame. Can you help me ?

Like.
• U
unbhandari May 18, 2018

in case of 2 nos of hc 12 if i apply 1 khz square wave to rx of one module of hc12 , will i get the same frequency and/or waveform at tx of another hc 12 module?

Like.
• Mark Hughes May 18, 2018
@unbhandari, That will not work. These things transmit UART data, not arbitrary waveforms. Best, Mark
Like.
• D
davidbr August 01, 2018

Hi,
I tried 2 modules HC12 (I bough 4 of them ) but for some reason I can get communication only in one direction.
One HC12 is connected to a arduino mega and other on an arduino uno. Both running same simple code from this article. If I send from mega to uno I get message. If I send from uno to mega does not receive anything. I switched HC12 modules and I have exactly same situation
What can be the reason?

Like.
• Mark Hughes August 01, 2018
Hi @davidbr, There are two possibilities that I can think of. The first one is that there is a bad electrical connection -- this can be caused by a bad wire, a bad connector in the board, or simply plugging a wire into the wrong spot. I've seen Arduino clones where the header pins are not electrically connected to the microcontroller. If you have another Uno, I'd program it and then swap it out to see if that resolves the problem. If not, start probing with an oscilloscope or a multimeter to ensure that HC12 has power, and that the logic levels of the pins are appropriate. The second issue I've seen is when the two HC12s are too close together, sometimes they cannot communicate consistently. Turn the transmit power down and make sure they are at least 1-2 meters apart. I don't think that's the case here, but it won't hurt to ensure that they are separated. @davidbr, please post this question in our forums, along with a picture of your setup. Then tag me ("@" symbol) and I'll try to help more. Thanks, Mark
Like.
• Márk Szűcs October 12, 2018

Hi,

I tried the project between an arduino nano and a raspberry pi zero.
It worked perfectly if I powered with an USB cable the arduino, but when I tried to use a standard usb adapter from wall it become very instable (not working).
I don’t use the 1N4007 diode or any decoupling capacitor that i read can be useful.
Will it solve my problem?
In the end I would like to power the whole system from battery, but I’m confused with the powering part.
Could you help me what could be the problem? If i connect it back to my computer with usb it works perfect.

Regards,
Mark

Like.
• Mark Hughes February 14, 2019
Hi Mark Szucs, Sorry for the late reply -- I never got a notification about your post -- perhaps it went into my spam folder. You should always use decoupling capacitors in your designs. A 1 nf or 0.1 nf capacitor as close to the device as possible. These capacitors prevent a phenomena called ground-bounce. When I'm designing boards, I put decoupling capacitors within 1mm of all power rails. Additionally, a larger reservoir capacitor can be useful in this design(47-100 uF electrolytic) -- this acts like a little battery that keeps the voltage up during transmissions (high current draw). A cap with a low ESR is better than one with a higher one. You shouldn't really power this over USB -- Between the arduino and the HC12 -- you can draw too much current from the USB port during transmission (USB 2.0 is limited to 100 mA, and the HC12 can draw 100 mA, Arduino is around 50 mA I believe.) I'd pick up a small wall-wart power supply. I don't think you could add enough capacitors to make it work on USB. If you ever don't get a response from me -- create a forum post and ping me with the @ prefix. I'll definitely see those.
Like.
• kannannatesh February 11, 2019

Dear AAC,
i am trying to get multi receiver data with single receiver. so i set different channels for slave. the master automatically change the channel when client sent “complete” acknowledgment .
Here i face some issue, my concept is the master send request to slave for data transmission after that request received the client transmit the data to master. but issue is the request doesn’t shown to slave buffer but if i send two or more requests that is shown in slave buffer. what is the problem here.

thank you

Like.
• Mark Hughes February 14, 2019
@kannannatesh, Ooh....that's a hard one. I don't quite know what the problem might be. Do you think you could create a forum post and ping me? In the forum, post your source code -- hopefully we can identify a problem there. If not, we're going to have to use an oscilloscope to further investigate. Thanks, Mark
Like.
• kannannatesh February 16, 2019
@Dear Mark, Thanks for your reply, here i attached my code for your reference - https://pastecode.xyz/view/450d2251 And i am trying to upload a sketch through HC-12 like one hc12 is connected to PC and another one is connected to Arduino main UART. i was done upload the sketch via TTL with CP2102 that is have a DTR pin so that is make easy to upload a sketch but HC-12 don't have a DTR that why this make hard. If you have any idea or suggestion please let me know. thank you. with regards kannannatesh
Like.
• Mark Hughes February 17, 2019
Hi @kannannatesh, Do you mind creating a forum post for this question (https://forum.allaboutcircuits.com/)? You'll find that it's much easier for a back and forth and as a bonus -- it will automatically email the participants so we can have a faster back and forth. I wonder if it isn't a timing issue? Do you have both HC12s connected to a computer that we can send debug messages to? Also -- do you have access to a 2/4-channel oscilloscope? It'd be nice to know if the problem is on the sending end of things, or the receiving end. Thanks! BTW -- when you create a forum post, ping me with the @ sign followed by my user name.
Like.
• B
brsglr February 11, 2019

Hello. Im newbie. I have 433mhz garage door opener system. is it possible to open the door with hc12 ? to make this possible can I read values/codes with hc12? I couldn’t find any article on the internet.Does that mean it can’t be done with hc12 module?

Like.
• Mark Hughes February 14, 2019
@brsglr, Yes it is possible. But you need to add an additional microcontroller. The HC12s transmit UART data -- you need a microcontroller in the remote control to configure the HC12 send some UART data -- for example "Open Door". Then you need a microcontroller in the receiver to configure the HC12 and receive the UART data -- then open the door. Please create a forum post and ping me (@ sign) and I'll try to help you further.
Like.
• ophir bamani April 14, 2019

Hi,
in the docs:
It is recommended that a reservoir capacitor be
provided across the power supply of at least 22uF, preferably 1000uF.

I used a 10uf “Smoothing Capacitor” and everything is working, but the document is very specific on using ” reservoir capacitor”.

any suggestions? I can’t seem to find any reservoir capacitors to buy online?

thanks

Like.
• Mark Hughes April 14, 2019
The issue is that passive components degrade over time. A 10 uF capacitor now, might have an effective capacitance of 8 uF a year from now, then 7, then 6. If the datasheet recommends something, it's usually a good idea to follow the recommendation unless you have a compelling reason not to. And "it seems to work just fine without it today" isn't compelling, as much as it is luck. I'd use the bigger capacitor if you can. Best, Mark
Like.
• K
KorrinF April 29, 2019

Hello, thanks for the article, I am new to arduinos and HC12 and just programming in general. Iv got a project that I am working on and the HC12 module was recommended to me by my local robotics club at the university who advised on wiring as well. To start with I just wanted to test them using your first sample script on this page and unfortunately they are not behaving accordingly.  I am using 2 knock off arduino nanos. The HC12’s are wired the same:
VCC= 5v arduino pin
GND = GND
RX = d11
TX = d10
SET = d8

I have used the recommended capacitor and diode in series with the HC12 module. And during testing I used 2 separate computers with the arduino IDE and had them several meters apart. I am aware however that the power supply may not be sufficient, my project is powered via usb to a power bank, which was the recommendation by the robotics club and during this initial experiment, of testing your sample code, they are also powered via the usb from my laptops.

These wireless modules are actually a late edition to the project, something that was always intended to be incorporated into the programming but only after the initial programming was finished and the other electronics were working correctly. Because of this I have already created PCBs and soldered all the components to them including the HC12 units so there is not room for changing pins unfortunately.

But hopefully we can figure something out I am at a loss. If we can get these working they nearly achieve what I want them to do for my main project but I will most likely start a thread in the forum to accomplish that. Thanks.

Like.
• Mark Hughes April 29, 2019
Hello @KorrinF, Please create a forum post and upload some photographs of your boards. Then tag me with @Mark Hughes. It's either the power supply, bad connections, bad code, or defective components (arduinos or HC12s). A picture will help me get a better idea of what's going on. Thanks! Mark
Like.
• Hani Ginice September 06, 2019

hello, how do i test if the HC-12 is working or not???? do you have a software for it?

Like.
• B
Bob R July 23, 2020

Hi,

Great article.

I am attempting to create a wireless connection with my Robot using the HC-12.  However, before connecting the HC-12 to my Robot, I first started testing and programming them using Tera Term on two computers with an RS232 level shifter between the computers and the HC-12.  The computers’ serial port was configured as follows, Baud = 9,600, no parity and one stop bit.  When I tested the two HC-12 using the default settings they worked just fine.  I could send data from one computer to the other with no errors.

My Robot outputs a lot of data and I need to increase the Baud rate to 115,200, so I shorted pin 5 on the HC-12, powered it up and tried to send it AT commands.  The problem is no matter what I send the HC-12 it always returns ERROR after each character.  I have tried every upper case every lower case and even the special characters and it still always returns ERROR after each character.  Both HC-12s do exactly the same thing.  I have tried both methods of putting the HC-12 into AT Command mode, still get the same ERROR message.  I have tried changing the Baud rates, the response is then garbage, which tells me the HC-12 is running at 9,600.

I have used Tera Term for many years to communicate with processors and I know it is not output any extra characters.  I am powering the HC-12s with 3.3V.

Any ideas of what might be causing my problem?

Thanks,

Bob

Like.