Monthly Archives: May 2015

I want a raised garden but I don’t want to have to manually water it like my lawn sprinkler system. So I’ve been planning and gathering parts for an auto-irrigation system. Here are the key parts:

Rainwater gathering system

Valve control to drip-water plants

Solar power (with solar tracking?)

Soil temperature and humidity sensors

Auto water-soluble fertilizer mixing

In this part, I’ll talk about the solar power system -specifically power storage.

Solar Power: Power Storage

I have a bunch of 350 farad super capacitors laying around. The cool thing about super capacitors is that they can charge directly from the solar panel. I picked up a balancer on ebay and connected six of them in series to give me about 16 volts. I also have a spare 10W Instapark solar panel that I’ll use to charge the cells. The Instapark solar panel is rated for 22V closed circuit. I shouldn’t charge my super caps over 16 volts so I will need to reduce the voltage a bit. The easiest way to drop the voltage is to use a resistor. Using Ohm’s law we can calculate how much resistance we need:

R = V/I

My voltage drop (V) is 22V (the panel max) / 16V my super cap array max which is 6V. The current (I) I expect to see is 600mA or 0.6A. Plugging in my variables I get

36.66 ohms. I want 10 watts to be safe (I figure, probably wrongly so, that a 10W resistor for a 10W panel will be fine).

Enclosures

I found some water resistant enclosures on amazon. This was perfect size for my super cap bank. I got an additional one to put the Intel Edison and related circuits in. To keep it water tight, but also allow cables to get in and out I picked up 4 of these from adafruit along with matching water resistant cables.

I used a 5/8″ spade bit to create two holes for the cable glands for the super cap box.

Carefully I screwed in the glands and put some gasket sealer on the inside to seal some of the uneven spots from the drill.

I did the same thing with the “Edison box”, but on opposite sides.

I then stacked two power supplies on top of each other. I got the power supplies from amazon. They have adjustable output and a wide input range. I have one set at 12V for the valve solenoid and the other at 4.2V for the Edison.

Finally, I attached a power button so I can turn on and off. This too needed to be water resistant. The white LED color is a nice touch, IMHO:

Finished Power Enclosure

The enclosure works pretty well. It took about 15 minutes to fully charge. My hope is that it will power the Edison and friends for an entire day and most of the night. If it turns off in the night, I can live with that.

Next?

Next part we’ll look at the 2nd Enclosure for the Edison and friends. Stay tuned!

Quick update to the home theater system. I installed the max with silverjaw lure (adds mpci-e and msata). To attach the lights, I also required a level shifter to take the 3.3V up to 5V required by the Apa102’s. Adafruit had just the component for the job: The 74AHCT125.

Here’s the panel with the max in there:

The results are pretty awesome. The APA102’s peform much better than the WS2801’s. No flicker. Fast, and most of all, more lights!

Next up is to add some buttons to turn the thing off when needed and add USB capabilities and a remote.

AKA: How to build a smart sprinkler controller in less than 100 lines of code

Sound impossible? It isn’t. Here’s how I did it but before we start, lets define what we mean by “smart”. “Smart”, in a sprinkler context (yes, this will be highly subjective), to me means it waters my lawn and other things that need watering at just the right amounts at just the right time.

It must be green. If it rains, it can’t water unnecessarily. So it has to be able to understand the weather. It also cannot water more than my lawn or other plant needs. This means that it has to know what I’m watering and how much water it needs. With those features in mind, lets begin.

First, the brains of the operation: The Intel Edison. The Edison is a powerful and small unit with built in wifi and bluetooth. That means it’s really easy for it to connect to both other devices and to the cloud.

The wifi feature will help us get weather data from the cloud and also evapotraspiration data (ET say whut? More on this later). The Edison also has USB, which we will need later on.

The Second piece of hardware we will use is the “Koyo”. It’s a PLC. My brother had an extra one that he was willing to donate. I understand you can do the same thing with the Edison and a relay array, but if you have a PLC, why not use it, right?

The koyo uses UDP for control. My brother wrote a python library to interface with the unit. It’s pretty easy to use, the readme that comes with the library will help you find the koyo on the network and change its IP address. The library also allows us to toggle the koyo’s relays. The koyo python library requires a connection to the koyo. If you can plug the koyo into your network via ethernet, awesome. If not, you need to use something to bridge to the koyo over wifi. The Edison has wifi, so we are good there. But it doesn’t have ethernet. This is where USB comes in.

I picked up a usb to ethernet adapter on digikey. Using the Edison breakout board and a USB OTG to USB female I now have working ethernet -well almost. Connman, the network manager, which comes installed on the Edison was a bit of trouble here.

Once we have a connection set up, we need some data from the Internet so we can make the system smart. There are two sources we will use for data. Weather Underground and Agrimet. Whether Underground can tell us if it has rained and Agrimet will tell us how much to water.

Agrimet has a table that contains the evapotranspiration data for several crop types including “lawn”. Evapotransperation (ET) is how much transpiration and evaporation of water has occurred during the day. This number takes several variables into account including precipitation, solar irradiation, wind, and several other variables. For more on ET and how it is calculated checkout the Wikipedia page. Many local weather stations calculate ET for different crop types and Agrimet aggregates that data. Agrimet organizes the data per station so we will need to find you nearest weather station to our location. You can find your station on a map here. Remember the station id. We will need it later.

Once you have the weather station id nearest your area, we can get an ET data table for that station. The URL to get the table is this:

1

'http://www.usbr.gov/pn/agrimet/chart/{stationId}ch.txt'

Replace {stationID} with your station and open the URL in a browser and you should see the data table. To parse the data I used this script:

To use this class do the following:

1

forecast=Et(station).get()[cropName].forcast

“cropName” can be any crop that you see in the chart. Since we are watering grass, I will use “LAWN” for my crop. The next thing we want to do is see if it’s rained today. Since our forecast was predicted using yesterdays numbers, if it rained today, it will not have factored in. So we will just subtract the amount of precipitation if any from our forecast. I use weather underground to get the current weather conditions. Here’s my sprinkler.py that combines the Et with weather data and turns on/off my sprinkler zones.

The zones are defined in a json file:

I got the rate for each zone by putting a cup and running the sprinkler for 10 mins then dividing by 10 to give me how much water my system produces per minute. Type is LAWN, but it could be any crop. No I’m not using this variable in my code.

The last thing to do is set it up on a schedule. To do that, check out my video.

Conclusion

I’m almost completely happy with this setup after a few weeks of operation. I love being able to ssh into the sprinkler and turn it on and off -even from my android phone.