wireless water level dispaly (with HC-12 and LCD)

to start with i’m new to Arduino and coding

i’ve set up a Water tank level measurement using SR04 ultrasonic module and LCD display.
i want to upgrade this to a wireless one with 2 HC-12 modules. please let me know the codes to be added to Transmitter side Arduino and the Receiver side Arduino.

Thanks

Hi,
Can we see the code you have please and what model Arduino are you using?
How are you powering the remote unit and how far between Tx and Rx?

Have you googled arduino HC-12

Thanks.. Tom.. :slight_smile:

the code is as follows

#include <LiquidCrystal_I2C.h> //Lcd library

#define I2C_ADDR 0x27 //or(0x3F) I2C adress, you should use the code to scan the adress first (0x27) here
#define BACKLIGHT_PIN 3 // Declaring LCD Pins
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

#define TRIG 11 //Module pins
#define ECHO 12

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup() {

pinMode(TRIG, OUTPUT); // Initializing Trigger Output and Echo Input
pinMode(ECHO, INPUT_PULLUP);
lcd.begin (16,2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH); //Lighting backlight
lcd.home ();
}

void loop() {

digitalWrite(TRIG, LOW); // Set the trigger pin to low for 2uS
delayMicroseconds(2);

digitalWrite(TRIG, HIGH); // Send a 10uS high to trigger ranging
delayMicroseconds(20);

digitalWrite(TRIG, LOW); // Send pin low again
float distance = pulseIn(ECHO, HIGH,26000); // Read in times pulse

distance = distance/58;//Convert the pulse duration to distance
//You can add other math functions to calibrate it well

lcd.clear();
lcd.print(“Distance:”);
lcd.setCursor(0,1);
lcd.print(distance,1);
lcd.setCursor(6,1);
lcd.print(“cm”);
delay(500);

}
Now using Uno for wired one. for the wireless setup- one Uno and one Mega. for testing powering by 2 batteries. distance is around 20m. yes i have 2 HC-12 modules and tested LED dimming wirelessly.

Thanks

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

I hope you're using rechargeable batteries for the transmitter node as otherwise it's going to be expensive, fast...

achalaamarasinghe:
yes i have 2 HC-12 modules and tested LED dimming wirelessly.

Thanks

If you have been able to dim an LED using controller and HC-12, then you should know how to transmit data from your ultrasonic unit.
Can you post your LED dim codes please?
Using code tags.
Tom... :slight_smile: