So I’ve been playing with my new dual H bridge motor driver boards. They’re great, but they’re designed to power two bi-directional motors. A single H bridge has the following inputs:
- PWM: apply a pulsed signal to control the speed of a motor
- Pin 1: set high to go forward, low to go backward
- Pin 2: set high to go backward, low to go forward
Instead of one bi-directional motor, I want to hook up two solenoids, and control each one with an independent PWM control signal. (That’s a half H bridge.) But there’s only one PWM input, and the motor control inputs are supposed to be digital. What to do?
My answer was inspired by the SainSmart L298N board, which ships with jumpers that connect the PWM input directly to a constant 5V signal. I connected the jumpers, and tried a simpler configuration: I just wired it the way it would work in an ideal world:
- PWM: jumped (constant high signal)
- Pin 1: PWM input signal for solenoid 1
- Pin 2: PWM input signal for solenoid 2
I hooked up solenoids to the forward and reverse motor outputs, and THIS WORKS GREAT.
I tested it with both the L298N and TB6612 drivers.
Wait, is it OK to use the driver like that?
I think so!
The control logic part of an H bridge produces a PWM control signal for each side of the bridge. My simplified configuration bypasses some of the motor logic we don’t need by combining PWM and control signal ourselves (with the Teensy).
Once the signal hits the switching part of the H bridge, it’s back in normal, well-documented territory.
One thing I re-discovered while connecting batches of 4 solenoids to the same driver is that a solenoid’s response to PWM varies hugely. Some are quite responsive to subtle changes, others won’t budge at all without full voltage.
So my next step is to test more models, and stock up on the good ones. (Or even make my own?)