I am attempting to read voltage from a 6S LiPo battery for a quadcopter test stand. I am using a voltage divider as shown in the below schematic so that I can read from an analog pin on my Arduino Mega.
When I attach the battery, analogRead() works as expected and matches a multimeter reading from the battery. However, the instant I attach a load to the battery (turn on the quadcopter), the Mega stops sending Serial data!
I have isolated the issue to the code line that reads from the HX711 load cell. However, when I disconnect the ground from the battery, the code works as expected. Is this some sort of ground loop I'm missing? I am inexperienced in electronics and open to any suggestions.
If the "load" is a quadcopter with high current motors, all the wiring radiates severe electrical noise, which is easily picked up by long, loose wires connecting the various modules. That can lead to unwanted behavior and even processor resets.
Please post a photo of your setup and explain how the Arduino is powered.
Is there a fly-back diode on the motor, an extra capacitor on both between B+ & B- as well as between GND and A0, (or just across the whole volatge divider after bot separating diodes are in place, 1uF should do) and i think there should be a diode between B+ and the 100K resistor.
Somehow ideally you would want also the GND line separated with a diode, so also a diode between 22K resistor an B- with the cathode on B-
I suspect that the motor, with it's really low resistance, pulls up the GND level of the Mega.
I am guessing noise is not the issue, because when I run the identical circuit with the battery disconnected from the voltage divider, it works as expected.
This is correct, I am sending voltage data to a laptop through serial. I understand there can be issues with two seperate GNDs, so I've connected the Arduino GND to the battery minus at the end of the voltage divider.
I have added a diode between B+ and 100K resistor to test. The same issue occurs, and now the voltage reading is ~0.5V off from my multimeter. I need to rummage around to find some capacitors to add as suggested.
@razorxy
That is a clue as to what is wrong
There are probably voltage spikes on the battery negative, causing the Mega to reset.
How to fix it is to be determined.
Update: I have resolved the issue. The problem was not with the voltage divider, but from what I thought was an independent part of the circuit. The motor I was testing had its housing connected to battery negative. I foolishly had attached this directly to an aluminum frame for my load cells. When the motor began spinning, this caused a spike in the battery negative which traveled trough the sensitive load cells and disabled the Arduino. By insulating the motor from the test stand the issue was fixed. Thank you all for your help debugging this.