I tried to keep the electronics, for the mill, nice and simple as I would be building these driver boards on stripboard. Try it sometime. I ASSURE you it’s fun.
Originally, the electronics were for a wave drive configuration (only ever one phase on) but at some point I realised that I could use the same hardware for a full-step drive configuration (two phases always on), with some clever tricks, while still having just the two inputs: step and direction. This has the effect of doubling the torque which lets me run at double the speed without skipping steps. Thumbs up!
The image above shows the three driver boards and an Arduino running grbl for control. Each driver board has three ICs: an up/down counter , a quad 2-input NAND (in a XOR configuration) [4093/4011] and a current driver [ULN2003A]. And below the schematic of the system.
You might see from the image that the Arduino outputs STEP and DIRECTION (as dictated by grbl) but we have four inputs to control on the stepper motor. Therefore a couple of tricks are used:
The first trick is garnered from Ian Harries page on stepper motor controllers and notes that two of the inputs (A and B) are always the inverse of the input opposite (C and D), allowing us to effectively cut our inputs by half. The two inverters can be seen to the right of the image above.
The second trick uses a 2-bit counter and a XOR gate to convert STEP and DIRECTION into these two remaining input patterns. The first input pattern is easy enough as it merely follows the 2nd bit of the counter (A1), however, the second input (B) is out of phase with the first. In order to repeat this sequence out of phase it is simply a case of XORing the first input (A) with the 1st bit of the counter (A0).
|Step||A1||A0||A||B||C=(¬A)||D=(¬B)||(A0 XOR A)=B|
I haven’t included the mapping of the pins here as my configuration is slightly wrong in that the counter resets too early, providing an incorrect duty cycle for some of the steps. Also you’re not limited to the chips I’ve mentioned.
If any clarification is needed, drop me a comment and I’ll do my best to demist either your cloudy mind or my foggy writing.