UNO with MMA7260 3 axis accelerometer and LCD

Hello,

I interfaced my UNO with the 3 axis accelerometer MMA7260 breakout board along with the 24x8 character display HYUNDAI12605.
It works very nicely and you can see it here:

I programmed the LCD to show the input in values and vertical bars (rotated LCD).
However, when I unplug the USB cable and plug it in again after some seconds the unit diplays lower accelerations on all axes, e.g. 11/11/17 instead of 14/14/20 (as you see in the video) directly after uploading the program.
Can this be some kind of electrical effect at the arduino level?
Please advice me how to make it work well.

Andreas

Is it a power supply problem?
The device is ratiometric, I think.
How are you powering it, and which analogue reference are you using on the Arduino?

Hello Groove,

thanks for your quick reply!

I power the UNO by the USB line.
When unplugging it and waiting for some time, it still has the program in memory, but it then shows lower values.
I am not using the external voltage reference pin, but just feeding the analog outputs from the accelerometer directly on three analog pins.

Do you think it may be better to use the ext ref voltage input pin?

How is the reference set when one is not using the external ref pin?
And when is that reference set? Is it updated continually?

How are you powering the accelerometer?
If you unplug the USB, how are you powering the Arduino?
Which range are you using?

Hi,

I am powering the accelerometer through the 3,3V pin of the arduino.
I have connected the GS1 and GS2 to GND, so it works at max. sensitivity (1,5g). I power the LCD through the 5V pin of the arduino.
All works fine. But when I unpower the whole system by pulling the USB plug, and I repower it again, I get different (always lower) readings. But these readings are not always the same. I get consistently 14/14/20 after upoading the program. But I get always less, like 11/11/17 after unpowering and repowering the system.
I actually got even negative readings until I declared the type of the value variable as an unsigned int. After that I got always positive readings, but they are lower than "normal".

The problem is you're using the 3.3v generated from the FTDI IC as a power supply and referencing the 5 volt supply when doing the A/D conversion. I believe the 3.3 is a lot more stable than the 5 volts as referenced by analogreference. You could probably connect the 3.3 volt to the external reference (you need to change the code also) so any power supply fluctuations would cancel out. You'd also get better sensitivity doing it this way.

Hello Wayneft!

That sounds really very much like solving this problem! I had a feeling that it must depend on the power supply somehow.
Thanks so much!
But I have a question: How do I need to change my code in order to use the reference pin?
Would be nice if you can give me a hint,

Andreas

Have a look at the analogReference function.

I will certainly do that. And thanks for your help!!!!!!!!!!!!!!

Andreas

Here's the link for analog reference analogReference() - Arduino Reference

There is a warning on the page that tells you to set it to EXTERNAL before calling analog read. The reason is the default setting that you are using is actually outputing the 5 volt signal on the AREF pin so you don't want to connect an external source to a pin that is already outputting a voltage.

Not to confuse you but there is one other option that will give you the most sensitivity and that is to use the INTERNAL reference for the A/D converter which is 1.1 volts and is very stable. You would have to use voltage dividers on all three axis to bring the full scale range of the signals to below 1.1 volts. But it all depends on your application whether or not you need the extra sensitivity.

Hello Wayneft,

thanks for aour interest in the matter. I read, by the way, the interesting thread on the voltage reference switching. Very interesting.

I tested yesterday a setup with the reference set to EXTERNAL feeding the accel with 3,3V from the arduino and the aref pin through a 4.7K resistor. The sensitivity markedly increases and it works all right now.
I think I will also try out the 1,1V option just to see how much the sensitivity will increase.