Sunday, May 19, 2013

[Weekend Hack] Arduino + ADXL3xx Accelerometer

Do you remember I once told you I have an arduino uno board? I don't have enough accessories; a LED, a push button, 10 jumper wires, a  breadboard and an ADXL3xx accelerometer chip. Last weekend, I tried out the LED and the push button. 
This weekend, I set out to explore how best I can use my accelerometer chip. Though I could not understand most of the resources found, I resorted to this tutorial on the arduino site.  I wired up the chip and LED nicely to the breadboard and powered it with  5V. All I knew was, I will be receiving values from 0 to 1023 (0 at 0V and 1023 at 5V). I set my LED up to blink when the value of the x-axis exceeds 512.

board setup

I turned the board around, placed my phone underneath and introduced vibration to it. Luckily for me, it worked, seeing different values pop up. See my codes below:

Review and send in your comments.

No comments:

Post a Comment