by Mark Diehr, Matt Mitchell, and David Wrigley
EECS373, Fall 2004

Brief Description of Project

The self-righting fulcrum arm is a balance beam that is held at level using an infrared distance sensor and a DC motor that is pulse width modulated to create various fan speeds to balance the beam. An LCD is implemented display the pulse width being used to create the current fan speed in real time. There is a serial console based interface for the user to stop and start the auto updating function as well as arbitrarily define the duty cycle of the motor both during the auto updating and when the auto-update function is halted.

Hardware Components of Project

Software Components of Project

The software interface uses a combination of assembly and C functions, with assembly for the low-level programming of timers and interrupts, and C for higher-level functions to control the console and motor speed adjustments.

Global variables are used to hold the motor speed and center value for the lever arm. Input from the IR rangefinder is linearly scaled using a lookup table, and then compared to the center value to determine how the motor speed should change.

Two timer interrupts are used to control the software flow. One is dedicated to the pulse-width modulation of the motor, the second timer is used to run an update cycle, which reads from the IR rangefinder, calculates changes in motor speed, and writes to the LCD display.

The console interface has 5 commands.

Problems Encountered

There were several difficulties with the pulse-width modulation, range finding, console, and LCD in this project. Initially when driving the motor we used a MOSFET transistor, which did not work correctly. We switched to an electro-mechanical relay, which solved that problem. Additionally, we found that our method of pulsing the voltage on the motor called too many interrupts, which caused massive delays in console response time, and eventual locking. By changing the code we culled 98% of the interrupts, allowing the console to function.

For the lever arm we originally used a potentiometer with a hanging weight to determine the angle the arm was at. Due to the "stickiness" of the potentiometer it was impossible to get accurate readings, so we used the IR rangefinder instead. The non-linearity of the rangefinder posed a problem at first, but that was solved with a lookup table to translate it to linear values.

The console was a major stepping-stone due to software emulation errors that occured when driving the console with input too rapidly. This was never fully solved, but when we improved the efficiency of the timers running the motor we kept the errors fro happening except in more reckless cases.

The LCD had many problems with timing and initializing. Even when manually writing to the LCD, we found that it would not initialize properly many times, requiring a power reset. Empty for loops were used to delay output to the LCD so that it would write properly.

Media

Right-click and choose "save as..." to download each video.

Click on an image for a larger version.

Circuit Layout LCD Display Motor Mount Console

Fulcrum Arm Fulcrum Arm Fulcrum Arm

Links

Initialization data for LCD
Timing data for LCD

Infrared sensor data sheet

Last edited on Friday, Dec. 17th, 2004 at 11:17PM