How to multiplex multiple DRV8833 Dual Motor Drivers?

I am trying to use the Atmega328P with the DRV8833. I don’t have enough pins to power multiple drivers individually at different times both forward and backward (aka h bridge).

Do I use multiplexer or shift register? I’m not sure how they are different??

Both options will work. The first is easier, the second cheaper. Depends on what you want to achieve in the end, and of course what already have in your parts bin.

Motor speed control requires PWM signals, which can not be multiplexed easily.

shai: Do I use multiplexer or shift register? I'm not sure how they are different??

It would be much simpler to get a Mega. The small extra cost would easily offset the extra time needed to implement a multiplexer.

...R

One PWM signal per motor - allows for six motors per ATmega328p. All the other signals through a port extender.

That would at least work for the TB6612FNG which needs only one PWM signal per motor. The DRV8833 has four PWM inputs but I’m not too clear about this (never used that specific motor driver): do you really need PWM for both AIN1 and AIN2, or PWM on one of the two and a simple high/low signal on the other to switch on/off that motor? One PWM per motor should be enough.

Otherwise a PWM extension board may work. 16 channels for 8 (or 16( motors total.

wvmarle: One PWM signal per motor

The DRV8833 needs two PWM inputs if you want directional control.

You could use some external logic gates to "steer" the PWM to the appropriate pin but IMHO using a Mega is much simpler.

...R