Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Arnov Sharma
Published © MIT

GROW, the Opensource Soil Meter Project

Made a custom Handy soil meter that we can carry around for measuring soil moisture level.

BeginnerFull instructions provided1 hour2,927

Things used in this project

Story

Read more

Custom parts and enclosures

Fusion360File

Schematics

SCH

Code

code

C/C++
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define OLED_ADDR   0x3C
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);

int SensorPin1 = A0; 



void setup(){

  Serial.begin(57600);
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay(); 

}

void loop(){


  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Moisture Value:");
  display.display();

if (analogRead(SensorPin1) <= 300)  // 05 
  {
//  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 45);
  display.println("ITS DRY");
}

if (analogRead(SensorPin1) >= 300)  // 05 
  {
//  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 45);
  display.println("WET!!!");
}

if (analogRead(SensorPin1) >= 700)  // 05 
  {
//  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 45);
  display.println("WATER");
}


//  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 20);
  display.println(analogRead(A0));
  display.display();

//  Serial.println(analogRead(A0));
  delay(2000);

}

Credits

Arnov Sharma

Arnov Sharma

310 projects β€’ 311 followers
Just your average MAKER

Comments