For a update to a small robot I am doing, I am controlling a robot using the Pi. This works very well but I would like to add more precise control, using PWM on the H bridge that controls the motors, similar to what is described here. My problem is that the Pi only seems to have one available (GPIO hardware) PWM output, so I can't easily variably control more than one motor in one direction.
I do already know of the following additional options
- software-based PWM (examples: [ 1] )
- additional hardware that can do multiple PWM outputs (example)
Which may be easier, but I think one other way I could use it is to get the Pi's solitary GPIO PWM output to output a signal (which can be used to half power the motors when needed), and then use SOMETHING to send the signal to the relevant H bridge inputs when needed:
This would be part of a circuit that would also does other stuff - e.g. alternatively supplies a full signal to the motor controller input(s) so the motors go at full speed
My question, is what would be the best way to control where the signal goes from the Pi?. NPN transistors etc will likely mess up the signal, and most relay are overkill for this sort of need thing.
Using a Raspberry Pi 1 B (probably will upgrade to Pi 2 when have enough time/money), with L293D chips (the same as in that Adafruit article) to control two sets of motors.