Current sensing - ROS2 and others

24 views
Skip to first unread message

Sergei Grichine

unread,
Feb 17, 2025, 10:43:45 AM2/17/25
to hbrob...@googlegroups.com
Hi All,

it's useful to keep an eye on total current consumption in a robot - especially if you can program a behavior to back out of "wheels stuck" situation and other magic grey smoke events.

Some motor controllers provide feedback values for monitoring, others do not.

There are dedicated sensors with analog and I2C interfaces, for "high side" and "low side" current monitoring:

The sensor signal can then go to Arduino's A/D or I2C, and then be forwarded to ROS2 to become "current" member of the BatteryState message (https://docs.ros.org/en/jazzy/p/sensor_msgs/msg/BatteryState.html). Or, could be published via MicroROS or any other way.

For those who already have a digital V/A meter (https://www.amazon.com/Aideepen-Digital-Voltmeter-Multimeter-Red-Blue/dp/B0CP593Z2P) on a robot and don't want to add another shunt resistor to the circuit - there is a way to use that meter's shunt directly. All you need is an amplifier and a free A/D pin on your MC.

Here's my artistic rendering of such device for my robot Plucky (hey, robotics is art, not engineering ;-)):

image.png
image.png


--
Best Regards,
-- Sergei

Michael Wimble

unread,
Feb 18, 2025, 12:58:14 PM2/18/25
to hbrob...@googlegroups.com
I’m still recovering from a severe cold, so my brain is mostly fried. But:

* If you try to measure current on the wires going into the motors, be sure to remember that there will be plus and minus currents as the spin direction changes. A lot of current circuits only read current in one direction.

* The current variation from my CPUs spinning up into high performance mode is about as big as the current variant from my motors, so a single current reading probably won’t let me know if the motors are stalling — well, not without incorporating other sensors like an accelerometer.

* When motors stall, you don’t have very long to react before windings melt. Certainly less than a second for several small robots I made. I try to react in, say, a couple of tenths of a second after getting a few successive spike readings. On my bot, I read the current from the RoboClaw via a serial request that happens probably a few dozen times a second, and I use the usual tricks to make sure that all of the components wanting to read and write to the RoboClaw get serialized and prioritized so the RoboClaw doesn’t get overwhelmed and go into reset mode.

* I’ve tried a lot of current reading devices over bits of my robot and have settled on generally using Hall effect sensors. You run the main power wire through a core, and then the sensor can read current in either direction with good speed and accuracy and is completely isolated from the voltage on the wire itself.

* Always be aware of back EMF pulses from the motors. That’s why I put my motors through an isolating supply so the sometimes more than 1KV back EMF voltage spikes never make it to my other devices. I always use a shunt regulator across the power going into my motor controller (https://www.pololu.com/product/3779). I’ve even fried these devices a couple of times. Again, the power kickback from a heavy motor on a heavy robot moving along at a good clip and then slamming into something so that the wheels stop spinning is HUGE. I've melted the windings on a dozen Pololu 25D and 37D motors in my tablebots before I finally gave up on them and went with motors with much bigger wire gauge windings.

On Feb 17, 2025, at 7:43 AM, Sergei Grichine <vital...@gmail.com> wrote:

Hi All,

it's useful to keep an eye on total current consumption in a robot - especially if you can program a behavior to back out of "wheels stuck" situation and other magic grey smoke events.

Some motor controllers provide feedback values for monitoring, others do not.

There are dedicated sensors with analog and I2C interfaces, for "high side" and "low side" current monitoring:

The sensor signal can then go to Arduino's A/D or I2C, and then be forwarded to ROS2 to become "current" member of the BatteryState message (https://docs.ros.org/en/jazzy/p/sensor_msgs/msg/BatteryState.html). Or, could be published via MicroROS or any other way.

For those who already have a digital V/A meter (https://www.amazon.com/Aideepen-Digital-Voltmeter-Multimeter-Red-Blue/dp/B0CP593Z2P) on a robot and don't want to add another shunt resistor to the circuit - there is a way to use that meter's shunt directly. All you need is an amplifier and a free A/D pin on your MC.

Here's my artistic rendering of such device for my robot Plucky (hey, robotics is art, not engineering ;-)):

<image.png>

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hbrobotics/CA%2BKVXVMaiotq8qFyPqPEBQuBDn46gptnLd%3D2qXMqhn1sb9FhDA%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages