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.

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:

How to mount Cut Tape parts on CHMT48VB and other desktop Pick and Place machines

I had to load some more components on my trusty Pick and Place machine and decided to document the process for all the Internet to see.

If you are not made from money, chances are you have encountered this problem. Sometimes it is too expensive to order a whole reel of parts. So what to do with a cut tape of 100 or so components?

Most distributors offer a “reel” service – that is they would make your cut-tape onto a reel – this would save you all this trouble. I personally found this solution to drastically increase your price per component though. For example, a cut tape of 100 capacitors, would cost you $1-$3, the tape reel service is $7, which is more than twice the price for the components.

On some machines, you can cut a small strip, just long enough for the job and use the “IC tray” mode. But what if we can do better?

First, you need a reel where to put the components. You can 3D print one – I made a model here. It is two pieces (left and right) you can print separately. It is standard 178mm reel. I have printed both 8mm and 12mm wide versions, by adjusting the hub width. Initially, I tried 130mm diameter reel because it is suitable for smaller 3D printers, but it was a pain to work with on the machine. It was too small to stay on its own, and I had to put it on the the reel shaft. This, in turn, was a major issue every time you have to replace a component you have to remove all reels. So please use 178mm it would save you lots of pain.

Anyhow the reel is easy to put together, just print the left and right part, align them together and press. There is a little hole on the hub to feed the cut tape make sure the left and right part line together. It should look something like this:

You can see the cut tape of 0402 capacitors I’m going to use underneath. Make sure when you put the tape on the reel, you wind it in the correct direction – the tape sprocket holes should be on the correct side.

For example, this, turns out, was the wrong way for my machine:

Anyhow here is it wound up the right way.

This is all and good, but to properly install the reel in the pick and place machine you would need about one foot of plastic tape from the reel. The normal reels have about 30-40cm of empty space so that you can thread the tape through the mechanism. With the cut tape this means losing quite a bit of components.

Not to worry I have just the trick for you. For 8mm wide cut tape use this wonderful 3M product I found on Amazon –  0.188″ tape. The one I use looks like this:

For 12mm wide cut tape use 1/4″ 3M tape, for example, this one.

You would need to cut two pieces of sticky tape one about a foot – enough to get from your pick and place pickup to the tape collection wheel and wind on the wheel about once. The second piece about one to one and a half inch.

First you snake the longer piece of tape on the pick and place machine – follow the normal path for tape collection and make sure the tape is not twisted. I stick it a little on the collection wheel as well as on the pick and place pickup wheel.

It helps if you put the tape on the next position, where you insert the cut tape.

Now, peel off the plastic tape from the component tape for about an inch. You would lose 10-15 components – it is a worthy sacrifice. Why an inch? As you can see in the picture, I have to guide the tape about that distance to make sure it is not stuck anywhere. If your machine uses different setup adjust the length as needed. You cannot go smaller than 1/3 (one stapler size) inch though you’ll see why in a few paragraphs.

Insert the cut tape in the machine as if it was a regular tape, then tape the short piece of 3M tape over the peeled plastic tape. I use this to increase the plastic tape strength, because my machine pulls like there is no tomorrow.

Now turn the tape over and stick the long piece of tape on the opposite side.

Just like this:

Finally put a stapler on the small segment. The sticky tape alone would not hold to the pull force of the machine. The stapler would ensure the “mechanism” stays together.

Make sure you lock all 3 pieces with the stapler – the two tricky tape pieces as well as the plastic tape between them. I found that micro staples work for me. For example this Amazon item.

Here is how it should look like:

Finally, place the other end of the 3M tape over the collection wheel and pick up the slack:

Enjoy.

“mass” production

The demand for my CD-changer emulator is picking up, so I’m making several boards at the same time. Placing of the components on the board by hand and re-flow with hot air.

These 6 board take about 4 hours in this stage plus another 4 hours or so to solder the optical connector and other connectors. My hands feel tired after a while. I’ve heard that good scotch helps with this condition.

SMD stencil printer is so cool

If you can’t recognize what this is, here is an explanation.

When creating PCBs, one can order a stencil – usually from a thin sheet of stainless steel. On this stencil, there are cut small holes (with a laser cutter) where one is supposed to apply solder paste on the PCB.

So the operation is: you align the stencil on top of the PCB; then squirt some solder paste on top of the stencil; then use a flat “applicator” to smudge the solder paste over the stencil holes. In the end, you lift the stencil up, and you end up with the solder paste applied in a thin layer over the solder pads on the PCB.

To aid in this whole process is this contraption – a stencil printer. You align the stencil on the device and put come L shaped holders on the bottom to hold the PCB in place. The bolts on the bottom are to help to align the stencil and the PCB. When the alignment is achieved you put the PCB in the holder on the bottom; lower the stencil; apply solder paste; lift the stencil; remove the PCB. The whole solder paste application takes about 1 minute.

I should have gotten it sooner. My only regret is not getting a larger size printer, as you can see the stencil frame is a bit larger than the printer base – it still works though.

Fun with colors

I’m very pleased with the new box design. It allows me to play with multiple color plastic, so just in time I created a “4th of July” (red, white and blue) device edition.

The new Pi Zero version is ready

I had to re-design the new box. Before I was trying to make it from 2 parts – top and bottom. This process had issues because the bottom part would not 3D Print correctly – it would keep curling up due to stress in the ABS material.

So finally I made the box bottom from several pieces. The bottom has 4 curved corners and 4 side panels, which slide down – you can see one of the side “panels” in this picture.

Also, you can see the size of the old device version compared to the new version.