Arduino Ambient Orb Weather Predictor Revisited

 

Back in February, I posted about some new enclosures I’d built for my weather beacon.

This weekend, I finally got around to tweaking the code for my beacon. I was inspired to work on it after receiving one of ThingMs spiffy new MaxM’s. They’re nice and bright and will work with any BlinkM code you may have already written.

I’m pretty happy with how my beacon works now. After my initial post, I got an email from Dave Lemons. Dave took my initial cobbled-together code and added the pulse support I’d been meaning to implement. I wanted the beacon to pulse according to the forecasted chance of precipitation. Dave’s code used delay()’s to effect the pulses. I found that when I hooked this up to my Processing script that’d pull in the weather data, I got no response from the beacon. It looks like the Processing script was delivering the data while the Arduino was “sleeping” during a delay().

So… I rewrote Dave’s code to offload the pulsing effect to a BlinkM script, saved on the MaxM. That frees up the Arduino code so that it pretty much just sits there and waits for input.

If you’d like to play around with this project, here’s my code. Be gentle… my code reads a bit like someone learning to swear phonetically in a foreign language. It might be ugly, but it gets the job done. There are 3 parts to the project:

  1. PHP code that checks the Yahoo! Weather API. You’ll need to put this code on a Web server of some sort. This code translates the weather forecast into a color(RGB hex) and a pulse code. It’ll also dump out XML – I’ve been experimenting with implementing a beacon in Flash on my Chumby. It looks like I’m using an old URL for the API, but it appears to be working OK. Put that on my TODO list.
  2. Processing code that sits on your computer that periodically checks the PHP in code 1, then delivers the color/pulse info to your Arduino.
  3. The Arduino code that parses the input from step 2 and sends the appropriate instructions to your BlinkM.

Download the code here.

The code might be a bit ugly. Give a yell if you run into a snag or make some improvements.

6 Comments