Introduction: Plant Emoji

Picture of Plant Emoji

Since my grandmother loves plants while she always forget to water them, I create this lovely device that could notice people to water the plants. It displays a smiling face if the plant has enough water, and it cries when the plant is lack in water.

Step 1: Materials

Picture of Materials

Arduino Uno*1

8x8 led matrix*1

Soil humidity sensor*1

expansion board*1

battery*1

buzzer*1 (optional)

Step 2: Soldering

Picture of Soldering

Solder the led matrix, soil humidity sensor, and the buzzer to the expansion board.

PS. for the led matrix, I personally link CLK to pin #4, CS to pin #3 and DIN to pin #2. For the sensor, the AO is being connected to A5 on Arduino, and the buzzer is connected to pin #5. If you soldered them to other pins, remember to change them in the code.

Step 3: Battery

Picture of Battery

Stick the battery to the back of Arduino

Step 4: Put Them All Together!

Picture of Put Them All Together!

Combine the expansion board and Arduino.

Step 5: Coding

Now code your Arduino!

//Put the following code into arduino

long soilhumid;

long humid;

int dataIn = 2;

int load = 3;

int clock = 4;

byte max7219_reg_noop = 0x00;

byte max7219_reg_digit0 = 0x01;

byte max7219_reg_digit1 = 0x02;

byte max7219_reg_digit2 = 0x03;

byte max7219_reg_digit3 = 0x04;

byte max7219_reg_digit4 = 0x05;

byte max7219_reg_digit5 = 0x06;

byte max7219_reg_digit6 = 0x07;

byte max7219_reg_digit7 = 0x08;

byte max7219_reg_decodeMode = 0x09;

byte max7219_reg_intensity = 0x0a;

byte max7219_reg_scanLimit = 0x0b;

byte max7219_reg_shutdown = 0x0c;

byte max7219_reg_displayTest = 0x0f;

int e = 0;

void putByte(byte data) {

byte i = 8;

byte mask;

while(i > 0) {

mask = 0x01 << (i - 1); // get bitmask

digitalWrite( clock, LOW); // tick

if (data & mask){ // choose bit

digitalWrite(dataIn, HIGH);// send 1

}else{

digitalWrite(dataIn, LOW); // send 0

}

digitalWrite(clock, HIGH); // tock

--i; // move to lesser bit

}

}

void maxAll(byte reg, byte col) {

digitalWrite(load, LOW); // begin

putByte(reg); // specify register

putByte(col);//((data & 0x01) * 256) + data >> 1); // put data

digitalWrite(load, LOW);

digitalWrite(load,HIGH);

}

void maxSingle(byte reg, byte col) {

digitalWrite(load, LOW); // begin

putByte(reg); // specify register

putByte(col);//((data & 0x01) * 256) + data >> 1); // put data

digitalWrite(load, LOW); // and load da stuff

digitalWrite(load,HIGH);

}

void setup()

{

Serial.begin(9600);

pinMode(dataIn, OUTPUT);

pinMode(clock, OUTPUT);

pinMode(load, OUTPUT);

maxAll(max7219_reg_scanLimit, 0x07);

maxAll(max7219_reg_decodeMode, 0x00);

maxAll(max7219_reg_shutdown, 0x01);

maxAll(max7219_reg_displayTest, 0x00);

for (e=1; e<=8; e++) { maxAll(e,0);}

maxAll(max7219_reg_intensity, 0x0f & 0x0f);

pinMode(0, OUTPUT);

soilhumid = 0;

humid = 0;

}

void loop()

{

// detect soil humidity

soilhumid = analogRead(A0);

Serial.println(soilhumid);

// lack water

if (soilhumid < humid) {

// sad face

maxSingle(1,0);maxSingle(2,102);maxSingle(3,102);maxSingle(4,0);maxSingle(5,60);maxSingle(6,66);maxSingle(7,66);maxSingle(8,0);// buzzer on

digitalWrite(0,HIGH);

delay(3000);

// buzzer off

digitalWrite(0,LOW);

} else {

// happy face

maxSingle(1,0);maxSingle(2,102);maxSingle(3,102);maxSingle(4,0);maxSingle(5,126);maxSingle(6,66);maxSingle(7,36);maxSingle(8,24);// buzzer off

digitalWrite(0,LOW);

}

}

Comments

Arpi0220 (author)2017-09-17

Hi, what was the expansion board that was used? Or does any expansion board work

syamiran (author)2017-07-06

bos how many input and output this program..?

JonathanM257 (author)2017-06-21

Hello I'm having issue with the soil moisture. My sensor values are 974 out in the air and around 380-400 in the water instead of 0 and 1024. Someone knows this issue?

flpsoares (author)JonathanM2572017-07-03

The sensor is probably deregulated. Look for a potentiometer on the module board, you can make some adjustments with it.

HusnaN (author)2017-02-24

can you help me?

lijomk (author)2017-02-09

Looks interesting. would appreciate if you can share more details on the wiring on the expansion board. the attached picture is not very clear.

bhalliday (author)2017-01-28

i am having zero luck compiling this in the IDE any suggestions?

zextron (author)2017-01-08

The major problem of your project is the humidity sensor. I bought two just like yours and the first turn rusty very fast when exposed to moist soil.
One solution can be only stick it in the soil to get readings and then clean it.. well!
The other can be a mechanism with a servo and some sort of brush to clean the sensor on the way up.

aceiswild (author)zextron2017-01-14

You could try sending a very small current through the stick to help reduce/prevent rust. It's very similar to how rust proof systems work on vehicles.

GavinF2 (author)zextron2017-01-12

Was it a copper or nickel plated one?

Kawaiifelt (author)2017-01-11

I like your sense of humor!

DIY Hacks and How Tos (author)2017-01-08

Clever way to make a moisture sensor. You might also think about making a different expression for when the plant might be over watered.

About This Instructable

3,679views

71favorites

License:

More by HengzhiLiCD:Obstacle Avoiding CarPlant Emoji
Add instructable to: