ERAD2 | Tiny Yet Powerful BLDC Motor Driver for Wireless Robotics
by RoboticWorx in Circuits > Robots
67 Views, 2 Favorites, 0 Comments
ERAD2 | Tiny Yet Powerful BLDC Motor Driver for Wireless Robotics

For access to cool interactive models as well as the best quality read, check out this article on my homepage here. Also, don't forget to subscribe for free to support my work! :)
A Quick Preview
This is ERAD2! A revised and miniaturized brushless DC (BLDC) motor driver with built-in wireless capabilities to power your next project. Based on the powerful ESP32-S3 SoC with SimpleFOC compatibility, it makes high-power robotics applications easy with simple and effortlessly customizable code.
Originally conceived for moving robotic arm limbs, my first ERAD project (Everything Robotic Arm Driver) was a neat motor driver project that was well-developed for a variety of custom applications but could use a couple tweaks. ERAD2 is my new version of this project, primarily focused on making it smaller and more portable while keeping its high-power wireless capabilities.
This makes ERAD2 a super expandable motor driver, as you can run each motor comfortably with the easy-to-use Arduino SimpleFOC, but have them be based off wireless commands sent via a more complex system such as a home assistant setup, FreeRTOS device, etc., without any additional hardware! (If needed. Perfectly fine to only use Arduino.)
2.4GHz trace antenna!
This project is also completely open-source, like all my others, so anyone can feel free to make adjustments to adapt it to your own projects. With this, I hope ERAD2 can become a good base-line for cool robotics projects through the power of enabling movement. Here it is wirelessly test actuating the heaviest joint of a robotic arm I've been working on:
They're pretty quiet too! Here's another demo with a different motor:
I'm also selling some here!
For high-power applications, it's also fully compatible with a nice heatsink to allow for long runtimes without issue.
This also makes it super easy to just slap on the back of a motor, no more need for huge external driver boards! Everything can be integrated into one easy system like seen in the demo.
Can be used for any motor! But this one is great for high torque.
If you've been reading all of this and are intrigued but are still unsure of how ERAD2 works and can be used in custom projects, stick around! I'll explain everything.
Main Idea
Basically, the purpose of this project is to enable brushless motors to move and surface in custom projects. Brushless motors are infinitely more powerful than typical brushed motors that you may have seen around due to their much higher efficiency and speed. Brushed motors just don't stand a chance by comparison.
Image from haredataelectronics.co.uk
So why doesn't everyone use brushless DC (BLDC) motors? Well, they are much harder to actuate (get to move) and can be more expensive than brushed ones. With a normal brushed motor, all you have to do is apply power which can be pretty enticing.
Brushless motors are more complex, but also more efficient!
ERAD2 really excels here by utilizing the power of SimpleFOC on the Arduino framework. This allows it to easily interface with brushless motors with minimal code, while also utilizing the power of ESP-NOW wireless technology.
The ESP-NOW protocol was a great choice here due to its quick and efficient wireless communication. (Requires basically zero connection time.) It can also communicate much further than a standard Bluetooth transmission and has great data rates. Although, the hardware is also fully capable of Wi-Fi and Bluetooth too if needed.
Thanks to the affordable price point of many of the on-board components, this motor driver can also be built quite affordably, besting other mysterious/foreign drivers with limited documentation. (I also doubt they're capable of wireless/open-source!)
Subscribe here for free to support my work!
Or go Plus for $5 and get additional perks! I'd also really appreciate it.
Hardware
Let's explore how this project works on a more technical level. Below are the full schematics for this project.
These schematics aren't a whole lot different from my original ERAD project, so if you would like a highly detailed explanation of how brushless motors work in addition to each part of the schematic, please read up on it here.
Some changes I did make, however, were to the step-down converter circuit, TMC6200 configuration, some hall effect sensor integration adjustments, and a few other things. Nothing catastrophic, but these changes will help ERAD2 run smoother and given it better performance and versatility. And of course, the new version is much smaller.
Now, ERAD2 can also take any motor voltage input up to 34V! This means you can use a 12V/24V/34V motor, or anything in between! Much better than the original fixed 24V. The new step-down converter is also designed for 89% efficiency, enabling better power performance.
I've also miniaturized the ESP32-S3 module using the SoC, making it more space-optimized. ESP32-S3 was perfect for this project, since it's compatible with SimpleFOC with two built-in MCPWM units and has a built-in wireless radio. My variant also comes with 8MB of FLASH memory, so you never have to worry about running out of program space.
For driving the motor phases themselves, the TMC6200 was a no-brainer, as it's a gate-driver rather than a complete controller with built-in FETs. This way, I can get far more power out of the board because the motor phases are being driven with larger external MOSFETs that are rated for higher currents and temperatures.
I should also mention that I broke out two GPIOs should you ever want to add an encoder or anything else. The pins are compatible with the ESP32-S3's GPIO matrix, so they can be configured for any function (I2C, UART, etc.) This isn't required, as it has built-in support for hall effect sensors, but it's there if you want it. The hardware is also capable of sensing with back-EMF, should you ever want to mess with that.
Although, if you're using a geared motor for extra torque (like mine) you don't actually need an encoder for closed-loop control! The built-in hall effect sensor support will act like a low resolution encoder, in which the resolution will increase proportionally to the gear ratio.
Hall effect sensor control scheme.
Hall effect sensors placed around a motor. ^
This works because a typical BLDC motor uses three hall effect sensors to detect the rotor’s position, like seen above. These sensors are typically placed 120 electrical degrees apart and provide binary outputs (high or low), resulting in six unique combinations per electrical cycle. For a two-pole-pair motor, this gives us an angular resolution of 30 degrees per step. Not too great, but with a 50:1 gear reduction this becomes 0.6 degrees. Pretty solid!
P - Num. pole pairs. P becomes P x G with gear reduction.
These readings are hard sampled too, so there is no such thing as "skipping steps" on a BLDC as you may have experienced with a stepper motor. You can rely on consistency!
To learn more about motor commutation using hall effect sensors, check this out.
Possible Applications
This is all great, but you may be wondering how it's actually used. There is no set answer to this question, as ERAD2 uses pretty basic and easily customizable code, which allows for practically infinite possibilities.
Here are two possible examples:
- ERAD2 is one of many BLDC motor drivers, reliant on control signals from a main motherboard.
- For robotic arms, large systems, etc.
- ERAD2 is driving a specific load on its own.
- Opening a door, moving a pulley, etc.
A cool automatic door opener I made.
If you're using it as one of many drivers (first example), the wireless would really shine here. I would have ERAD2 listen for a rotation command over wireless from the motherboard/primary controller and then have it execute the command, constantly listening for updates over wireless.
Ex: "Move +30 degrees at 10 degrees/sec." or "Move clockwise until I say stop."
Wireless control from a central device.
If you're using it as the sole driver (second example) you could just preprogram it for whatever application it is being used for. For example, if you walk past a sensor have it send a wireless signal to ERAD2 to open a door/do whatever. The possibilities really are endless, so think big! You don't even have to use wireless if you don't need it, which is perfectly fine too.
Example Arduino sketches here with SimpleFOC examples here!
Building the Boards
Let's get into how you can build one of these for yourself! Although, they're also available for purchase here if you'd like.
For designing this PCB (Printed Circuit Board) I used KiCAD which is an awesome/free ECAD tool for building circuit boards.
I decided to go with a four-layer board because the MOSFETs will be switching pretty quickly, and they needed to have easy/unrestricted access to the motor voltage (VM) and ground planes. PCB stackup:
- Signal
- Ground
- Power (VM)
- Signal
I also included extra ground pours on the top and bottom signal layers to help isolate the various signals and add coupling.
- The Gerber/fabrication file for the board can be found here.
- The editable STEP and KiCad PCB files are available here to plus subscribers. Want to become a plus subscriber? It’s only $5 and I would really appreciate your support!
- The part list (BOM) with designators can be found here with the CPL available here if needed.
- As always, I know that it can seem like a pain to have to order parts, but it’s really not so bad as almost all the parts you order from one project get reused. Think about how much you’ll learn with some hands-on experience!
If you’re interested in learning more about embedded systems (PCB design/development), check out Robert Feranec and Phil’s Lab on YouTube. They’re great designers and I’ve learned a lot from them.
To actually produce the PCB, we'll need to go through a manufacturer. For this, I used PCBWay!
I've never had to question their quality and they also offer many other services such as CNC machining, 3D-printing, and PCB assembly. They also feature nine different solder mask colors to choose from and three different silkscreens, which is great for customization. (I even believe they have multicolor solder masks now!) I chose mine to be blue, as I like the color and it offers a slim solder mask clearance, but you can feel free to choose yours to be whichever color you’d like!
Since I designed with KiCad, I didn't even have to leave my design software to check out, thanks to their convenient plug-in! If not though, you can always just go to PCBWay.com, click on quick-order PCB, and upload the Gerber file for the board. Or alternatively, just go here which I have saved in my favorites bar. I recommend clicking the stencil option at checkout to make hand assembly easier!
Everything else you can leave as the default, unless you have any specific adjustments you want to make. (Lead-free surface finish, remove product number, etc.) You can also increase the copper thickness if you plan to use this for a high-power application like an e-bike. This will help with cooling and enable better conduction.
When they arrived about a week later, they looked awesome!
To assemble it, first tape down the PCB and then apply solder paste using the stencil.
After that, take out the reference sheet (designators on the BOM) and start placing the components.
Once everything has been placed, carefully place it on a hotplate (or similar) to melt the solder and solidify the components.
Then, carefully take it off and let it cool.
That's it!
Next, you may want to do a quick test to make sure everything looks good and there were no mistakes in assembly (which are easy to make). Maybe a backwards diode or incorrect IC rotation. A good basic check would be just to plug in the USB and make sure the power LED turns on. Should you have any issues, you should use a multimeter to troubleshoot. This said, I also got a super neat new tool to add to my collection which might be able to help, called a Pokit Pro!
They were nice enough to send me one to play with, so I want to give them a quick shout-out. They have quite a few multi-tool devices but the Pokit Pro is an all-in-one compact measurement device, featuring a multimeter, oscilloscope, and logger. It connects wirelessly to your phone for displaying the data, so it's basically as compact of a measurement device as it gets. I'll be using it for all my on-the-go troubleshooting. Pretty cool!
Wiring It Up
Now that ERAD2 is fully assembled, let's explore how it can be connected and implemented into projects.
As I mentioned earlier, my main motivation for this BLDC motor driver was its applications in robotic arms (though it can be used for anything). For this reason, it is perfectly matched up to fit on geared BLDC motors from StepperOnline. They aren't sponsoring me in any way; they just honestly do seem to have the best affordable high-power motors, so it made sense to make them a nice fit.
Perfectly flush!
But of course, ERAD2 will work great with other motors as well. These are just super easy to set up. For my robotic arm actuators (though still in progress), I decided to go with 24V 172W 70RPM 50:1 geared BLDCs which have built-in 5V hall effect sensors for easy control and basically zero backlash. They're also rated for 17.63Nm of torque, which is plenty for my application.
To wire it up, just connect the hall effect sensors of the motor to the pins on ERAD2 (labeled on the back).
StepperOnline also supplies datasheets, which is great. Since they're rated for 5V (in datasheet), simply close the 5V jumper on the top left of the PCB and solder the motor wires to the driver. (If yours are rated for 3.3V, you would close the 3V3 jumper and remove R25, R27, and R29.)
I would also go ahead and solder on some power leads for a more stable power supply connection.
Then just upload whatever code to ERAD2 and apply power.
IMPORTANT: I also highly recommend first powering everything up with a current-limitable power supply! (Couple of amps or less to start.) Every motor is different, and it would suck to accidentally blow something out because your motor parameters in the code are too high.
ALSO: If ERAD2 is ever drawing too much power to be able to upload code, just hold the RST button as you plug it in and then put it in bootloader mode by holding BOOT > pressing RST > releasing BOOT. You will need to put it in bootloader mode for first upload anyway! In addition, to debug over USB (.println), you will need to enable "USB CDC On BOOT" under tools.
If you're new to ArduinoIDE and unsure how to configure it for ESP32, I wrote some about it here. Just be sure to select "ESP32S3 Dev Module" as the board.
But what if you want to use a different motor? That's perfectly fine too! You can take any motor, like an ML5010, and add your own hall effect sensors (or encoder) liked I used in the demo from earlier.
Used custom hall effect sensors. ^
To use hall effect sensors (like these), simply mount them around the motor (instructions here) and then connect them the same way to ERAD2. Since I'm using 3.3V DRV5013 hall effect sensors, I'll close the 3.3V jumper, remove R25, R27, and R29, (pull-downs) and be good-to-go!
If you're using other custom hall effect sensors, just be sure to note that ERAD2 is configured for open-drain ones by default. If your hall-effect sensors are push-pull, then you should remove both the pull-up and pull-down resistors.
If you'd like to use an encoder, that's great too! Just connect the I2C lines up to IO1 and IO2 on the PCB and adjust your program for it.
Attaching a Heatsink
If you plan to use ERAD2 for a high-power application, a heatsink would probably be a good idea! It will better prevent thermal shutdown so it can drive more current for longer durations.
Technically speaking, ERAD2 can drive with up to 14A (FET rating), but you'll need to upgrade/remove the shunt resistors which will start to burn at ~5A. Still, that's a lot of power! (336W at 24V.) Although, I've never had to exceed more than a few amps even for maxed-out loads, so if you're drawing that then it's likely overkill due to an over-configuration in the programming. But it's capable nonetheless! (TMC6200 is a beast!)
This said, heating is the biggest problem! The TMC6200 is equipped with thermal shut-down, which will limit performance if the board should ever get too hot. A simple heatsink can help with this a ton. All you need to do is print out this mount and get some insulating thermal tape.
First, put the thermal tape across the bottom of the heatsink, being sure to go past the end a few milimeters.
Then, align it against the back of the driver and slide through two M3x20mm bolts.
IMPORTANT: Be sure that you align the heatsink such that the end with the insulating tape over the side aligns with the bottom of the PCB where the solder pads are exposed. Otherwise, the heatsink will short the driver by connecting VM and GND. I would also recommend first connecting ERAD2 to whichever motor (soldering) before putting on the heatsink or else the heat may melt the insulating tape, exposing the bare conductor.
With that, grab the 3D-printed mount and pop two M3 nuts into the hexes on the back. Then screw the board onto it.
That's it! For mounting it to a motor, I just used some heavy-duty double-sided tape.
BOM
This is the ERAD2 Bill of Materials!
I’ll put everything that you need to have here so that you don’t have to go scrolling around looking for the links I sprinkled throughout the article.
- All the CAD for this project can be found here on my Thingiverse.
- Everything else including the Gerber files, part list, etc. can be found here on my GitHub.
- The editable STEP files, logo-less STL files, PCB STEP file, and editable KiCad PCB files are available here to plus subscribers. Thanks so much for your support!
- ESD-proof IC storage container
- Thermal tape
- If you don’t already have them:
- Mini soldering iron (what I use, but any will do)
- Solder paste
- Solder (my roll of choice)
- Hot plate
- Adjustable lab-bench power supply
- 3D-printer filament (my go-to)
- Hot air rework gun (great for fixing broken or misaligned ICs)!
- Some nuts & bolts
- Basic screwdriver kit (one of many options)
Disclosure: These are affiliate links. I get a portion of product sales at no extra cost to you.
Thanks so much for reading! I hope this was a helpful and informative article. If you decide to do the build, please feel free to leave any questions in the comments below. If not, I hope you were still able to enjoy reading and learn something new!
Have constructive criticism or a suggestion for a future project? I’m always looking to improve my work. Leave it in the comments! Until next time.
Be sure to follow me on Instagram! If you want to learn more cool stuff, I also highly recommend Branch Education and Kurzgesagt on YouTube. :)
If you feel this read was worth at least $5, please consider becoming a plus subscriber on my homepage. I don’t use ads, so I rely on your support to keep going. This is a quick read for you, but I’ve been working on this for months! You will also receive the following benefits.