Go Down

Topic: sending data from moisture sensor to central hub (Read 111 times) previous topic - next topic

cfinch

hi
ive made a plant watering system using uno .a moisture sensor and and i2c lcd screen to give the reading of the sensor. as this is some 20m away from the house i want to send the data from this to another arduino with lcd display aswell near the house and replicate the data on one screen to the one near the house
ive thought about having a nrf24lo1 attached to both arduinos but am a bit lost as to how to collect the data from the garden module screen . the sensor is attached to a0 grd and 5v could i put a pin in say a1 and read from that ,would i need to attach pins at all or would it be done by code only within the nrf24lo1 sketch
later i want to add more sensors for functionality temp ect just asking what would be the best way to go about it any pointers would be welcome please
thanks colin

Railroader

Can You make a little drawing telling about the architecture You have in mind?
Connecting a number of sensors, reading them and transmitting, and receiving, the data, let's say once per minute, should not be much of a problem.
Use Your knowledge. If that's not enough, look for education.
Having knowledge, think outside the box to gain more of it. Only trains run like the train, on the rails. The rest run between the rails.

cfinch

hi
will do one tommorrow and post it as i have just been called out to work ,if you need anymore info ill include that if you let me know
thanks colin

Railroader

Readings "some sensors", and displaying them, is no problem. Sending that data involves wireless, always delicate. Start by sending and receiving just "Hello world" and make that work.
You will need to create some kind of protocol for the communication but it's not rocket science, only close to.
Use Your knowledge. If that's not enough, look for education.
Having knowledge, think outside the box to gain more of it. Only trains run like the train, on the rails. The rest run between the rails.

cfinch

hi
i have added a pic aswell as code im using on garden monitor it all works well apart from ive got to up the values that it puts pump on/ off but thats the easy part another question along the lines of nrf24lo1 if i had these talking together and to my pc could i update the sketch on the garden one from my laptop instead od carrying it outside and plugging into usb only a thought
regards colin









Code: [Select]
#include <Wire.h>

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
//#include <PCD8544.h>

//PCD8544 lcd;

int sensor_pin = A0 ;

int output_value = 0;//changed

int valve_pin = 8 ;//relay

void setup ( ) {
 Serial.begin(9600);//changed

 Serial.print ("Reading From the " );
 Serial.print (" Moisture = ");
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);

lcd.print ("Reading From the " );
lcd.setCursor(0, 1);


pinMode (valve_pin, OUTPUT);

delay (2000);

}


void loop ( ) {

output_value = analogRead (sensor_pin);

output_value = map (output_value , 1023 ,0 , 0 , 170);

 


lcd.clear ( );

lcd.setCursor (0, 0);

lcd.print (" Moisture = ");

lcd.print (output_value);

lcd.setCursor (0, 1);

//if (output_value < 40)//changed
//if ((output_value < 40)&&(output_value > 70))//changed
if (output_value <= 50) //turn valve on
//if (output_value >= 70)  //turn valve off


{

lcd.print (" Valve: ON ");

   digitalWrite(6, HIGH); //green
digitalWrite(7, LOW); //red

digitalWrite (valve_pin , LOW);    //Relay operates on opposite signal

delay (20000);

}

else

{
//if (output_value > 70)//changed


lcd.print (" Valve: OFF ");
if (output_value >= 80)
  //turn valve off

   digitalWrite(6, LOW); //green
digitalWrite(7, HIGH); //red

digitalWrite (valve_pin , HIGH);    //Relay operates on opposite signal

delay (1000);

}

delay(1000);

}

Go Up