Tuesday, October 20, 2009

Setting-up an Accelerometer - Help Needed

Last week I purchased an accelerometer for my Arduino – an ADXL335 with a breakout board from Adafruit. I have wanted to play around with an accelerometer since I became addicted to the Wii (an addiction that I have now overcome). So I couldn’t wait to get started.

That said, my excitement was tamed by the multiple obstacles that I encountered – I’ll get to those shortly. I’ve already hooked up my accelerometer in multiple different configurations with minimal impact on the output – all of the figures always seem to move in tandem. Also sometimes when I move the unit the readings barely change until they suddenly make a big jump. I have no clue whether my readings indicate that my unit is working properly, or if it is defective.

The graphed figures that follow were recorded when I hooked up the accelerometer using the set-up labeled "set-up A" in the video below. I used a tutorial from the Arduino website as a guide and code source for this set-up. I did not know that you could us a standard pins as power input or ground. The code also is much more complex than the simple read/write to serial sketch I developed to use with my previous set-ups.
  • I used analog input pins on the Arduino for power output (I assume 5v) and ground. Pins 0 and 4 we assigned to low and high respectively for ground and V.
  • The output for each of the sensor’s axis was connected to analog input pins 1, 2 and 3.



Here is an overview of the other circuits that I created using the accelerometer (set-up B). This next one, also featured in the video above, is a simple circuit that is similar to set-up A, but uses a breadboard and standard power output and ground pins from the Arduino.
  • To power I used the 3v power output and ground from the Arduino.
  • The sensor’s outputs were connected to analog pins 0, 1, 2.



For the last set-up I fed back a 3v current to the HREF pin to see if this would increase the strength or resolution of the output (set-up C). Set-up Number Three. Unfortunately, I don’t have any pictures of this set-up.
  • For power I used the 3v power output and ground on the Arduino.
  • The sensor’s outputs were connected to analog pins 0, 1, 2.
  • To set the reference current 3v was fed back into the Arduino AREF pin. Used a 5K Ohm resistor to connect to AREF pin.
I did not solder the pins to the breakout board because I was doing this work at home and I did not have a soldering iron – also, if the accelerometer is broken I won’t be able to return it if it has been soldered.

I have read the data sheet and many tutorials and discussion board posts regarding this subject. Please share with me any recommendations regarding where I may be able to find other helpful resources.

If I understand the data sheet correctly (as I’m still new at deciphering these coded documents), the variable resistor on each axis can only alternate the voltage by +-15%. This makes sense since all three of them share the same voltage. Another concern that I learned from the discussion boards is that these sensors tend to generate a decent amount of noise.

What these learnings seem to imply on a practical level is that the output from the accelerometers may need to be amplified using capacitors. Another implication seems to be that by adding a short delay between each reading ensures that the chip has time to fully reset the voltage before providing the output from the next axis (thus reducing noise). Not sure if this is true.

That’s all for now. More news later this week after I meet with the resident at school to speak about my dillema.

No comments: