Skip to Content

archive

Monthly Archives: December 2012

post

Industrial PID Temperature Controller Teardown

+ PID Temperature Controller Teardown

Last weekend, I went to the Guangzhou markets with my buddy Matt. There was lots of good stuff there, but one of the things that caught my eye were these PID temperature controller modules. Its the sort of industrial process control gear that is normally inaccessible to mortals. Fortunately for me, this was China, so I plunked down 80yuan and took one home with me.

photo (16)

+ Exterior

The unit is an elongated cube with interface on one side and terminals on the other. Its got a schematic silkscreened on one side to make hooking it up possible without a reference manual. Pretty snazzy.

photo (22)

+ Interior

Getting inside was pretty easy. The thing has tabs that you press and all the guts slide right out.

photo (20)

The first thing I noticed was that the interior is pretty much all PCB. There are 3 PCBs + the terminal block that are all soldered together for electrical and mechanical strength.

Elsewhere there 2 PCBs connecting. They designed pads onto each PCB where they needed to connect. Then someone simply bridged the pads with solder. Very clever. Not the strongest connection in the world, but it is certainly cheap and effective.

photo (19)

The interface board is interesting. Nothing too fancy here. A couple buttons, some LEDs, and some 7-segment displays. Nice and simple.

photo (21)

The board appears to be controlled by an Atmega and they kindly left the ICSP header exposed and labeled. Probably for their manufacturing process, but if I wanted to hack this device I could load my own firmware too.

photo (18)

+ Wiring it up

The controller is powered with AC wall current (110-230v) so I hacked up a power cable to control it. I took a thermocouple and a heater cartridge and taped them together with Kapton. I wired up my desktop bench supply to provide current to the heater.

photo (23)

Unfortunately my PID settings were way off and this thing has too many options that I didn’t want to mess with. After a couple minutes though it settled in an the appropriate temperature.

photo (17)

post

Challenges of Building a CNC Stepper Driver

I’m fascinated by motor drivers, and stepper motors in particular. There is just something so awesome about a modular little unit that will allow you to control a motor. As the motors get bigger, the awesomeness increases.

Lately I’ve been looking at high powered driver chips as part of a plan to build a CNC machine. Toshiba makes some great chips. The TB6560 is the ‘classic’ driver chip they make: 1/16th step, 4amps, and >30 volts. Unfortunately it has some flaws with power sequencing that causes it to blow up if you don’t turn VCC on before VMOT.

They’ve since released a few new driver chips. I designed a board around the beefy THB6064AH. This chip is pretty badass as its a 4.5A, 1/64th step, 50V beast. This thing will do some damage with the right motor. Unfortunately I’ve been struggling with the design. You can find it on Github.

Lately I’ve discovered an even more awesome chip! The THB7128. Not only is it cheaper than the THB6064AH, but it does 1/128th stepping. The internet doesn’t have a ton of info. This appears to be a new chip on the market. This should make for extremely smooth operation. The only real downside is that it maxes out at 3A instead of 4.5A. Most of my motors are <3A so that shouldn't be a problem. I've ordered a demo board to test it out.

With my new design in hand, I ordered the boards + a new test fixture and got cracking. I used my Stencil8 setup to make 6 beautiful prototypes and a test fixture to go with it. Then things started to go wrong.

The Ugly Details of How I Messed Up

First, I messed up the connector on the test fixture. Basically it was mirrored, so I had to solder on the headers on the back side. That just generally made things awkward. Always do a reality check before purchasing boards!!!! Your printer and some cardboard (or old pcbs) are your friends.

Second, I messed up a couple traces on the PCB. Nothing major, but things like the relay enable lines for 5V and VMOT being the same weren’t cool. Easy enough to fix with some jumper wires. The good news is the relays fired up first try, and the current measuring works as expected. I’ll do a writeup of this new and improved test fixture soon.

Third, and here’s where the trouble really started: I had no idea how to design for these higher power drivers. I knew about the sense resistors, and what value to make… but not what wattage. I knew they needed fast response diodes, but nothing more than that.

One very real problem I had was using too small of resistors. I never really quite grokked how to select current sense resistors for stepper motor drivers that need them. It’s actually very simple! Your driver is rated for a given current (say 4 amps). The datasheet will typically recommend a resistor value, as well as a formula for current based on a VREF. From that, it is easy to determine the ohm rating of your resistor (for the THB6064AH, its 0.22ohm). What they don’t say (and this is probably obvious to a real electrical engineer) is that the WATTAGE of the resistor can be calculated by W = I^2*R. In this case, 4*4*.22 = 3.2W. That pretty much rules out SMT resistors like I was using. Instead, you’ll need to use ceramic resistor. These resistors come in different sizes, but 5W is probably a safe bet. The next lowest is 3W which is less than the max required wattacge.

Fourth, and this is the main problem that I bashed my head into for 2 days in a row: The THB6064H is NOT THE SAME as the THB6064AH. I somehow purchased the THB6064H chips while designing for the THb6064AH. Of course this results in completely unpredictable operation that was so tantalizingly close that I *just knew* it had to be something in my circuit. Turns out, it was just me being an idiot.

Ultimately, this was a very frustrating but enlightening problem. I bashed my head at almost every single problem – both perceived and real. I did find some real issues, but the ultimate problem was one that I had completely overlooked. In the process I used the scope on just about every single pin, verified the test fixture, and just generally went over it with a fine toothed comb. I also learned a ton about the workings of the diode bridge, the current sense resistors, the resistors that control the oscillator, etc. I wish I had gotten it in one, but hey… thats life!