Go Down

Topic: how to transfer of data from one arduino to another arduino using HC12? (Read 106 times) previous topic - next topic

tsd4

can anyone help me regarding sending measured voltage and current values from respective sensors from one arduino to another arduino using hc12 module

GolamMostafa

The following example uses two UNOs to exchanges messages (Hello! and Fine1) between then using HC12 Radio Modules. It could be helpful for you.

Figure-1: Connection diagram between HC12 Module and UNO

(1) Let us build the setup as per above circuit diagram of Fig-1.

(2) Create, compile, and upload the following sketch into the flash of the Master UNO-1. Save the program as hc12-1.

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial HC12(10, 11); // HC-12's STX Pin, HC-12's SRX Pin
void setup()
{
  Serial.begin(9600);             // Harware Serial port to computer
  HC12.begin(9600);               // Software Serial port to HC12
}

void loop()
{
  while (HC12.available())          // If HC-12 has data
  {        
    Serial.write(HC12.read());      // Send the data to Serial Monitor
  }
}


(3) Upload the program codes of Step-2 into the flash of UNO-2.

(4) Bring in SM1 for UNO_1.

(5) Bring in SM2 for UNO-2.

(6) In SM1, enter Hello! And click the Send button. Check that 'Hello!' has appeared on the SM2 of  UNO-2.

(7) In the InputBox of SM2, enter Fine! And click the Send button. Check that 'Fine!' has appeared on SM1.


Go Up