For my caving robot project, I have 8 motors for which I need torque control (they will mainly be stalled or nearly stalled.) Each motor is driven by a DRV8801PWPR H-bridge (commanded by one digital and one PWM signal from a STM32F723.) In order to get the torque, I was planning to measure the cu…
Your driver and many others have an external “current sense resistor” (some have internal sensors) , why not use them?
@tlfong01 : the DRV8801 supports external sense resistor (and I’m using one). Even beter, it has the “VPROPI” pin acting as amplifier, in order to be able to use a small resistor while getting decent voltage (specially usefull in a battery powered project like mine, where I don’t want to loose 1V out of 12 in a sense resistor)
(1) My apologies for not reading your question carefully and giving you a silly answer. I read your question again and found that you presented your situation very well. (2) I am curious about your cave exploration robot project. It would be nice if your can show us the robot’s user requirement or spec. (3) I guess you are using DC motors in your project. I happen to be playing with a robot car project, an 4WD/8WD with TMC2160 stepping motor (can also do DC motor) driver (big current > 10A). If I know your motor requirement better, I might suggest BLDC or stepping motors.
@tlfong01 : I have ni idea how to give a complete “description” of my robot on this site without being out of topic (If you have, it might be usefull to refer to it as most of my questions relate to this robot). Or if you are just currious, we could do a skype. For short, it’s a robot to explore vertical narrow cracks, by driving blocked between the 2 opposit walls. Basicaly, the robot is made of 8 arms (2 horrizental “X”) with a wheel at the end of each arm. Each wheel is pushed agains the wall (to avoid the robot slipping down) by a motor (those I’m asking about) pulling some elastic band.
The motors are very small geared DC motors (<1A, weigting less than 20g). The weight is a very important factor for this robot, as the force needed for the arms (ie motor torque) is proportionnal to the weight of the robot. The goal of torque control is to ensure constant force against the walls (ie “constant torque” changing a bit depending on the position of the arms)
(4) Are you using small DC motors such as N20 (see Ref below). Perhaps you can give me the link to your motor. (5) You following spec is good: “a robot to explore vertical narrow cracks, by driving blocked between the 2 opposite walls. (6) Is there are reason using drv8801, and not the possibly improved version drv8833/8871 (also see refs below). (7) The tmc2160/2209 has some advanced features on torque/current (using microstepping/pwm constant current) which might give you some brainstorming ideas. (8) You might also to consider BTN7971B, whose current sensing comparing with drv88xx.
Our discussion is getting TLDR, so let us do our long winded in this chat room.
References to motor drivers with different mot coil current sensing features.
Above references contain typos. It is too late for me to do editing. So I am sending an update.
2 hours later…
Question: How narrow is your vertical narrow cracks, 18 inches, like below?
1 hour later…
drv8833 driving dc motor Problem
I found the above EESE question on drv8833 with Rpi Pico. The OP does not know his motor spec. So perhaps I can use the small N20 motor and experiment with. You can, on your side, try your STM32 your motor and can do sort of pair programming/development.
@Sandro Yes, the “vpropi” pin is good because it save power. The “sleep” pin also saves power. The “fault“pin perhaps also good because it it can warn over current which might mean load/torque over limit, but not sure. I vaguely remember btn7971b has similar current/sensing/fault features, but I have not used it.
(4) -> I’m indeed using N20 motors. More precisely, I bough those in 12V/60rpm version : fr.aliexpress.com/item/…
Usually, I’m not that fond of non specified components, but it’s hard to find that light motors (I already had 2 N20 at home, which worked well), and cost is a critical aspect of the robot, because in real use, there will be a huge risk of loosing the robot due to pilot errors (maybe 10% per operation). As there are 16 motors (8 for the elastics of the arms, 8 for the wheels, it makes a significa…
6) I choose the DRV8801 for 3 main reason :
– it is in stock at JLCPCB
– it uses only 1 PWM input (and one direction input) : I do not have enough timer outputs (even on my 144 pin STM32F723ZE) to spend 2 PWM for each motor. I could do softPWM, or use a single PWM on a 2 PWM controler (ie doing slow decay PWM in one direction, fast decay in the other), but it makes things more complicated
– the VPROPI is a nice aditionnal feature (I can use small (SMD) sense resistors while still having a “big” signal without needing an AOP)
For the DRV8833, it would also do, but I would need softPWM or some external logic in order to use it with a single harware PWM. And it is nearly 5 times the price of the DRV8801, so even if I need 2 times less, it’s also more expensive
For the DRV8871, it doesn’t support external sense resistor (it does internal measurement but without outputing it). It has a I limit pin, that is made to put a fixed current limit (it should be possible to trick it by applying a voltage or current to this pin instead of using a fixed resistor).
I do not know for the DRV8871, but the DRV8870 that I used on the first prototype (at first glance, it seems the same excepted that it uses an external sense resistor) does very poor job on current control when the motor is stalled.
7) tmc2160 : far too complex (requires external mosfets, …)
tmc2209 : only 2 control pins (step and dir) : it can only be used by steper motors
For the width of the crasks, I was aiming for the 15-40cm range (above, humans can pass).
In case for some specific cave I need something a bit larger, I just have to 3D-print some longer arms (it increases a little bit the minimal width, and more significantly the max widths)
For the pins :
– VPROPI : nice for “big” analog signal without big sense resistor nor external OP-Amp
– sleep : not sure it is really usefull : when the robot is on, the motors will have to provide torque all the time. I think that bin is mainly usefull for machines always powered on but not used most of the time. I’m not planning to use it
– fault : it might be interesting (even in in case of a problem, the robot is probably already lost). I was planing to group all fault pin in between 1 to 4 GPIOs, just for the prototyping phase
Just above : the current state of the prototype
3 hours later…
Ah, your cave robot looks interesting. I never thought of something like this before. Long time ago I read about window plane crawler robots for cleaning windows, but that is using a different method.
Now some random brainstorming comments:
N20 is a good choice, I learned many things from Polulu, but I bought the motors from TaoBao. Below is a reference of my learning notes.
How to use motor drivers with H-bridge and PWM input, to control direction and speed of DC motors?
Appendix C, D – (20) TaoBao GA12-N20 Gear DC Motor with Hall Effect Encoder – ¥30
My N20 has rotary encoder. My 8WD is for rough terrain. I am experimenting with different strategies, including the following. (1) All 8 wheels with speed encoder are moving at the same speed, perhaps same PWM frequency and duty cycle. If one wheel suddenly moves very fast, that means it is hanging in the air, perhaps above a hole or something, so no load no torque. But I am only thinking, no tests yet. The thing is that I don’t measure motor coil current, to deduce torque.
Motor current sudden increase means stalled or jammed.
The other reason is that I am trying the driver in “chopper mode“, or constant current mode. You might skimmed that following references for a rough idea of “current chopping”.
(1) Misconceptions about Stepper Motors Explained – MachineDesign 2017feb18
(2) Step Motor Basics – GeckoDrive 2017nov03
(3) What is a chopper drive for a stepper motor? – Dantelle Collins, 2017aug11
(4) Optimized Current Control Chopper Modes – Trinamic
There you are – Chopper Mode (Ref 3).
Yes, tmc2160 or tmc2130 is very complicated, using SPI/UART control. But tmc2130 without the external mosfet switches is very small, not bigger than drv8833.
Ah, I never knew that drv8801 is 5 times cheaper than drv8833, because I am only doing one off prototyping, hoping to learn some new stuff. If one day I am going to make perhaps 500 robots to make some money, of course I will components as cheap as possible, so to make as big money as possible. 🙂
I am using Rpi Pico because it is cheap (US$4), and it has a lot of PWM pins, and also two ADC pins, so is good for testing, not to worry it falling down a cliff or a cave.
Ah, almost bed time. So see you over the weekend. Cheers.
Why all those resources about stepper motors? (Excepted if you know a stepper motor the size of a N20?!?)
For the tmc2130, it has just 2 input pins in total (step + dir), so it can’t be used for 2 DC-motors
For the prices of drv8801 vs drv8871, it seems I was “wrong” : it is just JLCPCB that incrased the price of the 8871 (probably because they are currently hard to come by currently). On digikey, they are about the same price, but 8871 is out of stock
As microcontrolers, I mainly used arduinos until know (the cheap clones are about 3€/$), including just the Atmega328p itself for the first prototype.
For the second prototype, I decided to use a STM32, because it’s a more professional one (it’s a nice addition on the CV for a robotics engineer), and because there are some very powerfull ones (the one I’m using has 144 pin, and runs at 216MHz)
13 hours later…
(1) Just a quick reply to cheap and small stepping motors. You might like to look into “28Byj48”. See Ref 3 of the Reference below.
How can Rpi3B+ use the A4988 stepper motor driver to control a NEMA17 motor? – Asked 2021, Viewed 2k times
28Byj48 Reference below.
How to control unipolar/bipolar stepper/stepping motors such as 28BYJ48 using motor drivers such as L293D
Asked 2002 Viewed 1k times:
2 hours later…
BTW, you might like to skim this post:
Purpose of PWM in a stepper motor driver – Asked 1 month Viewed 90 times
2 hours later…
I am also thinking of making a java hole robot.
Now I am testing my Pico MicroPython Program controlling 4 I2C PCF8574 8-bit IOx modules each of which moves 2 tmc2160 stepper motor controller each moving 1 stepper motor.
The 4WDs in the background are using BLDC and geared DC motors (TT130 and N20s). The tmc2160 can be configured and diagnosed using SPI (I am testing at the same time tmc2190 with UART interface). A full listing of the pico code is shown in the Penzu diary below.
tmc2160_test52_2022叛0501 – penzu.com/p/2a05a9cf
The moon’s java tube can be 500 metres wide. So we need to modify our designs for the moon. 🙂
Lunar lava tube – Wikipedia
2 hours later…
Motor Coil Current Measurement Notes – Introduction
Now I am making a plan to measure motor current, which is what the OP is asking for. I am doing it in two steps: (1) Using a resistor, perhaps 0.5 ohm, in series with the motor coil to ground. I can use a scope to display the current waveform. (2) use a current mirror/amplification chip to do the job.
The current mirror chip I will be using is the following:
Reference: Current mirror: real-life examples? – EESE Q&A, 2021jan24
And the current mirror/amplification spec:
And my current measurement hardware setup:
Because using the current mirror chip, I need first use a stupidly looking 0.5R resistor and a scope to help getting a rough picture of the motor current waveform.
Ah, locking down supper break. See you later.
1 day later…
Now I have assembled a Rsense current testing setup. I found that 0.1 Ohm is not a good choice, because noise is 50mV. Finally I used 0.5 Ohm For 5 Ohm load and current around 2A. Rsense output of 1.1V looks good. This time is only pilot DC V testing. Next step is to measure DC motor and Stepper motor driver current, both chopper and non chopper mode.
Now I appreciate the DRV8833’s Rsense current amplification circuit, because it saves power.
The last message was posted 13 hours ago.