Switch PWM signal to two destinations

arduinopwmswitchingtransistors

Sadly i am not really experienced with electronics, i have recently obtained an Arduino and a motor driver and i am trying to hookup some lego motors.
My motor driver outputs 2 signals, one for direction (high/low) and one for speed (PWM).
My lego motor (Power functions medium) has 2 inputs for PWM signals, one forward and one reverse. So i was thinking i could connect these by sending my PWM signal from the motor driver to one of the two inputs based on the direction signal voltage from the motor driver.
What kind of component could do this job? I have been looking into using a transistor as a switch but i am not sure if i will be able to make it work like i want.

Best Answer

So upon looking at that motor, I believe you can not power it directly with Arduino PWM power, you need to buffer the signal because the PWM is directly powering the motor.

The problem here is that digital pins on an Arduino (Atmega 328p and all other microcontolers) are designed to only provide a small amount of current (typically < 20mA). What you really want is an H Bridge system, this is a chip or device that typically takes a single PWM signal and a direction signal. An example of one that would work for you is the L293, Sparkfun and Adafruit have both information and motor control boards based on these chips. The good news is that they still are made in DIP packages so you can buy some and drop them in a bread board.

Here is an example using the L293 chip mentioned:

enter image description here