Wireless Water Level Sensing

This is a project I am working on. The purpose is to read the water level of a water tank outside and display the water level in a display inside the house. I am using the waterproof ultrasonic sensors for this.

There is some option of this RF module that I can’t get to work.

*I do not want to read and display the water level all the time. It will waste both energy and sensors.
*I prefer if I could get this working as follows.
1)When that button is pressed
2)The LCD of the RX turns on
3)The RX says the TX to wake up( I saw this option in the TMRh20 library but I do not know how to use it)
4)After waking up the TX reads the water level like 5 times and send those values to the RX.
5)And goes back to sleep. Sleep means it does not read the water level and transmit.
6)And the LCD in the RX turns off

I have attached an image so you can see what I am trying to do. :slight_smile:

I could build the code to read and transmit the water level to the RX and display it on the LCD. It is that additional button and sleep wake up thing I can’t figure out. Please help me out here.

Code for the TX

#include <SPI.h>  
#include "RF24.h"
#include <NewPing.h>

#define TRIGGER_PIN  3  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     2  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 500 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};
int data;



void setup()
{
  Serial.begin(115200);
  delay(1000);
  myRadio.begin();  
  myRadio.setChannel(115); 
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ; 
  myRadio.openWritingPipe( addresses[0]);
  delay(1000);
}

void loop()
{

  data=sonar.ping_cm();
  myRadio.write(&data, sizeof(data)); 
  Serial.println(data);

}

Code for the RX

#include <SPI.h>  
#include "RF24.h" 
#include <Wire.h>  // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>

RF24 myRadio (7, 8); 

byte addresses[][6] = {"0"}; 
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
int data;



void setup() 
{
  Serial.begin(115200);
  lcd.begin(16,2);
  delay(1000);

  myRadio.begin(); 
  myRadio.setChannel(115); 
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ; 
  myRadio.openReadingPipe(1, addresses[0]);
  myRadio.startListening();

}


void loop()  
{

  if ( myRadio.available()) 
  {
    while (myRadio.available())
    {
      myRadio.read( &data, sizeof(data) );
      
    }
    lcd.setCursor(0,0);
    lcd.print("Water Level");
    Serial.println(data);
    lcd.setCursor(0,1);
    lcd.print(data);
    lcd.print("cm");
    delay(250);
    lcd.clear();
    
  }


}

SO no body knows?

You can't wake up the transmitter remotely. What you can do is have it periodically wake up in receive mode, check if there's a request for data, then either read and send it or go back to sleep.

regards

Allan.

It is that additional button and sleep wake up thing I can't figure out. Please help me out here.

Personally, I would probably move to the ESP8266 platform and the ArduinoIDE core for that device. It has a number of low-power modes. It is small. It is cheap, around $4 USD ($9'ish for Adafruit's version.)

I have some sample projects on my page, but to give you an idea, this basement temperature project works great, but only 1 attached client at a time.

Remote WiFi temperature Ray

IMO: an old notebook PC running XP, not Internet connected, and a working suspend mode is all you need. Connect to the remote ESP8266 which is running as a softAP, put in the server URL, and refresh.

Caveat: If you are not a web-dude/dudette, the learning curve is a bit steep ... but once you learn the basics, you are opening a door that you will never close.