HC12 Receiving issue ( I think). TX good but no RX

I'm trying to setup a simple one way data link between two Arduino using the HC12 433MHz serial communication bords. Should be simple. Lost of examples out there - but so far none of them work for me.

I have four HC12 boards to chose from in case one is bad (or even two!). All look good.

All of the boards will respond to the AT commands. All are setup to the defaults (9600 baud, channel 001, FU3 transmission mode, 20dBm output). On a spectrum analyzer all put out what appears to be a good signal at 433.4MHz. So I think all 4 boards are good, have the same settings and are capable of transmitting.

On both the Tx and Rx end of the link, I use software serial ports on pins 4 and 5 of the Arduino Uno. Pin 4 (UNO Rx) connects to the Tx pin on the HC12. Pin 5 on the UNO connects to the Rx pin on the HC12. The HC12 power is 5v with a 100uF cap to ground and a series diode to drop the voltage (to about 4.3v). Connecting wires are good (tested).

The setup pin on the HC12 boards is floating (but has in internal pullup resistor).

This is the simple TX code. It just sends out a single character twice a second. As far as I can tell, it works. My spectrum analyzer shows a signal at 433.4 MHz, twice a second. If I disconnect the connection between pin 5 (Tx) on the Arduino and the Rx pin on the HC12, the signal goes away (as it should).

#include <SoftwareSerial.h>
SoftwareSerial HC12(4, 5); // HC-12 TX Pin, HC-12 RX Pin
void setup() {
  Serial.begin(9600);             // Serial port to computer
  HC12.begin(9600);               // Serial port to HC12
  Serial.print ("HC12 TX setup"); // Confirm setup via serial monitor
}
void loop() {  
  HC12.print("A");      // Send that data to HC-12  
  delay(500);

}

On a second Arduino, wired identically to the first, here's the code I'm using for testing

#include <SoftwareSerial.h>
SoftwareSerial HC12(4, 5); // HC-12 TX Pin, HC-12 RX Pi

void setup() {
  Serial.begin(9600);             // Serial port to computer
  HC12.begin(9600);               // Serial port to HC12
  Serial.println ("HC12 Rx setup");    
}
void loop() {
    while (HC12.available()) {        // If HC-12 has data
        Serial.println(HC12.read());  // Send the data to Serial monitor
     }   
}

All I get when I look at the serial monitor on the Arduino being used for Rx is the "HC12 Rx setup" message, then nothing. If I'm reading the code right, when there's something in the output buffer of the HC12, it will be read and sent to the serial monitor in the IDE to which that Arduino is connected. So it looks like the HC12 is not receiving anything (or at least isn't decoding any thing it receives)

It this point I'm stuck. I've tested and switched all four modules, I've tested all the wires, all the HC12 units are set to the default values and respond to AT commands (using a different sketch of course). The RF coming out of the Tx end of the link is on the right frequency and look like a digital signal (of some sort). I see nothing on the Rx Arduino.

I've done the usual switching of boards, powering things on and off, resetting the Arduinos etc. I've tried with both Arduinos powered by the same PC and with each one powered by a different PC. I've had similar results when trying sketches I've found on the web for HC12 testing. Something doesn't make sense. What am I missing here? It shouldn't be this hard. What don't I know!

What is the powerr supply of the 5 volt to the transmitter?

I don't have an HC12 to test with, but I can't see anything wrong. The only thing is I'd send using "HC12.write('A');" instead of "HC12.print("A");", but it won't be the culprit.

Anyway, even if you said you already tested sample sketches, try this video:

Try the code linked there, and see if it works.
If not, it isn't a sketch issue, it must be something from the hardware side, but I can't tell you what to do (except contact the dealer asking for some more tests to be done), sorry.

I've tried powering the Tx HC12 both from the Arduino via USB, from Arduino powered with a 7.5v supply and with a separate 5v (4A ) power supply. No difference. Spectrum analyzer shows what looks like the same signal.

The HC12 modules were from two different sources (though they were both probably mode in the same factory somewhere in China!). I will try the suggested sketch and see how that does.

I have some 2.4GHz wireless serial transceivers on order. Maybe I will have better luck with them if I can't get these to work...It should be a 10 minute job to do this, not a 10 hour job! It may be some very simple mistake. Maybe I should leave it for a day or two them come back to it and try again from the start.

Separate 5V should be used. Did You connect the power GND with the controller GND?

I can' see anything incorrect with what you are doing.

Are you using antennas? I would use a straight 17 cm piece of bare wire instead of the short spiral antenna supplied with the unit.

I also think there needs to be some distance between the units for testing.

I have always used genuine modules and never had any issues. I know there has been much written about bad clones with crystal frequency issues and other problems.

https://www.thebackshed.com/forum/ViewTopic.php?TID=11132

https://www.youtube.com/watch?v=ZfBuEAH-Q8Y

Thanks for the confirmation my software looked OK. So I decided to put on my RF engineer's hat and look that the problem that way,

Well, it tuned out it was an RF hardware issue after all. I retested all 4 HC12 units. All of them responded correctly to the AT commands. All of them showed that the 30MHz crystal oscillator (which is used as the frequency reference) was oscillating and at the correct frequency, However, this time, one of the units showed no output in the Tx mode and that was also the unit that failed to receive anything. Presumably the MCU on the board is fine since it responds to AT commands, the oscillator is fine, but the frequency synthesizer stage in the 44322A transceiver chip must be faulty. The onboard 3.3v regulator was working fine so the chip was getting power. It's hard to tell if it was doing anything, but it wasn't generating the RF output for Tx and the same synthesizer is used to generate the LO signal for the mixer in the Rx section.

These chips were designed for the Chinese smart meter market. The originals were made by Silicon Labs, but the ones used on the HC12 board don't have a Silicon Labs logo on them, so I assume they are Chinese clones. The MCU is an 8S103F3P6 with an STMicroelectronics logo on it (though logos can be cloned too...).

I thought I'd tested all the combinations and permutations of these boards, but apparently not! Either that or everything did test OK then I damaged one of them while putting it in the circuit. Unlikely, but possible.

BTW, it does not matter it you power the HC12 from the Arduino or via a separate 5v supply. Both seem to work. It doesn't draw much power so unless the Arduino is already nearing its current limit, I don't see why pulling an additional 100mA or so would be an issue, It does not seem to matter if the Tx and Rx units are close or a few meters apart. It does not matter if you power it from a 5v supply via a diode to get a voltage drip or not. The onboard 3.3v regulator is a low dropout regulator with a 200mA rating. I suppose for continuous transmission, a slightly lower voltage then 5v would make it run a little cooler. It also doesn't matter (if the units are close) whether you use the spring antenna, a length of wire, or even no antenna at all. If the hardware is good, you get good data transmission.

Thanks for the help. Problem solved. Lesson learned!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.