Pages: [1]   Go Down
Author Topic: Analog pin sensitivity  (Read 2023 times)
0 Members and 1 Guest are viewing this topic.
London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 0
Posts: 414
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ? (:
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

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

D
Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: December 11, 2006, 07:04:30 pm by Daniel » Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 0
Posts: 414
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

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

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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)
Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

-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.
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 0
Posts: 414
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote
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 smiley-wink

JDS
« Last Edit: December 13, 2006, 04:05:50 am by jds » Logged

Pages: [1]   Go Up
Jump to: