Archive for March, 2010

PCB layouts and schematics for my CNC

I’ve received some email and comment requests for the layouts and schematics of the electronics running my CNC machine. I’ve pulled together what I can find for this article.

Power Filter Boards

Electronics 002

I made these power filters for a few reasons. One is to protect the stepper motor drives from the inductive spikes that can come off of the motors.  They can be pretty big. Another reason was that I wanted to use a switch-mode power supply to run the drives. There’s a lot of good reasons for this:

1. Switch-mode power supplies are cheaper than linear power supplies.

2. Switch-mode power supplies are smaller than linear supplies for equivalent output power.

3. Switch-mode power supplies come in a wide range of voltages, so you can run the stepper motors at the highest voltage possible. (The highest voltage your controller supports) This allows for more torque from any motor because a higher voltage will push more current through the inductance of the motor than a lower voltage. It will also do it quicker, so you should get a little more speed too.

However, I wasn’t sure that the chopper-style stepper driver would be okay with a switch mode supply, as it pretty much shorts out the supply every time the chopper turns on. So I needed a buffer.

I found this article at EETimesAsia by John Betten from TI. I modified the circuit for the voltage levels I wanted to run, and also found a suitable replacement for the FET since I couldn’t find one at the time. Here is the original schematic:


I’m using an IR IRFP9140N in place of Q1. I also replaced D2 with a 56V TVS from ON semi, 1.5KE56A. I used 56V because the LMD18245 motor driver IC I have has a continuous rating of 55V and an absolute max of 60V. I also oversized the output capacitor just to be on the safe side since I had some big ones laying around anyway. They are 22000uF 100V Panasonics. They are overkill, the voltage is rock-solid even when the motors are running at full clip. I wanted to be able to recycle the boards though if I ever upgrade to a bigger machine and have bigger motors. Here’s the layout for my circuit:


Opto-isolated Parallel Interface Board

I designed this parallel interface board after killing a parallel port with a breakout board that I bought off the internet. I think it just pulled too much current from the port. I designed this board to pull the smallest amount of current from the parallel port as possible, while also providing good drive characteristics for outputs. This board is customized to my application, so the voltages and bias might not be appropriate for all.  Check to make sure your inputs will work before using the values here. I couldn’t find the schematic, just the layout but it’s not too complicated to figure out if you have the datasheets for the TLP2631 and the SN74LS244N. › Continue reading

Tags: , , ,

Thursday, March 25th, 2010 CNC, Electronics 5 Comments

Build a spot welder from a battery charger

I ran across a battery charger a while ago that was collecting dust. I looked inside and saw the transformer, heatsinks, high current bridge rectifier and SCR and knew I could do something with it. So I turned it into a spot welder.

SpotWelder 028

I originally intended this project to weld thin sheetmetal tabs to stuff to act as solder tabs. The project has not been as easy as I originally thought though. (It also suffered some scope creep) It’s my first crack at 5V logic mixed with line AC voltage, and for rolling my own power supply. I used a step-down transformer, bridge regulator and a capacitor to feed an LDO regulator for the control circuit. With the low current draw of the controller, the voltage input to the regulator was relatively free from any ripple thanks to the capacitor.

I ended up frying a processor, LCD, and a couple other components due to a dumb move while troubleshooting the circuit, and overlooking a capacitor’s voltage rating. 120VAC will eat 5V stuff for lunch.

Spot Welder guts

The control circuit basically modulates the SCR, which is hooked up to the output of the bridge rectifier after a step-down transformer. The controller allows for adjustment of duration of the weld and amount of the rectified AC phase that is delivered to the workpiece. The controller holds off the SCR until a pre-determined time of each half phase to control power delivery. An analog comparator detects the zero point of the phase for timing purposes, via a seperate bridge rectifier that has it’s ouput fed through a large resistor to the comparator. A zener clamps the current-limited voltage at 4.8V so as not to damage the micro’s input. A high-to-low transition on the comparator triggers the zero crossing timer. The threshhold voltage is adjustable by an on-board pot.

I also added an Allegro hall effect current sensor that I had lying around from my alternator current sense project. It’s overkill, but it measures the amount of peak current being delivered and displays it on the LCD.

SpotWelder 034

The controller is an ATmega88PA running at 8Mhz. Firmware is written in C with AVRStudio and AVR-GCC. The micro reads the power and duration settings, displays that on the LCD, along with the max current for the last weld cycle and the temperature of the mega’s on-chip sensor. The controller also handles timing duties, zero crossing detection, and control of the SCR gate. The gate is fired by a P-channel MOSFET, with the FET’s gate driven by an NPN BJT on one of the micro’s pins. A footswitch is used as input to the micro to trigger a weld cycle. Both the footswitch input and the zero crossings are buffered by a simple three-sample debouncing routine to prevent erroneous triggers. The system also checks for the footswitch input on power up and after the weld cycle is complete, and waits if the footswitch is down with a message on the LCD to release the footswitch. This allows for safety as well as eliminating any unintended re-triggers at very short durations. Duration is adjustable from roughly one ac cycle to 60 cycles (1 sec). Power control allows from 5% to 95% of each half phase to be delivered to the workpiece.

The SCR’s cathode voltage is available at PORTC2 as a 10:1 voltage divider, and clamped with a zener to prevent damage to the micro. I didn’t need it, so it’s not used in the code.

I’ve also added a power resistor to the output to limit current. I used carbon-carbon as a power resistor (I work in a carbon plant) since it’s free and power resistors are expensive. You only need a few tenths of an ohm to limit the current to a level that won’t destroy the diodes and SCR. I’m overdriving mine at about 130A maximum. It seems to handle it fine for the short bursts.  [Edit: 130A isn’t enough though. I may rewire so the diodes/SCR are on the input side and push the current higher by removing or modifying the resistor. Pressure of the electrodes on the joint is also important, still figuring that out.]

Here’s some drive waveforms: yellow is the output voltage (it’s at 50V/div so it looks small), purple is the output current measured by the hall sensor, blue is the FET’s gate that turns on the SCR, and green is the bridge voltage.

Low driveMedium drive

This project has got me thinking about modifying my old “buzzbox” AC welder. I’ve got some big capacitors and IGBTs from a couple old motor drives that could give me a really nice TIG welding power supply. I think I’ve read you can weld high frequency (1-2kHz?) square-wave without needing any HF section. If I remember right square-wave with a positive DC offset is sort of the ultimate TIG welder. Anybody with comments or information about that feel free to drop me a line.

Continue reading for the schematic, PCB layout, and code.

References: Miller Resistance Spot Welding

› Continue reading

Tags: , , , , , ,

Wednesday, March 10th, 2010 Electronics 15 Comments