Arduino Hygrometer (Moisture Meter) Pt.1
by OnTheBrink in Circuits > Sensors
3268 Views, 20 Favorites, 0 Comments
Arduino Hygrometer (Moisture Meter) Pt.1
![1tfof3 (1).jpg](/proxy/?url=https://content.instructables.com/FCY/8GJM/J5X0FTDZ/FCY8GJMJ5X0FTDZ.jpg&filename=1tfof3 (1).jpg)
Hello everybody! Today, I'm going to show you how to make a Arduino moisture meter. You can use this for monitoring water levels in potted plants or in gardens. It's a pretty simple build and had tons of uses, so let's get right in to the build.
Parts
![IMG_0337.JPG](/proxy/?url=https://content.instructables.com/F5H/4B7B/J5U3TJHE/F5H4B7BJ5U3TJHE.jpg&filename=IMG_0337.JPG)
For the hygrometer, you will need:
- Moisture Sensor w/ dongle(1)
- Arduino Uno (1)
- Jumpers male-male(several)
- Jumpers female-female (2)
- Breadboard
- USB B Cable
Serial Printing Hygrometer-Circuit
![IMG_0339.JPG](/proxy/?url=https://content.instructables.com/FU6/70VJ/J5U3TJHC/FU670VJJ5U3TJHC.jpg&filename=IMG_0339.JPG)
![IMG_0338.JPG](/proxy/?url=https://content.instructables.com/F36/8MG9/J5U3TJHD/F368MG9J5U3TJHD.jpg&filename=IMG_0338.JPG)
The first project we'll be doing with the moisture sensor is making a moisture meter that read out in the Arduino serial monitor. The circuit and code for this project is very simple, so that's why there are two separate circuits in this Instructable. Anyway, let's get in to build number one.
- Connect the sensor to the dongle board w/ the female-female jumpers.
- Wire the VCC pin of the dongle to %V.
- Now wire the GND pin of the dongle to one of the many GND ports of the Arduino.
- Connect the A0 pin of dongle to the A0 pin of the Arduino.
Now for the code!
Code for Serial Hygrometer
![IMG_0342.JPG](/proxy/?url=https://content.instructables.com/F9C/MC78/J5U3TJF9/F9CMC78J5U3TJF9.jpg&filename=IMG_0342.JPG)
There are tons of basic serial hygrometer programs you can find on the internet, so if for some reason you don't like this program, you can easily find another one or just write on yourself. I also have another version of this project in the works, this time using an RGB LED to display the moisture level. That'll be coming out soon. Thanks for reading and, as always, Happy Making!
Anyway, Here's the code:
/Constants
const int hygrometer = A0; //Hygrometer sensor analog pin output at pin A0 of Arduino
//Variables
int value;
void setup(){
Serial.begin(9600);
}
void loop(){
// When the plant is watered well the sensor will read a value 380~400, I will keep the 400
// value but if you want you can change it below.
value = analogRead(hygrometer); //Read analog value
value = constrain(value,400,1023); //Keep the ranges!
value = map(value,400,1023,100,0); //Map value : 400 will be 100 and 1023 will be 0
Serial.print("Soil humidity: ");