The Mega has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function.
Happy New Years to everyone,
I have a question about the ADC in the Arduino Mega but I assume this also would apply to the other versions as well. According to the quoted text, the Mega has a 10 bits resolution meaning: at a reference voltage, that would yield .0049 voltage per unit. So if I change the reference voltage, does this also change the precision? Example: AREF = 3 volts, would the divisions or precision now be .0029.
Yes. But that changes the scale, not the resolution. The resolution remains 10 bits = 2^10 = 1024 steps regardless of the scale or reference.
Bad terminology on my behalf.
Let me explain my reasoning here. I have an analog gyro that I want to connect to the Mega. I measured the voltage output from the gyro and it measures high=2.9 and low=2.3 volts. So I want the greatest number of steps (1024) within that range.
The only way to get 1024 steps for that voltage range is to use an op-amp to scale up the voltage, with an offset to drop the 2.3 to 0.
An analog reference voltage of 3.0 will divide the 0 to 3 range into 1024 steps, but what do you do with the 900+ steps up to 2.3 that you will never see?
The only way to get 1024 steps for that voltage range is to use an op-amp to scale up the voltage, with an offset to drop the 2.3 to 0.
An analog reference voltage of 3.0 will divide the 0 to 3 range into 1024 steps, but what do you do with the 900+ steps up to 2.3 that you will never see?
Good Point, I am off to Radio Shack to purchase an opamp. Any suggestions as to which one would do the job?
You might use three signal diodes in series to drop the input voltage low value from 2.3v to ~.2v. Then use a pot as a voltage divider from the board 5v to generate a reference voltage of ~.6v. Not the total range, but something to try to see if the results are closer to what is desired.
No. You aren't looking for a comparator. You are looking for an op-amp. They are cousins, but not identical twins. Comparators are made for comparing (e.g. essentially digital 1/0, TRUE/FALSE, HIGH/LOW output). Op-amps are made for amplifying.
[edit]Just curious but which gyro are you using? Those voltage ranges don't sound right for full range on an analog gyro. [/edit]
Very possible, the specs call for 1.6 volt swing but I was unable to get the Flymentor gyro to move that far. Could be the speed or acceleration, but anything close to the range named, I will be entirely happy.