NHCAD
NHCAD

Fun Projects in Mechanical Design & Custom Programming
Lebanon, NH


NHCAD Home

CAD(Computer Design)
Free CAD Software
SolidWorks
SolidWorks Macros
SolidWorks Custom Properties

CNC / Steppers
5804 Stepper Driver Circuit
Floppy Stepper Motors
DIY CD Plotter
DIY CNC Mill

J2ME Mobile Programs
Sprtint Wireless Toolkit
Device / ESN Activation
Favorite Apps
JPGViewer

1964 Oday Javelin
1964 Oday Javelin
Centerboard
Rudder
Tiller
Transom
Hull
Topside
Deck
Details
First Sail
UCN5804B Stepper Motor Controller



While constructing the CNC Mill I decided to purchase a controller kit (with steppers) from www.hobbycnc.com. It was important to me to keep the cost down. I soldered all the components onto the printed circuit board and everything has been working flawlessly since.


HobbyCNC 3-axis kit (1 of 3 - 80 oz.in. motors shown)
not visible - 25 pin port & power plug (+12, Gnd, Gnd, +5) that PC power supply can plug into.



A friend of mine is interested in building a hot wire foam cutter. Sounds interesting doesn't it? Right away I'm thinking that my 3-axis motor controller will not work. I will have to modify it (and find a 4th motor) or make my own 4-axis controller (2 axes at each end of hot wire).

I thought I might be able to design my own 4-axis controller on a budget. I decided to stick with the UCN5804B stepper controller IC. It is discontinued now, but the hobbycnc controller I have uses it, and it is still quite available from Digi-Key and Alltronics.

In fact, I bought some 5804 ICs and a stepper motor from alltronics. Kit 93I003 'Stepper Motor Semi Kit' ($8.95 11/2005). Supposedly the kit came with an IC, Stepper Motor, & documentation. Because Alltronics had a $20 min, I bought 3 more IC's. If things went well, I figured I would need a total of 4 ICs, one for each axis. Unfortunately, the 'kit' didn't include any docs. I had to figure it out on my own.


Kit 92I003 from Alltronics - note the lack of 'documentation'.


5804 Documentation

A great place to start is with the 5804 data sheet from Allegromicro. It has a lot of important information in there. Getting data from the parallel port into the chip was a stumbling block, until I learned how to utilize a pull up resistor.




Pull Up Resistor


Because I am using a PC power supply to power this circuit, I already have a regulated +5V to control the logic of the 5804 IC. Pins 1-8 are all output to the motor, and pins 9 - 16 are inputs. To further simplify the circuit, many of the inputs are grounded or tied high (+5V).

In order to properly hold a logic pin high or low, it requires the use of a 10K pull up resistor (or pull down). Don't let the name fool you, it's just a resistor like any other. 'Pull-up' refers to its function in the circuit. See the Seattle Robotics Newsletter for a thorough explanation.


Schematic - Motor



The finished board. The bottom side is not so elegant. From the 25 parallel cable, pin 2 (blue) is Direction, pin 3 (white) is STEP, and pin 25 (magenta) is ground.



The fast recovery diodes protect the IC from the pulse of a collapsing magnetic field, which happens when a coil gets shut off. I used 4 off the shelf 1N4002 diodes, because that is what I had around. Some better choices are shown below.

Digi-Key Part Number

Manufacturer Part Number

Description

Vendor

Diode/Rectifier Type

Voltage-Rated

Current Rating

1N4935/4GICT-ND

1N4935/4

1 AMP 200PIV FAST RECOVERY DIODE

General Semiconductor

Fast Recovery

200V

1A

1N4935DICT-ND

1N4935-T

RECTIFIER FST REC 200V 1A DO-41

Diodes Inc

Fast Recovery

200V

1A

497-2445-1-ND

STTH302

DIODE ULTRAFAST 200V 3A DO-201AD

STMicroelectronics

Fast Recovery

200V

1A




Schematic - LEDs

I found using LEDs (Light Emitting Diodes) useful in debugging the circuit. I used the LEDs to test the circuit, prior to putting a stepping motor on it. The LEDs give some visual feedback. The coil that would be ON, would light up the LED. What is interesting is to try the different stepping modes offered by the chip. In my schematic I tied pin 9 & 10 low by soldering them to ground. If you think you will want to try the different wave options, you could use jumpers to make it selectable. Remember to use a pull-up resistor on pins 9 and/or 10 just like the step & dir pins (11 & 14 respectively). I also used a small program called LPTOUT.EXE to manipulate the status of the DIR and STEP pins while debugging. Remember, the IC will change the output states when STEP goes low.



Using LEDs and toggling the state of the STEP pin is interesting. It allows you to slowly make changes and see what the results are. Watching the different wave types step through the 4 LEDs is thought provoking.




Other Motors

The Fuji motor that came with the chip(s) has been working great. So I turned my attention to the larger HobbyCNC motor.
   	Fuji	HobbyCNC
        ------  --------
Volts	12	6
1 coil	35 ohm	5 ohm
Torque	?	80 in oz
To run the HobbyCNC motor, I applied +5v to the motor side of the chip (pins 2 & 7) instead of +12v. The resistance of the motor is significantly less and as a result, the motor uses more current. I ran the motor for about 15 minutes with TurboCNC g-code software. The motor didn't get hot, but the 5804B sure did. I think it could use a heat sink on it. Occasionally I would miss a step too. I'm not sure if I was just running it too fast or if the heat was affecting the logic. I will have to study it a bit more.



5804B Links

Electronics Lab http://www.electronics-lab.com/projects/pc/008/

DIY Foam Axis Cutter with Electronics Section http://www.8linx.com/cnc/electronics.htm

CW Technology - Allegro 5804 3 Axis Controller http://www.theworkshop.ca/machining/FoamMill/foamMill2/cwtechdoc.htm

Simplified Output Interface (C) 2003 Jim Fullerhttp://www.ecawa.asn.au/home/jfuller/sio.html