loading
1, Apple earphone box
2, Arduino pro mini
3, Soil humidity sensor
4, 74HC595 shifter
5, 2 digit LED (common negative pole)
5, 330 ohm resistance X 2
6, some wires

Step 1: Cut the Earphone Box

Cut the inner of the earphone box, and make a slit fit for soil sensor's installation.

Step 2: Circuit Design

Step 3: Solder All Things Together

It is easy to make mistake when solder circuit.
So be careful and check.

Step 4: Install Electrical Parts Into 'Apple'

Step 5: Start to Work

Connect to 5V DC power, it begin to work.

LED shows 0~99% of soil humidity.

Arduino pro mini input volt range is 5~12V, you can use 2 X 3.7V Li-Po battery to make it as a portable measurement sensor.

Step 6: Arduino Codes

//Soil humidity sensor by TL.Zhang

//Publish on www.instructables.com

//user name:bluestar179

//2015.10.30

byte data;

int humidity;

int humidity_A = 1;

int humidity_B = 1;

int DATApin = 9;

int LATCHpin = 8;

int CLOCKpin = 7;

int SELECTpin_A = 6;

int SELECTpin_B = 5;

int SENSORpin = A0;

byte digitSeg[10] = {

B11101111 , // 0

B01000001 , // 1

B11011110 , // 2

B11011011 , // 3

B01110011 , // 4

B10111011 , // 5

B10111111 , // 6

B11000001 , // 7

B11111111 , // 8

B11111011 }; // 9

void setup() {

//Serial.begin(9600);

pinMode(DATApin,OUTPUT);

pinMode(CLOCKpin,OUTPUT);

pinMode(LATCHpin,OUTPUT);

pinMode(SELECTpin_A,OUTPUT);

pinMode(SELECTpin_B,OUTPUT);

pinMode(SENSORpin,INPUT); }

void loop() {

humidity = 109-analogRead(SENSORpin)/10;

//anlog singal is about 80(in water) to 1000(in air), change anlog singal from 0%(in air)~99%(in water)

if (humidity < 8)

humidity = 0;

if (humidity > 99)

humidity = 99;

humidity_A = humidity/10; //get Ten digit

humidity_B = humidity%10; //get Single digit

//Serial.print("humidity=");

//Serial.println(humidity);

for(int i=0; i<100; i++){

//100 means get humidity singal 2s/time=2*delay*100

//send Ten digit to LED

digitalWrite(LATCHpin,LOW);

data = digitSeg[humidity_A];

shiftOut(DATApin,CLOCKpin,MSBFIRST,data);

digitalWrite(LATCHpin,HIGH);

digitalWrite(SELECTpin_A,LOW);

digitalWrite(SELECTpin_B,HIGH);

delay(10);

//send Single digit to LED

digitalWrite(LATCHpin,LOW);

data = digitSeg[humidity_B];

shiftOut(DATApin,CLOCKpin,MSBFIRST,data);

digitalWrite(LATCHpin,HIGH);

digitalWrite(SELECTpin_A,HIGH);

digitalWrite(SELECTpin_B,LOW);

delay(10);

}

}

//shiftOut function tutorial see https://www.arduino.cc/en/tutorial/ShiftOut

About This Instructable

779views

11favorites

License:

More by bluestar179:#3 'Apple' Soil Humidity Sensor #2 LED Grow Light #1 Easy Soldering Table 
Add instructable to: