Hello everyone, I just got two new HC-12 models and have been struggling with the one constantly printing to the Serial monitor nonsense. Here is the code I'm using:
#include <SoftwareSerial.h>
SoftwareSerial HC12(6,7);
void setup() {
//put your setup code here, to run once:
//enter AT mode
Serial.begin(9600);
HC12.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
while(HC12.available()){
Serial.write(HC12.read());
}
while(Serial.available()){
HC12.write(Serial.read());
}
}
And here is what I'm getting on the Serial monitor:
Both HC-12 modules have come from the same buyer. I wonder if it is just a dud as the other one works. Has anyone been able to fix this issue? I have tried changing the baud rate of the HC-12 sensor but unfortunately, that did not work. I have also tried putting the sensor into "RT" mode, but it constantly outputs random characters onto the Serial monitor. Any help would be most appreciated.
I usually buy one or more extra of the dirt cheap boards sold on the Alibaba, Amazon or Aliexpress hobby market, because quality control is very low to nonexistent, and failures are common.
If you want modules that are well designed, well made and guaranteed to work, spend a bit more and buy with confidence from a reputable hobby supplier like Adafruit, Sparkfun, Conrad, Pololu, etc.
If you can correctly diagnose the problem, it is in principle repairable. But you need the circuit diagram and high quality test equipment for the diagnosis.
Thanks for the advise but the HC-12 module does not even respond to any "AT" commands. It just continues to output nonsense no matter what I do. This leads me to think that the Hardware is fine, but the IC chip integrated onboard was not programmed correctly at the factory. My conclusion is that it is a bad module, I just wish it was somehow fixable.
When entering "AT" command mode I have made sure to connect the set pin to ground. As for the distance, I am only a few inches away from the other module. But this does not matter as I can not even get the module to respond to anything (including "AT" commands and data from the other HC-12 Module).
I really appreciate you trying to help but like I have said earlier, the sensor doesn't work in AT command mode and when I read from the sensor it returns nonsense even when the other module isn't plugged in or connected. If the sensor was working, it would not be acting in this way. So I really think that the module is toast.