Arduino and the MMA7361L

Discussion in 'Electronics Resources' started by krow, Jul 13, 2011.

  1. krow

    Thread Starter Member

    May 25, 2010
    49
    0
    Hey guys,

    I wanted to pretend to be the 'macho' in electronics and I told my teacher to give me one of his projects that involves the accelerometer MMA7361L and the Arduino but now I'm in trouble as I don't know how to connected it.

    I have the schematic diagram of the MMA7361L and it basically tells you what to do (I haven't included the capacitors on the X, Y, Z outputs because I don't have those now but I don't think it shouldt affect the output values drastically?).

    The problem is, I wire it up, I write a basic code and then I get some values ranging from 300 to 100 without even moving the circuit.

    I found the very same problem on a different forum but in the end nobody said what the problem was, I actually cheated and copied and paste the code.

    int XPin = 1; // X
    int YPin = 2; // Y
    int ZPin = 3; // Z
    int valX = 0;
    int valY = 0;
    int valZ = 0;
    void setup() {
    Serial.begin(9600);
    }
    void loop() {
    valX = analogRead(XPin);
    valY = analogRead(YPin);
    valZ = analogRead(ZPin);
    Serial.print("X-");
    Serial.print(valX);
    Serial.print(" Y-");
    Serial.print(valY);
    Serial.print(" Z-");
    Serial.print(valZ);
    Serial.print("\n");
    delay(100);
    }

    Like I said, there's no connection of capacitors on the outputs but there is one capacitor across the power pins.

    Can I anybody help me find what the problem is? attached is the datasheet of the MMA7361L, thanks a million!
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Your code indicates that you are expecting the accelerator signals are being read on the ANALOG pins 1,2, and 3.

    If you connected your accelerometer signals to the DIGITAL pins 1,2, and 3, then you will get nothing but noise since the ANALOG pins you are reading are open circuit.

    hgmjr
     
  3. sanjaynekkanti

    New Member

    Sep 27, 2009
    1
    0
    krow!
    Were you able to fix the problem ?
     
Loading...