Supply voltage affecting sensor readout

Hi,

Have a question regarding say for example a voltage divider sensor. When using a 12v power supply it give a lower reading but when using the usb from the cable it is higher.

Will using a aref pin voltage as a reference be the solution to ‘calibrate’ the reading such that it would give consistent reading irregardless of the supply voltage(assuming within the arduino board range).

Cheers

The 5V from the USB input and the 5V from the onboard regulator should be the same. :(

Do you have a meter that would allow you to check the voltage at the 5V pin? If not you should get one.

The issue is when i run the project on a 12v battery supply it give a certain reading but when i use USB to power it the value is higher. So I still need to hook up the 12v to get the same reading i 'calibrate' with the divider ratio.

I think the 5V from USB and the 5V regulator is different for readadc. When using the USB 5v it is not fed thorough the voltage regulator but the 12v is fed through the regulator.

Wonder if there is a way to make the reading be the same?

As I said before:

johnwasser: The 5V from the USB input and the 5V from the onboard regulator should be the same. :(

Do you have a meter that would allow you to check the voltage at the 5V pin? If not you should get one.

Until you measure the voltages there is no way to know which one is wrong. Until you determine which one is wrong there is no way to know how to fix the problem.

shadowless: The issue is when i run the project on a 12v battery supply it give a certain reading but when i use USB to power it the value is higher. So I still need to hook up the 12v to get the same reading i 'calibrate' with the divider ratio.

I think the 5V from USB and the 5V regulator is different for readadc. When using the USB 5v it is not fed thorough the voltage regulator but the 12v is fed through the regulator.

Wonder if there is a way to make the reading be the same?

The regulation for the USB +5 is performed by the PC, the on-board regulator performs the regulation when powered from the arduino external power connector (or Vin pin). They will never ever be 'exactly' the same. A DVM will tell you how far apart they will be at any given instant in time. There are several methods to deal with variations of accuracy when using the Arduino analog input pins. A lot depends on your expectations Vs capablilites of the basic 10 bit A/D performance. Keep in mind that AVR specifies absolute accuracy at +/- 2 lsb, which is not a great specifications.

So what are your needs in the way of accuracy specifications, that will determine the best method to improve what you presently have.

PS: Do indeed obtain a digital multimeter if you don't presently have one.

Lefty

If you want the ADC reading to be independent of whether you power the Arduino from USB or external power, I suggest using the 3.3v supply as the analog reference instead of the default +5v, assuming you don’t need to measure input voltages greater than 3.3v.

dc42, I was thinking the same, hence i was think that i need the aref to set to a voltage that is achievable by both supply. Can use the aref to set a 5v ref or must it be lower than 5v to make it work?

I think the dcm discussion is missing the point totally. It is not a faulty board or a lack of dcm.

If you understand the character of the 5v input to the board u will understand my issue. Go try it out yourself and u will see what i am asking about. Set up a voltage divider on your board and try the usb and 12v/9v input and see what u get.

I get a variation of up to 0.5v from the analogread using the 2 diffent supply.

On my Arduino UNO R2 I made a voltage divider with two 22K resistors: from A0 to +5V and A0 to Ground.

USB power only: result = 522 USB + 6xAA battery pack: result = 522 USB + 9v wall wart: result = 522

On my Arduino Diecimila (which has a power selection switch) I made a voltage divider with two 22K resistors: from A0 to +5V and A0 to Ground.

USB power: result = 521 (occasionally 522) 6xAA battery pack: result = 521 9v wall wart: result = 521

I don't know how it work with your set to measure your own board internal 5v voltage that fluctuate with the power source. I think you should measure a 5v fix external voltage.

Anyway i will test out the aref solution for my case.