The Rusty Spike

A Railroad Fan's Website


WIP: Police Lightbar Physical Prototype

Between dealing with a terrible manager at work, switching jobs and the family being perpetually sick, all hobby dollars and time were sucked into the void. 🙁 The parts I ordered from finally arrived recently, so I finished up the initial attempt at building a light bar.

And it was a total failure. The 1206 SMD LEDs weren’t getting good connection and some where blowing out. So I scrapped it and started fresh.

I hit upon a decent manufacturing process and refined it in the build, so the current (2nd) prototype still needs improvement but is infinitely more stable than the first. Solder traces are not very tidy, wire management could be better, etc, etc. But it works and sure looks purty!


Police Lightbar Sim for Launchpad – Rev 3

Last round of modifications to this project for a while. Rev 2 was pretty good, but the memory limitations of the MSP430G2553 chip posed a challenge: 512 bytes of ram! I was only able to get three flashing sequences plus the logic loops into that little memory. So another rework was needed.

Instead of using a byte broken down into 1bit/7bit status/time chunks, for Rev 3 I went with a hardcoded 50ms time chunk constant and used every bit in each byte as a status flag. Example: 00111100 would tell the logic loop that the first two 50ms steps are ‘OFF’, the next 4 steps are ‘ON’ and the last 2 are ‘OFF’. This allows me to compress 8 steps into one byte… an initial 8x memory efficiency increase.

The trade off to this is that counters like ‘CurrentStep’ are now moved out of the flashing sequence. Which, when you think about it, the notion of which step a sequence is on is not necessarily an attribute of the sequence itself, but rather a bookkeeping value by the logic loop. This increases memory usage however, stealing the thunder of my previous 8x decrease in memory use.

The overall effect is still a large reduction in memory use. Rev 3 ups the number of LEDs controlled from 8 to 11 (3 red, 3 blue, 2 yellow, 1 white takedown light, and 2 headlights.) as well as increasing the flashing sequences from 3 to 10 (Technically 15). The LEDs are also now grouped into 3 groups which allows for changing of the flash sequence on one group without interrupting the sequence of the other groups. Rev 2 had a ‘jitter’ problem when the sequences changed. Barely noticable, I think, but the power of my OCD compelled me to fix it.

The final feature enhancement is the concept of ‘Modes’. Currently, there are only two modes installed: Demo and Random. Demo will iterate through each sequence, spending about 8 seconds on each sequence. Random will pick a sequence at random and spend 2-6 seconds on that sequence. (Note: There is some room for improvement on the random chooser)

Anyways, code and how-to are posted below, so for now here’s a video of what Rev 3 can do:

Read More


Police Lightbar Sim For Launchpad – Rev 2

Spend some time reworking the core code as well as the storage format for the flashing sequence. Turns out that I was spoiled working with the Arduino boards, which has significantly more memory. I am endeavoring to put multiple flashing sequences into one code binary and switch them with a pushbutton attached to a DI pin on the Launchpad. Installed an old copy of Adobe Premiere and started playing with that as well. Here’s the results:


Read More


Free Samples from TI

The Free samples from TI arrived today. One ULN2803 8 channel Darlington Driver, and two variants of the MSP430G2 chips.

Free stuff is cool 🙂


Police Lightbar Sim For Launchpad – Rev 1

Ported the previously posted Police Light Sim to Launchpad this evening. Here’s the results:


Not bad, but it needs to better. I’ll look at the Whelen light bar flashing sequences again.

–Insert code here–

One problem I ran into was ram. The sequencing array was on the edge if using up all the ram. A more efficient storage is needed!