Question About Voltage Divider

Thread Starter

dandy1

Joined Sep 30, 2017
178
hi all, im having an issue with a voltage divider circuit.

i have 12v on the input then 150k and 10k in series going to ground. For some reason i am not getting any voltage at the output - well 3mV but shouldbe getting 0.75 ish. the output is directly connected to analog input on ardunio, and grounded to arduino ground, What i have noticed is that the 150k resistor when coupled up drops its valvue to about 86k and gives the same value across both resistors when coupled, i.e from 12v to ground.

any advice?
 

AlbertHall

Joined Jun 4, 2014
12,345
Do you get 0.75V if the arduino input is not connected to the divider?
Is the arduino powered from the same 12V supply? If not please decribe the arrangement.
 

Janis59

Joined Aug 21, 2017
1,834
May be too high-Ohmic source of signal. May be too low-ohmic load for signal, may be the defect of resistors, may be a curvy hands. All three probable reasons are well adjustable, last not
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
AlbertHall
yes the arduino is powered from the same source,however it only seems to be a problem when ground is connected, i have got the same arrangement on an identical project and that works fine, I have also swapped out both resistors. i will try it without connecting to arduino.

Janis59
curvy hands - is that another way of saying badly soldered? if so there is a definite possiblity
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
tested without arduino connected and getting .789v - so resistors ok.
changed out for 15 and 1k resistors, again ground resistor keeps 1k but 15 k looses about 1.1k, is this something to do with the arduino?
 
Last edited:
If you use a 1.5K / 1.0K ladder I suspect it will work ok can you test that?

The ADC is optimized for an output signal impedance of 10K or less.

Edit: I should have been clearer. Using the 1.5k/1.0k will produce 4.8v and should be read accurately by the Arduino.

If you have to read the signal from 150K/100K (or 150K/10K), you would typically use an op amp configured as a unity gain buffer for impedance matching.

At least that it what I think.

Edited again:

I have used this type of circuit numerous times to measure analog voltages below 1V, including with 5V Arduinos and others. Not saying you will get great accuracy in the microvolt range. Also note that with the 601 op amp as shown (5V supply), your input cannot exceed 5V.
ArdA0.jpg
 
Last edited:

Ylee5763

Joined Sep 23, 2015
27
there are a few things you may consider to check:

1. the programming code setup for the ADC input pin. You might set it up as output.
2. recheck the ADC pin you using to ensure this pin for ADC input.
 

MrChips

Joined Oct 2, 2009
30,712
You cannot measure resistances in-circuit.
You cannot accurately measure the input resistance of an MCU pin with an ohmmeter.

Show us your code for initializing the input pin of the MCU.
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
//variable int 'total' declared - pin not set input/output - not needed and has worked several times before: - Aref set to 1.099 - int 'voltage' declared:

void battery_sense() { // battery_sense()
total = 0; // Reset value
analogRead(17);
for (int x = 0; x < 16; x++) {
total = total + analogRead(17);
}
voltage = total * Aref / 1023;
//Serial.print("The battery is ");
//Serial.print(voltage);
//Serial.println(" volts");
delay(100);
 
Last edited:

Thread Starter

dandy1

Joined Sep 30, 2017
178
If you use a 1.5K / 1.0K ladder I suspect it will work ok can you test that?

The ADC is optimized for an output signal impedance of 10K or less.

Edit: I should have been clearer. Using the 1.5k/1.0k will produce 4.8v and should be read accurately by the Arduino.

If you have to read the signal from 150K/100K (or 150K/10K), you would typically use an op amp configured as a unity gain buffer for impedance matching.

At least that it what I think.

Edited again:

I have used this type of circuit numerous times to measure analog voltages below 1V, including with 5V Arduinos and others. Not saying you will get great accuracy in the microvolt range. Also note that with the 601 op amp as shown (5V supply), your input cannot exceed 5V.
View attachment 158834
thank you ray will try lower value resistors next.
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
Right it looks like ive got a failing arduino here, ive set it up to analogRead on all analog pins and A0-A5 are not reading anything or random values when conectted to 5v, A6 A7 showing 1023 so looks like something up with the adc on those pins? very stange.
 
The resistance won't do anything for the issue you have.
Yeah, I think you are probably right.

I just did some testing with 5V 10K/100K and 100K/10K with and without an op amp and got reasonable values in all cases. I still maintain that an op amp buffer is a good idea. The ATMEGA ADC may be optimized for input signals 10K impedance and will work up to 100K, but something else is going on.
 

ebp

Joined Feb 8, 2018
2,332
Does the compiler automatically configure I/Os according to the calls to use them? Though this is by no means inconceivable, "usually" it is necessary to explicitly configure I/Os that are not single function. While it can be tedious, I've often resorted to looking at an assembler listing from a compiler to determine what it actually does. This wouldn't be necessary if the documentation was good.

Though compilers refer to ports symbolically, remember that the registers associated with them, both for data and configuration, are just addresses somewhere in the processor's total address space. If you do something wrong anywhere in your program you can reconfigure a port without having had any intent to do that.

If you suspect a problem with configuration, don't connect I/O pins directly to 5 V. Usually it will cause no harm, but it is safer to use a series resistor of something around 5k to limit the current in case the pin is configured as an output and is set LOW. This also allows you to conveniently use a meter or oscilloscope to check the voltage on the pin.

It is common for microcontroller analog inputs to require quite low drive impedance to assure accuracy. Often this is because ADC inputs are "sampled" by charging a capacitor internal to the ADC. The results in a short duration but relatively high magnitude current "spike." If the source impedance is too high, the capacitor may not charge "fully" resulting in a reading that is incorrect. Often you can improve performance by adding a small capacitor (and you must be careful of the type used) from the input to ground, but only if the signal doesn't change rapidly. The cap acts as a charge reservoir so the impedance is very low for that transient spike. Usually this is detailed either in the datasheet or an ap note for the processor.
 
Top