Uncategorized

tmc2160 notes

load older messages load to my last message full transcripthighlights

Feeds

Feeds

yst 12:28

3

Q: Motor torque control with PWM : how to measure current?

SandroFor 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…

pwm current-measurement control torque

tlfong01

tlfong01

Your driver and many others have an external “current sense resistor” (some have internal sensors) , why not use them?

Sandro

Sandro

1766

@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)

tlfong01

tlfong01

6932

(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.

Sandro

Sandro

1766

@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)

tlfong01

tlfong01

6932

(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.

(1) drv8801/8833/8871
electronics.stackexchange.com/…
tmc2160/2209 chat.stackexchange.com/rooms/…

(2) btn7970/7971B
(2.1) electronics.stackexchange.com/…
(2.2) electronics.stackexchange.com/…

(see full text)

Above references contain typos. It is too late for me to do editing. So I am sending an update.

(1) drv8801/8833/8871
electronics.stackexchange.com/…

(2) btn7970/7971B
(2.1) electronics.stackexchange.com/…
(2.2) electronics.stackexchange.com/…

(3) tmc2130/2160/2208/2209
(3.1) raspberrypi.stackexchange.com/…

(see full text)

2 hours later…

tlfong01

tlfong01

6932

yst 14:24

Question: How narrow is your vertical narrow cracks, 18 inches, like below?

(1) allthatsinteresting.com/…

(2) corimsimmons.wordpress.com/…

(3) kutv.com/news/local/…

(4) theatlantic.com/science/…

(5) masslive.com/news/2018/06/…

1 hour later…

tlfong01

tlfong01

6932

yst 15:51

drv8833 driving dc motor Problem
electronics.stackexchange.com/…

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.

user image

@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.

Sandro

Sandro

1766

yst 16:50

(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…

(see full text)

Sandro

Sandro

1766

yst 17:08

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)

(see full text)

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

Sandro

Sandro

1766

yst 17:45

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

(see full text)

user image

Just above : the current state of the prototype

3 hours later…

tlfong01

tlfong01

6932

yst 21:09

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?
electronics.stackexchange.com/…

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
machinedesign.com/…

(2) Step Motor Basics – GeckoDrive 2017nov03
geckodrive.com/support/…

(3) What is a chopper drive for a stepper motor? – Dantelle Collins, 2017aug11
linearmotiontips.com/…

(4) Optimized Current Control Chopper Modes – Trinamic

(see full text)

There you are – Chopper Mode (Ref 3).

user image

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.

Sandro

Sandro

1766

yst 22:24

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…

tlfong01

tlfong01

6932

11:03

(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
raspberrypi.stackexchange.com/…

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:
raspberrypi.stackexchange.com/…

(removed)

2 hours later…

tlfong01

tlfong01

13:19

BTW, you might like to skim this post:

Purpose of PWM in a stepper motor driver – Asked 1 month Viewed 90 times
electronics.stackexchange.com/…

2 hours later…

tlfong01

tlfong01

6932

15:48

I am also thinking of making a java hole robot.

user image

nanowerk.com/news2/space/…

tlfong01

tlfong01

6932

16:18

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.

tmc2160 pico test 2022feb0501

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.

(removed)

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
en.wikipedia.org/wiki/…

tlfong01send upload…
help | faq | legal | privacy policy | mobile

all rooms  site rooms

Discussion between tlfong01 and Sandro

Imported from a comment discussion on electronics.stackexchange.com/questions/607017/…

control current-measurement pwm torque

leave (all) | Electrical Engineeringroom▼ | info

  • tlfong01

not the room you are looking for?

There are other rooms, with 38 users currently talking in 33 rooms.

enable desktop notification

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.