Menu 1

Archive | fun

Airbus anti-collision lights part 2

Back in December I wrote about making a portable anti-collision light systems for, say, cyclists using the Airbus scheme.

That first version used a generic full-size Arduino unit. I’ve been miniaturizing it and changing hardware platforms over the last month or so as parts arrive from China. Here’s version 2 below. It adds the tail light, switches to a LiPo battery and uses a trinket instead of an Arduino:

Version 3 moves to an ATTiny85 programmer board:

Version 4 uses just the the ATTiny84 IC and switches to rechargeable AAA batteries. By rearranging components I removed 8 wires and added an on/off switch:

The next step is to put the thing on some strip board and/or design a PCB and case for it. There are a bunch of mixed considerations as the case and PCB layout interact with each other, and I’d like it to be waterproof for helmet mounting for cyclists. The battery type introduces a lot of complexity – a rechargeable lithium cell is probably best but that means integrating the charging cicuitry and having a USB socket on the thing. I have more parts ordered from China to test all of this.

Explore OpenStreetMap Statistics

OSM Stats for Namibia

Ever wanted to explore OSM statistics over time and in depth? OSM Stats is for you. Notice the site asks for your location – this is just to show you your country automagically by default.

The site lets you explore by country, over time, major types of OSM data. The left-hand graph shows you the aggregate count over time, the right-hand graph shows the difference (delta) over the same time period. You can click different data types on the left, change country at the top, and change the time range just above the graphs.

You can find some interesting things. Here’s the default view for the United Kingdom:

What it shows is data growing over time. We like graphs that go up-and-to-the-right. The right-hand graph shows, as expected, the amount of data being added declining over time. This is because there’s less and less to map in the UK as I started the project there.

Compare that to Haiti:

Can you guess what the spikes in data addition are?

Now look at residential roads only in the United States:

Things are declining over time! Where are all those residential roads going? Well a small part of the answer (notice the vertical axis is 2 orders of magnitude less than above) is the growth of living streets in the US:

That’s a small taste of the things you can learn – have fun exploring the site and email me any comments.

Continental Drift Part 2

Phone superglued to foundation

(see part 1)

The phone’s been running for nearly a week collecting data despite rebooting servers and wifi failing so I superglued it to the foundation of the house, which is concrete and in the ground. The data collected so far has all been deleted since it was just a test, but from here on out it’s real. In a week or two I’ll write some scripts to analyze the data and figure out what the error bars are.

Measuring Continental Drift with a Phone

Worldwide Continental Drift Velocities

Worldwide Continental Drift Velocities

Here in Colorado if you believe the above map (more detail), we’re moving a few centimeters a year west or south-west. Queue music, and a weekend project.

How is continental drift measured? It turns out there’s not a lot to it, you just superglue a GPS to a rock and take location measurements for a year or two. If you average out the noise of the GPS you should see it move over time.

I have an old Lumia phone that is worth about $5 on eBay yet will run Windows 10 so I grabbed Visual Studio 2015 and wrote a little app to grab the GPS location every second. The app also keeps the screen alive, displays the location and then sends the data off to a server. The “server” here is a Mac running a tiny little ruby daemon which listens for the GPS data and logs it to some files. There’s also a little plist file you put in your launchd directory to keep it running as a background service. A great excuse to learn how Windows 10 apps and ruby sockets work.

Now the “real” geologists, probably their GPS is bright orange, has solar power, a big drive to log data and special clamps to mount the whole thing to the bedrock that’s being measured. It probably has a wonderful view of the sky, and cost $20k or something. The concrete foundation of the house and superglue will have to suffice for mounting. We have interference from the (wooden) roof of the garage. The server might go down. The wifi will too, occasionally, and there is no buffering on the phone at this point so we’ll lose data here and there. The code is all available here.

I’m currently running the setup for a few days and will then superglue the phone to the foundation and forget about it for a few months while it collects data. Though there is one piece left to write for logging, we need to compress the files after they’ve been stagnant a while.

Analysis will come much later, and we’ll need a decent numerical library to make sure the averages are computed correctly. There are various other thing that can break like thermal expansion or some other effect may throw the whole thing off. Stay tuned!

Arduino Airbus Anti-Collision Lights

Airbus aircraft, like the model A380 above have a specific anti-collision lighting setup that I like. The white LEDs on the wing tips blink twice, then the red light on the top and bottom blink. I’m ignoring the tail light since I’m not sure I care about it for what I want to do.

Here’s the timing diagram:

The middle row shows the wingtip lights blinking for 50 milliseconds, wait for 350 milliseconds then blink the red (top row) for 100 milliseconds. The bottom is the tail I’m ignoring for now.

I implemented this on an Arduino:

Here’s the code (and yes, I know the loop is unrolled):

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(12, HIGH);
  digitalWrite(11, HIGH);
  delay(50);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  delay(50);
  digitalWrite(12, HIGH);
  digitalWrite(11, HIGH);
  delay(50);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  delay(350);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(100);
  digitalWrite(LED_BUILTIN, LOW);
  delay(400);
}

So the question of course is, why?

I think it would make a neat set of lights for a bicycle helmet or something lighter (e.g. a headband) for runners. If it’s good enough to protect a half-billion dollar aircraft then why not try it on the mean streets?

I need to miniaturize and package it, and make it work in the rain as next steps.

Here’s the Arduino clone kit I used, and the ultra-bright LEDs. The kit came with some fogged white LEDs which are OK, but not great. Overall it was a fun first project, and if you already know how to write software and some electronics you can get going extremely quickly. My problem was I never had a real reason to use an Arduino until now…

Powered by WordPress. Designed by WooThemes