Voltage divider reading different when plugged to laptop and not.

Hi Guys,
I'm programming a control system for a motorbike powered by a 68V battery. From this battery I have a shunt resistor whose voltage is amplified by an op amp and fed into an analog pin of the MEGA2560, this works fine. I then connect the battery to a basic voltage divider with 2 resistors (33k and 430k for a x14 division). This is where it behaves "weirdly". I want to use a voltage regulator to power the op amp and the arduino and make it all standalone. When I close the system to the ground of the battery with the regulator powering the arduino and the op amp I get a fixed reading from the voltage divider (should be oscillating a bit) on the Arduino which is wrong (Using a LCD screen). I checked the voltages between the ground of the battery and the divider's output and it is fine. The arduino is not sensing the input voltage properly from the divider. Now, when I plug the arduino to my laptop using a USb cable and keep everything plugged as is (regulator+ op amp + divider), it works perfectly fine! I am not sure what is the cause of this, if everyone has any idea it would be greatly appreciated!
Thank you for your help!

TO sum up: When my system is not plugged to the USB laptop it gives out wrong readings when its inputs apear to be correct. As soon as it is plugged on my laptop it all works fine!

You probably need to use a switch mode power supply to get the 68 V DC down to a smaller DC voltage.

I think the problem with using resistors to drop the voltage is --- the big resistor will limit the current. So if whatever is needing a certain amount of current, then it might not get that current, due to the current limiting property of the resistor.

The other problem is..... if smaller valued resistors were used instead, then the smaller resistors would waste a lot of power (as well as heat up a lot and might not be able to handle the power dissipation unless they're designed to handle it).

Also..... a divide by 14...... will give 4.5V. When using regulators, the DC voltage that gets processed by a regulator often needs to be 2 to 3 volt higher than the output of the regulator, unless otherwise indicated by the manufacturer data sheet.

I'm actually using a voltage regulator to convert the battery voltage to 5V DC to power the Arduino and the OP amp. The op amp is used to amplify a very small signal (shunt voltage with mOhm resistor) 75 times up to 3.1V. I'm using the voltage divider to be able to read the battery voltage, so almost no current is going through it (I'm wasting approximately 0.01W). Basically it scales it down linearly 14 times to make it readable by the Arduino and proportional to the input. Everything works properly when I measure it with a multimeter and everything works perfectly but the voltage divider when not plugged in the laptop. I'm thinking that maybe it could be due to a grounding problem, but I'm not sure how to solve this issue... I'm grounding everything on the battery ground.

elt93:
When I close the system to the ground of the battery with the regulator powering the arduino and the op amp I get a fixed reading from the voltage divider (should be oscillating a bit) on the Arduino which is wrong (Using a LCD screen).

Maybe it will be beneficial to show a circuit diagram of the setup. That will definitely let the people here take a proper look at the situation.

At the moment, the word description you gave makes sense in some parts, but appears to be incoherent (jumbled up) in other parts.

For example, when you have a voltage divider, the voltage at the divider terminal is meant to be constant, if voltages are DC. But you indicate that something should be 'oscillating', and you also indicate 'which is wrong'. This piece of information appears to not make sense.

Just trying to help only.

Also, is the GND pin of the arduino connected to the battery's negative terminal as well? (For the case where your laptop is not involved).

Ok sorry for not being clear. I misused the word oscillating, I just meant that the arduino was displaying a constant value from the voltage divider which is not only too high but also should go down with battery voltage but doesn't.

Here is the schematic where the arduino returns the wrong value from the voltage divider input (A4):

Here is the schematic where everything works fine:

Hope this is clear enough, if not don't hesitate I will do them again.

For the case where the laptop is not connected to the system, use a multimeter to check the output voltage of the regulator. That's to make sure the regulator is producing the correct output voltage under this different load condition.

Also, did you add decoupling capacitors for the supply rail pin on the op amp circuit?

And, also, with the battery disconnected from the circuit (and no laptop connected to the system), use a multimeter (on resistance setting or continuity setting) to check that the negative supply rail of the op-amp and a GND pin of the arduino are connected together.

Then, re-connect the battery again, and leave the laptop disconnected. And use the multimeter to check the voltage at the voltage divider output...... to make sure it is about 0.64 Volt.

Hi, thank you for your answer!

Southpark:
For the case where the laptop is not connected to the system, use a multimeter to check the output voltage of the regulator. That’s to make sure the regulator is producing the correct output voltage under this different load condition.

The voltage is at 4.99V as expected.

Southpark:
Also, did you add decoupling capacitors for the supply rail pin on the op amp circuit?

I didn’t as the op amp and the voltage divider circuit are isolated and I still get the problem when I connect the voltage divider and disconnect the op amp.

Southpark:
And, also, with the battery disconnected from the circuit (and no laptop connected to the system), use a multimeter (on resistance setting or continuity setting) to check that the negative supply rail of the op-amp and a GND pin of the arduino are connected together.

They are connected together.

Southpark:
Then, re-connect the battery again, and leave the laptop disconnected. And use the multimeter to check the voltage at the voltage divider output… to make sure it is about 0.64 Volt.

I connected the voltage divider and the battery without the laptop and obtained a voltage of 3.85V. The battery was at about 53.8V at that point so 3.85*14=53.9 corresponds to what could be expected.

Could the problem be actually that the resistors in the voltage divider are somehow too high for the Arduino and the laptop helps solve this problem? So if I lowered the resistance in the divider but kept the ratio this might solve the pb?

Your circuit diagram shows a 9V battery (in the diagram). And the diagram also shows extra wires running out from the battery ‘upwards’ to some where — out of view. So, at the moment, the circuit diagram doesn’t appear to represent the system that you were mentioning… due to the existance of a 9V battery in the circuit diagram.

Based on the 9V battery and the divider in the circuit, the output of the divider should be 9V / 14 = 0.64 Volt.

0cPh6.png

I reckon, for the moment… keep the laptop disconnected. Keep everything else connected and powered up. Put the multimeter in voltage measurement mode. Then put your negative lead of the multimeter on the GND pin of the arduino. And then put the positive lead of the multimeter onto the analog pin (on the arduino) which is being used for the arduino’s own voltage measurement.

Assuming the ‘battery’ is 54 Volt or so, see if the voltage remains at 54/14 = 3.86 Volt.

If the voltage is 3.86 Volt, and your arduino isn’t taking a measurement, then there is likely a setup problem with your arduino. Could also put a large electrolytic capacitor between 5V and GND of the arduino, to ensure the arduino isn’t getting upset by fluctuations on its power supply pin.

Thank you for all your help!
Sorry about the mistake in my circuit diagram. The battery is indeed 54V and not 5V. Also the wires running out of view are there to represent the fact that they connect to the rest of the system: ESC, motor, etc. I just measured the voltage between the Arduino ground pin and the voltage measurement pin and obtained the right value of 3.84V... Then I guess it is something internal to the Arduino.

Thanks for checking. One small question about the setup ...... when you have your laptop connected, you're using the laptop and a Serial Monitor software window to confirm that the arduino is correctly taking the measurements, right?

However, for the case when the laptop is NOT connected........ what kind of indicator or system is telling you that the arduino is not measuring the voltage properly? That is.... what method are you using to know that the arduino is not functioning for the case when the laptop is not connected?

Yes I use the USB port and the Serial window in the Arduino IDE. To read that it's not working properly I use a LCD screen which displays the value of the variable which contains what was read at the pin with analogRead.

Thanks for letting me know about that.

Another thing...... the circuit diagram resolution is a bit low, as it's impossible to see every detail (label etc) in the image. So, the general recommendation is (not just for this forum, but anywhere/everywhere), make sure to check diagram for clarity and resolution AFTER you upload it. That is, after uploading, check to see for yourself on your own computer screen to see whether you can read everything clearly (including labels etc). Increase the resolution if you aren't able to see everything clearly.

I'm guessing at the moment that you connected the regulator output to the 'Vin' pin.

Ok...... see what happens if you make the output of your regulator 6 Volt.... instead of 5 V. The extra volt is to account for the diode drop that occurs after the Vin pin.

If you supply 5V to the Vin pin, then the arduino might be getting just 4.3V for actual supply.

Also, if you really are using the Vin pin, and if you really are applying 5V to that pin at the moment, then make sure to avoid 'assuming' things. Check out manufacturer's specs, or ask people how to use the Vin pin if you don't know how to use it to begin with. This is only for helping.

Sorry about the resolution, I'll make sure it's better next time! Please don't hesitate to tell me if you need any precision on the circuit that you couldn't make out on the diagram!

Yes

Southpark:
I'm guessing at the moment that you connected the regulator output to the 'Vin' pin.

Yes I did, and I measured the regulator output to be 4.99V before the pin. I will try to increase the supply voltage and gather info regarding the Vin pin!

Thank you so much for all your help!