Arduino Forum

Using Arduino => General Electronics => Topic started by: Wils0n on Dec 14, 2016, 03:57 pm

Title: Weird analogRead problem
Post by: Wils0n on Dec 14, 2016, 03:57 pm
Hi all,

Can't solve this :( I have custom 328p board with voltage reading circuit. Input voltage goes to R1 and series in that R2 to groung normally voltage divider. Both 10k ohm. Between those resistors to 328p analog input 1. If supply voltage goes under 6.5v led should blink. But it does not. Tricky part here is when i measeure voltage between gnd and A1 voltage, it is half of the input voltage. Thats normal. But when my multimeter is connected led starts to blink and when remove it stops. When measuring with oscilloscope i see half 1/2 voltage like with multimeter but now led does not blink?

Then when i power down 328p and measure voltage A1 pin it is about 1 volt??

Aref pin connected 0.1uF to gnd.

Anyone? Thank you.
Title: Re: Weird analogRead problem
Post by: ricky101 on Dec 14, 2016, 04:09 pm
You need to post your program code and details of how your led /resistor is connected ?
Title: Re: Weird analogRead problem
Post by: wg0z on Dec 14, 2016, 04:17 pm
I suspect the meter itself is affecting the circuit. You could add code to monitor/ouput the actual a/d conversion result.
Title: Re: Weird analogRead problem
Post by: DVDdoug on Dec 14, 2016, 04:18 pm
Is the voltage divider ground connected to the Arduino ground?


The 'scope & multimeter should be high impedance relative to the 10K resistance and should have no effect.  


What does the ADC read?   (See the Analog Read Serial Example.)   Does the reading change when you connect the meter or 'scope?

Quote
When measuring with oscilloscope i see half 1/2 voltage like with multimeter but now led does not blink?
Is there any "wiggle room" in your code?   i.e. What happens if the voltage is just-slightly above 3.25V?    (NOTE - The same thing will happen if the reference voltage (5V) drops a little...  You'll get a slightly higher ADC reading.)  

Quote
Then when i power down 328p and measure voltage A1 pin it is about 1 volt??
That's normal.  There are over-voltage (and negative-voltage) protection diodes inside the chip.  If Vcc is below the input voltage, current flows through the diode "shorting out" the over-voltage.    See Figure 22 (page 46) of the ATmega Datasheet (http://www.atmel.com/images/doc2503.pdf).



Title: Re: Weird analogRead problem
Post by: terryking228 on Dec 14, 2016, 04:49 pm
Hi,
Quote
multimeter should be high impedance relative to the 10K resistance
The multimeter needs to have an input impedance of 10 Meg ohms or so to have 'little' effect when probing your circuit. The meter IS part of your circuit.

What are the specifications on the multimeter part of your circuit?
Title: Re: Weird analogRead problem
Post by: MarkT on Dec 14, 2016, 06:47 pm
You could be injecting noise simply by holding the multimeter wires and probes, you may be picking up
some RF or other nearby mains noise.

The oscilloscope probe is in a grounded coax sleeve so it doesn't pick up noise.

Also you could be picking up noise from the wiring you use to sense the supply voltage.

The 1V on powering down is perfectly normal - CMOS circuits below their minimum voltage consist
of a bunch of FETs that are fully off, so not current flows and the decoupling capacitors / power supply
cannot drain any further unless there are other routes to ground.
Title: Re: Weird analogRead problem
Post by: Jiggy-Ninja on Dec 14, 2016, 07:24 pm
I suspect the meter itself is affecting the circuit. You could add code to monitor/ouput the actual a/d conversion result.
This is kind of a critical thing to know. Is the meter causing a drastic change in reading? Is there an extremely low margin on the threshold? There's no point guessing until we actually get more data about what's going on during the fault.