A Weather Prognosticator

I’m not what you would call a Summer Person. My usual strategy for dealing with long-term inclement weather (known to humans as May, June, July, August, and, increasingly, September) is to insulate the house as much as possible, close off rooms I don’t need, run the AC, and pretend that I actually live in northern Canada or somewhere else where the weather outside is pleasant.

It’s a good strategy, and thus far has kept me from catching on fire during the dreaded Daystar Months. However, it is not without its drawbacks: I have no idea what to expect, temperature-wise, when I open the front door. Is a short shirt appropriate for a walk to the corner store, or is it too hot to venture out without a fire suit?

Of course, I could pull out my phone, unlock the screen, pull up a weather app, wait for it to load, and look at the temperatures. But who has time for that? Wouldn’t it be nice to just be able to look up and know what the weather will be like for the next few hours?

The display, running a static color test

The Weather Prognosticator display, running a static color test

Enter the Weather Prognosticator! (Okay, right now it’s just a Temperature Prognosticator; I still need to add precipitation.) An Arduino Uno and Ethernet shield connect to the weatherunderground.com API to pull an hourly forecast once every five minutes*.

This data is translated into a color map from blue (#0000FF) through green (#00FF00) to red(#FF0000), covering temperatures from 0C to 30C. The temperature map still needs a little tweaking; I’ll probably add purple/white for temperatures below zero — but I’ll probably leave 30C-35C as the high end. Anything over that is not amenable to going outside.

Once the data has been translated into a color map, it is sent to a 1m long 30 LED strip that I bought on sale at Radio Shack a while back. The data sheet isn’t very helpful, but with some tweaking, the provided driver functions do work.

This particular LED strip has ten addressable sections of three LEDs each; all three LEDs in each section are the same addressable color. In order to separate the light from each section, I designed a linear sconce, and 3D printed five copies to cover all the sections.

Anyway, here are the plans. You’ll need your own (free) API key from weatherunderground.com .

Arduino code: Weather Prognosticator 0.1 (Alpha)

3D printed holder (print five of them): See Thingiverse

* I plan to dial it back to polling every 30 minutes once it’s more reliable. Right now, I’m still testing it, and it still pulls an all-zero forecast every so often.

Posted in 3D Printing, Arduino, C, Coding, Design, Digital, Electronics, HOW-TO, Internet, Level 2, Networking, Projects | Tagged , , , , , , | Leave a comment


Math is weird and is sometimes frustrating, but it can certainly be beautiful.

The Bit Order Shuffle. For an explanation, keep reading...

The Bit Order Shuffle. (For an explanation, keep reading.) Click for uncompressed BMP.


When I first took a Digital Electronics course years ago, the instructor started talking about what sounded like “big-Indian” and “little-Indian” formats. I wasn’t really sure what he was talking about — but then I read the textbook. (It’s actually useful, on occasion, provided that the instructor isn’t the author.)  As it turns out, there are two main ways of storing binary numbers — with the “big end” first, or the “little end” first. Thus, “Big-Endian” and “Little-Endian.” Endian-ness, not “Indian-ness.”


This can’t be what the professor meant, right? (Drawing by Millard E. Carr)


In Big-Endian format, the largest bits (and bytes) of a binary number are stored first. So, the number 0100 would represent “four,” and the number 10100000 would represent “one hundred sixty.” Motorola processors (Freescale, these days) are big-endian.

In Little-Endian format, the order is reversed: the smallest bits come first. So, 0100 would represent “two,” and 10100000 would represent “five.” Intel CPUs are little-endian.

Both systems are well entrenched (although I confess I don’t understand why someone would use little-endian when most networks use big-endian), so it’s important to know about the problem of endianness, and how to convert between the two (using LIFO buffers, if dealing with serial data.)

But back to the “Bit Order Shuffle” image, above. It turns out that when you read the numbers in backwards order like this, you shuffle the value order of the numbers. 0000 will still be first in a list of four-bit numbers and 1111 will still be last — but 0001 will become 1000, jumping to the middle of the deck — and 0011 (three) will become 1100 (twelve) etc.

I decided to visualize this, and colored the numbers 0-1023 with a continuous color spectrum in the 24-bit RRGGBB space, with Red mapped to 255-(n/8), Green mapped to 255-abs(512-n)/4, and Blue mapped to n/8. (All values clamped 0-255.) In order to try to avoid the pattern being dominated by the last lines to be drawn rather than the overall pattern, the lines are drawn in random order, with the law of averages ensuring most or all lines were drawn.

As the pattern shows, an initially well-ordered set is shuffled — repeatably and reversibly — into a homogenous mix of values. It would be a good shuffle, if it wasn’t ultimately predictable.

As for my Dad’s “Indians” — they’ve found work as corporate bit-order spokespeople.


Posted in Digital, Math, Networking | Leave a comment

Gotta catch ’em all!

A few days ago, Niantic (of Ingress fame vague familiarity) unleashed Pokémon Go on the world.

If you’ve been living under a rock for the past week, Pokémon Go is the latest phase of the popular Japanese Pokémon (“Pocket Monsters”) franchise, which has been around since the late 1990s. The twist with this latest version, though, is that it uses real-world places as the playing field for the game. Players walk around their neighborhoods, searching for virtual Pokémon that the game superimposes on the real world.

Ran across this guy (turned out to be something called a Grimer) on campus. There are some weird ones out there!

Ran across this guy (turned out to be something called a Grimer) on campus. There are some weird ones out there!

It’s perhaps the first truly popular Augmented Reality (AR) game — and judging from the overwhelmingly positive response, it’s leading the way to a whole new genre of gaming that has the potential to completely reshape what we think of gaming.

Like any nascent paradigm shift, though, Pokémon Go and similar AR games are not without their potential hazards. Here are my thoughts — on the good and bad — after an evening or so playing Pokémon Go.

It gets geeks like me out and about
This is probably the biggest point in the game’s favor. You progress in the game largely by walking around. Whereas more traditional games like Skyrim have sometimes been criticized as “walking simulators,” there’s nothing simulated about the walking Pokémon trainers are doing, tracking down that elusive, rare … seventeenth Ratatta in a row.

It teaches you local geography and history
Pokéstops — important nodes in the game where you can obtain items for free — correspond to points of interest on Google Maps. It’s unclear exactly how these points were chosen, but churches seem to be favorite slots, as do many of Philadelphia’s murals. I’ve learned perhaps half a dozen interesting things about Mantua, Powelton Village, and West Philadelphia in general just by playing.

…as long as you watch where you’re going
I strongly recommend playing in a safe area. Many people have commented how college campuses are awesome places to play. Presumably they were talking about the proximity of so many players (with lures, etc) to points of interest. However, another good reason to play on campus is because of the security. If you’re walking around, keeping out of traffic, and trying to find that Pikachu that someone said was over on this side of town, you’re probably not as aware of all of the people around you as you should be — and not all people are to be trusted. It’s important not to become a smartphone zombie. Stick your head outside your digital bubble and look around once in a while. Watch your six.

…and if the servers aren’t on fire.
I feel sorry for whomever Niantic contracted to for their data services. Because from the look of things client-side, their data centers are probably about to melt through the floor. Quite a few of the people I saw outside — possibly as many as 10-20% — were also playing. There’s no question it’s very popular. So much so, that people have set up websites tracking whether the servers are currently up or down.

Some of the dynamics raise security concerns
Players walk around in the real world while playing. They are free to go wherever they choose — but obviously, some directions are going to have more points of interest than others. It’s also possible to track down Pokémon in your area by looking for “rustling leaves” on the screen.

So these Pokémon — as well as points of interest — are influencing where people are going, perhaps without the people being aware. (I found myself walking down a route I hadn’t taken before, and realized I was walking along Powelton Ave, when I usually just cross over it northbound.)

Businesses are already catching on to this, advertising that they are Pokéstops or perhaps offering discounts to customers who set up lure modules on the local node. Or they play and set up a node there, themselves, in order to draw customers who will sit and play as they eat.

There have also, of course, been reports of muggers setting up lures, hoping to draw victims to them. How apropos.

This could be an insanely effective way to crowdsource searching for something.
Pokémon Go is a dramatic example of the power that games have to get people to do things. (I mean, come on. I walked to work and back even though I was done working — from home — for the day.) Imagine what such a game could do, if people were scored on types of wildlife they photographed, or number of potholes they reported, and so on. Crowds of people could be out there, looking for actual useful data instead of pocket monsters.

Pokémon Go is one of the more thought-provoking games I’ve come across. Ingress, also by Niantic, was another — but they’ve done a much better job with implementation this time.

A few tweaks — some major, some minor — would greatly help the experience, though:

  • Maybe perhaps buy a second server. Just sayin’.
  • Instructional videos on what constitutes a good Pokéball toss would be very helpful. A lot is lost in the 2D-3D transition.
  • Why all the emphasis on fighting? People are getting in real-life fights over this. I’m having fun just collecting the little critters.
  • The Pokémon transfer mechanism needs to be speeded up. Let us look at all of the stats of the Pokémon we’ve captured, and check which ones we want to transfer, rather than having to dig through each slow-loading screen individually and then scroll down past the map which loads halfway there, slowing things down.

I would consider the game to be mid-to-late beta at this point, mostly because the servers are not yet up to handling the game’s unexpected runaway popularity. It’s still a lot of fun to play as long as you watch what you’re doing. And it’s certainly a harbinger of a whole genre of interesting AR games to come.

Go Team Mystic!

Posted in Current Events, Digital, Digital Citizenship, Games, Internet, Reviews, Toys | Leave a comment

Apollo 11 source code made public

NASA has just released the source code used for the Apollo 11 lunar landing mission.

You know — the code in the stack of printouts Margaret Hamilton is showing off in that famous NASA picture.

Apollo Guidance Computer project lead Margaret Hamilton shows off the printouts of the AGC software.

Apollo Guidance Computer project lead Margaret Hamilton shows off the printouts of the AGC software.

Anyway, it’s up on github. It may be a bit more difficult than most libraries to re-use, being written in AGC4 assembly language — but it’s an important piece of technological history.


Posted in Assembly, Aviation, Coding, Current Events, Design, Digital, Digital Citizenship, Nostalgia | Leave a comment