Digital Output affects Analog Input

Hey,

I got a problem with my Arduino Duemilanove getting input from the MMA7260Q accelerometer.

The accelerometer itself, without other things being connected to the Arduino, works perfect,
but when I set a high-output on two digital pins(in order to power a motor), the analog input from the accelerometer suddenly changes.

Does anybody know this kind of problem or its solution?

Greetings robin

Hi,
Are you using the output pins to control the motor directly?
If so, you should use a different power source for your motor and control it with a transistor like in http://www.arduino.cc/playground/uploads/Main/relays.pdf (but by replacing the relay with the motor).

I've a similar setup:
12v+ from power source -> Arduino VIN
12v+ from power source -> Motor
GND -> Transistor Emitter
GND -> Arduino GND
Motor -> Transistor collector
Arduino Digital PIN > Transistor Base

You just have to be sure the source has enough current to feed all your gear, and you shouln't run into problems :slight_smile:

There are several ways this could happen.

Direct mechanical effects - the motor moves the accelerometer or creates vibration that gets to the accelerometer.

Direct electrical interference, because motor current wires run close the the accelerometer wires.

Indirect electrical interference where the motor load affects the supply voltage or ground return and interferes with the ADC input or reference.

Need more information to track it down...

Seems to work with an external power supply on the H-Bridge.

Thank you for your quick help!