So happened when I was looking at different electronic designs to drive the steppers. After scrutinizing a dozen designs on the internet and a few coffees, I decided to build my own stepper motor driver.
Well why would you reinvent the wheel might one say? Now, this is not about reinventing the wheel, it's about balancing and polishing the wheel.
While watching several designs, I noticed many of them are using all-in-one driver ICs like Allegro A4988. These ICs are pretty neat and easy to use. They are tiny and support 1/16th microstep! But by looking deep into the specs, I noticed the Rdson is about 320 milliohms. Let's say we want to drive our stepper with 1.5 amps per coil, then the total dissipation for the IC would be: 2 x (1.5)² x (RdsonH + RdsonL) = 2.9 Watt. To keep the IC cool enough, it should be force-cooled. Now I do not prefer fans buzzing around me, so time to make things cooler :)
It would be great to use the Allegro A4988 in combination with external FETs to reduce Rdson. However, the A4988 is not really suited to drive external FETs. To drive a stepper motor, the FETs must be configured in H-bridge. Each stepper coil needs such a H-bridge configuration:
Notice that the low-side is driven by N-channel FETs and the high-side is driven by P-channel FETs. However, P-channel FETs are usually having a higher Rdson and are more expensive than P-channel FETs. The P-channel FETs can be replaced with N-channel FETs but there's a tradeoff! That's because the N-channel FETs needs a positive gate drive with respect to the source. If we want to drive Vsource up to V+, the gate voltage at least needs to be V+ + Vgs(th). Fortunate, we are not the only with this problem and semiconductor manufacturers helped us by putting a complete solution into one tiny package. Take a look at Fairchild's FAN7842. This is a complete half bridge driver, including the bootstrap (circuit to generate the higher Vgate) and all other circuitry we just need!
Now that we have figured out how to drive our FET's, we still miss the signals to drive them in the right way. We need one H-bridge (full bridge) per stepper coil and thus two H-bridges per stepper. For four steppers, we need to have 8 H-bridges with 4 drive signals per bridge, totals 32 drive signals.
We could just take a simple micro and write some code with interrupts to generate these signals. However, we prefer these signals to be accurate within the 100ns range. It will be a though job to write the code and require a fast micro to get within this accuracy...
Designing electronics wouldn't be fun if is was like one-two-three. Designing electronics is like choosing the right ingredients for your cake. Too much salt will ruin it and too less will make it tasteless. And sometimes you need these vanilla and chocolate flavors, to make it delicious!
The missing ingredient for the stepper driver is the combination of a PLD/FPGA and a micro to convert the G-codes into 32 accurate timed drive signals. Now there's a very nice chip on the market called PSoC. With PSoC you have a mix of PLD-like circuitry and a controller core in one package! PSoC comes with different cores: ARM, 8051 and their proprietary M8C core.
I prefer a 32 bit controller for CNC, so the obvious choice is PSoC5. This is an AMR Cortex M3 powered chip with 24 digital programmable blocks, which should be sufficient to drive 16 half bridges. I am currently designing the PCB based on the CY8C5468AXI-018, the most utilized PSoC5. When the design is finished, I can select a more budgetary PSoC5, depending on the used resources.
The next blog will be about building my eShapeoko #105. Please feel free to write down your comment, thoughts or questions :)