Arduino Uno with voltage divider not working as expected

fnb111:
R4 & R5 is the divider. Its been suggested that this is not the best way to do this.

fnb ..... thanks for pointing that out, and for updating the diagram. The mid-point of the divider ..... where will that mid-point be connected to? Just asking ----- only so that we can see if we can spot any issues to help you out.

#18 show that the midpoint between R4 & R5 is connected to A1. The divider is in parallel with the board supply.

fnb111:
#18 show that the midpoint between R4 & R5 is connected to A1. The divider is in parallel with the board supply.

Thanks fnb. Ok .... assuming +V is 15 volt. Then the divider mid-point voltage will be approximately 4.606 volt, and this voltage is fed to PC1 (ADC1) ...... and this analog input pin should be able to convert that voltage to digital level 943 (based on a 0 to 1023 range). That should be ok actually.

Should I increase the values for the combination R7 & R1?

I assume the Schottky diode in your voltage divider is for reverse polarity protection, but it will throw your measurement off by about 0.4V. if you have 16V in, divided by your ratio of 3.26 that would be 4.91V, but the diode will cause the voltage across the divider to drop to 15.6V, that divided by 3.26 will be 4.79V, add the 0.4V dropped between the bottom of the divider and GND, you would have 5.19V from A1 to GND.

With your current values the voltage divider will draw 5V/(226+510)=0.0068A (6.8mA)
Also, the schottky diode connected to the bottom of the voltage divider is unnecessary.

fnb111:
Should I increase the values for R7 & R8?

What are you trying to do with that amplifier ?
It's output will flip and activate or deactivate VPROGRAMMER (5 volts from a FTDI device) to the 3V3 regulator, depending on some 3V3 source, and the level of your nominal 15V divided by R7 (15K) and R8 (13K).
The current through R7 and R8 occurring at 15 volts, would be some 0.54 mA, resulting in 8 milliwatts (0.008 W).
At 15 Volts, the junction R7/R8 would be some 6.964 volts.

Below approximately 7.107 volts at your 15 volts input, the 3.3 volts will win (if it is available of course) and the amplifier output would invert.
Because this seems to switch one of it's own inputs (3v3), some oscillation would not surprise me much.
I'm assuming the regulator and its output capacitor will slow that down quite a bit, but i'm wondering how happy the regulator would be with that on the long term.

I'm wondering if any of these voltages will ever be reached without severe damage (to the battery for example).

Calculations are done assuming very accurate resistors and fixed voltages, both unlikely so allow for some deviation.

MAS ----- thanks for posting. If +V is 15 volt, and the divider of R8 and R7 provides approximately 6.9 volt to the '+' input of the comparator, while the '-' input of the comparator is at 3.3V, then the comparator output will be a 'high' voltage.

Whatever that comparator output voltage is for that LMV358 ...... not sure, as the diagram doesn't show the power supply details of that comparator. The details are probably hanging around there somewhere .... maybe.

Hi,
Have you constructed this on protoboard or have you got a PCB made?

If a PCB can you post Exported jpg images of it please?

Thanks… Tom… :slight_smile:

The 3.3V regulator output will always be lower than
the input so when the 15V input drops to 7.1V
the oscillation will start. I'm not sure when or if it will stop.
If it is a PS and not a battery then why do you need the comparator ?
One would be correct to say "Doesn't that depend on what's powering the comparator which isn't shown ?"

Thats rather a strange circuit.
You have a "16V" (10 - 16V) supply with a voltage divider supplying "+7 to +11V and "-3.1 to -5V" relative to ground.
The positive feeds a regulator which gives +5 to power the arduino.
Yor GND is connected to the arduino ground.

All OK.

I'd anticipated you would use the negative supply to power op amps - but no.

It only seems to be connected to A1

You cant directly connect a negative voltage to an analog input.

Southpark:
Whatever that comparator output voltage is for that LMV358 ...... not sure, as the diagram doesn't show the power supply details of that comparator.

raschemmel:
One would be correct to say "Doesn't that depend on what's powering the comparator which isn't shown ?"

I just took another look at the picture.
There's something floating close to the comparator, showing pin 8 connected to 5V, and pin 4 to GND.
That sounds familiar with what i remember from the good old LM358, of which this device must be derived.
.

So...
It is powered with 5 volts, and will get inputs well above 5 volts.
Perhaps consulting the datasheet would help to see whether this is a smart thing to do or not (i already knew the answer to that, but it's always good to check).
See page 3, and memorize the complete table shown there (and what that table shows, according to it's name/description).

Thanks very much MAS3. I think what you pointed out regarding the chip being powered with 5V and an input going well above 5V is significant and important information.

My vision must be deteriorating with age because I didn’t see any power connections on the Linear Monolithic 358.

Members

Thanks for the feedback. I have changed the drawing. Removed D2. Placed the divider in parallel with the 16V dc supply from a battery.

MAS3:
I just took another look at the picture.
There's something floating close to the comparator, showing pin 8 connected to 5V, and pin 4 to GND.
That sounds familiar with what i remember from the good old LM358, of which this device must be derived.
.

So...
It is powered with 5 volts, and will get inputs well above 5 volts.
Perhaps consulting the datasheet would help to see whether this is a smart thing to do or not (i already knew the answer to that, but it's always good to check).
See page 3, and memorize the complete table shown there (and what that table shows, according to it's name/description).

Thanks for the information. Ive looked at R7 & R8 again. Am I correct if I do R1 = 16K & R7 = 6.2K and the voltage across R7 would be approximately 4.5V & 16V max?

16 volts max

16K + 6K2 = 22K2

16/22.2= 0,7207207207207207

0,7207207207207207 * 6.2 = 4,468468468468468

That stays below 5 volts, and would be a lot better.
But you also need to consider the other level at the inverting input of your comparator.
That doesn't change (i must assume), and you just changed the level that represents 16 volts.
Your comparator will now flip it's output at another input level (~ 11.82 volts, was 7.107 volts) than it would have before.

Hi,

16 volts max

16K + 6K2 = 22K2

16/22.2= 0,7207207207207207

0,7207207207207207 * 6.2 = 4,468468468468468

16V max ==== fine
Total pot divider
16K + 6K2= 22k ==== fine
Ratio respect 16K
16/22.2= 0.720 == fine
Voltage across 16K
0.72 * 16V = 11.5V
Voltage across 6K2
16V - 11.5V = 4.5V

Tom... :slight_smile:

MAS3
'But you also need to consider the other level at the inverting input of your comparator.
That doesn't change (i must assume), and you just changed the level that represents 16 volts.
Your comparator will now flip it's output at another input level (~ 11.82 volts, was 7.107 volts) than it would have before'

Do you refer to the voltage drop across R1? I'm not sure if I'm reading the data sheet of MC33269 correctly. Is the max Vin = 20V?

fnb111:
MAS3
'But you also need to consider the other level at the inverting input of your comparator.
That doesn't change (i must assume), and you just changed the level that represents 16 volts.
Your comparator will now flip it's output at another input level (~ 11.82 volts, was 7.107 volts) than it would have before'

Do you refer to the voltage drop across R1? I'm not sure if I'm reading the data sheet of MC33269 correctly. Is the max Vin = 20V?
[/quote]

As the name 'comparator' of that component tells, the input (at pin 1) is compared to whatever is available at pin 2.
As soon as the level at pin 1 drops below, or rises above the level at pin 2, the output of the comparator will be inverted.
But because you changed the ratio of R1 and R7, the output will invert at a completely different input level from your battery.
In your 1st. circuit, this battery voltage would be at 7.1 volts to invert the output of the comparator.
In your 2nd. circuit, the battery voltage would be at 11.2 volts to invert the output of the comparator.

So the question still is:

What do you want to achieve with this circuit ?
At what input voltage do you need to enable or disable the 3.3 volt regulator ?

The remarks / worries about oscillation are still valid.

[edit]

Sorry, forgot to answer the 2nd part of your question:

Indeed the absolute max vin is 20 volts.
Expect impressive effects when it's fed with something like 20.5 volts.
So make sure you have ample of margin towards that 20 volts maximum.
[/edit]