The GoPi5Go-Dave Uncertainty Principle, also known as the “What Is That Robot Thinking?” principle, shows up an interesting “Sense-Think-Act” issue. GoPi5Go-Dave sits on his dock sensing the current flow. It has happened more than once, that I sit down at the computer to check on Dave’s /batter_state topic, only to hear Dave announce “Charging at xx [xx < 100] milliamps, calling undock service”, and the battery_state topic reports the battery to be charged to 99%.
2024-09-09 23:52|dave_node.py| ---- GoPi5Go-Dave ROS 2 Undocking at Charge Current -100 mA 12.13v after 2.6 h charging
...
2024-09-10 05:19|dave_node.py| ---- GoPi5Go-Dave ROS 2 Undocking at Charge Current -100 mA 12.15v after 2.6 h charging
...
2024-09-10 10:42|dave_node.py| ---- GoPi5Go-Dave ROS 2 Undocking at Charge Current -100 mA 12.15v after 2.5 h charging
2024-09-10 10:43|[logMaintenance.py.main]** checking battery_state caused early charging state termination **
Since normally the current jumps quite a bit, Dave measures the average current at three instants 20ms apart. It appears that my request’s additional computational load, as the charging is nearing the chosen 100mA limit, causes the measured charging current to dip enough to trigger an early undock.
Perhaps I need to check the average current three times some seconds apart, or just live with my paranoia confusing Dave.
More important: Why is the current jumping so much?
Is the supply folding back under load
Wire size?
Current capacity of the supply?
Have you looked for high frequency noise that might be affecting the readings?
Maybe you should add some filtering?
Idea:
I opened up an older surge-supressor power strip whose socket contacts had come loose. Inside was a pretty decent pi-filter (no pun intended!), between the two sides of the line to earth ground.[1]
Connecting something like this in-line with the two charging output leads, with the center going to earth might help.
I would suggest that you characterize the problem and try to find out what’s happening before just shotgunning a solution.
European mains power doesn’t have a specifically designated “neutral” wire in the sense that U.S. mains power does. (i.e A wider contact pin on one side or a specially polarized plug.) As a consequence any plug, including grounded plugs, can be inserted in either direction.[2] Therefore treating each side of the line as if it’s the hot side makes sense. I don’t remember how U.S. style surge suppressors are wired.
In fact, I have seen situations where people working on the outside power lines themselves have broken the mains-power circuit, done something, and then rewired the outside, pole-power leads in the opposite polarity, (hot to neutral and neutral to hot).
Because of this, any house-wiring designs I have done here[3] have to be done assuming that either line can be the “hot” line and the presence of a properly wired safety (earth) connection and properly wired GFCI circuit breakers is much more important.
I do most of my own design work, (or carefully check the work of others), because the so-called “professionals” here leave much to be desired, at least in some cases. The house we’re currently living in was wired by one of these (so-called) “professionals”. It was so poorly, (and dangerously!), done that I had to completely rebuild the circuit breaker box, (it caught fire), re-pull every inch of wire in the house, and replace the outlets with something other than the flimsy junk that the original installer used.
the normal fluctuating current draw of the Raspberry Pi due to the varying processor load from the task scheduler and
the “smart” battery charger that is charging the battery, unaware that there is an active load on the battery.
The RPi wants 6-7W from whomever will supply it - the battery or the battery charger. The charger starts out supplying 14-15W to the “battery+GoPiGo3_supply” and eventually decreases the power delivered to 1.2W (12.1v at 100mA). The RPI still wants 6-7W but somehow the charger is able to charge the battery at 100mA while the Battery is draining at 500-600 mA. (That is what the sensor “thinks” that is).
An inductive filter between the battery and the robot to smooth out the current profile.
A pair of current monitors - one for charging current between the battery and the charger and one between the battery and the robot’s input filter to measure the power consumption of the robot.
I would recommend a biflar wound inductive filter of a few (μ?)henry’s calculated based on the noise frequency.
A capacitive bypass at the Raspberry Pi side of the filter might be good too.