20A Stepper Motor Driver


This is just a concept sketch of the driver step for a 4 phase driver. We add the 4th phase, but I only use one current shunt on this. The width is ca 33 mm using the same trick in mounting a 4 pole 5.08 pitch connector on the back. I need to adjust this and find space for the 6-wire motors so will play around with ideas for now. The size above is ca 33mm x 23 mm , so an actual controller in 35 x 50 mm size might be possible.

Stepper Motor Controller

RAMPS are great for driving stepper motors for 3D printers because they are small and cost around 1.- GBP each. They are quite capable of controlling steppers up to 2A with some heat sinks, but controlling steppers above that is a challenge. Available controllers are large and tend to be expensive.


Looking at the 3-phase motor controller it is quite easy to add a 4th half-bridge to control a larger stepper motor up to 20A. The concept is simple using a discrete gate driver, two HEXFET’s and a dedicated MCU. On a driver this size you also want current sensing and a bit of protection logic. If we design for 12-24V it means we are designing a 500W stepper motor. My target is actually up to 10A, so a 20A should give me some margins.

I also want to study a gateway to the Mach 3 or similar standard. This is something I currently know little about, but I am told that this standard is important as it enables existing top-side systems to be used. My first idea is to create a RPI GW Hat to connect easyIPC and Mach 3, but I will return to the details later.

Lets look at some stepper motors (Pictures from various internet sources) to get an idea:

stepper-nema11This is a smaller Nema 11 using 0.67A. The 6 wires means we have 2 phases where each phase are two coils in series. I need to experiment a bit with this as well as test on the 28BYJ-48 that uses similar wiring with 5 leads where the two centre ones are connected. Driving motors this small is well within more cost optional solutions, but we should be able to run this as well if needed.

stepper_nema23 The Nema23 above is rated at 3,5A and typical for our target range. The same for the Nema34 below rated at 5,5A.

stepper_nema34This is a classic Nema17 (below) with double shaft. You get these below 10.- USD with single, double and hallow shafts. This one have a 0.44Nm holding torque using 1,5A. Again well within the capababilities of a RAMP.

stepper_nema17doubleYet another Nema23 with a gearbox mounted (below). Rated to 4A. Looking at various sources I find that the majority of steppers are within the range of a RAMP and very few above 10A. So a low cost controller targeting 0-10A (max 20A) should be a great addition to what currently is out there.


As for wiring we should allow a stepper 4,5 or 6 wires where the 5th and 6th is +, – or not used. Minimum voltage should be 12V. We obviously need end points and I would like to add some temperature sensing as well as support for encoders. I will have a look for pre-amplifiers for this, but so far I have not seen anything worth mentioning so I am planning discrete gate drivers. This is not always a disadvantage, but a modern pre-amplifier usually implement some logic that we otherwise need to code.

32 x Servo Controller Logic


The illustration above shows ruffly how servo logic will come out if you bit bang directly. Some of the Arduino libraries does this. As each servo uses up to 50ms on a pulse you can in theory service 20 servos in a second. The limitation here is that you bit-bang one channel at the time in sequence.


This second illustration shows how we want it to be with all 32 servos operating in parallel. This way we have a much higher capacity and avoid latency between servo operations.

To achieve this we need to use a table with 32 channels and accurate timing for then we switch on, length of pulse and then we switch off. Switching off is an issue because we need to do it with some accuracy. Our RTOS is perfect for this type of jobs and will achieve 0.1 ms accuracy without any problem.

The 32 x Servo Hat uses 32 pins that can be used for multiple purposes.

  1. Servo
  2. Digital output
  3. Digital input
  4. Analogue input
  5. Analogue output

The servo interface is (1) signal pin, (2) Voltage pin and (3) Ground pin.

As the user set a servo value in Raspberry PI using the easyIPC libraries that value is transferred to the 32 x Servo hat, the value is inserted into the 32 channel entry and the pulse will be corrected to represent the new value. The total time latency should be very low, but up to 100ms from a value is set in RPI and the output is corrected must be expected. I will return on actual latency timing later.

Manual Subscription System

I had to clean my subscription pages due to the amount of bot’s that joined. Once a bot subscribe they also start commenting every article with nonsense. So for now you need to contact the site on subscribe@basicpi.org and you will be added manually. Add Your name and a valid email address.

I apologize for this inconvenience.

3D Printer

I have a Prusa i3 3D printer that I purchased from Hong Kong a few years ago. It was a DIY kit costing around 280.- USD at the time. The printer was good value, but I ran into several problems with it’s control system. The one I use is based on Arduino, but with re-designed electronics so you get an all-in-one system that is based on Atmega2560.

Moving on I wanted to re-write the firmware package, but I also want to upgrade my printer with more advanced features than my current hardware will allow.

  1. Scalability to add more control IO to expand the printer’s capabilities.
  2. Proper firmware package that is well designed, easy to maintain and not riddled with real-time issues.
  3. Ethernet wired and wireless.
  4. Proper printer queue solutions.
  5. I want to target CNC machinery in general, not only 3D printers.

Using the current Prusa i3 as a starting point I need the following:

  1. 5 axis on standard RAMPS or equal.
  2. 3 end-stop switches.
  3. 2 temperature sensors.
  4. 2 heaters.
  5. 1 fan.
  6. USB serial solution.

I want to build this on top of my current system with Hat’s and RS-X modules, so it’s more an issue of what do I need to add on electronics. Also keep in mind that I still have my 6 legged robot in mind as I create modules.

The major benefit of this system is that we enable people to build and experiment themselves on plug & play level rather than creating Yet Another 3D Printer Control System.



DRV8301 is a pre-amplifier for 3-phase motor controllers. It is programmable through SPI, handle 60V, contains a 1,5A buck converter and support for 2 current sensors. DRV8302, DRV8303 and DRV8305 are other variants of this. I really want to dig into DRV8305, but they are a bit hard to get and I had my eyes on DRV8301 for quite a while.

I have a dev board from TI with this, and I am a bit concerned about the total footprint with all components, but I want to give it a try. The buck converter will feed MCU and RS-X transceiver, so it will be interesting to see what I can achieve.

Com Adapter w/Galvanic Isolation


Finally done. This picture illustrate the 3 different grounds and the space between the areas that is part of the galvanic isolation. Finally got everything on and routed, so will double check tomorrow (or later today) and order PCB’s. Hopefully this is my x-mas fun project, but I don’t really expect to see the PCB’s before early January due to x-mas post.

I was thinking about adding a LCD display and by irony I actually have. I have a UART on the SWD port that is perfect for usage together with a Nextion display.

Com Adapter 1_2


I wanted to use STM32F405RG for this, so I needed to update the design with lessons learned from my breakout board. I also replaced ESP-03 with ESP-12E/F and replaced all 0805 packages with 0603 as well as adding an extra status led. I still lack support for ESP-01. As a result of the smaller 0603 packages I got more space and this is single sided assembly only. I have soldered quite a few boards with 0603 components and yes they are small, but I never get them wrong anymore.

 I have not done cost calculation yet, but I estimate ca 20-25.- USD in component/PCB Cost.

Notice the silc drawing in red on the MCU and W5500. I recommend that you always remove that silc on tight chips because it makes it difficult to inspect pins after soldering. The white line is difficult to distinguish from solder waste. Also avoid ground plane on mount side if your assembling yourself. This is why I wanted single sided assembly so I could use ground planes on the other side. The adapter is quite small 80*50mm.

I did consider replacing the tiny Murata x-tal used on the MCU, but looking at the size of the alternatives realizing that my x-tal cost 21 cent compared to 5 cent on the larger I ditched the idea. I have soldered quite a few Murata x-tals now and I never get them wrong (expect for the ones I drop on the floor). Those HC49C pack with 2 x caps each look gigantic in comparison. I will upload New schematics once I am done.

Micro Sensor Module


The 7x PWM module (blue on bottom) worked just fine. I have not used ULN2003 much so eager to test and see how it works. I have not tested the sensor (white on top) yet. The larger DHL11 module is mounted on back because it got a bit tight in the front. Will dig into the bit-bang protocol and analogue readings tomorrow.