An open source ESP32 motor driver development board for brushless motors

Oct 29, 2020

Project update 5 of 11

SwarmDrive with Brushed Motors, and New Boards

by Majodi Ploegmakers

The new pre-production boards have arrived! I think the new silkscreen with the SwarmDrive logo looks good. First thing I did was make a jig for placing the through hole components, so they will go on straight when soldered to the board. A jig also helps when having to produce larger numbers of boards.

Brushed Motors

After finishing one board, I hooked up two normal brushed motors to demonstrate the use of two plain DC motors with SwarmDrive. Of course, working with BLDC motors is far more interesting but I will get into that next time. Here I used the L6234 triple half bridge to power the motors in a way that can control their direction and speed. That’s done by simply by switching the right upper/lower side of each half bridge.

This will control the direction of the motors depending on the direction of the current. To do this, I used the EN and IN signal inputs of the L6234. EN is set to "high," which will switch the lower side to ON and IN is set to "high," which will switch the high side to ON. However, an inverter construction inside the L6234 will avoid a short when switching both (the high side and low side) to on. This will not be possible. When EN is "high" and IN is set to "high" also, the lower side will turn off. So, what we get is:


To control the speed of the motors, I used PWM. I enabled all three half bridges by setting EN to "high" and used a variable duty cycle for the IN signal. This will still switch the lower half bridges due to the inverter functionality explained above.

Now, I can easily control direction and speed by applying a PWM signal to either the outer two half bridges or the inner half bridge. The motors will run either clockwise or counterclockwise depending on the IN signals. If both motors are switched on by applying a PWM signal with a certain duty cycle, then they will run in a symmetric direction. But what if we want to control the direction of each motor independently?

Independent Direction Control

I can create a virtual ground at the middle node by applying 50% duty cycle to the middle half bridge. Then, if I apply > 50% to one of the outer bridges, the motor on that side will run one way, while applying < 50% will make it run the other way. This cuts the power bandwidth in two, so the motor should be able to handle these lower power levels. On my test bench, it turned out that below a certain point my two test motors were not able to start spinning so I had to adjust for that.

It is rarely needed to steer something on wheels using two opposite directions. A tank-like vehicle on tracks could need it to turn in place. But otherwise, in movement, you just apply more power (is speed) to one side or the other.

So, although simple and perhaps less interesting, there are many things to discover also with brushed motors. SwarmDrive lets you do so with minimum effort. I’ve created a separate (simple) class library for brushed motors. The code will be available on Github.

For the next update, I plan to get started with BLDC motors and calibration in particular.

Until next time,

Sign up to receive future updates for SwarmDrive.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects