ADLX335 connection to arduino lilypad

Hi everyone I am connecting a 3 axis accelerometer to my arduino lilypad

I have x,y,z accelerometer pins connected to AO,A1,A2 on the lilypad.

I am powering the adlx335 with 3V and the lilypad via USB. I am using the lilypad accelerometer

I have uploaded the sample sketch that comes with the Arduino IDE.

the problem is that I am getting random readings on the pins. I disconnect the accelerometer from the arduino

and I still read data when I run the serial monitor.

I am pretty sure the lilypad accelerometer is working fine because when I interface it with my arduino Uno. everything works fine.

I also tested the regular adlx335 accelerometer(not lilypad accelerometer)on the lilypad and I am facing the same problem.

Does anyone have any idea why this is happening?

analog port “float” when nothing is connected to them, so thats why you get random values w/o the accel. i don’t know why the accel wouldnt work; uno and lilypad are essentially the same main chip(328P), i think.

I know this is an old thread, but I just had similar experiences, and here is what I found that may help others in this situation.

I was trying to supply the 3V to the accelerometer with pulse-width modulation. With my meter, it was measuring right on 3V, but the serial monitor showed odd results from the accelerometer. When I tested the accelerometer on my UNO (using the 3V from the header, not through PWM) it worked fine, all of the values from the serial monitor were what they should be.

Then I decided to try PWM on the UNO and see if that was the same, and that seemed to be the problem. Not sure why, but using PWM (even though it measures as 3V) was goofing up the accelerometer. I found a resistor that put me close to 3.4V (still within the datasheet limits), and the code started to work again.

So, I don't know what your particular setup was, but if you were using PWM, then that is the culprit, if it's not that, then I'm not sure. Seems really odd that the lilypad accelerometer uses 3V when the lilypad only has the 5V natively. I don't really like sewing resistors to my projects, but oh well.