What do you know about Zero Ohm's consulting services?

IOT : Automated Indoor Gardener

Posted by Momen 28/09/2017 0 Comment(s)

Some people easy to forget something as example sometimes the person forget to pay a little attention to a thirsty indoor plants then it will be yellow carcasses . so this project it will help you to make a compact , automated , raspberry pi – powered gardener to give a water and light for your plants . this gardener memory is reliable and never forget to give a water for your plants .

Hard component :

Circuit Diagram:

 

Step one :

We will start this project by wiring the electronics for the gardener which is controlled by a raspberry pi zero w . in this project no need for wifi because the code runs of a scheduler , but if you want to extend the functionality by connecting it to a smart phone IOT app like Blunk .

For this project the electronics were attached to a 3D printed case which consist of both halves were printed put of PLA and there is enough space to hide the extra wiring .

Step two :

turn on the 12 v pump by used 12 v boost adapter that was connected to the 5 v input on the raspberry pi . but the raspberry pi power supply wasn’t able to output enough current for the pump motor to power . so you can use external 12 v switching power supply or also use a 12 v battery pack or 12 v wall adapter  . that need to output around 3 amps at 12 v .

step three :

expose the 5 v power and ground wires by removed the USB connector from the end of the grow light . the red wire was connected directly to a 5 v output pin on the raspberry pi .

step four :

connect the ground wire from the grow light to the drain (middle ) pin on one of our N-channel MOSFETS . the source ( right ) pin was wired to the ground on the raspberry pi . then connect the left gate pin as a signal wire to the GPIO pin 20 on the raspberry pi . when running or make the GPIO pin 20 high will turn on the light in this case .

step five :

solder two wires to the connectors on the pump motor . then insert the motor into the slot for the pump and pass the wires through a small opening at the back . after that connect on of the wires directly to the 12 v power supply .

step six :

add an N- Channel MOSFET  for the pump with a similar configuration . then connect directly the 12 v power supply with a gound pin on the raspberry pi .

 

  • Drain : ground wire from the pump
  • Source : ground pin on the raspberry pin
  • Gate : GPIO pin 12 on the raspberry pi

Assembly :

After soldered the electronics , we tucked the loose wires into the opening on the back of the case . also there is two holes on the  back of the case which can be used for M3 bolts through to attach the raspberry pi . two M205 bolts were also used to secure the pump on the side of the case .

There is a small cutout that used for the stem of the 5 v grow light . to attached the two halves of the case you can used M4 BOLTS that they sandwiched the stem .

Run the code :

From our Github repository download the code and navigate to into the folder .

cd Automated-Gardener

step 1 :

open the file with vim ( you can install it with apt-get install vim )

vim gardener.py

step 2 :

 to edit press “I”

if your signal are connected to different pins on the raspberry pi , modify the pin variable like that :

LIGHT_PIN = 20

PUMP_PIN = 12

step 3 :

you can see where the schedule is set :

# Turn water on every 30 minutes for 10 seconds

schedule.every(30).minutes.do(threaded, water, forLength=10)

# Other scheduling examples

#schedule.every().hour.do(threaded, light, forLength=300)

#schedule.every().day.at("10:30").do(threaded, light, action=GardenerAction.turnOn)

#schedule.every().day.at("12:30").do(threaded, light, action=GardenerAction.turnOff)

#schedule.every().monday.do(threaded, water, forLength=30)

#schedule.every().wednesday.at("13:15").do(threaded, light, forLength=30)

schedule.every(30).minutes.do(threaded, water, forLength=10)  

this is mean turn the pump on 10 second every 30 minutes . to changing the time/day just uncomment some of the scheduling examples by removing the # from the start of the line . as example , if you want to turn the light for 30 min on Wednesday at 1:00 pm , just write :

schedule.every().wednesday.at("13:00").do(threaded, light, forLength=1800)

step 4 :

press esc to exit edit mode , then :wq to save and quit . install a couple dependencies before start the program

sudo pip install schedule

sudo pip install rpi.gpio

run the program

python gardener.py

step 5 :

press control-c to quit

get the current working by running :

pwd

step 6 :

open rc.local and copy the path :

sudo vim /etc/rc.local

press “I” before exit 0 , add :

 

python <pwd output>/gardener.py &

press esc the:wq to save and quit

when you reboot the pi the program start .

Attach the Pump Tubing

After testing the code, we attached the gardener to the plant's pot with the light clip. Our gardener was attached it to the water dish, but you can also attach it to the rim of the pot.Two silicon tubes were cut and attached to the existing tubes peristaltic pump. The right one was placed in a cup of water near the pot, the other was positioned near the base of the plant because our pump was wired to flow from right to left. You might want to turn the pump on to determine the flow direction of the water.

Finally, make sure to plug in the Raspberry Pi, turn on your 12v power supply, and toggle the grow light on.

 

 

 

 

 

 

 

Leave a Comment