Professional Documents
Culture Documents
Micro controller also takes care of motor current. The voltage divider is made
with resistor 2k2, and trimmer 470R. When P1.1 is low the divider is
additionally pulled low via 180R resistor. This way we reduce standby current
to 1/3 of full current. This way motors stay cool when the machine isn't in
use. The current through each motor is controlled with 470R trimmer
potentiometers TP1, TP2 and TP3. The power loss on output chips depends
on motor currents and chopper frequency. Probably you will need a smaller
cooler and maybe a little fan on top of it.
The power of power supply required by our circuit depends on motors we
use. In most cases the 36V/2A and 5V/0.3A PS will do fine. The cable
between PC and driller is usual with two DB9 connectors, male and female.
The initialization switches are normal mechanical. I decided so, because they
aren't sensible to light or dust like IR.
Note: if the schematics doesn't load, hold SHIFT and click on picture to
save it to disk and then open it with your favorite image viewer.
The same goes for other High resolution images too.
Circuit schematics
MICRO CONTROLLER OPERATION AND ROUTINE EXAMPLES
On power on the micro controller first initializes all three motors. First it lifts
Z motor on top, to avoid drill breaking. If the motors are in initial position,
they are moved a little and initialized back again. The motors run until they
hit their end switch. The mcu then stops that motor and initializes next one.
The initialization routine looks like this.
'Z axis initialization
If P3.5 = 0 Then
P1.3 = 1
For N = 0 To 100
P1.2 = 0
Delay
P1.2 = 1
For J = 0 To M
Delay
Next J
Next N
End If
P1.3 = 0
Do
P1.2 = 0
Delay
Delay
P1.2 = 1
For J = 0 To M
Delay
Next J
Loop Until P3.5 = 0
The same happens for X and Y axes too. When initialization is done, the MCU
sends message to PC that it's ready.
Print "Ready";
After that it waits for computer commands. It's interested in coordinates and
command which tells it what to do. The computer asks MCU if it's ready
before starting the job. If he doesn't get any reply from machine he warns
as with error dialog. If the MCU is ready, then computer sends him the first
coordinate with a command what to do when it gets there. When the driller
is in position, it can do the following:
decrease the driller on position marked with "a" in settings and switch
it on,
make a hole, that means go down for "b" and then go up for "b" too,
=
=
=
=
=
Waitkey
Waitkey
Waitkey
Waitkey
Waitkey
'reads 5 variables
'from serial port
Num = Chr(pom1)
Pom1 = Val(num)
Temp = Pom1 * 10000
Num = Chr(pom2)
Pom2 = Val(num)
Pom2 = Pom2 * 1000
Temp = Temp + Pom2
Num = Chr(pom3)
Pom3 = Val(num)
Pom3 = Pom3 * 100
Temp = Temp + Pom3
Num = Chr(pom4)
Pom4 = Val(num)
Pom4 = Pom4 * 10
Temp = Temp + Pom4
'tens
Num = Chr(pom5)
Pom5 = Val(num)
Temp = Temp + Pom5
'and ones
X = Temp
Delay
'wait a moment
P1.6 = 1
P1.4 = 1
For N = 0 To M
Delay
Next N
'generate a delay
'which determines
'motor speed
If Clkx = 0 Then
to 0
If Clky = 0 Then
to 0
Exit Do
End If
End If
loop
Print "Done";
That's all about main routines. Some of them are repeated several times,
but I explained only the main examples.
ASSEMBLING THE PCB
If you are going to make the PCB at home, you will encounter a problem,
because it's double sided with lots of vias. I suppose that best way to make
a professional PCB is to have it done by PCB manufacturer. The plans for pcb
and all other stuff you can get at the end of this document.
When you have your PCB done, you can start soldering SMD components. All
100n capacitors are filter capacitors for power supply. If you don't have 100n
you can use greater values as well. They should be dimensioned for 50VDC
and preferred size is 1206.
= hot, pin 10 = GND) Be sure not to short circuit the motor cables. The
current regulator cannot limit current fast enough, since short circuit means
only a little inductance.
As we know, there are two basic groups of stepper motors, looking from
point of coil connections. Unipolar motor has four coils (or two coils with
center connection, if you wish) and 6 wires on outside. Some of them have
center of coils connected together and have only 5 wires on the outside.
Bipolar stepper motors have only two coils and four wires on outside.
Considering that our circuit is intended for driving bipolar motors we will
have no problem connecting bipolar motor to our circuit. If we want to
connect a unipolar motor then things get a little different.
Since unipolar motor has center connection on each coil, we can leave this
connection free (NC) and, as you se on schematics of motor, by doing so, we
transformed this motor to bipolar. Only problem is coil resistance, so we
should choose this option when coil resistance is low and motor is made for
low voltages (3 to 5V). If it is too high, the current won't reach it's nominal
level and the torque will be lost (Variant 1). In this case we can disassemble
motor and brake connection on middle terminal and then connect coils
parallel, as it's visible on picture, variant 3. If you don't need motor's full
torque, you can connect it on one of the side wires and on center wire, as
you can see on variant 2. Maybe someone will ask why don't we just connect
the side wires together and we would get lower resistance for variant 3
without disassembling the motor. But this won't work, since the coils are
winded bifilar and magnetic flux would be compensated.
IMPORTANT!
When disassembling motor NEVER pull the rotor out of stator! This
way you will partially demagnetize the permanent magnet in rotor and
motor will no longer have specified torque.
disappear when motor will have a load to carry around. When you press on
that mtor's end switch then the X motor will start turning (after current
adjusting procedure). Press on it's end switch as well and then repeat all this
for Y axis motor. When all of this is done and if PCB is connected with your
computer, you can start Easy NC drill program, described below, open file for
drilling and press Start. The motors will start turning as they will later, when
they will be fastened in their position. If any of motors has wrong direction,
just swap the two wires of one of the coils. If the motors get hot, reduce the
current.
If all of this works for you, you are really on a good way to make the final
product working. Congratulations.
SOFTWARE
The software for controlling of our machine is written for MS Windows
operating system. I tried to implement as many functions as possible, tow I
know that many things can be done better. Any ideas and suggestions are
welcome.
P100
16MB of RAM
Windows 95
The program easy to use and I hope very intuitive too, but I'll explain some
details any way.
The program Easy NC Drill reads standard drilling files (*.NCD) generated by
various PCB designing programs, but there are some settings to be carefully
set in order to make file readable by Easy NC Drill. These settings are:
Units: Inches
Code: ASCII None
Zero Suppression: Trailing
The CAD program will this way generate a file that will be understandable by
Easy NC Drill. I made an example of file which has only one tool and three
holes. On the beginning of file there must be line with text M48 or M72,
otherwise the file will be considered of wrong format.
M48
INCH,LZ
T04F00S00C0.030
%
T04
X+002Y+004
Y+002
X+003Y+003
T00
M30
Easy NC Drill supports up to eight different tools and 1000 holes of each
one. When you open the file, the coordinates are visible in table on the left
side of screen.
When you have a file opened and all settings set you can start drilling. Many
of settings are those, which are set only once for your machine and others
may be set several times. The settings are available by clicking on button,
via menu or shortcut keys. So, lets take a look of these settings:
Warning! Some names of settings may be changed in the future.
Communication
Under Communication tab you can choose a port that your machine is
connected to. If you don't know which one is it, you can click on the Find
button and machine will be detected automatically. There are no other
communication settings necessary since they are controlled internally.
Steps Per Inch (SPI)
In these fields you can type how many steps does your machine have to do
to "travel" 1 inch (25,4mm). You can come to that numbers by trying. You
can draw a PCB with four holes and then drill it with machine and adjust
parameters. The numbers are usually around 200 and 400 when stepper
motor with belt directly on it's axes is used. If you use same motors for X
and Y axes, the numbers should be the same.
Range
In these fields you should enter the full range of your machine. This depends
on it's construction and is defined in mils. These numbers you get by
measuring of machine range with ruler and subtracting about 2 mm of it. If
you enter too big numbers, the machine can crash into the end mechanism.
Offset
Offset tells us where the 0,0 coordinate should be. Increasing offset means
decreasing our active area of work, so consider setting offset to minimum.
Also offset can not be bigger then range anyway. The offset coordinate is
ignored when tool change coordinate is sent.
Trapezoid
The trapezoid distortion occurs, when machine mechanics is not mad enough
precisely (90angle between X and Y axes) or when you use laser printer
it's output can be distorted too. Usually you don't notice that. I didn't too
until I had to drill PCBs made with laser printed film. We can test machine
and printer the same way. Draw a rectangle and print (drill corners of) it.
Then measure opposite points. Maybe you'll be stunned with results. I
measured difference on one Epson laser. It was almost Num! The value can
be positive or negative.
Tool change
In these fields we enter coordinate for tool change. This is a position where
the tool is most easily exchanged. If enabled, the machine will go to this
coordinate every time the tool has to be changed.
Head
Under mark "a" we enter offset from initial position on top to the PCB's
copper layer. We should leave 1 to 2 mm for safety reasons, otherwise the
drill can break if it hits something.
Under "b" we enter drilling depth. This depends on thickness of our board.
Speed
The speed can be set for X and Y axes together and for Z axes. The number
we enter tells the micro controller how many delays he should make
between motor's clock pulses. Higher value faster transport. Speed must be
set in reasonable limits. If it's too slow, drilling will take a while, if too fast,
the motors can loose their position on startup and board will be ruined.
Speed of motors depends on machine design, motor torque and motor
current. You can get your value with testing.
When you're done with setting parameters click the OK button and settings
will be saved to program and to hard disk in file cnc.ini. Settings are also
saved when you exit the program.
I should mention some other settings, which are not available from settings
window. They are available only in program's main window.
Warn for tool change
If this box is checked, the program will warn you every time the tool should
be changed. The drill head will go to coordinates set in Tool change settings
window. The dialog will also tell you which drill diameter is next. If
unchecked, the machine will not ask anything while drilling and all holes will
be done with the same diameter.
Mirror X
If this option is checked, the image and drilling path will be mirrored. This
option is very usable, since we design PCBs in "top view" mode, but when
we want to drill, we do it from copper side of board, if PCB is single sided.
Go to 0,0 when done
If this option is checked, the machine will go to 0,0 when the job is done,
otherwise it will go to Tool change position.
O.K. So now the tool bar is next. The commands on toolbar are the basic
ones.
Open NCD
Opens file with extension NCD in last used directory if possible. If file format
isn't supported or if the coordinates are out of range the error message
appears. In case that coordinate is out of range it's possible that we made
our project far from bottom left corner. Usually the easiest solution is to
move our PCB in bottom left corner or to put origin point closer to our
project.
Drill
Well, I guess we'll need this one. It starts the machine and executes selected
job. If the machine is powered off or if it's COM port isn't properly selected
the message will warn us, that the machine isn't responding. Also it will warn
if no job is selected.
Stop
Press stop when you want to end drilling prematurely. A dialog for
confirmation will appear ae .
Settings
Opens dialog with settings mentioned before.
Offset
Opens dialog with offset settings mentioned before.
About
Opens dialog with some program info and links to this page.
Exit
Closes program and saves it's settings.
There are four speed buttons in right upper corner for sending machine to
some often used coordinates:
TC means tool change position, Offset means offset position, 0,0 means
position 0,0 and MAX means maximum range position.
Some of options are not visible until a file is loaded. In upper left corner of
"drawing surface" the painted circles with check boxes, drill diameter and
number of holes are shown when the file loads. The circle paint corresponds
to paint of holes on drawing surface. You can select type of holes to be
drilled by checking the appropriate check box.
During the drilling process you can monitor it on screen. Finished holes are
marked with red cross and driller path is colored green. We can also trace
progress on two progress bars in status line.
Job in progress
around. You can see the motor and "home switch" on the picture below.
The smaller motor is driving Y axis on which the driller is fastened. The third
motor, which drives driller on Z axis can be connected directly to spiral axis if
it has high enough resolution, otherwise it should have a gear transmission
like in my case, where the motor is 7,5. As you can see the mechanism
which holds the Z axis is made from PCB material. It isn't very neat, but it
works. The only problem is it's stability which is quite gentle due to weaker
construction. But it's prototype anyway.
The swirly axis i took out of an older, double speed Mitsumi CD-ROM, the
"guides" (I don't know the right word for it but I mean that metal stick on
which everything slides.) are ones from old floppy disk units. The motor and
mechanism of X axes is from old scanner and of Y axes from Epson Stylus
400 printer. The power supply is also from this printer.
The motor of Z axes is from Canon's typewriter, the flat cables are from
steering wheel of Fiat's Bravo (Air bag connection). You can also use cables
from old dot matrix printers which lead to printing head. All together is
mounted on 16 mm wooden board and it is quite fine. The driller is a little
motor with drilling head.
COMPONENTS LIST
Label
Value
Pcs
Comment
R1
22k SMD
Size 1206
0,47R/2W
Vertical mounting
2k2 SMD
Size 1206
180R SMD
Size 1206
R14 - R25
5k6 SMD
12
Size 1206
C1
2200u/25V
22
C4
47u/25V
C7
4u7/25V
C9
2,2n SMD
470u/40V
1n SMD
C24
470n SMD
Size 1206
C25, C26
33p SMD
Size 0805
C29 - C32
1u/25V
C36
100u/63V
C40
47u/6,3V
D1
1N4148 SMD
D2 - D25
FE2B
24
IC1
LM78L05
L297
L298N
2A fast recovery
IC8
AT89C2051
IC9
MAX232
ZD1
BZX85,
15V/800mW
RE1
JSM1-12V-4
T1
BC239C
470R
trimmerpotentiometer,
horizontal
GR1
B20C23001500
X1
12MHz
JP1
2 pin
WITHOUT JUMPER!
Close only for reset.
JP2
3 pin
CN1
In line
screwdriver
connector, 7
pin
CN2, CN10
DB9FA
Female adapter
Speedy 10 M
Male
Speedy 10 F
CN9
DB9MA
Male