1
\$\begingroup\$

enter image description hereI using an Arduino uno analog read function to read a voltage divider circuit for a voltage range from 0-70 VDC. On the voltage divider, I am using 2.7Kohm and 36kohm to reduce to voltage range from 0-70VDC to 0-5VDC for arduino analog input. The circuit works fine with the USB power to the arduino, and as soon as the I disconnect the USB, and the arduino switches to the backup dual switching power supply (120 VAC to 12VDC and 5VDC), the analog values change. The values are still steady and I dont see any garbage values, but there is a big offset between the original values and the values after disconnecting the USB power to arduino. Can anyone comment with a solution to this? I checked multiple times and the ground is common through out the circuit.

\$\endgroup\$
18
  • 1
    \$\begingroup\$ A schematic would help... Otherwise the answer is, what is different when the power switches over.... which is not an answer either... \$\endgroup\$
    – Trevor_G
    Commented Nov 30, 2017 at 22:07
  • \$\begingroup\$ @Trevor I have added the schematic for reference. Please note that the schematic wont help much as the issue is somewhere related to switching the supple from USB to the external dual voltage switching power supply. \$\endgroup\$ Commented Nov 30, 2017 at 22:17
  • 3
    \$\begingroup\$ I'd suggest there is a 5 V supply level difference between your AC supply and your backup DC supply. Since the A/D uses the 5 V as it's reference you would see a change. \$\endgroup\$ Commented Nov 30, 2017 at 22:30
  • 1
    \$\begingroup\$ Which source is used for Vref? Check and measure Aref out, and all Gnd voltages in both modes. V REF can be selected as either AV CC , internal 1.1V reference, or external AREF pin. AV CC is connected to the ADC through a passive switch. The internal 1.1V reference is generated from the internal bandgap reference (V BG ) through an internal amplifier. In either case, the external AREF pin is directly connected to the ADC. \$\endgroup\$
    – D.A.S.
    Commented Nov 30, 2017 at 22:36
  • 1
    \$\begingroup\$ I'm lost by your lack of clarity in question. what are your actual ADC vs Vref vs Vdc errors and what do you not understand? Analyse error results in a spreadsheet. Also be more explicit about Gnd vs Earth ground and floating ground.. Your schematic says it all. You have no idea about "star ground" and earth ground or EMC and this leads to consequences of measurement errors. \$\endgroup\$
    – D.A.S.
    Commented Dec 1, 2017 at 17:53

1 Answer 1

3
\$\begingroup\$

Read the Atmel Datasheet for the '328

Section 28.2 cover the A/D The inputs look like this:

enter image description here

By default on the Arduino Uno the ref voltage is taken from AVCC which is the 5 V VCC used by the MCU.

The Arduino schematic is here.

You can program the unit to not use AVCC/1.1ref and feed in a more stable reference ....or fix your supply voltage.

You could also switch to the 1.1 V reference and change your input divider.

\$\endgroup\$
9
  • \$\begingroup\$ Thank you for your reply. I understand that i can change the reference to internal 1.1 V, but i am still trying to understand that if the default setting is 5 V that is provided by the arduino input, why would the analog values shift so much while shifting power supply from USB to power supply. Both USB and power supply are supplying steady 5 VDC. \$\endgroup\$ Commented Dec 1, 2017 at 0:06
  • 1
    \$\begingroup\$ We have no idea how much is "So much" and how much noise is on the system getting rectified nor ground shift with 3+ external grounds. (usb, batt, PSU) \$\endgroup\$
    – D.A.S.
    Commented Dec 1, 2017 at 0:49
  • 1
    \$\begingroup\$ @AmmarSurti. You have not supplied very much information ...how much does your A/D reading change? Are you measuring the voltage with a digital meter? \$\endgroup\$ Commented Dec 1, 2017 at 1:49
  • \$\begingroup\$ @TonyStewart.EEsince'75 I ran a few tests this morning: I check the AREF voltage when USB port was providing power to the arduino, and it was 4.9Volts. I changed the reference voltage to external in the program and provided exact 5 volts from the switching power supply. The analog values increased upto 2 times the original value. So if i was getting a value of 5, it increased to 15. \$\endgroup\$ Commented Dec 1, 2017 at 14:02
  • 1
    \$\begingroup\$ That tells me you have a EMI problem with your signal input and poor CMRR. Get twisted pair, shielded and add big ferrite sleeve. The noise is getting rectified to DC from input nonlinearity. \$\endgroup\$
    – D.A.S.
    Commented Dec 1, 2017 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.