Step 5Upgrade #3: New Software
In fact I thought I could do a better job regulating the time from my laptop. Not only would the light only be on at night and in the morning when I wouldn't care, but I could reset the arduino power at any time and it wouldn't change this schedule. The added advantage to this method would be that I'd also be able to record the sensor readings from the garden to look at them later.
To get started you have to know that the arduino can talk over a serial connection to your laptop. You probably already knew this, but what you may not know is that you can use the Python programming language to read and talk to the arduino. This is great because it opens up all sorts of tools for you to use when interacting with your arduino.
For this you'll need to download and install the following:At this point I also want to direct you to the Arduino Controlled Servo Robot project by Oomlout. My methods roughly follow what I learned there. The basic premise is that you'll be sending a command from the laptop to the arduino every 15 seconds. The arduino will decode this message, check that it is a correct message, and then the arduino will use the commands to manage the garden. If no message is received then no new actions will be applied to the garden.
I choose to send a command that looks like this: "+++lw". The arduino can tell if the message is correct by reading that I have included the "+++". Then I pass the letters 'l' and 'w'. If the 'l' is lower case then it tells the arduino to turn off the light. If the 'l' is an uppercase 'L' then the light will come on. Easy, right?
The 'w' is trickier. I have included some safety protocols in my software. The arduino will only turn on the pump for a maximum of 5 times for 5 seconds each time. You may wonder how a plant will live on only 25 seconds of watering. Well I reset the counter every 4 hours. This way the plant will continue to get water and my kitchen will not continue to get flooded. The 'w' as a lower case tells the arduino nothing useful, but if I change the 'w' to an uppercase 'W' then the pump counter will reset to zero and the arduino can again water my plant if it's necessary. Make sense? You may want to something slightly different, but this worked for me.
Instead of including the code in the text here I've decided to include files. You should be able to open these with your Arduino IDE for the arduino code and with IDLE or a text editor for the Python code.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|















































