Instructables

Arduino and Accelerometer ADXL335 help

So I'm a complete amateur when it comes to electronics so you'll have to bare with me.

What I am looking to do is create a brake light for my bicycle that's a little bit different and can help me learn some bits about arduinos and electronics for future projects. I am looking to make it so that the light lights up in a similar way to that of how they show the brake force on an F1 car with more LEDs lighting as you decelerate faster.

I have an arduino UNO and an ADXL335 accelerometer on a breakout board. I just mainly need help writing the code or even just the basics if someone was willing to help out it would be greatly appreciated.

Thanks for your time and any help you can give in advance

Regards,
CraigLewis


I believe the ADXL335 measures on a scale of how much force is being exerted so would be fine. I am planning to build a bike brake project with the same accelerometer and a micro arduino driving a LED matrix (HT1632C) so I can draw some funky messages when I am braking and taking off... Also going to add some turn signals using some switches located near the handlebar. Driving the LED and reading the accelerometer is relatively simple. The hardest part is packaging it all up and mounting it to the bike.
Have you started on your project already, would be good to know if you made any progress or not.
gmoon1 year ago
It's not an Arduino and the accelerometer is slightly different, but here's an AVR and ADXL330 wireless controller project,which is pretty close (yeah, it's something I made six years ago when I was into microcontrollers). The C code might be helpful. The Google Video link is dead (google killed Google Video), but it's here if that's important...

Conceptually, it's an analog accelerometer, so just read the outputs with the ADC pins/channels on the arduino. I'm guessing you won't even need three dimensions of data...
Where have you seen this effect? Is it from a video game or an actual F1 racer? If the F1 has a neat feature like that it is probably detecting how hard the break is being applied rather that detecting deceleration.

It would be much easier to understand and program this kind of a setup with a force sensor rather than an accelerometer. The force sensor is basically a variable resistor that changes it's resistance with the amount of pressure applied to it. So the Arduino would read the resistance on one of the analog pins and light up the right number of LEDs based on the resistance value.

Here is a little tutorial about using them with an Arduino.
http://itp.nyu.edu/physcomp/sensors/Reports/ForceSensorResistor