Reverse Engineering 7 Segment Display

I recently came across an old five digit seven segment display and decided to see if I could give it a second live.  It appears to have been from a  weighing device of some kind, judging by the company name: Weigh Right Inc.

5 Digit 7 Segment Display

It’s a gorgeous piece of hand drawn circuitry with lovely smooth lines.  There are also very few jumpers on the board so clearly the designer had put in some effort into this single sided design.

Circuit of the 7 segment display

The display is essentially a serial to parallel converter, with 5 8bit 74C164 chips driving each digit.  Each 74C164 has the 8th bit connected to the following chip to create a single serial interface for the entire display.  To understand the design and how to interface to it I traced out the circuitry and drew up the schematic.  You can find it on the github page for this project.

After figuring out the binary codes for each segment and building a simple 5V to 12V logic translator with 2N3904 transistors, I wrote up a simple script for an Arduino that would light up all the segments, which was when I found the reason that it was in the scrap pile:

The display functioning, sort of…

Oh dear.

Rather than throw this away I figured I’d see if there was a way to fix it.  First step was to figure out if it was the 74C164’s.  They seemed really hot so I quickly figured out the current for each segment by turning one on at a time and watching the power draw on my bench supply.  18mA.  Which if you’ve read the data sheet for the 74C164 is a tad over the 8mA absolute maximum current of the device.  Since I didn’t have the original machine that this came from I can’t say for sure that the display wasn’t being flashed using PWM to reduce the drive current.  I can only hope that the original designer didn’t miss that.  I just reduced the drive voltage from 12V to 8V to get the current down to below 8mA per segment.

After further inspection that all the LEDs were okay on the dead segments I tested the voltage output from the 74C164: 7V, even higher than the lit segments.  A bit odd considering the LEDs themselves are fine.  Turns out whoever assembled the board decided to save power by putting the LEDs in backwards on a few of the segments!  An easy enough fix and now I have a fully functioning 5 digit 7 segment display!

All segments working now

You may notice one LED is brighter than the others.  One LED was actually dead and my replacement LED is much newer.  Not sure if that’s due to technological progress on LED efficacy or just wear (better on the former), but it’s quite a big difference!  There’s another dead LED but somehow it’s still conducting current so I might leave it in for now rather than having another strangely bright LED.  If I can scavenge a period correct LED (not something I thought I’d ever want) then I might drop it in.

Side note: 1970’s Solder smells weird.  Not sure if it’s the solder formulation, PCB materials, or flux residue.

Next step is just to figure out what to make with it!

Glider Performance

So I started wondering the other day just how each of our gliders at the club stack up against each other on OLC. Thankfully, the Online Contest website has a large amount of data available.  After grabbing a bunch of data and writing a python script to analyze it we have the following result:

The DG808/15m is the most successful aircraft for collecting Points.  This is not taking into account any bias on the pilot.  It could be that all 16 flights recorded were done by the best pilot on earth and are skewing the data (what a jerk!).  There is also the possibility of a bias based on how OLC rates the aircraft, since they have a “handicap” number for each aircraft.

What is interesting is that our oldest aircraft, the 1-26, rates at 230 on the chart, where other more advanced planes like the L-23 and L-33 are at 339 and 414 respectively.  Our best aircraft, the Cirrus, rates at 220, just barely above the 1-26.  So the handicap levels are working to level the playing field at least to some extent.

Something else that might be interesting is comparing the cost vs average number of points collected to see what is the most cost effective aircraft for collecting points.

The finished dataset can be downloaded here: aircraftStats

The python script used is below.

import csv
data = list()
canadaFiles = ['OLC_Daily Score_Canada_2016.csv',
                 'OLC_Daily Score_Canada_2015.csv',
                 'OLC_Daily Score_Canada_2014.csv',
                 'OLC_Daily Score_Canada_2013.csv']

worldFiles = ['OLC_Daily Score_Worldwide_2016.csv',
              'OLC_Daily Score_Worldwide_2015.csv',
              'OLC_Daily Score_Worldwide_2014.csv',
              'OLC_Daily Score_Worldwide_2013.csv',
              'OLC_Daily Score_Worldwide_2012.csv',
              'OLC_Daily Score_Worldwide_2011.csv',
              'OLC_Daily Score_Worldwide_2010.csv',
              'OLC_Daily Score_Worldwide_2009.csv',
              'OLC_Daily Score_Worldwide_2008.csv',
              'OLC_Daily Score_Worldwide_2007.csv']

for filename in worldFiles:
    with open(filename, 'rb') as file:
        csvreader = csv.reader(file)
        for line in csvreader:
            if line[0] is not '#':
print "Num Flights Examined: %d"%len(data)
# Sort by Aircraft type
aircraftSortedNames = list()
aircraftPoints = list()
aircraftDistance = list()
for row in data:
    if row[7] not in aircraftSortedNames:

# Aircraft stats formatted as [aircraft name, flightCount, Max Points, Min Points, Average Points per flight, max km, min km, ave km]
aircraftStats = list()
for index in range(len(aircraftSortedNames)):
    flightCount = len(aircraftPoints[index])
    maxPoints = max(aircraftPoints[index])
    minPoints = min(aircraftPoints[index])
    sumPoints = sum(aircraftPoints[index])
    avePoints = float(sumPoints)/float(flightCount)
    maxDist = max(aircraftDistance[index])
    minDist = min(aircraftDistance[index])
    sumDist = sum(aircraftDistance[index])
    aveDist = float(sumDist)/float(flightCount)
    # Remove anything with less than 3 flights, since it's not statistically significant (yes, even three is a stretch)
    if flightCount > 3:
        row = [aircraftSortedNames[index], flightCount, maxPoints, minPoints, avePoints, maxDist, minDist, aveDist]

print "Num Aircraft: %d"%len(aircraftStats)

sortedList = sorted(aircraftStats, key=lambda l:l[4], reverse=True)

# Create a csv result file
with open('aircraftStats.csv', 'wb') as outfile:
    csvwriter = csv.writer(outfile, delimiter=',')
    csvwriter.writerow(['Aircraft name', 'FlightCount', 'Max Points', 'Min Points', 'Average Points per flight',
                        'Max km Flown', 'Min km Flown', 'Average km Flown'])
    for row in sortedList:

Glowing Ball

A simple project that a friend asked me to make for her to fit into her show.  Basically she wanted a glowing ball that would mimic the breathing light that apple computers have.  Going from a dollar store glow ball to a breathing ball was relatively simple, taking an ATiny micro and a LED RGB chip with built in controller and slapping it all together on some perf board.

Here’s what you get for a couple dollars from the Dollar Store:

2014-07-08 19.06.15

What you probably can’t see is the extreme amount of corrosion on the wires or the fact that there is no insulation on anything.  If that LED were to drop down and short across that nut (yes, it is just a nut glued in there) there is a chance for a fire.  Personally, I will never buy anything cheap from china anymore, it’s just too scary what they will do over there.

After modifying the design and adding in my perf board hack we have:

2014-07-10 11.53.32

Not bad.  Coating everything real well with hot glue to ensure nothing can come loose and cause a short the final product is this:2014-07-08 19.06.24

The circuit and code is hosted here on github, feel free to do with it as you please.  One thing that needs to be changed is adding a 5V boost regulator to keep the voltage constant, as the RGB led chip turns more and more red as the voltage droops lower.  As red less generally have lower forward voltage drops, my assumption is that the other LEDs are getting less current and thus the red colouring.

Here’s a short video showing the end result:




Replacement License Plate Bulb for CBR250R

A simple project to replace the incandescent bulb that lights up the license plate on my CBR250R bike that keeps burning out. This light and the tail light appear to be more prone to failure, perhaps due to the more rigid connection to the bike than the other lights. I’ve also been wanting to try and replace lights with LEDs as there is a theory that they provide additional safety due to the fast on times.

The project is really simple, just a PCB that fits into a 168 bulb socket and powers three LEDs with a resistor in series. I want to try and see if i can even do a simple retrofit like this before I think about moving to properly driven electronics.  Just sent the boards off to get manufactured, will update once the boards get here.

Project is hosted on Git.


Ring Clock Control Board

Just got some of the boards back from OSH Park and they look great!

2014-06-24 22.42.00

Next step is to get the components and try them out.

In the meantime I found a bluetooth enabled Arduino platform, the Lightblue Bean. This begs the question, would it be better to set the time of the clock with buttons on the clock or with a bluetooth app?  I think the coolest solution would be to use capacitive sensors along the perimeter but the cost would be higher than I want with this project at the moment.  Thankfully, due to the modularity of the design, I can easily change the control board and upgrade the device whenever I’d like.

More info on the project soon.

DOCSIS 3.1 Transmitter

As part of a class in my master’s program in Electrical Engineering, we were asked to create an OFDM transmitter/channel/receiver in Matlab.  In our next class we also created the transmitter in Verilog HDL for an Altera Stratix FPGA.  This is a that project.

Since this was a very interesting project for me I thought I’d share my code, hopefully it will benefit someone.

The transmitter is a very simplified design, with an FFT size of 256, Cyclic Prefix of 96 and a Roll off of 32.  A random number generator creates a sequence of bits which are converted into QPSK symbols.  After running through a FFT, the cyclic prefix and roll off are appended and prepended to the sequence.  This was one of the most interesting parts as it required creating a secondary clock which ran at (256+96+32)/256 (or 1.5) times the original clock rate.  The FFT output, now stored in RAM, was accessed in such a way that the cyclic prefix and roll off were added to the original sequence.

I should note that this is in no way a finished project, but does demonstrate the a starting point for implementing the DOCSIS 3.1 standard.  One of the most difficult parts of implementing this project is keeping track of every single bit, especially when switching clock speeds.  Modelsim was very helpful in this.

Likely the most challenging part of this project was the very long compile times.  It is very much well worth your time to read the compiler documentation.  Anything that can increase your compile times is going to save you a huge amount of time.

The repository is located here.

Latex Resume

I decided I needed to update my resume and give it a more modern look and found that there is indeed a LaTeX package for doing resumes.  The only problem, the references are poor.  Thankfully there is a wonderful little bit of code available for making your references much, much nicer.  Thanks to user doncherry!

Attached is my finished resume, all nice and pretty (note that references and contact info have been removed)




EmbedXcode for Arduino Development

While starting development on a project I finally got fed up with the default Arduino IDE and decided to try something new.  Apparently others have reached the same conclusion, and a few of them decided to start some wonderful projects:

Arduino Eclipse Plugin

I wasn’t able to get this one working, but what I saw looked great.  Check it out at: Arduino Eclipse Plugin.


I ended up going with this system, in part becuase of the excellent support from user avenue33 on the arduino forums, and becuase my research group all uses macs and so support of Linux or Windows is not crucial.  I just thought I would share the problems I had and the solutions.  You can get embedXcode from here: embedXcode.

I have two computers, a Mac Pro and a Macbook Pro, runing 10.7 and 10.9 respectively.  With 10.9, xcode 5 and arduino 1.5.5 you may find that you get a large number of errors when compiling the test project.  These errors are apparently due to the Arduino 1.5.5 IDE deciding to compile all libraries.  To change this edit the makefile with:


This will stop it from compiling everything.  EDIT: You want to not set APP_LIBS_LIST = 0, otherwise it will not compile the default libraries, or so it seems.  If you are getting “not declared” errors this could be the reason.  Edit2: Instead of setting USER_LIBS_LIST = 0, add the offending libraries to the exclude list or delete them.  The exclude list can be found below the above two items.

My other problem, which admitedly was simply because I didn’t read the instructions, was that I didn’t run the Arduino IDE before attempting to compile.

Hope that helps someone!

Aircraft Light Controller Part 1


As you may or may not know, aircraft flying at night are required to have navigational lights, configured as such.  After flying my Hobby Zone Super Cub at dusk and comparing that experience with flying my ParkZone Night Vapour at night, it became clear that having lights on the aircraft would greatly increase usability.

That’s how this project was born, an aircraft light controller.  Or really, a pulsing circuit.

There are many ways to do this, the first two that come to mind are using a micro, or using a  555 chip.  A micro requires a regulated supply, but can do some more interesting things, like changing the frequency based on battery voltage (notice the feature creep starting already).  A 555 on the other hand requires no regulation and is very robust.  Having a strange affinity for 555 chips that many share, I decided to go with that.

Here’s the circuit:

This works by charging the capacitor through the 10k resistor.  When it reaches a threshold level, the 555 output goes low.  The 100k resistor then is the discharge path.  When the capacitor discharges to the threshold point, the output goes high and charges the capacitor.  This creates a pulsing waveform, with frequency around 1-2Hz (I didn’t measure it) and very nice short pulse widths.

The 555 then controls a 2N3905 NPN transistor that drives the LEDs.  Since the entire battery voltage is available, we can have more than a single LED in series, with a simple resistor to control current.

In my design I also added a place to have an “always on” LED so I could add landing lights.  Not because they would be helpful, but just because they would look cool.

PCB Manufacturing

Here’s a couple pictures of the finished PCB:

IMG_7988 IMG_7990

The PCB was designed using Eagle and etched using the “PCB Fab-in-a-Box” kit, which works great if you have the time and inclination to etch your own board.  I used Feric Acid to etch away the copper.  Needless to say, if you’re planning on etching your own boards, use proper safety gear!  Goggles, gloves, chemical apron, the works!


The finished design can be found here.  You will likely need to modify resistor values to fit your needs, different supply voltages can affect the frequency, different chips can have different voltage limits, etc.  I was also very lazy with the resistors, I have to choose correct ones based on the LED forward voltage and the current I want going through them.  That will come.

Eagle Files: Aircraft_lights