1
\$\begingroup\$

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 anyone 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!

EDIT:

This is the schematic of the circuit where the arduino returns the wrong value for the voltage divider (A4)

schematic

simulate this circuit – Schematic created using CircuitLab

This is the schematic where it all works fine:

schematic

simulate this circuit

Don't hesitate to tell me if this is not clear enough, I will draw them again.

\$\endgroup\$
  • 5
    \$\begingroup\$ You should add before and after schematics. It's difficult to figure out what someone means by "connect x to y". There are usually many ways to do that. \$\endgroup\$ – pipe Sep 29 '16 at 18:52
  • \$\begingroup\$ We'd probably need to see exactly what closing the system does electrically. Likely it forces the input to have the wrong voltage with respect to the Arduino's ground. \$\endgroup\$ – David Schwartz Sep 29 '16 at 18:57
  • \$\begingroup\$ I just edited my answer to add the schematics \$\endgroup\$ – Eliott W Sep 30 '16 at 10:53
  • \$\begingroup\$ can you be more specific about what is "wrong"? numbers would be good. With both USB and VIN connected, the power should still be selected from the regulator, so the most significant difference I can see is the USB has changed the ground reference: does that give you any clues? (see arduino.stackexchange.com/questions/893/…) \$\endgroup\$ – tardate Sep 30 '16 at 11:43
  • \$\begingroup\$ Yes thank you. The arduino should basically return about 58.5V to the LCD, which it does when the USB is plugged in. However, when it is not plugged to the USB but the regulator only it returns a value of 70V exactly. I actually just realised that this means the Arduino is reading it as superior or equal to 5V as the voltage divider divides by 14. SO it does seem to be a grounding problem. How could I solve this? \$\endgroup\$ – Eliott W Sep 30 '16 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.