KiCAD 3D export + onshape

In my experiments with the rev1 version of the TMC2130 board I found that the motor drivers get quite warm with increased current. If I point a fan just right it would cool the driver enough, but if the air flow was not sufficient the drivers overheat quite easily.

I wanted to improve the cooling on the PrntrBoard motor drivers. The board layout is challenging with the NUCLEO board on the bottom and a bunch of connectors on the top. Achieving good airflow for the Trinamic drivers would not be simple unless I add many many fans.

I tried to design a custom airflow conduit that would direct the air over the drivers without taking too much extra space. To start I did an export of a 3D model of the board and all components from KiCAD – it proved to be an excellent feature. I exported a STEP file, which I then tried to import in onshape. It kind of worked, but the generated assembly was full of small parts which would move all over the place and there was no easy way to tell onshape that this was one solid block of parts (at least I didn’t find an easy way to do that). Not to worry I fired off a copy of Autodesk Fusion 360. Imported the file there and added models for the heatsinks I was using on the board. I also added the IDC connectors to the NUCLEO board (they were not in the KiCAD export). I tried to figure out the assembly feature in Fusion 360, but gave up and exported STEP file again and imported it back to onshape. This time it appeared as one giant part, so I proceeded with my favorite feature – “design part in place”. This lets you design a new part in the context of an assembly and you can use geometry from the assembly as reference.

This is what the current design looks like:


And here is how it actually fits on the board, when I created the parts on a 3D printer:

TMC2130 catches fire

A co-worker shared this story yesterday with me. He upgraded his printer to TMC2130 drivers and while he was testing how the new toys performed he got a message that one of the drivers overheated and then the driver exploded in a non trivial ball of fire.

I asked if I can have the driver for some pictures. The driver boards were clones from the usual Asian markets. He now has ordered some “legit” boards from DigiKey. Crossing fingers these would not burn his house down. Said unfortunate driver was on his Z axis and he was running it at 1.1 amps.

This is what it looks like, next to a working board from the same supplier:

(click on the image for better resolution)

As you can see the top of the board kind of exploded, with some of the copper traces melted away. I suspect when the driver overheated either a solder joint shorted or the board shorted internally and that caused the severe failure.

This is the bottom of the board, where the driver chip is mounted:

The damage looks less severe from the bottom. There are charred components, but no melted copper.

Here is the top part – where the copper melted under my microscope:

Another angle – close to the edge of the board:

This is the bottom side – you can see the chip is a bit burned and some capacitors have been barbecued.

Another view of the barbecue area:

The rest of the chip looks intact:

I removed the chip an this is a view of the PCB underneath:

All but 3 pads look in very good condition. Unfortunately the 3 pads have evaporated completely from the board as well as the chip itself:

I was wondering if the chip can be salvaged, but it does not appear to be within my abilities.

One more reason to keep a fire extinguisher handy and not let your 3D printer unattended.

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.

A series of unfortunate events

The long weekend was a perfect time to take some vacation days and work on my projects. Alas the past few days have been nothing but failure after failure. Ahh, let’s make lemonade.

So I started very optimistic – my 3D printer controller board was basically working, and feeling bold I went on “improving” the puny 3D printed (Duplicator I3 mini) that I purchased for this experiment.

For some time I’ve been wanting to add dual extruder support to my printers. The ability to print with PVA support, dual colors – oooh the possibilities. However my previous experience was that such endeavor is feeble at best.

Two and a half years ago I assembled a MendelMax printer with dual extruders and it was not very successful. The design used dual E3D V6 hotends – these were all the rage back then. Unfortunately there was no easy way to level the two extruder heads, so what you end up is one head printing correctly and the other was printing in the air. Even if you get them somewhat leveled one head would print and the other would scrape the filament from the bed. Add to that the head was now super heavy from two sets of steppers and assorted hardware.

Since that experiment I wanted to try a Bowden extruder setup – mainly to reduce the weight of a dual extruder setup. I also was fascinated by the E3D’s Cyclops/Chimera designs and wanted to try one. It seemed like a design that would solve some of the issues I had encountered with the MendelMax setup.

I procured parts for the cyclops/chimera setup some time ago from China, but I was suspicious why this has not become popular setup. Since the E3D designs are open, various suppliers are offering reduced price version of the kit for some time – yet it has not taken the world by storm.

In unrelated observation, I was very impressed by the Wade’s extruder design used in the Lulzbot mini. The geared setup provided so much torque – the extruder would practically push filament cold out of the nozzle – well not really, but close.

Anyhow I got the parts for the hotend, now I needed two extruders and lucky for me E3D came up with the Titan extruder. It was geared 3:1, not too bit as Wade’s masterpiece and affordable, thanks to the people of China.

To drive filament trough the extruders I opted for 2 pancake steppers with 0.9 degree precision from the E3D web site. On paper these were perfect – increase precision, low weight and as added bonus they had 6 pin plug for a  cable of my choosing, instead of the usual pigtails.

All this prep work done, rewind to yesterday where I was going to put it all together. What could possibly go wrong – well everything and more.

First I designed a mount for the cyclops/chimera hotend for the Duplicator I3 Mini. Took a few hours, but I was very happy with it. As added bonus I put a mount for a bed leveling probe.

It was looking very cool when mounted on the printer.

Here I tested the bed level probe and the endstop homing the X axis correctly. Unfortunately the bed level probe did not work out of the box. I tried to use an optron to decouple the probe high voltage output from the sensor input on the controller, but the optron was not pulling enough current to produce a level change on my board. I gave up on the bed level probe for now. I’ll have to design an adapted of some sort for it.

Then I designed a spool stand and a bracket to mount the Titan extruder, because it would not fit on the small printer body.


Again it was looking good. The picture is of an earlier design, without the support beam. I added it because the bracket was wobbling too much.

Then I tried to hook the extruder to the 3D printer controller and it was not working. Try as I might to increase the current – nope. It would buzz and wobble, but not spin. I dismantled the whole thing and left the motor alone – it was spinning, but in weird directions – it would change direction on it’s own. I thought the controller was busted or the motor was possessed.

Long story short it was the motor cable. Remember I was so excited that the motor had this plug, instead of cables running out of it.

Instead of splicing cables around you can just buy a cable with the length you need and plug it in the motor and the controller. Well sounds cool, except there is a trick to the cable and not all cables are created equal.

The motor has 6 pins – only four are connected. The signals are A(1), B(3), !A(4), !B(6). Pin numbers are in braces and pins 2 and 5 are not connected. Here A and B are the two motor coils and A and !A are the two ends of the coil A.

Now the connector on the controller board takes the signals in this order: A, !A, B, !B and usually the cables I got are kind enough to swap signals from pins 3 and 4, so the board receives the signals correctly. You can see where this is going. I was unlucky enough to get a straight cable so the signals were not in the right order when the motor was connected to the board.

OK lesson learned. Check the motor cable before using it. I fixed the cable and put everything back together. Still no luck.

This time the motor would try to spin but start to skip steps and would not move the extruder. It would move if I help it with my hand, but that was not a workable solution. I cranked the motor current up and it would move the filament up and down the tube, but it was struggling. I let it be and proceeded to hook everything else to the cyclops hotend.

If you are not following the cyclops/chimera is a hotend which has two configurations. The first is called cyclops: two filaments come in a common heated block and come out via single nozzle. I wanted to try that first, because this way I won’t have to level two extruder heads. It was a bit more complicated setup in the firmware, but I thought it was worth it.

Unfortunately my hopes were crushed again by failure. To spare you the details this design has a few flaws. First the filament path is not straight – in a normal extruder the filament goes in a straight line to the nozzle. In the cyclops design the filament has to bend 90 degrees twice – once it enters the heater and once to go trough the nozzle. This in turn requires much more torque from the extruder.

The second design flow is that the molten filament shares a common path between both intake points. It is possible for molten filament to go up and clog the other intake – this happened to me twice before I gave up on the cyclops.

The third problem I has was with the manufacturing of the heated block – it used way too lax tolerances an filament was oozing out from the heat break threads as well as the “plug screw” thread (a screw that is used to plug a hole on the side of the heater block).

So to conclude the cyclops was a fail. I can get it to extrude from one side, but to switch to the other side it required quite a bit of initial torque. Once you get one side going it was working, but to get it extruding was a challenge, and there was the clogging thing. Stay away.

Disheartened by this failure I dismounted the cyclops and decided to try the chimera. This configuration is more straight forward – is looks like two hotends which share a cooling block, which is a space saving design. There is the problem with leveling the two heads against the bed, but this is eased by holding each head with set screws. Not ideal but workable.

Before completing this setup, I gave up on the E3D pancake steppers – they provided too little torque for the extruders to spin reliably. I’m not sure if the motors are bad, the 0.9 degree thing or what is it, but I could hold the motor shaft with my hand and stop it from moving. If they produced any torque it was measure in mosquitoes not ounces per inch. I put two regular 1.8 degree motors I had lying around – these worked much better even with 30% lower current than the pancake motors.

The chimera setup was too plain to leave alone, so I decided to experiment with another innovation from China – the combined nozzle/heatbreak.

Again on paper it sounded intriguing. Instead of having a nozzle and a heat break tube – both meeting in the heater block. This all in one design would simplify the system. No more careful torquing of the nozzle required. Or so I thought.

Here is a picture of the combined nozzle/heatbreak tube vs a regular heatbreak tube.

I have a feeling you are questioning my sanity at this point. Why would I do this? Well you see a traditional heat break tube has to be machined properly – the sides of the holes have to be polished. This takes time and makes it expensive, so creative folk have decided to save cost by adding a PTFE (Teflon) tube.

This saves on machining the tube, but ruins the whole “all metal” hotend concept, by adding back a piece of plastic. The purpose of an “all metal” design is to be able to allow the heater to reach high temperatures (above 300C) safely. High temperatures are needed to extrude some plastics like Nylon.

The PTFE tube would limit the usable range of the hotend to 260-270C.

In addition because the nozzle and the heat break tube don’t meet in a perfectly straight line there is always the issue with the filament locking and clogging in the heater block – it is not a terribly big problem, but annoying at times.

Enter the promise of the combined nozzle/heatbreak tube. By now you should sense another fail coming.

One thing I did not account for was the amount of heat transferred between the heated block and the cooling block. It was ‘uge. The combined nozzle design was an excellent heat conductor so a large amount of heat was transferred to the cooling block. The cooling block was not able to keep up and heated to the point of melting the mount.

Also because the cooling block was not cool at all, the filament melted inside the Bowden tube clogging it and I was not able to move it up or down. It was complete and total disaster.

For posterity I measured the cooling block temperature: with one of the nozzle heaters at 215C, the cooling block was reaching 63C – not terrible but quite hot. With both heater set to 215C, I measured 91C on the outside, enough to make the mount flexible and to make the filament inside the Bowden tubes flexible as well.

Once again, I had to dismantle the hotend,  cut the clogged Bowden tubes, make a new mount and re-install the original heatbreak tubes. After two dais of failures, I settled to just be able to print something.

I measured the temperature first and with one heater set to 215C, the cooling block was at 36C (28C ambient temperature). With two heaters it climber up to 45C- on the outside and 51C on the inside. Warm but manageable.

So here it is the current setup.

Naturally the left nozzle clogged on the first print. I’m not having a good feeling on this one. Like most E3D setups you have to watch the retraction amount. You have a choice between stringing and nozzle clogging.

On my old E3D V6 I was having lots of similar issues and the cure was to “oil the hotend” – sounded like a bunch of baloney at first, but then I tried it and it really improved my  clogging issues. I should try it on this setup as well.

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 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 ( 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 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.

Gerber Viewer updated UI

Some time ago I wrote an online Gerber file viewer. I’ve been using it to validate the KiCad Gerber output files, before I sent them to the PCB manufacturer. One feature that was missing was the ability to set transparency on the layers, when more than one layer is selected for display.

As I started working on that, I realized that I also need to be able to select the color for the layer as well. Here are a few screenshots of the viewer in action.

Two layer PCB, top layer is red, the bottom is green:

Six layer PCB (Beagle Bone XM) with top and two internal signal layers selected:

The same Beagle Bone XM board with 6 layers selected: