CPAN Modules

MeI've uploaded a few simple Perl modules to CPAN (the Comprehensive Perl Archive Network) that you can download in use in your own Perl projects.

Polycom::App::Push - Module for pushing messages to Polycom VoIP phones
Polycom::Contact::Directory - Parser from Polycom VoIP phone contact directory files
Polycom::Config::File - Parser for Polycom VoIP phone configuration files
Crypt::Rot47 - Encryption via the ROT47 substitution cipher
Data::Formatter::Text - Formats data structures using plain text

Open-Source Contributions

I try to contribute to open-source projects when I can. Specifically, I've contributed quite a bit to Cppcheck - A tool for static C/C++ code analysis.

Ohloh profile for zblair

HD4478-compatible LCD Driver For Atmel AVR ATTiny2313


Download LCD driver source

Using an Atmel ATTiny2313 microcontroller and an HD44780-compatible character LCD display, along with a reed switch and some magnets, I was able to construct a tiny speedometer/trip computer for a soapbox derby cart.

It's primary function was to measure the top speed of the cart, total distance travelled, and total race time.

It measured the speed of the cart using a permanent magnet attached to the rear wheel's rim, and a stationary reed switch attached to the soapbox derby cart. Every time the wheel revolved, the magnet would pass by the reed switch, thereby momentarily opening it. The microcontroller calculated the speed of the cart simply by dividing the circumference of the rear wheel by the period of the wheel's revolution.

PIC Microcontroller-based Timer

spacer.gifDownload source code.

This project was motivated by a problem I heard about from a friend. At the Burger King where he works, employees should take no longer than three minutes to build a burger; however, at his Burger King, no way to measure your burger-building time was supplied.

Initially, I suggested buying a watch or an egg-timer from the local dollar-store, but I was soon reminded of why that was not a great solution: it was too easy and rather boring.

And so began the design and construction of the Big Beepin' Egg Timer.

The timer had to do one very simple thing: it had to count down from 3.00 minutes to 0.00 minutes and then beep. Consequently, I designed it to be very easy to operate. It had just one button - a very large, red one - that the user would press to turn on the device and start counting down from 3 minutes. Pressing the button while the count was already in progress would simply reset the count to 3 minutes. When 3 minutes elapsed, the device beeps for 1 second, and then switches to a low-power mode.

I used a 32.768 kHz crystal and a PIC16F84A microcontroller as the heart of the device, taking advantage of the PIC's low-power "sleep" mode so that one-button operation would be possible. There is no need for an "off" switch, because once it's done timing, it just goes to "sleep", where it consumes very little energy until it is awakened by someone pressing its big red start button.

Atmel AVR Microcontroller-based Robotic Turret


The robotic turret was a project I devised to experiment with five technologies I was interested in: 

Essentially, I wanted to be able to control a little robotic arm / turret using a PC with a serial port. I thought this was a worthwhile project because I could later adapt it to aim a webcam, Nerf toy gun, or maybe even a felt pen so it could draw pictures.

One stepper motor rotated the base of the turret, while the other adjusted the turret's pitch. I designed a stepper motor controller IC using CUPL (Univeral Compiler for Programmable Logic) and a GAL16V8 chip. This enabled an Atmel Attiny2313 MCU to control the two stepper motors using only three of its pins (one each for step, motor, and dir signals).

The Attiny2313 served as the "hub" that connected all the other components together by receiving commands from the PC via a MAX232N IC, performing basic calculations regarding the turret's position and velocity, and then sending signals to the GAL16V8-based stepper-motor controller to drive the two stepper motors. In order to supply the voltages and currents necessary to drive each stepper motor, I used a Toshiba ULN2803A Darlington transistor array.
By clicking on the image to the right, you can view a video of the turret working. I wrote a program for my PC that would send the appropriate commands to the turret for it to follow a target on my computer screen. The result is quite entertaining.

Picture of the robotic turret

By clicking on the image below you can view a schematic I quickly put together of the circuit. It likely contains errors, but should at least provide a general idea of how the circuit is constructed.

Click to see a schematic of the turrret circuit.

Atmel AVR Microcontroller-based Anti-lock Brakes For a Bicycle

spacer.gifThis project was an ambitious project for my Engineering Science Capstone project (ENSC 440). The idea was to design an anti-lock braking system for a bicycle.

In our small group of students, we divided up our work into various parts. One student focused  mainly on the hydraulic actuators for the bicycle's brakes; another student focussed mainly on the speed sensors for the bicycle's wheels that would indicate a lock-up.

Electronic Control Unit

I focussed on designing, building, and programming the electronic control unit (ECU) that would process the signals from the speed sensors and actuate the brakes to avoid a skid.

LCD Display

We used an HD44780-based character-LCD. Our LCD has 20 columns and 2 rows. We used a shift register to interface with the LCD to save pins on our microcontroller.

With three buttons mounted below the screen, we were able to implement a fairly complex menu system that allowed users to view different trip statistics and configure ECU parameters. We were even able to use the Atmel microcontroller's PWM (pulse width modulation) peripheral to programmatically control the LCD display's backlight.

Speed sensor
Magnets attached to wheel and a stationary pickup coil on the frame For the speed sensor, we placed small permanent magnets on the rim of the wheel and placed a pickup coil on the frame of the bicycle. As the wheel turned, the pickup magnets would pass by the stationary pickup coil, thereby inducing a voltage in the coil that we could detect. Knowing how many magnets we placed on the rim, along with the circumference of the wheel, we were able to estimate the speed of the bicycle by measuring the time between consecutive passes of the magnets by the pickup coil

The result is a signal with positive and negative peaks as the magnet flies by the coil. To measure the speed of the bicycle using this method, we used a Schmitt trigger to convert our somewhat noisy analog signal from the coil into a clean signal with 5 V pulses whenever a magnet goes by.

Speed sensor output on an oscilloscope To the left is an oscilloscope screenshot showing the output of the pickup coil as the bicycle wheel was spinning. The peaks and valleys mark when a magnet passed by the pickup coil

View of the bicycle with hydraulics To actuate the rear brakes of the bicycle, we attached a fuel pump and valve to the bicycle's existing hydraulic brake system. By turning on the pump or adjusting the valve, we were able to release the brake calipers while at the same time forcing the brake lever on the handlebars up. Both the pump and the valve were controlled by the ECU to release the brakes momentarily whenever the speed sensor detected the rear wheel had locked up.