Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: bootstrap on February 14, 2008, 09:14:43 AM
-
Hello.I am new to using sensors .I have not used a sensor till now.I have bought an accelerometer to measure angles and send them back to the PC via the serial port.
Before doing that please guide me about how to interface a sensor to a micro controller (atmega8) and how to read the values.As I know a sensor generates an analog voltage signal which is to be taken up by a pin on the microcontroller.Thats it..i dont know which pin and mathematically analysing the values generated..Please help
-
http://www.societyofrobots.com/robotforum/index.php?topic=602.0
-
to read an analog voltage with a microcontroller you'll have to connect it to the internal ADC, read the datasheet.
-
equations here:
http://www.societyofrobots.com/sensors_accelerometer.shtml
-
The accelerometer is MMA7261.Can I use it to measure angle (tilt )and implement as john palmisano did to move the servo along with the tilt of the acclerometer?
-
of course, it just depends how (which axis) you mount it on.
For example, you will measure tilt (front to rear) if you align the sensor parallel to the body frame (long ways - front to back).
you'll measure tilt (or side tilt) if you place it perpendicular.
-
equations here:
http://www.societyofrobots.com/sensors_accelerometer.shtml
I know about the hardware setup.But program part I am having probs.I need help reagrding the C code about using an accelerometer..
-
I need help reagrding the C code about using an accelerometer..
just show us what you currently have and tell us where exactly you are stuck
-
I need help reagrding the C code about using an accelerometer..
just show us what you currently have and tell us where exactly you are stuck
I had a problem with interfacing the accelerometer and programming the micro controller to read the accelerometer values.Right now I am able to get 10 bit adc values to be read.Now I have to hook up the accelerometer.As the accelerometer operates on 3.3 volts I also need to make up a resistive volatage divider.Do i need to keep a resistive voltage divider to each and every pin of the accelerometer? (I have the microcontroller running at 5v.)
Also do I need to keep as resistive voltage divider between "ADC pin" of the Microcontroller and the "X out" of the accelerometer?
Also what is the ideal capacitor (value ) to be used?And what is the capacitor that you used in your accelerometer ?
-
You should only need 1 voltage divider for the vcc of the accelerometer.
The mcu running at 5 volts can still read in the 3.3v x output on an analogue pin, but it obviously wont be a very good resolution. You might want to consider using an opamp to boost the output of the accelerometer or maybe try to change the analog/digital reference to 3.3v .
If you are using a 10-bit a/d conversion then i would personally just try it because you might get a resolution that you can use - ive got a 3.3v 3axis accelerometer that i use on a 5v mcu with 10bit sampling it works good enough for me. all it means is that the highest output would register 675.83 instead of 1024
-
So paul if i use an op-amp then will all the voltages above 3.3 will be boosted to 5 v?or will the op-amp add some fixed amount of voltage to each and every output voltage.What I want is 0 - 3.3 v should be scaled to 0 - 5 v.How shall I do this?
-
You will need an op-amp:
http://www.societyofrobots.com/schematics_voltamp.shtml