3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Garduino Upgrade, Now with more Twitter!

Step 5Upgrade #3: New Software

Upgrade #3: New Software
Now it's time for the software upgrade.  With an indoor garden I no longer had the need to have the entire project be automated within the arduino.  The original arduino kept an internal clock and counted the amount of daylight from the light sensor against the number of seconds in the day.  I found this to be more frustrating than it was worth once I moved inside and stopped using the light sensor.  This was primarily because I found that the light cycle revolved around when I power cycled the arduino, having no way to set the internal clock myself.

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 StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
51
Followers
7
Author:natantus(Chris Gilmer Project)
I'm a software and aerospace engineer. When I've got free time I like to work on robot projects and love to play with my Makerbot Cupcake and Eggbot. I would love to be involved in DIY prosthetics a...
more »