HC-12 wireless serial module and grounding plane issues with communication

I'm having issues in data transmittal between two HC-12 modules.
A while back someone mentioned using a grounding plane for antennas.

I basically have both ground connections from the HC-12 modules hooked up to my aluminum extrusions with a fastener and t-nut. I think they are anodized but would that make a difference?

The connection works sometimes but most of the time it's having trouble on the receiver end from what I can tell.

I'm wondering if I have a good enough grounding plane based on the pictures below???:

A ground plane (for an aerial) has nothing to do with grounding.

The length of a ground plane (wire) has to match the transmit/receive frequency (433Mhz in this case).

I recommend a factory tuned dipole, or a DIY "sleeve aerial" for max range.
Leo..

Hmm... I have antennas hooked up to the HC-12 module, are those not good enough??

Based on the wikipedia article on ground plane,

To function as a ground plane, the conducting surface must be at least a quarter of the wavelength (λ/4) of the radio waves in diameter.

should I hook up the antenna to a wire that is hooked up to a metal disk or something???

They were communicating fine before. I'm hoping it has nothing to do with the power save mode I put the modules in. I've attached the manual for reference.

The picture below shows just how much metal I have connected it to.

I was using this response for troubleshooting:

https://forum.arduino.cc/index.php?topic=537526.msg3664749#msg3664749

HC-12-Documentations.pdf (282 KB)

This article seems interesting so for 433 Mhz, I should have a 17.31 cm ground plane wire?
From my breadboard I have this hooked up to the ground connection of the arduino and hc-12 module???

knightridar:
I have antennas hooked up to the HC-12 module, are those not good enough??
should I hook up the antenna to a wire that is hooked up to a metal disk or something???

They were communicating fine before. I'm hoping it has nothing to do with the power save mode I put the modules in. I've attached the manual for reference.

The picture below shows just how much metal I have connected it to.

Which antenna. Inside the green box?
The coil aerial some HC-12 modules come with is a space-saving solution.
A full size aerial for that frequency is about 33cm long (that includes ground radials).
The green/yellow ground wire seems useless (for RF). The power wires already act as "groundplane".
The frame creates footprint distortion (dead spots in the reception circle).
Maybe that's your problem. The aerial should have free view (if you want range), high above the frame.

Don't know if the HC-12 goes to default mode after sleep. Probably not.
Note that lower data rates have larger range (see datasheet).

How much metal is irrelevant. Only the first ~17cm matter.
Leo..

Yes I am using the coiled antennas that come with the HC-12 modules.
They have worked fine in the past for messaging back and forth between the modules and before I even mounted them.

I changed the HC-12 modules back to their default factory setting mode which is FU3.
Still no luck they are running at default mode now at 9600 bps.
I thought the power saving mode may have been the culprit.

The program is attached that I use to change between different power modes.
I used the FU2 mode to save power on the transmitter side since it uses 18650 batteries.

I cut two ~17 cm wires and hooked them up to the ground location on the breadboard for both the receiver side and transmitter side.

So in place of the soldered coil antenna I should just attach the ~17 cm wire I cut to the antenna?

The green box has the transmitter
The white box has the receiver.
They are less than a meter apart from each other.

HC-12 settings change code for reference:

/*********************************
Simple demonstration of HC-12 433mHz Radio
Connect Vcc to Arduino 5volts
Connect Gnd to ArduinoGnd
Connect SET to Arduino pin 10 (Take LOW to send AT Commands)

To switch HC-12 to AT Mode, take AT PIN LOW
To return to Normal Mode take ATPIN HIGH

*********************************/

#include <SoftwareSerial.h>
#define ATpin 10 // used to switch to AT mode
#define LEDpin 13
SoftwareSerial HC12Serial(14,15); // RX,TX --> GOES TO TX,RX OF DEVICE

void setup() {
Serial.begin(9600);
//Serial.begin(4800);
Serial.setTimeout(20);
pinMode(ATpin, OUTPUT);
digitalWrite(ATpin, HIGH); // normal mode (Alternate between High and Low, Low mode is for programming, normal mode is for functioning)
//digitalWrite(ATpin, LOW); // AT Mode
pinMode(LEDpin, OUTPUT);
digitalWrite(LEDpin, LOW);
HC12Serial.begin(9600);
HC12Serial.setTimeout(20);
}

void loop() {
if(Serial.available() > 0){ // Read sent TO HC-12
String input = Serial.readString();
HC12Serial.println(input); 
} 
if(HC12Serial.available() > 0){ // send data FROM HC-12
String input = HC12Serial.readString();
Serial.println(input); 
}
delay(3000);
}

/***************** 

• AT Test command.  Send command “AT” to the module, and the module returns “OK”.

• AT+Bxxxx  Change the serial port baud rate. The baud rate can be set to 1200bps, 2400bps, 4800bps, 9600bps, 19,200bps, 38,400bps, 57,600bps, or 115,200bps. 
The default value is 9600bps. e.g: To set the serial port baud rate of the module to 19,200bps, send command “AT+B19200” to the module, and the module will return “OK+B19200”. 
After exiting from command mode, the module will begin to communicate at 19,200bps.

• AT+Cxxx  Change wireless communication channel, selectable from 001 to 127 (for wireless channels exceeding 100, the communication distance cannot be guaranteed). 
The default value for the wireless channel is 001, with a working frequency of 433.4MHz. 
The channel stepping is 400KHz, and the working frequency of channel 100 is 473.0MHz. 
e.g: To set the module to work on channel 21, send command “AT+C021” to the module, and the module will return “OK+C021”. 
After exiting from command mode, the module will work on channel 21, with a working frequency of 441.4MHz. 
Note: As the wireless receiving sensitivity of the HC-12 module is relatively high, when the serial port baud rate is greater than 9600bps five adjacent channels should be staggered for use. 
Even when the serial port baud rate is not greater than 9600bps, over short distances (less than 10m) also five adjacent channels should be staggered for use.

• AT+FUx  Change the serial port transparent transmission mode of the module. 
Four modes are available, namely FU1, FU2, FU3, and FU4. Only when the serial port speed, channel, and transparent transmission mode of two modules is set to be the same, can normal wireless communications occur. 
For more details, please see the above section “Wireless Serial Port Transparent Transmission”. e.g: Send command “AT+FU1” to the module, and the module returns “OK+FU1”.

• AT+Px  Set the transmitting power of the module, with x selectable from 1 to 8. 
The corresponding transmitting power of the module is as shown below: x value 1 2 3 4 5 6 7 8 
Transmitting power of module -1 dBm (0.8mW) 2 dBm (1.6mW) 5 dBm (3.2mW) 8 dBm (6.3mW) 11 dBm (12mW) 14 dBm (25mW) 17 dBm (50mW) 20 dBm (100mW) 
The default value is 8, and the higher the transmitting power, the further the possible wireless communication distance. 
When the transmitting power level is set to 1, the transmitting power is at the minimum. 
Generally speaking, every time the transmitting power is reduced by 6dB, the communication distance will be reduced by half.
e.g: Send command “AT+P5” to the module, and the module returns “OK+P5”. 
After exiting from command mode, the transmitting power of the module will be set to 11dBm.

• AT+Ry  Obtain a single parameter from the module, where y is any letter among B, C, F, and P, respectively representing: 
baud rate, communication channel, serial port transparent transmission mode, and transmitting power. 
Example 1: Send command “AT+RB” to the module, and if the module returns “OK+B9600” it is confirmed that the serial port baud rate of the module is 9600bps. 
Example 2: Send command “AT+RC” to the module, and if the module returns “OK+RC001” it is confirmed that the communication channel of the module is 001. 
Example 3: Send command “AT+RF” to the module, and if the module returns “OK+FU3” it is confirmed that the module is working in serial port transparent transmission mode FU3. 
Example 4: Send command “AT+RP” to the module, and if the module returns “OK+RP:+20dBm” it is confirmed that the transmitting power of module is set to 20dBm (100mW).

• AT+RX  Obtain all parameters from the module. 
Returns serial port transparent transmission mode, serial port baud rate, communication channel, and transmitting power in that order. 
e.g: Send command “AT+RX” to the module, and the module returns “OK+FU3\r\n OK+B9600\r\n OK+C001\r\n OK+RP:+20dBm\r\n”. (“\r\n” means return\newline) 

• AT+Udps Set data bits (d), parity (p), and stop bits (s) for serial port communication. 
For parity, N means none, O means odd check, and E means even check. 
For stop bits, 1 means one stop bit, 2 means two stop bits, and 3 means 1.5 stop bits. 
e.g: To set the serial port format to eight data bits, odd parity, and one stop bit, send command “AT+U8O1” to the module. 
The module will return “OK+U8O1”.

• AT+V  Request firmware version information from the module. e.g: Send command “AT+V” to the module, and the module returns “HC-12_V2.3”.

• AT+SLEEP  After receiving this command, the module will enter sleep mode upon exiting from command mode, with a working current of about 22uA. 
This mode doesn’t allow serial port data transmission. 
Upon entering command mode again the module will exit from sleep mode automatically. 
e.g: When wireless data transmission is not needed, to save power send command “AT+SLEEP” to the module, and the module will return “OK+SLEEP”. 
Upon exit from command mode the working current will drop to about 22uA.

• AT+DEFAULT  Set serial port baud rate and configuration, communication channel, power, and serial port transparent transmission mode back to the factory default values. 
e.g: Send command “AT+DEFAULT” to the module, and the module returns “OK+DEFAULT”, with the factory default values restored. 
The factory default serial port baud rate is 9600bps, 8 data bits, no parity, 1 stop bit, communication channel is 001, transmitting power is 20dBm, and serial port transparent transmission mode is FU3.

• AT+UPDATE  Puts the module in the state of waiting for a software update. 
After receiving this command the module will not respond to any further AT commands until power has been cycled.
(AT Commands from HC-12 Wireless Serial Port Communication Module User Manual version 2.3B)

 *******************/

HC-12-Documentations.pdf (282 KB)

HC-12_AT_COMMANDS_INPUT_LOW_POWER_MODE_SOLAR_TRACKER.ino (6.94 KB)

That antenna configuration won't work.
The ground plane has to point in the opposite direction of the aerial (coil).
Now they cancel each other out.

The one in the big box might work better without the green wire, since there is enough 'RF ground' around it.

The receiver aerial has to have the same orientation as the transmitter.
Leo..

The little coiled antennas are normal mode helicals, and they work to an extent , BUT you cant have any metal near the antennas, as nearby metal detunes them.
Make sure there are no wires, metal bits or anything else near them.
The normal approach of a 17 cm length of wire connected to the antenna pin on the HC12 board is a much better solution.

Not really sure about your ground plane fixes but i thought i should mention that there have been reports recently of cloned Hc-12s that are using a different crystal which results in failures like you are describing. Check your crystals to see if they say t300 or 30.000 MHz. If they both say the same thing they should work fine but mixing them doesn't work well. Check this thread for more information: http://www.picaxeforum.co.uk/showthread.php?29875-HC-12-working-supply/page5

Thanks. Just checked the transmitter side module.
It says:

CEC4J
30.00L

I will check the receiver side tomorrow since it's currently outside.

I remember a while back I put the transmitter in the front yard
and the receiver was upstairs in my bedroom.
Back then I had both the HC-12 modules in the default FU3 mode.
They worked fine for transmitting and receiving data.
I also remember they were not near metal.

It may be time to start a fresh thread on "HC-12 issues" ? Here's a FU-2 bug (?) comment from a "smell of an oily electron" T300 module Kiwi user-
I have found they are all working okay but one mode FU-02 (standby 80uAmp) looses the plot and just hangs on Rx. All other modes are too hungry for most of my work so my dual work around is to power them up only when needed anyway...

So maybe it's a good thing I changed back to FU3 mode.

My entire structure is made of aluminum close to 6063-T6.
It's a dual axis tracking solar cooker.
So the transmitter side will constantly move but slowly.
It is suppose to follow the path of the sun from sunrise to sunset.
Avoiding metal will be tough.
However, the two modules are not too far from each other (less than 1 meter).

I'll try to hook up a straight wire to the HC-12 antenna out to see if that helps with any potential interference issues, but first I will try to make the grounding plane wire go the opposite way.

knightridar:
However, the two modules are not too far from each other (less than 1 meter).

That might be a problem.
These modules are made for long range (100mW output).
Can you understand someone clearly when they are yelling in your ear?
Now you're trying a megaphone (better aerial) to fix the problem.
Leo..

Ok I tried something else.
I've always gone back to using these very basic messaging programs for the HC-12 modules
to test if they are working properly.

They were created by Tom Heylen.

I originally tried this program with the default coiled antennas that come with the HC-12 modules.
They were definitely less than a meter apart.
I read somewhere in the manual or online that the distance should be over 30 cm apart at least.
I've never had issues with them communicating when they were close in the past.
However, I did this without them being close to metal.

This time around I tried the messaging program with longer sentences and sometimes a few words.
One thing I noticed is the longer sentences errored out sometimes.
That may have to with the programming and buffer/string coding???

The messaging program is working
so I'm wondering if this is a programming issue versus a hardware issue??

I'm jumping to this conclusion because when I put the dual axis solar tracking programs onto both arduinos, the receiver side isn't showing anything on the serial module.
This is weird because the receiver side has worked in the past intermittently.
What makes it even more weird is I took off both the modules and away from the metal structure.
The code is just not being received from what I can see on the serial monitor.

The picture below shows how far apart they are from each other when I'm communicating via the messenger program. The receiver side now has a 17 cm wire attached on the antenna port of the HC-12.

//RECEIVE
#include <SoftwareSerial.h>

int HC12RxdPin = 15;                  // RECEIVE PIN ON HC12
int HC12TxdPin = 14;                  // TRANSMIT PIN ON HC12

SoftwareSerial HC12(HC12TxdPin, HC12RxdPin); // CREATE SOFTWARE SERIAL PORT

byte incomingByte;
String readBuffer = "";


void setup()
{
  Serial.begin(9600); //SERIAL PORT TO PC
  HC12.begin(9600); //SERIAL PORT TO HC12
}

void loop()
{

readBuffer = "";

// ==== Storing the incoming data into a String variable

while (HC12.available())  // If HC-12 has data
  {            
    incomingByte = HC12.read();          // Store each incoming byte from HC-12
    readBuffer += char(incomingByte);    // Add each byte to ReadBuffer string variable
  }
  delay(1000);
 
// ==== Sending data from one HC-12 to another via the Serial Monitor
while (Serial.available())
  {
    HC12.write(Serial.read());
  }

Serial.println(readBuffer);
delay (2000);
}

After a little bit more troubleshooting.......

The problem seems to be on the transmitter side.
The receiver is working fine.

Like someone had mentioned the antenna needs to be grounded.
As soon as I touch it on the transmitter side I get values showing up on the serial monitor.
The angle of the antenna with respect to the receiver antenna is not really affecting the transmission of values as shown below.

Confirmed.... hardware setup issue.

knightridar:
After a little bit more troubleshooting.......

The problem seems to be on the transmitter side.
The receiver is working fine.

Like someone had mentioned the antenna needs to be grounded.
As soon as I touch it on the transmitter side I get values showing up on the serial monitor.
The angle of the antenna with respect to the receiver antenna is not really affecting the transmission of values as shown below.

Confirmed.... hardware setup issue.

NO, YOUR ANTENNA CANNOT BE GROUNDED!!!! The grounds of the Arduino and the grounds on the associated boards ALL need to have their ground pins connected to all the metal work of your project. Your test by touching the transmitter side proves the grounds of all the equipment and metal are NOT connected together electrically. You have become part of an antenna when you touched the transmitter board.

Paul

Thanks for the correction.

I basically soldered a grounding wire in the opposite direction of the coiled antenna and that solved the problem.

Wawa's advice on post 7. Thx

I initially took out the coiled antenna and hooked up a 17 cm wire and soldered the other grounding wire to the hc-12 common ground. It didn't work. Perhaps I should have directly soldered to the wire.