pedrox
Posts: 7
Joined: Fri Aug 07, 2015 1:35 pm

How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 1:46 pm

Dear Friends,
I know a little about GPIO and I controlled 4 motors (DC/Stepper/Servo/...) with GPIO pins at same time. But if I want control about 100 or more motors(DC/Stepper) with one raspberry, is it possible?

Thanks

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 1:55 pm

yes.

pedrox
Posts: 7
Joined: Fri Aug 07, 2015 1:35 pm

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 1:58 pm

Dear mahjongg,
Thanks but how?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 2:01 pm

oh, you want to know how?

if no PWM control is necessary (stepper motors only), I would use I2C I/O expanders (with 8 16-bit I/O expanders you can control 128 output pins).
If however you do need PWM control, I would use as many small microcontrollers as needed, and control them serially in a master/slave configuration, with the one serial output sending data to all the microcontrollers in parallel, with a software protocol to select a microcontroller to control.

pedrox
Posts: 7
Joined: Fri Aug 07, 2015 1:35 pm

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 5:40 pm

thank you, I'll google it, however I can't find any good article/sample to control motors with these MCP4922 like microchips.

User avatar
mikronauts
Posts: 2749
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 6:01 pm

It is impossible to give you more help without knowing what motors you need to control as different motors have different interfaces (gear motor, stepper motor, servo motor, brushless DC motor) and require varying voltages and current.

Which is why you get generic (and accurate) answers like "yes, it is possible"

The physical layout of how far the motors are from the Pi's etc also matters greatly.
pedrox wrote:thank you, I'll google it, however I can't find any good article/sample to control motors with these MCP4922 like microchips.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

pedrox
Posts: 7
Joined: Fri Aug 07, 2015 1:35 pm

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 6:49 pm

Thanks mikronauts,
my question is about controlling about 100~200 micro stepper motors (something like this: http://www.amazon.com/10PCS-Phase-stepp ... QRYVMTZ7F8) with one raspberry pi.
I could manage 4 motors with L298N driver before, but now for about 100+ motors I need more than 400 GPIO pins!! and I didn't know how can I handle them.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How many Motors can control with one RaspberryPi

Fri Aug 07, 2015 10:01 pm

use a dedicated stepper motor driver IC (for each motor), like this one:
https://learn.sparkfun.com/tutorials/ea ... k-up-guide

this can be configured so it uses just one GPIO to make the stepper motor step, (STP) and one global direction output GPIO for all stepper motor drivers (DIR) to control in which direction to step.

With that many motors to control I still would use an arduino (or about 20 of them) to control the stepper motor drivers.

I'm curious, why do you need that many stepper motors? Art project?

pedrox
Posts: 7
Joined: Fri Aug 07, 2015 1:35 pm

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 1:48 am

Yes, exactly it's an art project.

User avatar
mikronauts
Posts: 2749
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 2:29 am

200x motors = 200x stepper motor controller IC's and 400 digital I/O's if each motor must be stepped independently

My friend... I am not sure you realize you are talking about many hundreds of dollars to even have a chance of making it work.

Not to mention wiring it all up.

Have you tried those stepper motors? are they powerful enough for your application?

Having said that, it sounds like a neat project.
pedrox wrote:Yes, exactly it's an art project.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 6:04 am

200x motors = 200x stepper motor controller IC's and 400 digital I/O's if each motor must be stepped independently
Err no, about one GPIO for each stepper driver PLUS one GPIO for a global direction bit, so for 200 stepper motors you need 201 GPIO's. still too much for 8 (the maximum) I/O expanders, with 16-bit I/O expanders you can do 128 GPIO's.
Still other solutions do exist, like using shift registers with output latches, but you need to shift a lot of bits through them, which would make it slow.
Yet another (relatively cheap) solution would be to build an 1 of 200 decoder by cascading several 1 of 16 decoders. With the 200 decoded outputs you can select (with an 8-bit binary word) one of the 200 outputs to generate a STP (step) pulse to the stepper driver.

If you want to step all motors simultaneously the best solution would be to control groups of 10 or so steppers with one arduino, and controlling 200/10 = 20 Arduinos by the PI through the serial port (UART) in the PI. Cheap arduino clones for a few euro do exist.

plugwash
Forum Moderator
Forum Moderator
Posts: 3546
Joined: Wed Dec 28, 2011 11:45 pm

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 6:50 am

mahjongg wrote: If you want to step all motors simultaneously the best solution would be to control groups of 10 or so steppers with one arduino, and controlling 200/10 = 20 Arduinos by the PI through the serial port (UART) in the PI. Cheap arduino clones for a few euro do exist.
Or just use a bare AVR (or PIC if that's your thing) chip.

At this scale i'd probablly be looking at doing a custom PCB with 10 motor control chips and a microcontroller. Then as mahjongg suggests connect them to the Pi over serial.

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 8:13 am

mahjongg wrote:If you want to step all motors simultaneously the best solution would be to control groups of 10 or so steppers with one arduino, and controlling 200/10 = 20 Arduinos by the PI through the serial port (UART) in the PI.
Or use ten Raspberry Pis instead of one? Depends how "real time" the motor control needs to be. Throughput of the communication channel between processors can become a bottleneck. Ethernet is quite fast for data transfer.

User avatar
joan
Posts: 14756
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 8:42 am

pedrox wrote:Yes, exactly it's an art project.
May I ask who is going to wire up those steppers? They are tiny and I don't see that a soldering beginner will have much success in putting them to use.

User avatar
mikronauts
Posts: 2749
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: How many Motors can control with one RaspberryPi

Sat Aug 08, 2015 2:22 pm

You are entirely correct if he wants all the steppers to move at once.

Cheapest would probably a long array of shift registers, without stepper chips, assuming that the '595 had enough drive current for the stepper, and that he did not need to move all the steppers often.

The OP has to give us more detail on how he wants to use the steppers before we can optimize a solution for him, however has he even tested those motors to see if they have the torque he needs for his application?
mahjongg wrote:
200x motors = 200x stepper motor controller IC's and 400 digital I/O's if each motor must be stepped independently
Err no, about one GPIO for each stepper driver PLUS one GPIO for a global direction bit, so for 200 stepper motors you need 201 GPIO's. still too much for 8 (the maximum) I/O expanders, with 16-bit I/O expanders you can do 128 GPIO's.
Still other solutions do exist, like using shift registers with output latches, but you need to shift a lot of bits through them, which would make it slow.
Yet another (relatively cheap) solution would be to build an 1 of 200 decoder by cascading several 1 of 16 decoders. With the 200 decoded outputs you can select (with an 8-bit binary word) one of the 200 outputs to generate a STP (step) pulse to the stepper driver.

If you want to step all motors simultaneously the best solution would be to control groups of 10 or so steppers with one arduino, and controlling 200/10 = 20 Arduinos by the PI through the serial port (UART) in the PI. Cheap arduino clones for a few euro do exist.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

pedrox
Posts: 7
Joined: Fri Aug 07, 2015 1:35 pm

Re: How many Motors can control with one RaspberryPi

Thu Aug 20, 2015 7:32 pm

I found this board, but I have another question, How can I access to the PINs and how is my addressing when I connect four same boards together.?
viewtopic.php?p=805370#p805370

PiGraham
Posts: 3778
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: How many Motors can control with one RaspberryPi

Thu Aug 20, 2015 7:59 pm

This chip could be used to drive 32 steppers from one i2c bus
http://www.onsemi.com/pub_link/Collater ... 0622-D.PDF
Might be a starting point.

AAT
Posts: 1
Joined: Wed Feb 14, 2018 6:26 am

Re: How many Motors can control with one RaspberryPi

Wed Feb 14, 2018 6:35 am

I am currently doing the same sort of project. Just gone through all the searching and find yours. In my case I want to control 100 servos by Raspberry pi. But unable to find a feasible solution though found some extensions but still it would be great help if u share something valuable (solution if u found one).
Thanks

pcmanbob
Posts: 8338
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How many Motors can control with one RaspberryPi

Wed Feb 14, 2018 12:26 pm

AAT wrote:
Wed Feb 14, 2018 6:35 am
I am currently doing the same sort of project. Just gone through all the searching and find yours. In my case I want to control 100 servos by Raspberry pi. But unable to find a feasible solution though found some extensions but still it would be great help if u share something valuable (solution if u found one).
Thanks
If you want to control 100 servos then i suggest you use i2c servo driver boards.

The Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface looks like it might be just what you need.

https://www.adafruit.com/product/815

https://learn.adafruit.com/adafruit-16- ... spberry-pi

It's an i2c-controlled PWM driver with a built in clock. That means that, unlike the TLC5940 family, you do not need to continuously send it signal tying up your microcontroller, its completely free running!
It is 5V compliant, which means you can control it from a 3.3V microcontroller and still safely drive up to 6V outputs (this is good for when you want to control white or blue LEDs with 3.4+ forward voltages)
6 address select pins so you can wire up to 62 of these on a single i2c bus, a total of 992 outputs - that's a lot of servos or LEDs
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: How many Motors can control with one RaspberryPi

Wed Feb 14, 2018 9:08 pm

The max 6v outputs is on the PWM channel and is a cut and paste from the data sheet for the PCA9685 chip which was designed to run LEDs and have the LEDs power from directly the PCA9685 chip.

If you look at the schematics of the board https://learn.adafruit.com/assets/36269 you will see that the chip is powered from the VCC(usually jumpoed from the RPi) not the J1 block where you connect the power supply for the servos. The J1 block connects directly to the servos only passing through reverse protection so you can power the servos on what ever the traces on the board can handle (much larger than 6v). The PCA9685 chip only supplies the servo signal pin the needed PWM duty cycle to control the servo position.

It is a great chip because as stated above you can chain a lot together and run up to 992 PWM channels off 1 I2C bus :)

MV911
Posts: 1
Joined: Wed May 22, 2019 11:45 am

Re: How many Motors can control with one RaspberryPi

Wed May 22, 2019 11:48 am

can i use multiple stepper & dc motors with raspberry pi?
& can you please tell me that for my purpose arduino is good or raspberry pi

Return to “Automation, sensing and robotics”