Page 1 of 1

Multiple stepper motors

Posted: Tue Sep 01, 2020 9:20 pm
by raym3d
Hi.

I want to build 2 robot arms connected to a Raspberry Pi. My problem is that I do not want to make it small and use servo motors. I want to use bigger and more powerful stepper motors... therefore I don't find many tutorials on how to link 8 step motors and control them from a single Raspberry Pi.

Some help?

I plan to use stepper motors like these (4 on each arm):
3 Nm - 30 kg-cm
https://www.amazon.com/Torque-Stepper-M ... B00PNEPW4C

2.4 Nm - 24 kg-cm
https://www.amazon.com/STEPPERONLINE-Cu ... B00PNEPKH6

2.2 Nm - 22 kg-cm
https://www.amazon.com/RTELLIGENT-Stepp ... B07WG56CN4

1.9 Nm - 19 kg-cm
https://www.amazon.com/STEPPERONLINE-St ... B077Z5QJCL

Note: I use the Raspberry Pi 4 (4GB). I have no problem buying another/s.

Regards.

Re: Multiple stepper motors

Posted: Wed Sep 02, 2020 6:30 am
by pootle
While a pi can drive 2 or 3 steppers with simple driver circuits very well, 8 is challenging if you want to drive them at speed. I would suggest using smart drivers such as those from TMC. Starting at this level you will have to write a lot of software unless you have a framework (like ROS) in mind.

Re: Multiple stepper motors

Posted: Wed Sep 02, 2020 9:30 am
by cleverca22
if your motor controller uses step and direction lines, then it is possible to abuse the DPI peripheral to drive 12 at once with ease and stable timing
cleverca22 wrote:
Thu Jul 09, 2020 4:08 am
you might be able to abuse the DPI to drive up to 12 steppers at once, with relatively low overhead and high precision to the speed and step counts

the intended use of the DPI is to take a 24bit-per-pixel image from ram, and blast it out 24 GPIO pins at a defined pixel clock
with a pause between each scanline for hsync and front/back porch, and a longer pause for vsync and its porches

the DE signal (display enable?) on gpio1 tells you when its valid pixel data (not a sync or porch)

https://github.com/librerpi/rpi-open-fi ... #L142-L185

and this example code, will shove a uart stream into one of the color channels

in theory, you could take each bit in the 24bpp, and treat it as a seperate digital signal, and then just fill the image data with step&direction pairs

for example, take the red channel, bits 0:1 control one stepper, 2:3 control a second stepper, and so on, up to 12 steppers total

and then DE is tied to the enable pin (though all 24 bits go low during sync anyways, so thats not a step pulse)

then all you need to do is generate a frame of image data, that moves all of the steppers at the desired rate&direction (you can even change direction mid-frame or stop mid-frame), and use the DRM page-flipping api to switch to the next packet or a "hold" packet (all 0's)
i have mentioned this idea before in viewtopic.php?f=37&t=279294 and the above is just a quote from that post

Re: Multiple stepper motors

Posted: Thu Sep 03, 2020 8:55 am
by clicky
Depending on your level of skills you could drive stepper motors directly by DMA from RPi as Brian did here:
https://blog.usedbytes.com/2018/06/motors/
https://blog.usedbytes.com/2019/02/mini ... -software/
and
https://github.com/usedbytes/yapidh

Re: Multiple stepper motors

Posted: Thu Sep 03, 2020 10:41 am
by cleverca22
clicky wrote:
Thu Sep 03, 2020 8:55 am
Depending on your level of skills you could drive stepper motors directly by DMA from RPi as Brian did here:
https://blog.usedbytes.com/2018/06/motors/
https://blog.usedbytes.com/2019/02/mini ... -software/
and
https://github.com/usedbytes/yapidh
DPI lets you drive things similarly to DMA, but with more flexibility on the sample rates