NextPCB
Published © CC BY-SA

Build DIY Soil Moisture Meter Using Arduino Nano

One easy way to monitor the moisture in your soil is to build a DIY Soil Moisture Meter using an Arduino Nano. With this project, you can ea

IntermediateFull instructions provided1 hour3,613
Build DIY Soil Moisture Meter Using Arduino Nano

Things used in this project

Story

Read more

Code

code

Arduino
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
#define sensor A0
Adafruit_SSD1306 display(OLED_RESET);
void setup()
{
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // change the adddress(0x3C) as per need
  display.clearDisplay();
}
void loop() 
{
  int value = analogRead(sensor);
  int percent = map(value, 1024, 0, 0, 100);
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("MOISTURE");
  display.print(percent);
  display.print("%");
  display.display();
  display.clearDisplay();
}

Credits

NextPCB

NextPCB

21 projects • 44 followers
We share Electrical, Electronics, Power, Robotics, Software, Communication, IOT “Internet Of Things”, based projects

Comments