Controlling hundreds of micro DC motors with only digital I/O?

Hey there all,

I have some mini coin motors about the size of a pea for each motor.

Each motor takes 3V to spin maximally. The direction of the spin doesn't change much here so I'm not worried about it (no H bridge if possible)

I've been wondering how to control hundreds of DC motors with some sort of decoder chip set up (only a few digital pins to have 2^N bit values)

This is a pretty open ended issue so any solutions that are cheaper than getting a board with hundreds of PID outputs (extremely expensive).

The goal here at the end of the day is the motors will be configured to run as one motor always being the center of other motors in the matrix, and sharing ON/OFF time for a percentage of a 100ms timeframe.

For example a 3x3 matrix, the central motor runs for about 76ms, and the other motors run for 3ms each.

Thanks!

EDIT: Added context from below
Alrighty to be more specific this matrix is imagined as a 2d matrix, but it will not be a perfect rectangle

This project has to do with a haptic suit I am designing where in by the user while in virtual reality can have other users interact with them via virtual points that correspond with a point on the body (or a point in the matrix)

For example, on my right arm I plan to have 100 motors from my fingertips to my shoulder / armpit

The motors on how they run should be strongest at the point where something is touching their virtual body, and like normal touch the nearby motors will be less intense.

To simulate this touch intensity, I would want to run motors for a certain percentage of a set cycle of time, for this case to be undetectable by the user 100 ms intervals are the highest we want to go.

Each motor will run in correspondence with the location being touched in VR on this uneven matrix wrapping around the arm.

It's an interesting project to say the least, my friend and I working on researching the shortcomings and hurdles found that it would be cheaper to use one Arduino if possible, and use digital outputs to an encoder to interact with the motors. No need for an H bridge or bidirectional control as we are simulating PWM with programmed clock intervals instead of using a PID output which gets expensive. Digital only.

Essentially the gross oversimplification of two problems is what I need to solve first I need to make sure I can access every single motor individually preferably via some sort of binary value

The second objective is with the ability to access every motor individually I should be able to activate half of all of the motors at the same time at full power if that is even a possibility minimally a quarter if I can only do one at a time and it's impossible to do it any other way without breaking the bank then we'll look into those solutions

What voltage and current do they need? Does more than one run at a time?

So based on the motor limit, 3V is the requirement

They will never run exactly at the same time, only taking up portions of an interval of 100ms

So out of 9 motors, each one takes a slice of time to be on at 3V

There might be a need to make separate groups to allow for "simultaneous motor control"

Hard for me to describe since I'm more software facing than hardware.

How many motors in the final matrix?

What are the number of rows and columns?

Do you literally mean only one motor will need to be energized, no matter for what small or large duration, at once?

Please just describe the end goal fantasy project you are working towards, your dreaming and we can't read dreams. We a;prove of dreams, but we not mind readers.

a7

Alrighty to be more specific this matrix is imagined as a 2d matrix, but it will not be a perfect rectangle

This project has to do with a haptic suit I am designing where in by the user while in virtual reality can have other users interact with them via virtual points that correspond with a point on the body (or a point in the matrix)

For example, on my right arm I plan to have 100 motors from my fingertips to my shoulder / armpit

The motors on how they run should be strongest at the point where something is touching their virtual body, and like normal touch the nearby motors will be less intense.

To simulate this touch intensity, I would want to run motors for a certain percentage of a set cycle of time, for this case to be undetectable by the user 100 ms intervals are the highest we want to go.

Each motor will run in correspondence with the location being touched in VR on this uneven matrix wrapping around the arm.

It's an interesting project to say the least, my friend and I working on researching the shortcomings and hurdles found that it would be cheaper to use one Arduino if possible, and use digital outputs to an encoder to interact with the motors. No need for an H bridge or bidirectional control as we are simulating PWM with programmed clock intervals instead of using a PID output which gets expensive. Digital only.

If you "pulse" a regular motor for 3ms it's probably not going to move at all! 76ms is still a bit questionable depending on the motor, inertia, and load, etc.

With serial addressing it just takes 3-output pins and daisy-chained shift registers you can control an almost unlimited number of on/off outputs (no dimming or motor speed control). I've got something "similar" controlling 48 LEDs individually.

Each motor will need a transistor or MOSFET driver. (A shift register chip can't power a motor, nor can the Arduino output pins.)

This is closer to what we imagined as well with the MOFSETs usage

I guess the interval to spin is because if we can only have one motor on at a time, 100 Ms is brushing up against the maximum time motors can be interweaving before the user notices motors actually turning off and on (to simulate the sense of touch and feeling as if the motor is on constantly)

The interval of being turned On/Off also simulates intensity of a touch with a motor, without having to actually worry about motor spin speed.

@DVDdoug @alto777

Sorry I don't usually use these forums the replies I made for you are up above :slight_smile:

Essentially the gross oversimplification of two problems is what I need to solve first I need to make sure I can access every single motor individually preferably via some sort of binary value

The second objective is with the ability to access every motor individually I should be able to activate half of all of the motors at the same time at full power if that is even a possibility minimally a quarter if I can only do one at a time and it's impossible to do it any other way without breaking the bank then we'll look into those solutions

Look at a chip of the TPIC shift register family. The TPIC6B595 can drive eight 150mA loads.
I once daisy-chained 24 of those, and controlled them with SPI. That's 192 outputs.
All that the chips need is a 100n bypass cap on the supply pin.
Leo..

I'll take a look! And they seem pretty well priced! Thanks for the pointer

This is your best approach, maximum flexibility solve all problems in software.

I see the TPIC6B595 for $1.66 in quantities > 10, still cheaper then wimpy shift registers and MOSFETs.

You'll need a diode per motor also.

In the software, you can use a bit array to turn on and off individual motors by number

https://www.arduino.cc/reference/en/libraries/bitarray/

then use a simple function to blast it out accessing the underlying bytes directly. You should be able to use the SPI hardware.

You may need or want to use several chains if you do want to PWM many motors. Sounds like a bit of scratching on the back of the old envelope to see what kind of time it will take to shift out to how many motors, just thinking out loud here so to speak.

The whole thing is starting to sound wonderfully insane. But it is easy to think through before too much money is wasted.

There are faster microprocessors, but I do not know that would automatically mean faster SPI peripherals on those chips.

a7

I've run SPI on a Teensy 3.2 around 20Mhz clock rate.

Not with TPIC chips.
They have 'active clamping'.

I don't see the need for faster SPI.
I could control 48 motors with a common Nano in a few hundred microseconds.
Leo..

The TPIC6B595 is a nice choice and external diodes are not needed as protection is built in per the data sheet. EAS Single-pulse avalanche energy (see Figure 11) 0 30 mJ, IAS Avalanche current(5) 0 500 mA.

OK. The data sheet just shows a single open drain MOSFET per output which led me to think a diode would be necessary,

a7

This is fantastic stuff, thanks everyone for the pointers! I'll be sure to update the project progress with questions and general progression once we get to the second or third stage with prototyping for the arm.

I still don't see where you say how much current each motor needs? A key requirement.

I'd also be interested in the physical layout and wiring scheme. How will all the motors be mounted and held in place? Where are the controller ICs going?

I built something similar with a smaller matrix of vibration motors around, um, 15 years ago I think? All I remember is that the person I did it for was making some kind of a game.

Connect them in a matrix with rows being current sources (ULN2981/2987, now made by Micrel) and columns being current sinks (ULN2803). Those two chips will control an 8x8 matrix with 16 pins. Expand as needed.

You can do the same with fewer pins using sink/source power shift registers as mentioned above. I remember the parallel version working well but I ran into a problem with the shift registers, possibly because the processor I was using couldn't update them fast enough. Too long ago to remember the details...

I think I actually still have a handful of Micrel 2981's from that project! ISTR that it was prototyped with ULN2987 but the 2987 has a current limit and kept shutting the motors off.