Introduction: C.H.I.P. Watering System
We have a problem at home... Plants don't survive very well lto our lack of Love (read water). Every now and then we realize we forgot to give love to our plants around the house... That and also when we go on vacation and come back to a house of death and fallen leaves.
The problem has been around for so long that a couple of years back a set in motion a plan so that this would never happen again... Then procrastination happen! Well, until today (well, yesterday to be more precise)
So as every mechanical fanatic keeps car parts in the back yard, I've in the same way have accumulated a bunch of Raspberry Pi, C.H.I.P. and other computer yet to become smarter than me. But most important of all I did also ordered some water pump and tubes.
So having had other sorts of projects with several of my Raspberry Pi I tough this was an appropriate occasion to
use the C.H.I.P.
Step 1: Ingredients
Just so you you are prepared so that half way through the project you don't have to go to the electronics shop or forget about i there are the stuff you will need for this
- C.H.I.P. v1.0
- Water pump (6v)
- Dual relay module (One of the relays appeared to be burned so the second was a savior)
- Water tubes and junctions (3-4mm ø give or take)
- 4x AA battery compartment (to power the pump) plus 4x AA the batteries
Electronic wires (I've used a mix of male/female and I prefer not to be too specific to prevent feminists attacks on my wire quotas)
Cardboard To build a layered box at the end (Optional if you prefer to let your electronics lie around spread)
Glue (Optional to build the cardboard)
- Cutter and scissors (to cut the cardboard)
I would love to link to specif hardware stores but I bought most of these items years ago fearing for a Zombie Apocalypse. You will most likely find most of these in your favorite local/online electronic and hobby shop.
Step 2: Making Sure Your C.H.I.P Is Up and Wireless
C.H.I.P. Comes with a RGB video output, which helps with its minimal size. On the other hand it makes it really hard for me to connect it to my wall mounted TV (RGB inputs did not came to mind when nailing the TV to the wall).
If you happen to be smarted than me did leave the RGB inputs available then you can probably skip this step... unless you want to enable ssh so you can access it remotely. I would hate you would have to choose between watching Game of Thrones and watering your plants.
So the CHIP does not have many input ports besides a micro USB port for providing power and a normal USB port (to connect a keyboard if you found your TV RGB input). After some exhaustive research I found out that the power USB port also provides a tty connection to a terminal where I could enable the wireless. To summarize a great article, Setting up C.H.I.P. as an headless server, upon connecting CHIP to your computer USB for power you can use dmesg to find out which a tty terminal in C.H.I.P. we can connect to.
$ dmesg | tail | grep tty cdc_acm 2-1.2:2.0: ttyACM0: USB ACM device $ screen ttyACM0
Debian GNU/Linux 8 chip ttyGS0
chip login: root Password:
Password is chip. Security advocates would now suggest you change that password. I will too since I don't want you to come home to find out someone hacked into your wirelless, ssh your C.H.I.P. and killed your plants.
Anyhow, once here you can configure wirelless by using a program such as nmtui. I'll spare you the terminal screenshots. Don't be like me and make the connection is working. Once it is running check its IP using ifconfig.
Once the wireless is up you can connect wireless via ssh and keep watching your TV Shows.
Step 3: Wiring You Components Togheter
Wiring was probably the hardest part as it made me realize (yet again) that I know nothing about electronics.
It went through some simple steps of testing total control of LED, figuring out if I needed resistances and once I decided to use resistances, I realized I knew nothing about the resistance code (and even if you know about it, you still need a magnifying glass). Don't worry. you won't need to know that. It was just a step to confirm I knew what I was doing and then move to the hard part... Realizing I didn't knew what I was doing.
Luckily for you guys I'll save you from your own humiliation, trial and error and cut straight to the diagram description.
CHIP controls the relay using a GPIO pin (CSID0) into IN1/2, the VCC-5v connects to VCC and finnaly connect a wire between the GROUND.
On the other side of the relay you make the circuit to power the pump engine using a battery compartment.
Step 4: The Soft Parts: Coding
This is not mechanics so it does not work without software. I've chosen Python because Python seems wired into this small electronics so libraries for a quick start of any hobby project are easily available.
Install Python and CHIP_IO Library
Luckilly In a chip terminal run the following commands:
apt-get update<br>apt-get install git build-essential python-dev python-pip flex bison chip-dt-overlays -y pip install CHIP-IO
You are now ready to start writing some code now.
Making the wheels turn: Writing code
I've used nano editor for some quick and simple scripting in the terminal. Feel free to use your favorite editor.
Write down the following script
import CHIP_IO.GPIO as GPIO #import the GPIO library<br>GPIO.setup("CSID0", GPIO.OUT) #set CSID0 pin as an output GPIO.output("CSID0", GPIO.HIGH) #tell CSID0 pin to turn on the relay
Make sure that CSID0 matches the pin you selected to connect to the IN1 in the relay module.
And that is all you need to to run on the engine. Press CTRL+O to save and CTRL+X to exit and run
And your engine should be running.
By now you noticed that I forget how to tell you how to turn it off and by now the water in the plants is overflowing... Yes, it was intentional.
Anyhow keep calm and lets make the off.py to shutdown the all thing.
import CHIP_IO.GPIO as GPIO #import the GPIO library<br>GPIO.setup("CSID0", GPIO.OUT) #set CSID0 pin as an output <br>GPIO.output("CSID0", GPIO.LOW) #stop telling CSID0 pin to turn on the relay
Repeat the save and exit CTRL+O to save and CTRL+X and now run
And catastrophe should have been averted by now.
Automating the watering of the plants
Hey, but this is the same. You just changed from manually watering the plants to having to ssh a remote machine and type some commands... And, more important, not to forget to turn it off again.
Yes, that is correct but we now have enough information to create a single script to turn on the tap, wait some time and then then turn it off again. Lets keep it short and call it water.py
import CHIP_IO.GPIO as GPIO #import the GPIO library from time import sleep #import sleep so the program waits before the next action <br>GPIO.setup("CSID0", GPIO.OUT) #set CSID0 pin as an output <br>GPIO.output("CSID0", GPIO.HIGH) #tell CSID0 pin to turn on the relay sleep(120) #wait 120 seconds GPIO.output("CSID0", GPIO.LOW) #stop telling CSID0 pin to turn on the relay
After this you can run water manually as the other programs or automate it with something like crontab.
In case you want to download the source code (well, an enhanced version by the time you get it) you can checkou my GitHub repo.
Step 5: Cardboard Layered Boxing
This is an optional step But as I've seen so many DIY cardboard projects using layered cardboard building that I tough this was just the appropriate project to try this out.
In the end it provided a not so pretty but compact and easy way to keep all together box cardboard.
There is not much diagrams and it was also a bit of trial and error. Just cut a cardboard big enough for holding the C.H.I.P., the relay and the pump (with some space in between), then place then in the square and draw around them and then cut those areas off. Try to make a pump cut tight to help keep the pump in place.
The layer under just cut the pump area. It will provide a base for the electronics and separate the battery container.
The next 3-4 layers make a pocket to place the battery container (and some open area for the pump) And end with a almost flat area leaving just space for the pump.
Glue everything with your favorite glue. I've used hot glue but any other kind of glue should do the work I guess.
Step 6: The Final Setup
Due to heavy testing the plants have given huge amounts of water and I did not remember to film it. But here is a film of some preliminary tests
So we will have to wait a couple of days to have another try.
The results so far indicated two things:
- Due to either the tubes being quite small or the pump not being powerful enough it requires some minutes to provide a considerable amount of water to all plant vases (and I only have 4...)
- it appears the high of the water bottle has little impact on the water preassure
- Tubes watering at lower high are taking more water which required me to ensure all tube endings are at a similar ending high.
Hope you enjoy it and that the instructions might help you in your own project.
Participated in the
Cardboard Contest 2017
Participated in the
Microcontroller Contest 2017
Participated in the
Gardening Contest 2017