Problem with HC-12 module

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.

Up your console speed, try 115200. You could be overflowing the print buffer.

Thanks, I'll try that, but I don't think it will work because I have tried the same code on another HC-12 module and everthing works with that one.

Unfortunatly, I get the same results.

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.

That's what I thought, I was just wondering if could possibly be fixed.

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.

Which of course I don't have, so I guess I'll just bye another one from a good buyer. Thanks for your help.

Try to reset the module to factory defaults, with "AT+DEFAULT".
Leo..

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.

To switch the module to AT mode, you must apply a low level to pin SET
You did it?

What the distance between modules while testing?

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).

It is not recommended to place two modules so close, the interference may prevent a connection. Move one a few meters away from the other.

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.