Analog pin sensitivity

Hi folks,

Been playing with the Arduino board and getting LEDs flashing. Now I'm trying to read the analog pins where an accelerometer is plugged in. Writing the values on serial and reading them on the PC, I can now move my mouse by tilting the breadboard ! Exciting (:

The resolution of the values is poor though. The 10bit adc maps from 0 to 5V, but the values I read range from 1.326V to 1.674V. This gives me ~71 usable values ):

How would I go about mapping the 10bit resolution to the 1.3-1.6V range ?
Or alternatively how can I change the signal so that it ranges from 0 to 5V ? Using a couple of transistors seems sensible, anyone could point me to a good resource to help me figure out how to choose the right components ?

Thanks a lot,
Lionel

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1165656828/1#1

Fair enough (: Thanks for that.
For the record I did search the forums (: It's hard to find the right keywords though.

I'll try the op amp. The noise is already an issue and smoothing the signal adds latency to the mouse, so the second solution looks less attractive.

Thanks,
Lionel

Have you considered using an external ADC with higher resolution (12-bit?)

Thanks for the input, I have considered it indeed. Because I'm trying to move the mouse on the screen, even if I get the op-amps to improve the signal I still only have 1024 different values on X and Y axes. With PC resolutions going easily up to 3200x1200, I would need more than that to get 1 pixel accuracy.

At the moment even with the poor signal, I can move the mouse very precisely if I use the values as delta to move the mouse. However I want to use an absolute position, which is a lot harder to get but in my opinion a lot nicer to use.

I just got the op-amps, I'll give that a try before looking into an external ADC. It looks like a significant operation to get the ADC setup... The MAX187 looks like a popular choice.

Any other suggestions before I go too far in the wrong direction ? (:

try a loop that reads the accelerometer's direction...
and then the direction could increment absolute position variables, which go up to 32K.

D

Ah but the precision of the variable is not a problem, 16bit is plenty. The problem is the ADC which is 10bit (which I can't even use fully yet).

yes I mean that you take the strategy of just using increment/decrement information from the accelerometer, and use that to increment/decrement the absolute position variable. So your loop would check whether or not the accelerometer value was one of three things: goign up, staying the same, or going down... just like one's state of mind in life!

D

I just got the op-amps, I'll give that a try before looking into an external ADC. It looks like a significant operation to get the ADC setup... The MAX187 looks like a popular choice.

Any other suggestions before I go too far in the wrong direction ? (:

Yeah, one suggestion: Read this thread, hint: SPI:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1163734586/6

Because I'm trying to move the mouse on the screen, even if I get the op-amps to improve the signal I still only have 1024 different values on X and Y axes. With PC resolutions going easily up to 3200x1200, I would need more than that to get 1 pixel accuracy.

An acceleration sensor will not produce absolute position data, like x-y coordinates. It will rather produce data about the rate of change. A big difference! That's one of the reasons why 10 bit resolution should be absolutely sufficient for this purpose.

jds:
Thanks for the suggestion. Very interesting thread, but I don't see how it applies to my situation at the moment. Am I looking for something particular in there that's corrupting my signal ? I don't use pin 13 apart from lighting the on-board LED briefly at init time.

brainfart:
I agree that 10 bit is plenty to read the sensor as a rate of change. This works completely fine already and has 1 pixel precision. Nice !
However there are 2 situations, and I prefer the second one (:

1- As you said, reading the values as a relative change. If the sensor is flat, the mouse doesn't move. The more you tilt one way, the faster the mouse moves in that direction. That's all good, but not very nice to use.

2- The values can be read as absolute positions. If the sensor is flat (the values are then roughly X=512, Y=512), then the mouse is centered on the screen. If the sensor is tilted one way, the mouse matches the position. Eg. the more you tilt left, the further left the mouse goes.
This is very nice to use, and very efficient. However with my current circuit I get a lot of noise and very little precision, which means I can't really aim the mouse at anything.

Thanks all for the suggestions, keep them coming.
Lionel

jds:
Thanks for the suggestion. Very interesting thread, but I don't see how it applies to my situation at the moment.

I think the hint is to look for an accelerometer with an SPI interface and let the accelerometer's built-in ADC handle the conversion, like this: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1159029426

-j (not jds)

-j:
It makes perfect sense now, thanks for the pointer. I'll read up on it and see how it fits my needs and budget.

jds:
Thanks for the suggestion. Very interesting thread, but I don't see how it applies to my situation at the moment.

I think the hint is to look for an accelerometer with an SPI interface and let the accelerometer's built-in ADC handle the conversion, like this: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1159029426

-j (not jds)

That was not what I meant, but still a good suggestion. Earlier I suggested to use an external ADC... If you would have chosen for the max187, then you would have to use SPI and the link to the thread I posted is usefull :wink:

JDS