Notice to YSPilots/YSFLIGHT

Notice to YSPilots/YSFLIGHT
Legacy Pack available under the YSFLIGHT category.
Any individual requests for a model must be made to my email address, see bottom of the page..
Enjoy!
Skippy

Thursday 25 April 2013

Arduino Moisture Sensor

 

Hallo, so, I got an Arduino to take the place of my Raspberry Pi. It’s more hardware oriented and therefore more geared towards the RPi projects I mentioned earlier.

So, my first goal is to create a moisture sensor.

This is done using the analogue pins.

Analogue pin 0, A0, is held low by a 10kohm resistor, Above this is one wire of the sensor. From the +ve rail is the other wire of the sensor. Currently the sensor is simply 2 bits of wire and the moisture is read from my fingers. But in the final prototype it will be read off of 2 nails stuck in the soil.

image
Circuit diagram

This is the code I used, it echos the reading back over the serial port to the computer.

const int sensorPin = A0;
void setup(){
  Serial.begin(9200);
}
void loop(){
  int sensorVal = analogRead(sensorPin);
  Serial.println(sensorVal);
  delay(500);
}

 

Refresh rate is 1/2 a second.

No comments: