chebe: (InADream)
chebe ([personal profile] chebe) wrote2014-07-30 09:39 am

Neckpiece that Predicts the Weather

A time not so long ago, in this very land you're standing, some people were known to hang seaweed out to dry. Whenever the moisture in the air reached a certain level the seaweed would rehydrate; warning those around of rain.

Ruling out wearing seaweed around your neck, how can we use this knowledge to help us avoid getting wet? Thusly was the kelp neckpiece born!

Mannequin wearing black tshirt with white Dublin Maker logo, and a green felted kelp piece

Kelp neckpiece at Dublin Maker
Photo by chebe



I have already talked about parts of this project; in getting many LEDs to light up, and then getting the humidity sensor working. But to recap/elaborate;

Each of the round nodules at the top of the leaves has an LED inside it. They are wired, using the thinnest wires I have ever come across, with a common V+ to the SewIO8, hidden in one of the larger leaves. This allows me to individually control eight LEDs using only two pins on the microcontroller. (As far as I can tell Rob hasn't published the library yet. Occasionally I get new updates by email. If anyone is interested I'll do a separate post on using the current version.)

The SewIO8 is connected by 2 wires (I2C protocol) to a Gemma microcontroller. The Gemma, for its advantageous size makes a few extra demands on you. For one it requires external pull-up resistors (5-10k) on the Data (D0) and the Clock (D2) lines, in order to work with the SewIO8. You also need an altered I2C library. (I found it helps to have a Flora microcontroller on hand, so you can experiment and debug with the relative luxury of serial communication. It really does cut down on the debug-by-blinking-LEDs that is required with the Gemma.) This too was then nestled inside one of the larger leaves.

Gemma microcontroller wired up (pre-soldering) with external pullup resistors visible

Gemma ready to get soldered up
Photo by chebe



Gemma microcontroller wired up (post-soldering) and nestled into an enclosing felt leaf

Gemma soldered and nestled in
Photo by chebe



Then all that was needed was the humidity sensor. We used the DHT-22, which has four pins; ground, not-connected, data, power. The data pin is connected to the only pin left on the Gemma, D1. There is a great library, with self-explanatory example once installed, which is all you need to make this work.

However. Two days before DM I noticed that the piece was acting up, blinking out of sorts. Eventually I uncovered that the pins had broken!

Humidity sensor with the three connected pins broken clean off

Argh! Humidity sensor with broken pins!
Photo by chebe



Luckily we had another one. (Protip; ALWAYS buy spares.) So I patched it back in, using stranded wire for a bit of extra flexibility, and drowning it in hot-glue to strengthen the whole thing.

Humidity sensor replaced, with stranded wire, and lashings of hot-glue

That looks much sturdier
Photo by chebe



But I tell you something, I am so glad it broke before DM rather than on the day!
The big leaves hang behind, down the back. While the eight smaller ones (with LEDs) sit to the front of the body. All in all, it ended up looking a little like this;

Kelp neckpiece laid flat, Gemma and humidity sensor still exposed

All the wires and details hidden away
Photo by chebe



All that was left to do was sew the big leaves shut, pop in a battery, and then when humidity reached 75% the LEDs started to flash, in a simple chase sequence. Which was fortuitous as the weather on the day was quite humid, meaning the LEDs were flashing before the rain hit, and we didn't have to keep triggering it with our breath.

It held up well through the day. Except that the D2 external pullup wire snapped (as we kept pulling at it to show people the innards), and I had to make an emergency run over to the tog stand to solder it back together again. (I did this more than once, but that's for another post.)

My takeaway is mainly; use stranded wire for flexibility at joints. And, there's probably a better way to attach the pullup resistors. Niki has already mentioned doing another version in another colour, so I guess I'll get a chance to try out some improvements!

There you have it; a felt neckpiece that warns you it might be about the rain. I began trying to leverage the extra information (temperature and pressure) from the sensor, and fit it onto local historical weather data to more accurately predict rain, but was pulled away from such indulgent pursuits by the need to complete the other pieces.