Can't Send Data Between Arduinos with HC-12 modules

I've been working with the HC-12 modules for about 2 days now and have set everything up, I've gotten the pins working and have tested the AT command which returns OK. However I haven't been able to send any data between them. I'm not sure if I'm doing something wrong but I just used this test code and it doesn't seem to be working. One of my boards is a Wifi Mkr 1010 and the other is just an Uno (uncloned)

Here's the code:
sendTest

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.print("Hello World");
  delay(2000);
}

recieveTest

void setup() {
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  //Serial.println("In Loop");
  if (Serial.available() > 0) {
    Serial.println("Serial Available");
    String input = Serial.readString();
    if (input == "Hello World") {
      Serial.println("Data found");
      digitalWrite(LED_BUILTIN, HIGH);
      delay(500);
      digitalWrite(LED_BUILTIN, LOW);
    }
  }
}

The recieveTest code is uploaded to the Mkr 1010 and the sendTest is uploaded to the Uno. When both are run the Uno's built-in LED doesn't turn on.

My wiring (Left side is HC-12 pin and the right is Arduino pin):
UNO:
VCC - 5v
GND - GND
RXD - TX (Pin 1)
TXD - RX (Pin 0)
Set - Disconnected

MKR 1010:
VCC - 5v
GND - GND
RXD - TX (Pin 14)
TXD - RX (Pin 13)
Set - Disconnected

I have no clue what to do since both compile without error and both the HC-12s work correctly and are set to the same settings when check with AT-RX. I can't get them to send data. Any help is appreciated! Thank you

That connection on the MKR1010 is accessed as Serial1. It is separate from the USB connection address as Serial.

Also, don't have the two HC12's too close together when testing. Separate them by a few meters.

make sure you don't open the the Serial monitor for that one

the MKR1010 is a 3.3V device. you might need a voltage adapter from the Tx of your HC12 to the Rx of the MKR1010. from the tech specs:

Please read: operating voltage is 3.3V

The microcontroller on the this board runs at 3.3V, which means that you must never apply more than 3.3V to its Digital and Analog pins. Care must be taken when connecting sensors and actuators to assure that this limit of 3.3V is never exceeded. Connecting higher voltage signals, like the 5V commonly used with the other Arduino boards, will damage the board.

I think the HC-12 can be powered by 3.3V (if there is enough current available), I'm not sure what HIGH looks like on the Tx Pin but if it's in line with he power supply then finger crossed it's not too late and that he HC-12 did not damage your Serial1 Rx pin on the MKR1010

EDIT: I went to check the datasheet and HIGH is 3.3V

The specs on the HC12 are a little confusing. I have seen sheets with both the 3.3 and 5v ttl levels for the Rx Tx listed.

Here is the data sheet from the hc01 factory which makes the original module. It says about the Tx level

UART output, 3.3V to 5V TTL level,internal200R resistor in series

I think that you want to power the module on the MKR1010 with 3.3 v to ensure the 3.3v output.

confusing indeed. makes sense to play safe and go for 3.3V power (with enough amps)

Thanks for all the replies!
I have separated them farther apart while testing. I have also not begun the Serial on the Reciever end. Finally I changed the Serial.available and Serial.readString on the receiver to Serial1.available and Serial1.readString to interface with the hardware. They now work! Thank you!!

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