CUBE CODE - WeatherCube

The "Cube4" is a 4x4x4 RGB LED cube with an Arduino Leonardo compatible onboard controller. [Product page]
Post Reply
tlrichar
Posts: 5
Joined: Tue May 12, 2015 5:46 am

CUBE CODE - WeatherCube

Post by tlrichar » Tue May 12, 2015 6:07 am

I've put together little weather visualization project that I call the WeatherCube, it uses a lot of the weather animations that came with the cube, along with a few that I've collected from this forum and others, along with one or two animations of my own to help round out the visualizations.

What I did is write a Ruby script (running in a cronjob) to query the Yahoo Weather service and write that out to a flat-file that is accessible from a URL on my web providers servers. My Arduino sketch, running on the Cube, makes a connection to the internet through an XBee WiFI. The Cube sketch then queries my hosted URL for the current weather code on my server. At that point I then map the code to one of the (current) set of eleven animations that I've coded into the sketch so far. When the weather changes, so does the cube.

I'm sure others have done this, but I thought I'd share it. I've put together a detailed blog entry here if anyone is interested:

http://www.digitalintellect.org/2015/05/12/weathercube/

UPDATE: I have updated this a bit to add an Analog Log-Scale light sensor to control the brightness of the cube. For example, in the evening, the cube will dim in brightness in proportion to the light levels (within reason). This makes the cube a bit more usable as a weather appliance... e.g. place it on a mantle or in a living room and it won't flood the room with 64 full-bright LED's. As the room brightens again during the morning into the daytime, the cube will once again go to full brightness.

Here's the updated blog post:

http://www.digitalintellect.org/2015/05 ... ed-part-2/

Enjoy!
Last edited by tlrichar on Tue May 26, 2015 5:57 am, edited 2 times in total.

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: CUBE CODE - WeatherCube

Post by andrew » Tue May 12, 2015 9:15 am

Genius! Thank you for sharing that with us. :D

tlrichar
Posts: 5
Joined: Tue May 12, 2015 5:46 am

Re: CUBE CODE - WeatherCube

Post by tlrichar » Tue May 12, 2015 1:41 pm

Thanks a bunch! I know I still have a little bit of work to do on this code, but it was fun to write!

tlrichar
Posts: 5
Joined: Tue May 12, 2015 5:46 am

Re: CUBE CODE - WeatherCube

Post by tlrichar » Tue May 26, 2015 6:15 am

Updated the original post to add the updates to the WeatherCube.

tlrichar
Posts: 5
Joined: Tue May 12, 2015 5:46 am

Re: CUBE CODE - WeatherCube

Post by tlrichar » Mon Apr 11, 2016 10:06 pm

I have updated the Server code for the WeatherCube as I realized that the query to Yahoo sometimes fails, resulting in a null return value in the JSON object. This resulted in quite a few Cron e-mails that sometimes filled my in-box. This doesn’t seem to be a consistent problem but I’m guessing that Yahoo will return null during maintenance periods. To handle that, I just check for the query failure now, log the FATAL error, and exit gracefully. Basically I ignore any query failures and just try again later.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests