Accelerometer use? - Page 1
Forum section: electronics / general

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 13, 2013, 07:50:20 pm
content: Hello today i recieved one MMA7361 Accelerometer unit.First i would like to knowHow you can read an accelerometer ... for example the output in the z axis is 800 what that 800 means.Also what is a gyroscope.... i could not find a video that was only about the gyroscopeAnd third how can i hook it up to my arduino ... i read the datasheet but i keep wiring it wrong and getting some values that wont change.Also there are no videos showing how to wire it ...To sum up ... i got an accelerometer that i dont know how to read it or use it .. and i dont know some practical uses for it ...Thank you and i am sorry for some of my questions but i could not get answers to them

author: FrankBuss
author_rank: Unknown
timestamp: May 13, 2013, 08:01:58 pm
content: A quick Google search shows this page:http://arduino.alhin.de/index.php?n=21The same Google search gives you this datasheet link:http://www.freescale.com/files/sensors/doc/data_sheet/MMA7361L.pdfOn page 3 it says typical 800 mV/g. I guess the value you are measuring is mV, and if you are not living on the moon, it should show 1 g.But I can't answer, why you get it, if you don't have practical use for it. Maybe try again Google, with something like "accelerometer projects", and pick one of the 2 million results which you like.

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 13, 2013, 08:07:24 pm
content: Quote from: FrankBuss on May 13, 2013, 08:01:58 pmThanks the datasheet is fine i checked that too but with this wiring the sensor did not work....Anyway the other site saved my life i can tell!!! ill try this method of wiring it and see what comes up its in German but its ok ich spreche English und Deutch(i am not so fluent but still)

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 13, 2013, 08:13:27 pm
content: I dont know.... the wiring looks fine but i still get some fixed values (x: 519 y: 519 z: 583)I dont know ill try changing exampleThe example i have uploadedCode:#include <AcceleroMMA7361.h>AcceleroMMA7361 accelero;int x;int y;int z;void setup(){Serial.begin(9600);accelero.begin(13, 12, 11, 10, A0, A1, A2);accelero.setARefVoltage(3.3); //sets the AREF voltage to 3.3Vaccelero.setSensitivity(LOW); //sets the sensitivity to +/-6Gaccelero.calibrate();}void loop(){x = accelero.getXRaw();y = accelero.getYRaw();z = accelero.getZRaw();Serial.print("\nx: ");Serial.print(x);Serial.print("\ty: ");Serial.print(y);Serial.print("\tz: ");Serial.print(z);delay(500); //(make it readable)}Maybe my accelerometer is broken....

author: PA0PBZ
author_rank: Super Contributor
timestamp: May 13, 2013, 08:35:58 pm
content: Quote from: ChrisGreece52 on May 13, 2013, 08:13:27 pmYou realise that nothing will change if you leave it sitting on the table?

author: FrankBuss
author_rank: Unknown
timestamp: May 13, 2013, 08:40:47 pm
content: The values look wrong, at least for x/y it should be different from z, if lying parallel to Earth (x=0g, y=0g, z=1g).Did you use some sort of breakout board, like on the webpage? You should check all connections with a multimeter, if all pins have the right voltage when powered, e.g. VDD=Sleep=3.3V etc. X/Y/Z-out voltage should change, if you turn it. Measure it with disconnected X/Y/Z cables to your Arduino, maybe you've connected the wrong pins on your Arduino side. Then you could connect just the X/Y/Z pins of the Arduino side to 3.3V and then to 0V and see if the console output changes, to check this.I hope you didn't use 5V for the digital control pins for sleep, g-select etc.? I don't know if you can change this for the Arduino, because if it was 5V, your accelerometer might be broken now.

author: Rerouter
author_rank: Super Contributor
timestamp: May 13, 2013, 08:51:23 pm
content: if you drive a car, set it up to log or display the forces applied in the vehicle, there are actually commercial products like this used to help train early drivers, mainly with braking and turns,

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 14, 2013, 06:52:38 am
content: Quote from: PA0PBZ on May 13, 2013, 08:35:58 pmBut of course i dont leave it on the tablei hooked up the accelerometer with female to male cables to the arduino so i can swing it freely!!!

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 14, 2013, 06:59:04 am
content: Quote from: FrankBuss on May 13, 2013, 08:40:47 pmNo i thought that i broke it too but when i checked the wiring it ws properly hooked up :SAnd i checked the connections again :ST --12GS--10GND-GND3.3--3.35--5X-A0Y-A1Z-A2SL-13OG-11

author: Skimask
author_rank: Super Contributor
timestamp: May 14, 2013, 07:09:57 am
content: And which variety of Arduino are you using?Disregard...It'll never work...

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 14, 2013, 07:19:58 am
content: Quote from: Skimask on May 14, 2013, 07:09:57 amI am using Funduino (a copy of arduino that served my well for months now) and the Chip it uses i an Atmel ATMEGA 2560 16AU 2245And i have 2 of these but the accelerometer was use with only one of them

author: Skimask
author_rank: Super Contributor
timestamp: May 14, 2013, 07:21:01 am
content: So, you're using an Arduino that normally runs at 5v logic outputs, with a chip that requires no more than 3.3v at it's logic inputs?How does that work?

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: May 14, 2013, 07:28:19 am
content: Quote from: Skimask on May 14, 2013, 07:21:01 amI did not quite get that ... sorry... but my setup is an Funduino Mega 2560 (Same product as arduino Mega) And an accelerometer (MMA7361) hooked up to it and it does not work. ...

author: FrankBuss
author_rank: Unknown
timestamp: May 14, 2013, 12:52:41 pm
content: There are different Arduino types. The German wikipedia page has a nice table:http://de.wikipedia.org/wiki/Arduino-PlattformThe important aspect is the operating voltage (Betriebsspannung). If it is 5V, and if you have just a breakout board for your accelerometer without voltage level shifter ICs on it, then this might be the reason that it doesn't work. Because when the operating voltage of the Arduino is 5V, then the voltage at the IO pins are 5V, too (see the schematic of the standard Arduino,http://arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf: VCC of the Atmega8 is 5V, and then the datasheet of the Atmega 8:http://www.atmel.com/Images/Atmel-2486-8-bit-AVR-microcontroller-ATmega8_L_datasheet.pdfpage 235: output high voltage at VCC 5V for 20mA is min 4.2V, so if you draw less than 20mA, the output voltage can be nearly 5V). Unfortunately the datasheet for the accelerometer is not very detailed (or I didn't find it), but you can assume, that it is not allowed to apply higher voltages than the operating voltage VDD at the logic input pins. Maybe there a MMA7361 version of the chip, without the "L" suffix for 5V? You might be lucky, because the digital pins of the Arduino might not deliver enough current to destroy the accelerometer, but it might not work while overvoltage is applied.So next step would be as explained before: test the accelerometer without the Arduino connected and a multimeter, then test the Arduino pins without the accelerometer connected. If both works, the higher voltage on the control pins might be the reason that it doesn't work. You can use a resistor divider to reduce the voltage from 5V to 3.3V (Arduino out -> 3.9k -> 2.2k -> GND, use the junction at 3.9k/2.2k to connect to the accelerometer).Sorry if it sounds a bit tedious to read all the documentation, to think about it and to do all the measurements and tests, but there is no free lunch, if you want to build something yourself