20 Sep

Radio Hack


Pictured above is the RFM 12B radio transceiver that sits on one end of a JeeNode. It is actually quite tiny—about the size of a fingernail. It’s extremely energy-efficient (every component that JeeLabs uses is mindful of power consumption) but it has a quirk: It sends data in binary packets, a seemingly confusing series of numbers in the range of 0 to 255 (read this for more info). That isn’t very convenient. We just want to see integers (24, for example) or floating point numbers (1.2, for example) representing our soil moisture and temperature data. Luckily, JeeLabs has some pointers on how to decode binary packets, but check out both the send and receive JeeNode codes on our GitHub page to see how it works in practice.

In other radio-related news, we did some range testing with the JeeNodes at Franklin Square to find out just how far away from each other they can be. The results were encouraging—we were successfully sending data from about 300 feet away with a line of sight, and nearly 200 feet with an obstruction in between (in our case, a building). If testing this at a park in Philadelphia named after Benjamin Franklin in any way connects us to the great inventor and the history of our city, well, that’s too much to even think about.

13 Sep

Big Changes

Where hardware for this project is concerned, everything has changed. We’re saying goodbye to the Arduino Uno, the WiFi shield, and the Solar Sunflower. Here’s why: The Arduino and WiFi shield setup consumes too much battery power, and we all pretty much agreed that having to change batteries more frequently than every 3 months would be unacceptable. Might there be a workaround for this? Sure—but electrical circuits aren’t our strong suit, and making that part of the design takes away from our desire for this to be a project that anyone can build themselves.

Speaking of strong suits and DIY building, we’re getting out of the sunflower business. The thought of mass-producing sunflower-shaped sensors isn’t particularly appealing. Who better to design the sensor housing than the students themselves? A student design competition for the sensor housing makes more sense, appeals to wider interests, allows for modularity in design and installation, and lets students create something unique to their classroom and their school. For the moment, we’re still calling our project group Solar Sunflower, but a re-branding is in process. So, cheers to the giant sunflower: It was a fine symbol for our work, it never failed to attract attention when you walked into a room with it, and it was the ultimate conversation starter on elevators and street corners.

But we have something new to talk about—meet the Raspberry Pi:


It’s a $35, credit card-sized Linux computer. Linux is an operating system, or OS—Mac and Windows are examples of operating systems, but they are proprietary; Linux, on the other hand, is open source (you can get under the hood and modify it) and it is free to install. Don’t be afraid of Linux—it can look and perform like your Mac or PC, with a desktop, software programs, Internet browser, and solitaire (or minesweeper if you prefer). You can connect a mouse, keyboard and monitor to the Raspberry Pi and have a functioning computer workstation. It accommodates Ethernet or WiFi for Internet access, a high-resolution camera, and audio speakers. The Raspberry Pi is so inexpensive because it was developed in England to teach computer science. You can read more about it here.

When we combine a Raspberry Pi with the JeeNodes mentioned in the previous post, something incredible happens. Many of our nagging problems and difficulties disappear. With the JeeNode in the garden, we’re using less power from the battery pack. By sending sensor data over radio waves, we don’t have to worry about having WiFi access outside the school. The Raspberry Pi can sit inside the school, receive the data, and upload it to the web. We’re no longer tying up a computer in the school. We’re even reducing the overall cost of the project.

More details on this new configuration to come, but Jeelabs’ Dive Into JeeNodes series of blog posts is a rough guide to the approach we’re taking. Our paths diverge a bit around step 8, but the idea is the same: JeeNodes communicating with each other by radio, and the Raspberry Pi uploading data to a server.

We’re also saying goodbye to Drexel student Tommy Thompson, whose co-op position at the Philadelphia Water Department is ending this week. Many thanks to Tommy for all his hard work and hours of troubleshooting hardware and software. Tommy isn’t a computer science major, but I’m especially proud that he’ll be leaving here with some programming skills in C++ and Python. One day he programmed a game of Pong onto an LED display using the Arduino and a soil moisture sensor as a game control. That was pretty awesome.

19 Apr

Solar Sunflower Comes Alive!


It’s alive!

It’s not really alive. But it has been built—just in time for next week’s demo at Philly Tech Week. The sunflower was built with the generous assistance of PWD aquatic biologist Jay Cruz and Drexel University student Tommy Thompson, who’s currently a co-op with our Watershed Sciences group. It’s heavy; it’s mostly made from repurposed metal pipes we had lying around in a PWD garage. We originally thought it might be made of PVC, but we already had the pipe, and PVC is difficult to paint (it requires roughing up the surface so the paint sticks). Let’s have a look at the construction:


Pipe sections and pipe fittings were assembled, with three cross fittings on the bottom for the three soil moisture sensors. The yellow cable at the top is a flexible gas hose from Home Depot, the kind that attaches to the back of a gas stove.


A closer look at the “roots.” The wires from the sensors thread up through the pipe/”stem.”


The head of the sunflower is a cheap mixing bowl from IKEA, drilled through the center to attach it to the flexible gas hose.


A threaded gas connector holds the head in place. The tubing is a little too flexible; the head droops a bit but it can easily be stabilized with some rigid wire (like a length of coat hanger) or a pipe section around the hose that acts as a sleeve.


A quick spray paint of the head and flexible gas hose.


Found some yellow and green plastic containers at the dollar store; cut out petals and leaves from stencils; did battle with a hot glue gun. Arts and crafts is not our strong suit, but it’s presentable enough. Here’s the sunflower in my cubicle, freaking people out.

07 Mar

Radio vs. WiFi

xbee        vs. wifi_shield

Pictured above, two ways to skin a cat. Or, in our case, two ways to transmit data from a sensor in the ground to a computer in the classroom. On the left is an XBee, a small radio that attaches to an Arduino via a shield; two XBees can send/receive data. On the right is the Arduino WiFi shield, which connects to the Arduino and sends data via an available WiFi network. After running into a little bit of frustration* with the WiFi shield at this week’s Code For Philly meetup, our group started talking about some of the fundamental decisions we made about data transmission. Below are some pros/cons for using an XBee (or a Wixel, or some other similar radio device) versus a WiFi shield. For the record, the cost is similar—a WiFi shield is $85, two XBees and its shield are around $75.

The nice thing about XBees is that they can be used anywhere. They don’t need access to a wifi network. You can also use multiple XBees to make a mesh network if, say, the rain garden is a good distance away from the school. (The book Building Wireless Sensor Networks by Robert Faludi is a bible in this regard.) On the other hand, weather—especially storms, when we most want to see the data—may affect the transmission. And XBees must be used in pairs, which means an XBee must sit inside a classroom, attached to a computer, to listen for incoming data. We realize that not every classroom has a spare laptop to dedicate to receiving a radio signal. With XBee, there are two legs to the journey from sensor to Web: data transmitted to a computer via radio, then data transmitted from the computer to the server via WiFi (or Ethernet or however that computer connects to the Internet).

Just thinking about the WiFi shield makes me sad that Philadelphia’s dream of the ’00s—a citywide WiFi network—never came to fruition. Accessing a school’s WiFi network is no small feat; the School District’s IT department has to be on board with the initiative (luckily, Philadelphia’s School District IT people have been amazingly supportive of a pilot project). A WiFi shield requires no equipment to be housed inside a classroom, and there’s something attractive about a product that’s a single object, that takes care of business all by itself. Plus, WiFi just seems like … the future. Going forward, there will only be more WiFi access. So we’re sticking with the WiFi shield and will work out the error messages; it provides the most direct link to the Web.

And just as an aside, we’re not married to Arduino over here. There are other boards out there—more of them every week, it seems—that control sensors, connect to the Web, etc. We’re keeping an eye on what’s being developed. Behold, for example, the BeagleBone. Seriously, who names these things?

* “ERROR WEBrick::HTTPStatus::LengthRequired,” if you’re curious.

18 Feb

Playing in Dirt: Soil Moisture Sensors

Resisting all impulses to make a “dry subject” joke with regard to soil moisture, let’s jump right in and look at the sensors below ground in our solar sunflower project. At this point, we’re planning to use Vegetronix VH400 soil moisture sensors (pictured below). We can’t directly measure soil moisture (well, it’s possible, but it involves disturbing the soil, drying it, and weighing it), but we can estimate the water content with dielectric sensors such as the Vegetronix.

vh400The basic idea is that wet soil conducts electricity better than dry soil. So we stick the sensor in the ground, have it emit an electromagnetic signal, and detect how well that signal is reflected back. Based on the amount of voltage detected by the sensor, it’s possible to estimate the volumetric water content (VWC) of the soil. VWC is simply the percentage of water in the soil—that is, it’s an overall percentage of water in the entire volume, which includes soil, water and air trapped between soil particles.

Of course, not all soil is the same. This complicates things—water drains through sand quickly, for example, but clay holds on to water—and can greatly affect the accuracy of the sensor readings. Calibration is the key to accurate soil data in this situation, and there’s really no way around it. The upside is that calibrating sensors (getting readings in dry soil, semi-dry soil, semi-wet soil, wet soil and constructing a curve based on those readings) is real science. It’s so real you won’t be able to stand it.

It should be mentioned that there are other ways to measure soil moisture besides the dielectric method described above. If you’re concerned about accuracy and have a lot of money, time-domain reflectometry (TDR) is for you. More realistically, for our application, you can also measure the soil tension, or how much suction is being exerted on the water in the soil. The Watermark 200ss soil moisture sensor (pictured below) measures soil tension. It contains two electrodes in a gypsum matrix. Water allows a current to move between the electrodes, and as the soil dries out, water leaves the sensor matrix and resistance between the electrodes increases.

watermarkWhy did we choose the Vegetronix over the Watermark? I see us asking that question again later on. Both sensors are affordable (a little under $40 each), which is a prime consideration here: We want to keep the cost of materials as low as possible, so that any school can obtain sensor equipment. The Watermark’s advantage is that it doesn’t care about soil type. However, it’s not great for sandy soils (such as we might find in a rain garden), and after some testing, the response time is not as fast; with the Vegetronix, you can grip it in your hand, and the sensor reacts to the moisture from your skin—it’s great for demonstration. The Watermark also takes some pre-wetting on installation and needs to be re-installed if it dries out completely. So it’s the Vegetronix for now, and the beauty of the Arduino is that we can change sensors at any time; it’s going to accommodate a wide variety of sensor types.

And now for the bad news: Soil moisture data is not inherently exciting. It is truly akin to watching paint dry—you see the volumetric water content spike during a storm or watering, then gradually decline until the next rain. So we’re going to need to make this more interesting. Adding a temperature sensor to the Arduino is easy; and we can grab rainfall and sunlight data from other websites (PAR sensors and rain gauges are a bit more difficult/expensive). Now we can correlate environmental data and see what typically happens during a storm: temperature drops, sunlight dims, rain falls, and soil moisture spikes.

The last thing I wanted to mention about these soil moisture sensors (for now) is that the sunflower will have three of them at different depths: one in the root zone, and two more beneath. We should be able to see the water infiltrate through the soil profile during a storm if we take sensor readings frequently enough. We should be able to draw some conclusions about how well the rain garden is draining. And in some cases we may want to bury the sensors at different spatial locations rather than different depths to determine, for instance, whether parts of the rain garden are receiving water and parts of it are not.

Who loves soil moisture? Australians and farmers. Read an outstanding primer on soil moisture sensors here.

11 Feb

Solar Sunflower Sensor

Until now, we’ve been fairly vague about labeling this “Arduino project” or “GSI sensor project.” Truth is, we didn’t have a concrete idea of what a final product might look like, or even all the things it might do. Jason Cruz, an aquatic biologist at PWD, used Sketchup to create a schematic of a sunflower-shaped soil-moisture sensor (that’s a lot of alliteration). The image above shows the basic structure—a smart and fitting design that places three soil moisture sensors underground at increasing depths, much like the roots of a plant. (We’ll discuss soil moisture sensors in more detail at some point, but the ones pictured here are Vegetronix probes.)

sunflower roots

The wires from the moisture sensors run up through the stalk/conduit to the head of the sunflower, a repurposed mixing bowl or lamp head that will house the electronics (Arduino, battery, maybe a WiFi or radio device to transmit the data). This housing would be waterproofed, of course, inside a plastic case.


Ideally, we’d be able to run the entire thing off solar power. A solar panel could charge a Lithium-ion battery (a setup similar to this one, but sized appropriately for our voltage needs), and if the head of the sunflower could swivel, we could optimize exposure to sunlight.

sunflower head

Jason’s design set off a host of new ideas and transformed an electronics project into an art project. Picture the sunflower in a rain garden at an elementary school, where students can use it to monitor soil moisture and water their plants when the soil is too dry. What if there was a do-it-yourself sunflower kit that students can build, decorate, and install themselves? What about a student design competition for the sensor housing? The Solar Sunflower would be a powerful tool for both GSI monitoring and STEM (science, technology, engineering, math) education.