I'm using arduino uno and ethernet shield with POE(R3). I have not yet used POE but will in the end application. external power is a 7.5v 300ma wall wart.
I'm driving 3 analog inputs from three buffered temp sensors.
the next adc input is driven from a very accurate reference, AD780 (3.00v), divided in half with two 1k resistors.
the next adc input is driven from the 5v supply(ipc connector) divided in half with two 1k resistors.
I accurately ready my reference when powered externally, but with usb power it reads 3.08v using the adc. using a DVM I read 3.002 at the analog pin input.
the 5v reference reads correctly always.
the three buffered inputs also read high, although a higher percentage than the reference. The voltage on these pins are ~2.98x volts.
I am not writing to the analog_reference register.
this doesn't happen all the time, only occasionally. sort of expected overloaded laptop usb, but this doesn't seem to be the case. I expect <200ma load from the board set but have not measured it.
It appears to me the issue is on the arduino board as I correctly measure the reference at the connector pin.
any suggestions welcome.
today I discovered that the AVref pin seems to be left floating on the board. fingers crossed
no help connecting AVref pin. I also added 1ms delay between readings, also no help.
Posting your code might help people figure out what's wrong.
Might also help if you measure (with your DMM) and report here the voltage at the AVCC pin when using the wall wart and the USB source. I bet the voltage from the USB is significantly lower than 5 volts (and not steady, either).
ok, sketch attached as well as explanation pdf with screen shots. I do see a 100mv sag on the usb supplied 5v as compared to externally powered, but am surprised it would cause such a dramatic measurement effect.
I can rescale some inputs and likely will use the external 3v reference to the AVref pin.
would appreciate any other suggestions.
thanks for taking a look at this
tim
temp__sensing_sketch_nov26a_no_SD.ino (9.8 KB)
Bad web page and good web page.pdf (86.3 KB)
You probably figured out by now that the reason you are getting 3.08v when you're on USB power and 3.00v when on external is that "volts per bit" is not constant, but your sketch assumes that it is.
When AVCC is 5 v, as it is on external power, your constant "voltsPerBit" is correct, or nearly so.
When you're on USB, AVCC is approximately 4.9 v, so "voltsPerBit" should be smaller by a factor of 4.9/5. But since you are using the larger voltsPerBit, the sketch thinks the 3v reference is 3 x 5 / 4.9 = 3.06v ... pretty close to your 3.08 v
And the "5v reference" is always correct because you're just asking the ADC to measure its own reference voltage. It will output 1023, and therefore 5v, even if AVCC is 4.5 v or whatever.
Using your stable 3v reference as input to the AREF pin (and selecting EXTERNAL with analogReference) should be ok, if all of your other inputs are less than 3v.
thanks Dave. I plan to rescale all the voltages to be < the new 3.00 ref voltage which should provide some stability. I'll report back results.
changed the reference presented to Aref and rescaled inputs, stuff very repeatable. with the series 5k resistor on Aref(exact divider will change a little due to tolerance of 32k internal R), I'm tweaking the VoltsPerBit to get exactly the external ref voltage and then it is very solid; I might make a routine to do this later. Then all the rest of the numbers are good. since there is some expected variation board to board, I'll make some code to do this so it is independent of board to board variation.
thanks for your help,
tim
Great - I'm happy it's working for you!