CSE 466 Lab 3a - "Flip Flop"


The Goals: The Motivation:
  In order to finish our project (the balance), we will need a way to determine the angle of the beam. Specifically, we'll be interested in the tilt angle relative to the ground. An accelerometer provides an easy and non-intrusive means of obtaining this measurement.
  To get the balance level, it will be necessary to take readings from the accelerometer, and then move the motor to level the beam. This week, we're going to focus on simply moving the motor depending on data from the accelerometer. 
  Because the motor won't affect the position of the accelerometer, this is an example of an open-loop control system. In following week or two, we will close the loop and experiment with control algorithms..
Links of interest
  - Analog Devices' intro to accelerometers.
  - The hows and whys of MEMS (micro electro-mechanical systems) accelerometers: a la Stanford

The Assignment:
  Use the accelerometer as a speed controller for the motor. If the accelerometer is level, the motor should be stopped. Rotating 90° one direction should bring the motor up to its full speed, rotating 90° the other way should turn the motor at its full speed in the opposite direction.  

The Instructions:
  1. Play with an accelerometer. Accelerometer datasheet here, Documentation for evaluation board here. The boards should already have the Xfilt and Yfilt capacitors installed (.224µF), but you will need to find a value for Rset. Apply power and hook a 'scope up to the X-axis output. Your will be making decisions based on this waveform, so take time to get familiar with it. We'll only use the X-axis for our project, but feel free to play with both axes for a while. Just be sure to observe the maximum acceleration (1000g) of the device (read Don't Drop It!).
  2. Use the external GATE enabled counting option of the 8051 Timers to measure the duty cycle of the pulses coming from the accelerometer. We'll just be measuring the "on time", and assume that the frequency of the pulses is constant. Output the result of this measurement via some simple means (increasing number of lit LEDS, a decimal value on the 7 segment display, etc.)
  3. Translate the accelerometer measurement to control the motor speed. You might want to get some ideas form this spreadsheet. Think about how to implement the fixed point algorithm with NO multiply or divide operations using only integer data types.
The Deliverables: