View on GitHub

Longboard-light-painting-speedometer

ELEC 327 Final Project

Download this project as a .zip file Download this project as a tar.gz file

LONGBOARD-LIGHT-PAINTING-SPEEDOMETER

ELEC 327 Final Project

Group Members: Ethan Yuqiang Heng, Thomas Tingkai Liu, Bill Yiqiu Wang

Concept

Given the high popularity of skateboards amongst college students, we came up with the idea of creating a speed measuring device for skateboard which also displays the speed in a creative way - light painting. An LED strip will be taped to the back of the skateboard, leaving a light painting display of speed behind the board. Since light painting requires periodically changing pattern of the LED strip whose frequency is dependent on the speed of the skateboard, the two parts of this design project come together to form a final product.

Persistence of Vision

Persistence of vision is the theory that an afterimage persist one-sixteenth of a second on the retina, this causes the perception of motion and enables the technique of light painting in photography.

Hall Effect

For those of you who have taken ELEC 261, you are probably familiar with hall effect: the production of voltage difference across an electrical conductor, transverse to an electrical current in the conductor and a magnetic field perpendicular to the current. Hence hall effect sensors varies output voltage in response to a magnetic field, they are often used for proximity switching and speed detection of vehicles.

Code Structure

Code Structure We designed our code structure such that we first configure the device, after which we enter low power mode. We exit low power mode by entering port interrupt, where we record the number of wheel turns. Afterwards we enter watchdog timer interrupt, which keeps a counter to keep track of the time. When a preset amount of time as passed and the counter in wdt hits a number, we reset the counter, calculate the average speed during this period of time and then enable timer interrupt,disabling other interrupts at the same time and adjust CCR0 according to the speed and display the pattern.

System Setup

System Setup We designed our system as follow: we secure the PCB holding both the MSP430 and batteries to the back of the longboard, the hall sensor is placed on the truck of the board, a high-strength magnet is placed on the inner side of the wheel. As the wheel turns, the hall effect sensor would be able to vary its output due to the varying magnetic field caused by the changing distance between the magnet and the sensor. The LED strip is placed on top of the board for light painting.

ADC vs Port Interrupt

In the debugging process we realized that we have two ways to detect wheel turn from the hall sensor. We started by using internal ADC of MSP430, which continuously polls data in a while loop and compare the current reading to a previous one. Since hall sensor outputs high in absence of a magnetic field and low when magnetic field is strong, if previous reading is high and current is low, the magnet has approached the sensor and a wheel turn is recorded. We also tried using port interrupt, we set it up such that it only triggers on a high-to-low edge, which signals the magnet approaching the sensor. At each trigger of interrupt we record a wheel turn. Since we can enter low power mode when there's no trigger, this method is more power efficient than using ADC. It's also more accurate since it promises to capture every high-to- low edge, where as the accuracy ADC high depends on the sampling rate. We chose Port interrupt eventually. >Luckily since the sensitivity of hall sensor we used isn't very high but we did use a high- strength magnet, the sensor reading has little noise and the output jumps from high to low instantaneously without any in-between values.

Light Painting Display

As for light painting using the LED strip, the LED displays speed as pixelated numbers of 12x8 arrays, which means that each number is displayed as 8 columns, requiring LED strip to be programmed 8 times to display each number.

Some Cool Results

Pattern with RICE ELEC 327 Pattern with numerical sequence Displaying speed

Longboard Light Painting Speedometer Demo

Longboard Light Painting Speedometer Demo

Longboard Light Painting Speedometer Presentation

Longboard Light Painting Speedometer Presentation