PrntrBoard TMC2130 redesign is complete

When I was working on the new layout for the TMC2660 branch of the board, I used a dedicated ground plane and turned out this was awesome. It simplified lots of the routing as well as added good heat dissipation capabilities to the board.

I wanted to try and redo the layout of the TMC2130 branch with this technique. In addition I wanted to swap the location of the E1 motor driver and the 5V input connector, before the E1 driver was crammed in the corner and it was challenging to get good routing of the power pins. By swapping the position with the 5V power connector there is a bit more space.

The third thing I wanted to try was to reverse the position of the STM32 NUCLEO board – in the previous design it was sticking out in an unsightly manner.

So here it is new layout all complete. DRC checks pass.

In a slightly different perspective:

You can see the NUCLEO does not block the mounting hole on the lower left corner anymore (MK4).

Here is a look from the bottom:

The motor driver have large area on the bottom for heat dissipation. You can also see the large rectangle area on the bed heater control MOSFET on the top.

I also added a few extra power connectors – two for Vin and two to the 5V rail, to hook cooling fans for the case. You can see two of them on the low left corner in the last picture.

Note: while the last picture shows the STM32F411 CPU, the board actually required the STM32F446 version. The only 3D model I found for the NUCLEO STM32 dev kit was with the STM32F441 part, so that is why it is on the images.

PrntrBoard first 3D print

I got this cute little 3D printer from the local MicroCenter two days ago. I know, I know, not everyone has MicroCenter around.

Anyhow, the printer is Wanhao Duplicator I3 Mini, it is OEM made for MicroCenter as “PowerSpec” brand. It is not the pinnacle of engineering, but it is quite amazing when it comes to cost cutting. Very minimal design – just the basics, but quite usable.

It has this cute front panel with graphic LCD:

I believe Monoprice sells a version of this printer with better features. It’s a good choice if you are looking to get into the hobby and don’t want to break the bank. The Monoprice version is $50 more expensive, but has way better features like heated bed and wifi support.

Here is a “torture test” I printed with the printer in it’s stock configuration with the sample filament that came with it. It is not bad at all.

The main reason I got this printer was to test my 3D printer controller board (open source designs on github.com here). I wanted something small that would fit on my desk and this printer was an excellent choice. Naturally I butchered it to connect my controller:

After a day of tweaking the Marlin firmware, I managed to get it to work:

I printed for about 3 hour yesterday, constantly checking the motor drivers for overheating, but they were not even breaking a sweat.

The motors are very quiet, unlike my screeching power supply on the video. Next, I’ll have to design a box for the controller, it is quite unsightly sitting like that with all cables.

Making PrntrBoard TMC2130 rev1

New revision (rev1) of my 3D printer controller board arrived a few weeks ago from the board manufacturer (http://jlcpcb.com). I did assemble a prototype with one driver for “smoke test”. Well it did “smoke” only a bit, because I accidentally put one chip in reverse. Lucky for me it was not the Trinamic driver – that one survived.

Anyhow today I made another board – this time with all components populated. Here is how it went up.

Mounted the PCB in an improvised jig to keep it secure on my table. The “jig” is made from 4 small PCBs from a different project. I secured them with blue tape, so they hold the main PCB in place.

Next was aligning the kapton stencil on top of the PCB. The stencil is made by http://oshstencil.com It is not aligned yet.

Here it is aligned on top of the board and secured with another piece of blue tape:

Getting ready to apply solder paste. I use “credit card” squeegee from OshStencil.

Paste away. I usually put too much, but it is easier to have some left over, than scraping the last bit of paste over and over again.

Here it is – paste applied. You can see that my footprint for TR3 needs to be fixed – the paste opening is way too big. Oh well – rev2 I guess.

By the way because my stencil application jig is not particularly sturdy you can see the solder paste is smudged over the fine point IC pads. It is not the end of the world. It makes a few solder bridges, but easily fixable. It is better, when I use solder paste printer, but I don’t have a framed stencil for this board they are $$$.

And it goes in the CHMT48VB pick-and-placer.

And the machine goes – here is a short video clip of the beginning of the job. Note that the board is split in two jobs. The second job is with different set of nozzles. I don’t have the nozzle change in the video – sorry.

The board after all components are placed by the machine. I use the machine only for tedious parts. I place other components by hand.

After manually placing the rest of the SMD parts, the board is ready for solder re-flow. I use hot air gun. I have a T962 oven, but it always seems like too much effort to use it. Here is the result of my hot air application. You can see quite a few bridges on the drivers. Click on the picture for full resolution image.

All cleaned up

Now to solder all true-hole connectors. This is the most tedious and time consuming part. Here it is all done. Front:

And back

I did a quick check and there are no shorts on any power supply lanes. On to testing the firmware.

TMC2130 does not cooperate :-(

Trinamic drivers are a marvel of engineering. However they combined many things in a single chip that it is hard to make it all work right. Well, it is hard for me at least, if you have mastered these drivers please let me know.

It started when I tried to test if the Marlin firmware for my board would agree to move the stepper motors around. To test the motor driver signals on the board I modified one of the tmc2130 arduino library samples like this, and it was spinning the motor. Alas my enthusiasm was short lived, when I tried to move the motor with Marlin, it would stutter and vibrate, but no motion.

Hmm, I checked and re-checked all the tmc2130 driver settings back and forth. Read the datasheet 3 times – nothing. I was going back and forth between the marlin firmware and my little test program to figure out what was wrong. Finally I was able to isolate the issue to the number of microsteps the driver was configured to take.

Now to be fair the microstepping configuration was not the issue per se, it was a setting I can change to introduce the same problem in my test program as well.

Let’s take a step back and explain what this all means. Stepper motors come in many different configurations. We’ll focus on bipolar 2 phase motors – these are the most common stepper type used for 3D printers. By far the majority of these motors are manufactured to make 200 steps per full rotation. Each step being 1.8°. There also high resolution motors which make 400 steps per rotation or 0.9° for each step. For the purpose of this description the difference is irrelevant.

In the 1.8° motors, it is common to say the 200 steps are “full steps”. In other words the rotor rotates from one stable position to another. In electrical terms, each motor coil is energized fully in one direction or the other.

Clever folk however discovered that they could achieve better precision if they don’t fully energize the motor coils – hence micro-stepping. The most obvious downside of the microstepping is reduced motor holding torque. There are different microstepping options offered by different stepper motor driver chips. Most common are 2, 4, 8 or 16 microsteps. This means that the driver would use 400, 800, 1600, 3200 microsteps to make a full rotation of the motor shaft. Some drivers offer 32 microsteps as option. The tmc2130 and other drivers from Trinamic also offer 64, 128 as well as whooping 256 microsteps. That is astounding 51, 200 microsteps per rotation or about 0.007° per microstep.

Before you get too excited, keep in mind each increase of the microstepping level comes at the expense of decrease in torque.

All these wanders aside, what was my issue with microstepping? I made a simple observation: my test program was driving the motor stepping pin at about 48kHz; with the default settings (256 microsteps) the motor would move, but when I switch to 16 microsteps the motor would make a high pitch sound, but not move. Why? I was puzzled.

Another week of experiments and I discovered the most benign of reasons – I was driving the step pin too fast. In the 256 microsteps configuration the motor speed would be a little under 56 rpm. In the 16 microsteps configuration it would be about 900 rpm. This was above the physical capabilities of the motor with that setup. I found this calculator and it seems with 0.6A current at 12V this motor could theoretically do about 850 rpm max. Practical measurements showed that even at 32 microsteps the motor has trouble moving. At 64 microsteps it was working.

But why does this matter? Well I found that marlin’s default speed is a 300mm/s. I did not change the default axis per mm configuration it was set to 78.74 for 16 microsteps. This would translate to 23,622 microsteps/s or 443 rpm for the motor. Practical test showed this motor was able to achieve about 230rpm max.

Now what? Very simple – I lowered the motor default speed in marlin and was able to issue commands to move the axis 😉

While I was investigating the issue. I got myself a current probe for my oscilloscope. I was able to shoot a few pretty pictures of the driver current of the motor coil trough some different driver settings.

The current probe I got was Hantek C-65:

Picture of the motor driven with full steps an no load. This graph represents the current that goes trough one of the motor coils. There are two coils that drive the motor, the current trough the other coil is identical, but shifted one quarter pulse (90°). The current swings from positive to negative each 2 full steps.

Current waveform with the driver configured for 2 microsteps and 600mA RMS current:

Waveform for 4 microsteps configuration:

Waveform with 16 microsteps:

The waveform with 256 microsteps looks like a smooth sine wave. Sorry I dodn’t manage to get a picture.

This driver has an interesting feature – microstep interpolation. When you enable it, the driver uses 256 microsteps internally and whatever you had configured externally. For example here is the waveform with 2 microsteps and interpolation enabled:

The following is the waveform for full step (no microstepping) and interpolation enabled:

The last image I thought was cool was a capture of the driver waveform changing when the motor is stalled. The configuration is 256 microsteps, with 300mA current. I was trying to stop the motor by holding the shaft with my hand.

PrntrBoard – bringing it to live May 13th.

In my previous tests my PrntrBoard prototype was having some issues talking to the TMC2130 motor driver chip. It took a while, but I figured out the issue – the SPI library was not initializing correctly, so the chip was using the SPI0, hardware block, while on my board the drivers are hooked to SPI1 pins.

A few configuration settings later and Marlin was booting up, without complaining. In the process of debugging I also created a small test program to control the motor driver. You can see it here.

From that work I found that the motor driver chip was getting quite hot if I set the motor current at 900mA. The default was 600mA – it was getting warm but not as bad. Anyhow I decided I want to further stress the thermal design of the board and ordered this 4 channel thermometer.

The thermometer arrived today and I set to use it for a few tests. Keep in mind the accuracy of the thermometer is questionable at this point. I did a very simple test:

  • at ambient room temperature all 4 channels showed values within 0.3 degree Celsius.
  • I held all 4 probes in my hand and all 4 showed 35.1C – again within 0.2C of each other.

First I tried to test the extruder heater control logic. From previous attempts I know it was working, but I wanted to see how accurate the temperature is. I set the printer to heat the E1 to 180C:

M104 T1 S180

This is a video from that test. My thermometer shower 163.5C or thereabouts – so there is a significant offset between the firmware and the thermometer. I also verified with an infrared thermometer and it was showing ~160C. So it seems the thermistor setting is not quite correct. The bad thing is that this heater came from China and I have no clue what thermistor they used, so I’ll have to measure it a few times to determine the correct parameters that should go in the firmware. That would be a post on its own.

Disappointed from my temperature control test, I set to test the thermal design of the board. I added a thermocouple to the bottom of the board – where the motor driver ship is mounted.

as well as a second thermocouple on top of the chip

This was to test a theory, which suggested that the chip dissipates more heat on the bottom side.

Attempt one was not very conclusive. This was using Marlin, I enabled the extruder motor and with the default settings it had 600mA of drive current and 300mA standby current, but this was not enough. The driver chip was barely at 30C and both top and bottom were at similar temperature.

Attempt two almost ended in a disaster. I used the above test program to make the motor running with 900mA drive current, but the program had an unfortunate side effect of leaving the extruder heater on. I smelled smoke and turned the power off. The smoke smell was from the extruder heater melting the temperature probe cable.

Crisis averted and on to attempt number three. My test program was spinning the motor, the power consumption was about 0.5A at 12V. The chip was heating with steady rate, even with my big fan blowing over the board. It was clear the board would not sustain such current. However the top and bottom of the chip were within 1-2C of each other. I decided that maybe the fan was interfering with the measurements and thus ensued attempt number five.

The chip was heating rapidly, but finally you can see the top was 5C hotter than the bottom. Another observation was how quickly things cooled down after the power was turned off.

After all this what is the conclusion:

  • the motor driver does get hot on the top, so putting a radiator on the top has some merit
  • my thermal design sucks, and I decided to re-route the bottom of the board, so there is a large copper area with no traces which can dissipate the heat from the chip.
  • the thermistor coefficient needs to be calibrated in the firmware
  • on the bright side almost all controls are working and Marlin is operational to a degree.

Well, ’till next time

~V

Prntr Board V1

Prntr Board V1

PrntrBoard is a 3D printer controller board designed to work with STM32 NUCLEO dev kits. The current version (V1) supports NUCLEO-64 series kits. The design is being developed on F446-RE kit, but other models could work as well. IMO the STM32F446 NUCLEO-64 kit offers very good performance (180MHz CPU) for the price ($15).

Some features of the board:

  • 5x Trinamic super quiet drivers (TMC2130 or TMC2660)
  • Marlin firmware
  • 4x controllable fans and 2x “always on” fan connectors
  • selectable fan voltage (5V or Vin)

Because the NUCLEO-64 has limited number of IO pins, some compromises had to be made:

  • No sd-card
  • No display support

Generic shortcuts I don’t plan to improve:

  • 5V power supply is external. These are available from various resellers and fairly cheap – less than $1. No need to waste board layout space and component count.
  • Heated bed MOSFET – large heated beds consume a lot of power, and it is challenging to provision the design for > 10A current. External heated bed MOSFETs are very affordable < $10 and claim to support 20A minimum. If you have large bet use one.

Details

I use the daily build of KiCad (soon to be released V5) – let me know if you have trouble opening the files.

Once the design is validated I would add support for NUCLEO-144 kits, these have many more available I/O pins, which would enable more extruders, SD-card and LCD screen utilities to be added. The downside is that they are quite big and I’m trying to limit the design to 10x10cm to reduce the cost of the PCB fabrication.

The current design is using 4 layer board, 6/6 mil clearance, 12 mil via hole size and 20 mil via diameter.

There are two active branches:

  • tmc2130 – the board design for TMC2130 series drivers
  • master – the board design for TMC2660 drivers

Both PCB designs use the QFP version of the driver ICs because they can handle a bit more power.

Status

I have made prototypes of the TMC2130 board design (rev0) – the board has a few bugs, that are corrected in the rev1 version. I have validated the heaters, and fan controls are operational. Working the kinks out of the motor driver wiring.

The TMC2660 branch status is: the rev0 board is fully routed and passes DRC checks. I have not made any prototypes of the board, because 2660 drivers are hard to find due to low stock levels at suppliers.

Software

The software for the board is a clone of Marlin at bugfix-2.0.x branch of my repository. I keep it relatively in sync with the Marlin branch. Note: there are other branches of Marlin as well only the bugfix-2.0.x supports the STM32 microcontroller.

Marlin is using Arduino IDE or Platform IO. I personally had issues with Platform IO not supporting the STM32F4 board, so I use Arduino version 1.8.5. To compile the firmware code, you would need to install the STM32 Arduino port.

Leave a comment if you have any questions.