Sei sulla pagina 1di 7

http://tlb.org/scooter.

html

http://www.dimensionengineering.com/accelerometers.htm

and

http://www.engineersgarage.com/contribution/microcontroller-based-accelerometer-project

Purpose
The purpose of this project is to register the forward acceleration and tilt angle of a bike using the Cerebot 32MX4 PIC32MX460F512L microprocessor attached to a Digilent ADXL345 accelerometer. The project demonstrates my: ability to identify, formulate, and solve engineering problems; ability to communicate effectively; ability to use the techniques, skills, and modern engineering tools necessary for engineering practice; ability to design software and/or hardware to meet desired needs.

Requirements
1. The system shall record tilt inclination changes to 1 resolution according to the formula I[g]x =g * sin(). 2. The system shall record acceleration data in 12-bit resolution according to the formula I[g]y = cos(). 3. The system shall record time-series information on: timestamp, tilt, forward/backward acceleration (2 axes). 4. The system shall start recording when button 1 is pressed. 5. The system shall stop recording when button 2 is pressed. 6. The system shall signal recording operation with 1 flashing LED light. 7. The system shall signal a fault state with 4 flashing LED lights. 8. The system shall allow the downloading of all recorded time-series data. 9. The system shall allow for calibration. Need interrupts for lights, buttons, accelerometer, timer, UARTs with DMA. The program uses various interrupt (ISR) routines to manage hardware input, output, and timers. Program Files

File main.c Data Files File

Description Main program file.

Description

Custom Parameters Parameter Description MOTOR_SPEED Can be set to Slow, Medium, or Fast Motor Control (MtrCtrl) Public Interface Function Description MtrCtrlFwd() impulse both motors forward. Main Public Interface Function void DeviceInit(void) Event Interface ISR Timer5Handler()

Description Initializes on chip peripheral devices to the default state.

Description Interrupt service routine for Timer 5 interrupt. Timer 5 is used to perform software debouncing of the on-board buttons. It is also used as a time base for updating the onboard LEDs and the Pmod8LD LEDs at a regular interval.

Function Call Graph Specify the function call graph of the Navigation program.

FlowCharts

Accelerometer Process Flow 9/7/2011

ADXL345

Record data

Data Storage Buffer Data Record Storage

Cerebot button press

mp sta ime t
Start/ Stop

Cerebot MCU

Configuration / Execution Instructions


Software Development Environment Hardware Configuration Bit Settings Bit Physical Layout Plan Setup and Pre-Conditions Value Description

Results
Describe the coefficients-download results. Describe the robot navigation results.

Error Control
Describe any and all error conditions encountered and the efforts to reduce or mitigate them. This is a significant portion of your project report!

References
Document Name Digilent Robotic Starter Kit with Cerebot 32MX4 Reference Manual Revision 10/8/2009 Description Describes how to assemble the robot.

http://forum.sparkfun.com/viewtopic.php?f=7&t=20737 http://www.analog.com/en/mems-sensors/low-g-accelerometers/adxl345/products/technicaldocumentation/td_Accelerometer_Specifications_Definitions/resources/fca.html

Source Code Attachments


Highlight where your code is different from the source code template.

A beginners guide to accelerometers What is an accelerometer? An accelerometer is an electromechanical device that will measure acceleration forces. These forces may be static, like the constant force of gravity pulling at your feet, or they could be dynamic - caused by moving or vibrating the accelerometer. What are accelerometers useful for? By measuring the amount of static acceleration due to gravity, you can find out the angle the device is tilted at with respect to the earth. By sensing the amount of dynamic acceleration, you can analyze the way the device is moving. At first, measuring tilt and acceleration doesn't seem all that exciting. However, engineers have come up with many ways to make really useful products using them. An accelerometer can help your project understand its surroundings better. Is it driving uphill? Is it going to fall over when it takes another step? Is it flying horizontally or is it dive bombing your professor? A good programmer can write code to answer all of these questions using the data provided by an accelerometer. An accelerometer can help analyze problems in a car engine using vibration testing, or you could even use one to make a musical instrument. In the computing world, IBM and Apple have recently started using accelerometers in their laptops to protect hard drives from damage. If you accidentally drop the laptop, the accelerometer detects the sudden freefall, and switches the hard drive off so the heads don't crash on the platters. In a similar fashion, high g accelerometers are the industry standard way of detecting car crashes and deploying airbags at just the right time.

How do accelerometers work? There are many different ways to make an accelerometer! Some accelerometers use the piezoelectric effect - they contain microscopic crystal structures that get stressed by accelerative forces, which causes a voltage to be generated. Another way to do it is by sensing changes in capacitance. If you have two microstructures next to each other, they have a certain capacitance between them. If an accelerative force moves one of the structures, then the capacitance will change. Add some circuitry to convert from capacitance to voltage, and you will get an accelerometer. There are even more methods, including use of the piezoresistive effect, hot air bubbles, and light. What things should I consider when buying an accelerometer? Analog vs digital - First and foremost, you must choose between an accelerometer with analog outputs or digital outputs. This will be determined by the hardware that you are interfacing the accelerometer with. Analog style accelerometers output a continuous voltage that is proportional to acceleration. E.g. 2.5V for 0g, 2.6V for 0.5g, 2.7V for 1g. Digital accelerometers usually use pulse width modulation (PWM)

for their output. This means there will be a square wave of a certain frequency, and the amount of time the voltage is high will be proportional to the amount of acceleration. If you are using a BASIC Stamp, or any other microcontroller with purely digital inputs, you will most likely need to go for a digital output accelerometer. The disadvantage here is that it requires you to use the timing resources of the microcontroller to measure the duty cycle, as well as performing a computationally intensive division operation. If you are using a PIC/AVR/OOPIC/Javelin with analog inputs, or a completely analog based circuit, analog is almost always the best way to go. Depending on the compiler, measuring analog acceleration can be as simple as acceleration=read_adc(); and can be done in a few microseconds. Number of axis - For most projects, two is enough. However, if you want to attempt 3d positioning, you will need a 3 axis accelerometer, or two 2 axis ones mounted at right angles. Maximum swing - If you only care about measuring tilt using earth's gravity, a 1.5g accelerometer will be more than enough. If you are going to use the accelerometer to measure the motion of a car, plane or robot, 2g should give you enough headroom to work with. For a project that experiences very sudden starts or stops, you will need one that can handle 5g or more. Sensitivity - Generally speaking, the more sensitivity the better. This means that for a given change in acceleration, there will be a larger change in signal. Since larger signal changes are easier to measure, you will get more accurate readings. Bandwidth - This means the amount of times per second you can take a reliable acceleration reading. For slow moving tilt sensing applications, a bandwidth of 50Hz will probably suffice. If you intend to do vibration measurement, or control a fast moving machine, you will want a bandwidth of several hundred Hz. Impedance/buffering issues - This is by far the single most common source of problems in projects involving analog accelerometers, because so few people thoroughly read the required documentation. Both PIC and AVR datasheets specify that for A-D conversion to work properly, the connected device must have an output impedance under 10k. Unfortunately, Analog Devices' analog accelerometers have an output impedance of 32k. The solution to this is to use a low input offset rail to rail op amp as a buffer to lower the output impedance. As far as we know, the DE-ACCM is the only accelerometer solution that takes care of this problem for you. Where can I find more information on accelerometers? Texas instruments has a great accelerometer guide, including how to do some of the necessary math.

The DE-ACCM datasheet has several examples of how you can use accelerometer readings to determine tilt and acceleration values. The Parallax forum has information on how to use their PWM based accelerometer. If you really want to get into the hardcore low level details of accelerometers, and want to try soldering surface mount packages, Analog Devices has a huge selection of datasheets covering both analog and digital PWM style devices.

Potrebbero piacerti anche