How To Make (almost) Anything 3-Axis CNC Machine Brandon Blott Madhu Josyula

How To Make (almost) Anything 3-Axis CNC Machine
Brandon Blott
Madhu Josyula
ECE 4983 ELECTRICAL ENGINEERING DESIGN
Summer 2010
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
THE UNIVERSITY OF MICHIGAN-DEARBORN
Evergreen Road, Dearborn MI 48128-1491
Tel: (313) 593 - 5420 Fax: (313) 593 - 9967
TABLE OF CONTENTS
ABSTRACT XXI
ACKNOWLEDGEMENTS XXII
1. INTRODUCTION ***Show page number for each section***
2. PROBLEM STATEMENT
3. TASKS ASSIGNED TO EACH MEMBER.
4. DESIGN CHOICES AND PERFORMANCE CRITERIA
5. DETAILS OF DESIGN
5.1 DESIGN TASKS FOR EACH TEAM MEMBER
5.2 FINAL SYSTEM
6 TEST RESULTS AND DISCUSSION
7 SOCIO-ECONOMIC ISSUES
7.1 Detailed Cost Analysis
7.2 Economic Benefits and Societal Impact and Global Issues
7.3 Ethics and Safety Issues
7.4 Lifelong Learning
7.5 Contemporary Issues
8 CONCLUSIONS AND EXECUTIVE SUMMARY FROM EACH TEAM MEMBER
9 REFERENCES
10 APPENDICES
10.1 APPENDIX 1: GUIDELINES FOR COST ANALYSIS
10.2 APPENDIX 2: ONE PAGE VITA
xvii
How to Make (almost) Anything CNC Machine
Any person that majors in Electrical engineering or
Project Team:
works on electronic projects as a hobby knows that
Brandon Blott
when working with breadboards can be damaging to a
circuit, on the other hand, using a Printed Circuit
Madhu Josyula
Board comes with its own disadvantage of a circuit
that is very difficult to troubleshoot. CNC Machines
Project Advisor:
Professor N.
Natarajan
can take a circuit designed using a computer
simulation and convert it into a circuit on a PCB but
most CNC machines cost thousands of dollars.
This
project is to build a CNC machine that can make
printed circuit boards in less than five hundred
dollars.
Since there was little use for simulation
or calculation, prototyping was the method used for
this project.
The project is an electromechanical
device that involves many different components such
as motors, drivers, microprocessors, a spindle,
software, etc. Each component was decided by cost and
ease of use. It was discovered that a CNC machine
could be fabricated for fewer than five hundred
dollars.
This will greatly aid students and hobbyist
that want to focus more on designing circuits rather
than the building and troubleshooting aspect of
electronics.
Figure 2:
(Select and insert caption here)
Figure 1:
(Select and insert caption here)
Acknowledgements
•
Prof. JWV Miller
– 4983 Professor, and donated XY Stage
•
Prof. N. Natarajan
– 4983 Advisor
•
Prof. T Kim
– Advised on Stepper Motor Control
•
Prof. Orady
– Advised on Spindle design
•
Jesse Cross
– Donated many components
•
Jeremy Lance
– Linux Support
•
STMicroelectronics and Microchip
1. INTRODUCTION
The project that was chosen by this group was a 3-Axis CNC Machine. CNC (computed numerically
controlled) machine are used for prototyping different kinds of designs. Do-it-yourself CNC machine
They can have different tool heads in the Z-axis that can be interchanged for use on different materials
such as wood, plastic, foam, and mostly importantly for this project, printed circuit boards. Many times
in industrial settings a CNC machine will have different stages of CNC machine will different tool heads in
order to make more intricate designs. Also, it is common to attach a plastuder to the machine making it
a 3D printer; however this will be outside the scope of this project. The highest priority of this project is
going to be printed circuit board prototype. As many electrical engineering student and hobbyist know,
the easiest way to build a circuit is using a breadboard however, the convenience of breadboards come
with a great price to the efficiency and design of the final circuit. Breadboards are riddled with
problems such as current limitations (250mA per hole), power loss, and Electromagnetic Compatibility
issues. However, while printed circuit boards are the best for the final design of the circuit it can be very
difficult to troubleshoot which is almost a guaranteed problem when it comes to building any piece of
electronics. That is where this CNC machine is the most useful. A student that is most interested in the
design aspect of a circuit instead of the physical building of the circuit would be able to design a circuit
using Eagle software and after, the simulation and design is done, they can use that design with the CNC
machine and they will have a printed circuit board built custom for their project. Most CNC machines
used programs such as CAD/CAM as the software for the means of designing but this project will include
CAD/CAM as Eagle so that the user can design either 3D shapes or printed circuit boards.
2. PROBLEM STATEMENT AND SPECIFICATIONS
2.1 General design approach
The goal of this project is to create a 3 Axis computer numerical control (CNC) plotter and mill that can
be used as a rapid prototyping tool for future senior design projects. As a CNC plotter or etcher, the
machine can be used to fabricate circuit boards. As a CNC mill, the machine can be used to cut out
custom wood, plastic and foam parts. Commercially available CNC routers and plotters cost over
$2,000.00 and DIY CNC kits cost over $750.00; the goal for this project is to create a far more
economical solution but similarly robust system by retrofitting existing manual mills with embedded
controllers and stepper motors.
The ultimate goal of this project a machine that can make itself, other machines and functional parts for
future design projects at the University of Michigan – Dearborn.
The inspiration for this project is based on the Machines that Make (MtM) Laboratory at the MIT Center
for Bits and Atoms. Software for user interface and for designing objects and controlling the machine will
reside inside a web browser that can run on any computer. The MtM laboratory provides several
examples of fully functional home-made mini-mills that were made with different fabrication methods for
the express purpose of having other students improve on these designs. The electrical design was
design working reverse of how the system processes data, starting from the motors and working
back to the computer. An XY table with drivers and motors were originally donated for the
project but the motors were difficult to control and the drivers were damaged. Since there wasn’t
a constraint on the type of motor so cost was the only restraint. The drivers needed to provide
enough current and be easily controlled from the PICs, L298 was chosen since it was free from
STM and it provides 4A with 4 inputs for sequencing it worked best for the system.
2.2 Specifications
Table 1: 3 Axis CNC Mill and Plotter Specifications
Requirements
Use of a
Microprocessor
Compliance/
Compatibility
References
Numbers
Details
Yes
ECE498X Req.
Min 3 inputs
Min 4 outputs
The project will employ
the use of an Arduino
Board
Interface to a
Something
Yes
ECE498X Req.
Ruggedized
Electronics
Yes
ECE498X Req.
Neatly
Packaged
Yes
ECE498X Req.
Large Working
Envelope
DTC*
Project Req.
Interchangeable
Tool Interface
DTC*
Project Req.
Economical
Design
DTC*
0-5V signals
The project will interface
serially to a PC
Limit of
breadboard
250mA
This project will use
soldered custom PCBs
The project will be selfcontained in a wooden
frame
Greater than 12" x 18" x
6"
The CNC machine will
have multiple heads to
be able to act as a plot
and mill
3 tool heads
Project Req.
less than
$500.00
The CNC machine
hardware will be low
cost
*DTC=Designed to comply
Table 2: 3 Axis CNC Mill and Plotter Specifications Accomplished
Requirements
Accomplished
Details
Use of a
Microprocessor
Yes
Use PIC16 to control motor drivers
Interface to a
Something
Yes
The project interefeaces to LinusEMC through a
parallel port
Ruggedized
Electronics
Partial
This drivers were soldered Protoboard but the PICs
were wired to a breadboard
Neatly
Packaged
Partial
The Z-axis was built on a wooden baseboard but
the wooden case was not copmlete
Large Working
Envelope
Yes
Greater than 12" x 18" x 6"
Interchangeable
Tool Interface
No
Only one tool head was used
Economical
Design
Yes
Only $xxx.xx were spent
3. Tasks assigned to each member
The tasks for Brandon Blott are as follows:
1. Program PIC microprocessors
2. Interface LinuxEMC with PICs
3. Uses PICs to control drivers
4. Use drivers to run motors
5. Install LinuxEMC software on computer
4. Design choices and performance criteria
Electrical Design
Motors:
A 4 phase hybrid stepper motors. The difference between hybrid and non-hybrid is that they
have a smaller step angle. Many different stepper motors could have been used in this project so
the cheapest but still effective motor was chosen. The only requirement was that it needed to be
a bi-polar stepper motor since every axis needed to be moved in both directions.
Motor Drivers:
The drivers that were used in the final design were the L298. These drivers were chosen because
they have such a high current limit (4A) and voltage limit (46V). Also, they have a simple pin
layout that worked nicely with the microprocessors as well as the motors. Cost was a constraint
on this project since the group had to keep it under $500 and the L298 was free from
STMicroelectronics.

A4983 Allegro Motor drivers
o The Allegro drivers were an alternative since they supplied 2A and had a voltage
rating of 36V, however, they are much too complex and expensive for this
application. Many of the added features of this driver were already contained in
the microprocessor and therefore a waste of money and time.

Existing motor drivers
o The XY table donated to the group came with existing drivers. However, these
drivers were not only damaged in the initial testing but the inputs would be
difficult to wire to the PICs.
Microprocessors:
The pic16f690 was used as the microprocessor. The group had previously used the pic16f690
for an unrelated project and therefore was familiar with it. The project only needed four outputs
for sequencing the 4-phase motor and three inputs to receive commands from LinuxEMC.

PIC18F
o The PIC18F has everything needed for the project and more. The problem with
using it is the “more” since it contains more outputs, inputs and PWM registers
than was needed for the project and would cost more since the group could order
free samples at microchip.com
LinuxEMC:
This software was chosen since the group had previous knowledge and experience with it. The
program is a Linux based with open source code. The output is between 0-5V from a parallel
port making it easy for the PIC16 to read as well as a program setup that allows the user to
change the pin out of the parallel port.

A windows based CNC controller
o There are a few windows based CNC controllers that also has open source such as
Flashcut CNC. One of these different program might have been a better choice
than LinuxEMC but that will be further discussed in section 6.
5. Details of the design
5.1 Design Tasks for each member
Madhu Josyula
This section will contain a brief synopsis of the steps that the team took to complete the CNC
machine.
The first task was to assess the current hardware available at the University of Michigan Dearborn. The team procured a XY table, stepper motors and drivers from Prof. John Miller.
This pre-built mechanical system was be able to be used for the x and y axis for the CNC
machine. The team also had a PIC programmer and several PIC16 microcontrollers that could be
used to receive information serially from a PC and translate that information into a command for
the stepper motors. To use the PIC16s with the stepper motors provided in the lab, additional
higher amperage h-bridges were purchased. At the end of this stage, the team will order the
electronics needed to implement their design.
The second task will be to design a Z-axis and a spindle that can house a pen, and drill bits of
various sizes. Further trade studies have to be completed before settling on a design. The MtM
lab at MIT has provided a spindle design that is cheap and confirmed to be effective. During this
time, serious design work needs to be done in choosing an effective way to mount the spindle on
an adjustable z axis. The team will use computer-aided drawings as well as the expertise of
University of Michigan lab technicians and professors to come to a design that can be built easily
and be used safely. The final outcome of this stage will be a fully built, ruggedized, selfcontained structure that can accommodate all the electronics needed for the machine.
After the mechanical subsystem design is completed the team will work on the power and
electronics subsystem. The team will make sure that every component is safely powered and can
safely power down. In addition, the team will make sure that the electronics chosen will match
the current and voltage requirements needed to operate the motors on all three axis and in the
spindle. Once this is done the team will generate an electronic schematic and will wire the
electronics on a plastic breadboard to the CNC machine.
The next subsystem that will be addressed is command and data handling. This is arguably the
most crucial subsystem of the project because the in implements the computer numerical control
of the machine. The team will generate documented and commented software that will control all
three axis of the machine as well as the spindle. In addition, the team will write software that will
translate the serial commands from a PC to a stepper motor command. The team will also
investigate open source CAD translation programs such as LinuxCNC and Kokompe. LinuxCNC
is an enhanced machine controller with a lot of community support. Kokompe provides the full
software stack from a user interface for designing 3D objects to a set of instructions for driving
computer controlled machines. Once the software is implemented the team will rest test the
ecacy of the design by controlling the CNC as a plotter and making sure the height of the z axis
can be adjusted so the pen is on the table and o. The results of the test should be a drawing
created by the plotter after being translated on a PC and commanded the PIC16. After this
system is working, further testing and programming needs to be done to adjust the height of the
spindle more accurately so the CNC machine can be used as a mill. The result of this test will be
a simple etching onto a block of wood; this test should confirm the milling capability of this
machine.
Once the plotting and milling capabilities of this machine are confirmed to be working the team
will do further study to determine the performance of the machine. The accuracy of the milling
and plotting will the done using graph paper. Fine tuning of the software may have to be done
until the machine is consistently milling and plotting with less than 2mm of inaccuracy. Once the
machine tuned properly, it will be used to create a isolated circuit board that will be used to
replace the breadboard currently housing the electronics. This will complete the ruggedized
electronics requirement of ECE498x. If the project finished ahead of schedule the team will use
the remaining time using the machine to create other CNCs from the original CNC and other
custom parts and isolated circuit boards for the other senior design students. The team may also
choose to create a laser etching attachment to the spindle housing so the CNC can also be used a
laser plotter. The optics design and laser trade studies and implementation would only be done
after the plotting and milling functions have been completed.
Brandon Blott:
The final design was to make a three axis CNC machine. The electrical aspect of this would
consist of motors, drivers, microprocessors, and software to design the shapes and schematics the
will be created by the machine.
To move each axis a DC stepper motor would be required. The most important issue when it
comes to stepper motors is getting the correct sequencing. The sequencing would be done using
the PIC microprocessor. Using the output port from the microprocessor will generate a square
wave by turning on a bit from that port, creating a delay and then turning the port off. The
bigger the delay the slower the motor will turn and the shorter the delay the faster it will turn.
Another concern about the motor would be the voltage and current. This will be supplied by a
motor driver. All voltage and current going to the motor will first be passed through the driver
since a PIC uses a very low amount of current and only uses logic voltages. The current required
to correctly move the motors was 2.5A therefore a driver was selected to be well above this limit
and also be easy to use. L298 will supply 4A and uses voltages between 8-46V and has a very
straight foreword wiring design. The driver requires a logic voltage of 5V, has four inputs for
sequencing and four outputs to supply enough current to the motors. However, to supply so
much current to the motors creates a lot of heat in the drivers and heat sinks are required to
running the machine for a constant amount of time.
The microprocessors are a very important part of the project since they receives all the data from
LinuxEMC and outputs all the data to the drivers. There are three PIC16 for each motor and
LinuxEMC outputs the commands for all motors, therefore, each PIC only receives the data for
that motor that it is responsible for and sequences accordingly.
The CNC machine should be able to take a Cad design or eagle schematic and make that design.
First a CAD file will be converted using Cad.py into G-code and that g-code is converted by a
program called LinuxEMC into commands that will be sent to the microcontroller. LinuxEMC
can take G-code and gives coordinates to each axis about direction, step size, enable, disable and
control over the spindle that include, spin direction and vertical movement. LinuxEMC uses a
parallel port to communicate to the microprocessor. The pins on the parallel port output a logic
voltage to indicate all the things list above, example, 0V means counterclockwise direction while
5V means clockwise direction.
5.2 Final System
This project is not going to be marketed for commercial use so different considerations are used
when analyzing the final design of the CNC machine. The machine is going to be used for rapid
prototyping of electronics by the University of Michigan Dearborn and therefore such things as
marketing, mass production and VLSI are not issues that concern the project group. However,
making a safe and robust machine for students to use is a major concern. The final stage for the
project was physically wired to a breadboard however, the goal was to used the working machine
to design printed circuit boards that could be used on the CNC machine circuitry to make the
machine more robust and take away a number of issue that arise from using a breadboard such as
power loss, EMC issues and loose wiring.
The project makes use of microprocessors as previously mentioned. The code that was used for
the PIC16 was done in embedded C and was made simple in the case that a senior design group
might take over the project or the project can be open sourced so that anyone using a PIC16 for
this type of application could make use of the code written for this project. Or if a PIC16
happens to get damaged from student use then the code would be available to flash to a new
PIC16 and exchanged with the damaged one. However, if a student has no interest in the code
and just wants to use the CNC machine using the more user friendly programs like CAD and
Eagle then there should be no need for a student to even look at the code. It is fully functional
and takes all commands from LinuxEMC and sends all commands to the motors accordingly.
6. Test results and conclusions
The design of the project stayed about the same through the project. Different parts were used
than what was expected at the beginning of the project and some compromises were made but
the overview system was the same. At the beginning the existing motors and driver were going
to be used but with very little information about how to use them and it very difficult to use them
and during the testing one of the drivers were damaged. Not knowing whether it was only the
driver or the motor too the group ordered new motors and drivers. Allegro motor drivers were
the first used to control the motors. However, after weeks of attempts, the drivers never operated
correctly and the group decided it was too difficult to use for this type of application. The
drivers never sequenced correctly and the chip had many more inputs for different uses than
needed for the project. Smaller motors were tested that could be powered right from the
microprocessors without the use of a driver. This was to test whether it was the driver or the
program was to blame for the failure of the stepper motors to move and after testing the result
was that the motor sequenced correctly and therefore it was the drivers. L298 were then used
instead which was a more practical and cheaper alternative to use. That worked exactly as
expected and the motors were functional but had a big problem with overheating. The motors
could only move for about half the length of the table before the drivers would go into thermal
shut down and stopped working right. With heat sinks attached to the drivers, each axis can
move the length of the table twice. With the motors working properly, attention was then turned
to testing how to control the direction of the axis movement. A simple code was added to the
existing code to check the input of the microprocessor and then to change how the motor is
sequenced in order to change the direction of the motor. After this was successful then installing
and running LinuxEMC was the most important step. A lot of difficulty occurred during this
process. After a computer was donated by Professor N. Natarajan Linux was duel-booted on the
computer that was already using Windows. The first attempt to install Linux did not work since
installation was not done right. The group acquired help from a personal friend, Jeremy Lance,
who is a student at the University of Michigan Dearborn and a teacher at Henry Ford Community
College. He was able to help the group install Linux properly as well as install LinuxEMC
software on the computer. A major problem that took much time away from the project was the
computer needed a new graphic card in order to run Linux EMC. The graphic card needed to be
PCI 2 or PCI express connection and did not run Nvidia as the proprietary drivers according to
the forum on the LinuxEMC project. LinuxEMC communicates through a parallel part therefore
a parallel port was connected to the back and the other end was stripped of the connector and
each wire was connected to an individual input into the PIC microprocessor. LinuxEMC was
much harder to control than expected. The output does not output in 0V for off and 5V for on, it
seems to have about 1V difference between being “high” and being “low”. Because of this an
analog to digital converter was used in the PIC16 and then code was added to the C program that
compared the input and moved one direction or another accordingly. Also, without a Z-axis in
place and fully wired machine, LinuxEMC has trouble running a file since the machine is not
honed in the middle of the machine. Despite the problems with LinuxEMC the machine could
successful change direction based off manually commanding the machine to move through
LinuxEMC. The project was delayed further by the drivers not working again. The heat sinks
that were used seemed to have problems caused the drivers to not work properly, even after the
heat sink was removed. Unfortunately, there was not enough time during the project to look into
this problem.
7. Nontechnical aspects of design
The final goal of the project was to build a CNC machine without spending more than $500.00.
Typical CNC machines that a built by hobbyist cost in excess of over $2000.00. This cost goal
was met in a number of ways, from using microprocessors and drivers that were donated from
Microship.com and STElectronics and using open source code software.
7.1 Detailed Cost Analysis
Economic Benefits, Societal Impact and Global Issues
Cost Analysis
Table 3: Preliminary Cost Breakdown of the Z- Axis and Spindle
Description
QTY
Total Cost
Details
Ball Bearings
Nylon Spacer
Shaft Coupler
Shaft Bore
Flexible Spider
Flexible Coupler
Toy Motor
Shim Washer
Bronze Bushing
2
1
1
1
1
2
1
1
1
$14.00 0.5"
$8.43
$4.48
$10.66 0.125"
$1.16
$5.04
$2.55
$13.73
$4.48
OD x 0.25"ID Flanged
Z axis unipolarstepper motor
1
Shaft
1
Miniature PrecisionThreaded Rod
1
Wear-CompensatingNut
Fixed-Alignment
Frelon-Lined Linear
Bearing
Motor
Graphics Card
$20.95
$2.63
0.25" ID
20,000 RPM
0.255"ID x 0.005"T
Spindle Housing,
0.625 "OD x 0.5" ID x 1.5" L
0.2497" OD x 2.125" L
$36.11
0.216"-20.8 Sz,
1:1 Speed Ratio, 1/20.8"
Travel Dist
1
$15.70
1/20.8"
4
3
1
$48.80
$30.05
$24.24
Anodized Alum, 0.
Hybrid Stepper
PCI express
TOTAL: $242.93
Safety and ethical issues (1/2 to 1 page/member)
Brandon Blott:
There are some safety issues with this CNC machines that had to be considered. One issue was
that the drivers overheated to the point of thermal shut down. This was solved by mounting heat
sinks on all drivers connected a motor. Another issue was if there was any problem where one of
the axes was to exceed the end of the table. QRB1134 sensors were wired to the end of the table
that would detect if the platform was going past the table and send a signal to the microprocessor
telling it to turn off the motor. Also, LinuxEMC is programmed with an emergency stop
command (F1 key) that will disable the system.
A big issue with the group would be communication and getting assigned tasks completed in a
timely manner. It was apparent to the group that dividing tasks with time limits to each task
would be the best effort to take at the beginning of a project. After all other attempts to keep the
project on track to finish on time was exhausted then careful thought and consideration was put
into alerting the correct people.
7.2 Lifelong Learning (1/2 page/member)
Brandon Blott:
In a field like electrical engineering where, there is constant change, it is the most important
thing to keep learning no matter what environment an engineer is involved with at the time,
whether that is electronics or management. There is always going to be a new software and new
hardware to keep learning. Since electronics is always changing and evolving that also creates
the need for engineers to learn about new issues. An example would be Electromagnetic
Compatibility; a field that will become increasingly important as electronics become faster.
There are many different ways lifelong learning can affect a career since there are so many
shapes and form a career can lead the individual. If an engineer is coming from a design
prospective then keeping up with new technology is important to build off of and motivate new
ideas. However, if the engineer is working from a technical prospective then being knowledge
about all the new technologies being implemented in so many different areas would be just as
crucial. Also, keeping up new skills and new knowledge of technology means keeping engineers
valuable to an employer which could be more important in a country where work is being
outsourced and an economy that has seen better times.
7.3 Contemporary Issues and Global Impact (1 page/member)
Engineering is such a broad field that it encompasses many different areas taffect our society. I
major concern of people today is the energy shortage and that engineering will definiatly play a
huge part in. New technologies are constantly being created everyday to make electronics faster,
new ways harnessing electrics power, cars run more environmentally safer, factories become
more conscience of their effects on the environment that it is obvious that engineers play a huge
role in this. It becomes ever more prevalent for engineers to stay up on new technologies and
advances in science in order to build off of them and furthering the growth of these technologies.
The new techniques learned don’t stop after the discovery is made, then the hardest part comes
and that is implementing these ideas in the field. Electromagnetic compatibility is a great
example of this; since it is a rising issue in the field. New interferences are being discovered
along with new ways of dealing with these issues. All these issues exist whether an engineer
knows about them or not and without the knowledge about the techniques to help reduce
emissions then the issues become a lot more expensive and time consuming. Problems like these
exist in all aspects of engineering and show how important it is to continue to strive all the time
for new knowledge.
8. Conclusions and Executive Summaries

Learned that tasks needed to be divided early

Learned to manage time better

Care must be used when handling new electronics

Working on a design project is a group effort

Building and testing in stages is important for any project
Even though the project was not completely the overall progress was going in the right direction
and the parts that were done were done correctly. A lot was learned about how to manage a
project with a group by dividing tasks and setting deadlines. Managing time was an important
issue with the project since there were a lot of external activities that interfered with working on
the CNC machine. However, in the end the motors were sequencing properly, the drivers were
working after a long struggle with which ones to use and how to use them and the
microprocessor program was coded correctly. The only major step was to finish interfacing
LinuxEMC with the PIC16 and even that was partially done before the end. The spindle was
fabricated and the Z-axis was assembled but the only step left was to build a chassis to suspend
the spindle above the XY-table. As it is to be expected from an electronics project, there were a
lot of interferences that cause the project to be slowed down and that contributed to the project
being unfinished, however, these must be accounted for in any project. Since it was the first full
open ended design project that the group had participated in there, there were a lot that was
learned about the non-engineering aspect of a design project as well as the design itself. Overall
the project was on a successful path but too many interferences and obstacles were in the way to
complete it. Hopefully another group of eager young senior design students would like to take
up the challenge of completing the project and add as many bells and whistle to it as they want.
That would make this project feel like a true success.
9. REFERENCES
References for Brandon Blott
Aco Hardware Supervisor
Doug Mitchell
Work number: (734)728-2561
Personal number: (313)584-6795
Academic advisor
Dr. Natarajan Narasimhurthi
Cellphone number: (313)593-5964
Office Number: (734)417-1285
Email: [email protected]
10. APPENDICES:
Code for PIC16:
//Madhu Josyula
//Brandon Blott
//ECE 4981
//Move the stepper motors
//Defines
#define BIT(n) << (1 < n)
#define stepper1 PORTC.F5
#define stepper2 PORTC.F4
#define stepper3 PORTC.F1
#define stepper4 PORTC.F2
#define SHUT_OFF PORTA.F5
//#define DIR PORTA.F2
#define STEP PORTA.F4
#define enablea PORTC.F0 //
#define enableb PORTC.F6 //
//Global Constants
const x = 2; //The delay between steps
void enableh()
{
enablea = 1;
enableb = 1;
}
void disableh()
{
enablea = 0;
enableb = 0;
}
//Clear all
void clearall()
{
stepper1 = 0;
stepper2 = 0;
stepper3 = 0;
stepper4 = 0;
}
//Turn the motor counter clockwise
void ccw()
{
stepper4=1;
delay_ms(x);
clearall();
stepper1=1;
delay_ms(x);
clearall();
stepper3=1;
delay_ms(x);
clearall();
stepper2=1;
delay_ms(x);
clearall();
}
//Turn the motor clockwise
void cw()
{
stepper1=1;
delay_ms(x);
clearall();
stepper4=1;
delay_ms(x);
clearall();
stepper2=1;
delay_ms(x);
clearall();
stepper3=1;
delay_ms(x);
clearall();
}
void main(){
int DIR;
int Pre_DIR;
ANSELH = 0; ANSEL = 0x00; // Turn on A2D
TRISB = 0x00;
// Sets PortB to Output
TRISC = 0x00;
// Sets PortC to Output
TRISA = 0xFF;
//ADCON1 = 0x0;
disableh();
// Enable Motors
while(1)
{
if(SHUT_OFF == 0){
//CHECK AGAIN!!!
} else{
DIR = Adc_Read(2);
if(DIR >= 100){
enableh();
cw();
PORTC = 0;
}
else if(DIR <= 100){
enableh();
ccw();
}
}
}
}
Progress Entries
ENGINEERING NOTEBOOK
SEPTEMBER 3 2010
The parallel port was wired to the microprocessors and LinuxEMC was used to control the XY-table.
LinuxEMC does not give a clean 0-5V output and therefore a analog to digital conversion had to be used
in the PIC16. The direction of the XY-table can be controlled by LinuxEMC but BB run out of time and
that is as far as the project is going to get.
SEPTEMBER 2 2010
New drivers were order since all the old ones seemed to be burnt out or lost somehow. The drivers
were wired and worked perfectly. As soon as the heat sink was attached again, the driver stopped
working. The heat sinks would be useful in the long run but for the limited time left in this project, the
interests lies in interfacing LinuxEMC with the circuit and not proper heat sinks since the drivers so
work for enough time. There was also a problem with the code. At some point it must have been
changed because the motors were not sequencing correctly. The problem was fix and now, for the XY
table, both axes work in both directions and the drivers work for limited time before overheating.
Tomorrow BB will attempt to interface LinuxEMC with the PICs.
AUGUST 6 2010
The computer was hooked back up and linuxEMC was tested today. The parallel port was connected
and double checked that all the connections from the computers end of the cable were labeled the
same on the Micro controller side. LinuxEMC seems to be working with a few errors but there is an
output on the parallel port and it was tested and found that the CNC controller outputs in 0-5V.
JULY 31 2010
LinuxEMC was successful installed on the SD computer. However, cad.py was not successful installed.
Because of the hardware limitations of the computer not all the software was compatible on the
computer. The project would still be able to work but at worst the project would have to convert a
CAD or Eagle program into G-code on a second computer and transfer in to the SD computer.
JULY 21 2010
All the drivers were soldered to PC boards and the A-axis and Y-axis were wired again with heat sinks
and the table is working consistently now with no overheating. Both axis can move back and forth
twice successfully without any signs of overheating, however the heat sinks do get very warm but that
is what they are for!
JULY 15 2010
With the software being delayed by waiting for a new graphics card and a time to meet jeremy the
group turns attention back to the hardware. The PICs are reconnected, tested and flashed with the
more current program and all seems to be successful. The group was informed that the drivers will
need to be soldered to a PC board since the bread boards that were previously being used can only
handle 250mA and this project requires 2.5A.
JULY 2 2010
The group received the graphic card and tried to use that with the computer but the connection was
incorrect. The graphic card has PCI and the computer requires PCI2 or PCIexpress. With the computer
being at Jeremy's house and losing access to the IAVS during nights and weekends this process of
getting LinuxEMC working it taking longer than expected.
JUNE 16 2010
The group meets with Jeremy to find out what is wrong with the computer. Linux was not correctly set
up on the Senior design (SD) computer and was redone the correct way. However, the new problem is
that a new graphic card is needed to run LinuxEMC on. Therefore, the group must now find Nattu in
order to order the graphic card as well as the remaining mechanical parts needed to finish the Z-axis.
JUNE 8 2010
MJ got the exact heat sinks that are needed for the drivers! The group connects the heat sinks to the
drivers but the project was taken apart and since then there seems to be a problem with the PICs and
therefore the drivers cannot be tested.
JUNE 4 2010
Electronic Connection did not have the heat sinks that would work with the drivers. Hopefully MJ was
find something during the robotics competition that is coming up this weekend.
JUNE 3 2010
The heat sinks that Jesse provided don't seem like they will fit with the drivers the group is using. The
group decides that they will try Electronic Connection.
MAY 24 2010
Since Jeremy is tied up with school and work for the rest of the month we have turned out attention to
another problem we have been having with the project and that is the L298 drivers overheating. The
group has been looking for heat sinks online but with little success. The group tried Jesse Cross but he
said that since the school so rarely runs into a problem of having a project that overheats that the
school no longer carries heat sinks and provided what he had but there is doubt that they wil work with
these drivers.
MAY 17 2010
A desktop computer was denoted by Nattu. It was running windows however it had to be duel booted
into linux since that is the only was to use the CNC controlled LinuxEMC that is preferred for this
project. Linux is proving to be more difficult to use then expected but BB is friends with a software
engineer, Jeremy Lance, and we will ask for advice from him soon.
MAY 11 2010
To Do List:
o
o
o
o
Download LINUX on a desktop or laptop provided by MJ
Install Linux EMC, Eagle and Cad.PY on Linux machine
Measure the signals from the Linux EMC on the scope
Figure out why the stepper motor drivers get too hot and start overstepping
MAY 7 2010
The stepper motor drivers we have have been overheating, and the stepper motors have been
overstepping. Well, to determine if the stepper motor drivers overheating directly caused the
overstepping MJ and BB devised an experiment. The stepper motor drivers were rapidly cooled with
Freon spray when the motors were oversteppingl this caused them to work properly again.
MJ posited, maybe the drivers are outputting too much current through are driver and that's why its
overheating. Maybe a darlington pair of transistors(its reduces voltage but bumps up current) can be
put on the output of the stepper motor drivers to reduce the current being demanded from the stepper
motor drivers.
APRIL 20 2010
Debugging started early in the morning. The wiring in the circuit was correct but Port C of the PIC
wasn't sequencing correctly so Port B was used instead and it worked just fine again. The next goal was
then to be able to control the direction of the motor from an external source such as a switch. First to
make sure the code was understood, two resistors was connected to Port A pin 4 and 5, and a pulse was
sent by touching the resistors with a wire and it changed direction. Then USART was attempted but
getting the sequencing to work correctly along with it was more trouble then it was worth. Then an
analog potentiometer was connected to an A/D so that at a half way value the direction changed. The
Y axis was wired to the PIC, driver and potentiometer the same way as well. The final achievement this
semester was control of XY axis through external switches. Now it's time for BB to get married!
APRIL 19 2010
MJ received the L298 drivers. A PIC16F690 was wired to the driver (wired just like the datasheet under
"Resources") and from the driver it was wired to the motors. A program was written in MicroC
(Embedded C) to sequence the motor correctly. For the first time the motors turned in either clockwise
or counter clockwise directions. Attempting to transfer the circuit to a different breadboard with
enough space for the whole completed circuit has resulted in the program not sequencing correctly.
Tomorrow will be a day for debugging.
APRIL 14 2010
STMicroelectronics offers FREE L298 samples if the project is approved. MJ was approved for two, BB
was approved for three. Hopefully having two to spare will be enough. Still waiting on shipment.
APRIL 10 2010
After many attempts at getting the allegro drivers to work it was decided that they were overly
difficult to control for this project. Instead L298 drivers are going to be used. Hopefully they will be
easier to use.
APRIL 8 2010
The hybrid stepper motor combines features of both the variable reluctance stepper and the
permanent magnet stepper to produce a smaller step angle
Linux EMC - Enhanced Machine Control
APRIL 5 2010
Coupled new motors to the XY table. The motors were coupled to the existing thread rods in the XY
table. Continuity checks allowed the team to select the right poles of the motor, the team then wired
the motors to the allegro stepper motor drivers.
MARCH 31 2010
Found out that one of the stepper motors had a bad connection so the second motor was wired to the
allegro with little success. Since, almost no information was offered about the existing motors on the
XY table, NN ordered the team new motors, more allegros and mechanical parts. The mechanical parts
were received but still waiting on the electrical parts. Tasks are started to be divided among the team,
BB will be responsible for motors, motor drivers and PIC programming while MJ will be responsible for
the building the Z-axis and the LinuxEMC.
FEBRUARY 23 2010
The Senior design presentation went well, JWVM suggested that we make the Gantt Chart more
readable and that roles are clearly defined. The team also procured JWVMs help in an advisory role in
addition to NN.
TASKS TO BE COMPLETED (OVER SPRING BREAK)
1.
2.
3.
4.
5.
Get a working oscilloscope for the IAVS work station.
Test the voltage levels coming out of the function generator.
Get the Allegro Stepper Motor Drive to move the stepper motors.
Program the PIC to send commands to the stepper motors.
Obtain more information about existing motors
FEBRUARY 20 2010
PROPOSAL PRESENTATION
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Intro Slide (MJ)
Overview Slide (MJ)
Systems Block Diagram (BB)
Stepper Control (BB)
Cad -> Motors? (B)
Toolheads (MJ)
Mechanical System (MJ)
Control System (MJ)
Summary (MJ + BB)
Gantt Chart (BB)
Question Slide (MJ)
FEBRUARY 15 2010
Haven't been able to get the stepper motors working again so Nattu was brought in for assistance but
still couldn't get the motors to work. However, since the stepper motor drivers are probably not going
to end up being used and instead use an Allegro driver, it was decided to redirect efforts to learning to
control a stepper motor with a PIC processor. In the mean time, purchasing the Allegro will be looked
into.
TASKS TO BE COMPLETED
o
o
o
o
Bring toolbox and store in locker Date unknown
Bring oil for XY table
Meet with Ryan to discuss generating PWM signals with the PIC programmer in exchange for
lunch
Generate a square wave with the fxn generator to see if the X and Y-axis steppers are working.
HELP NEEDED WITH THIS STEP! (2/15/2010)
o
o
o
o
o
Ask Jesse about getting a working oscilloscope
Get stepper motor or learn how to use the one Madhu has
Operate Motor with PIC
Buy an Allergro Driver (2/17/10)
Obtain more information about existing motors
JANUARY 30 2010
Investigated why the stepper driver may not be driving the motor. According to the data sheet the
stepper motors step on the trailing edge of a square wave. The square wave should have the minimum
width of 10usec. 10usec translates to 50KHz… maybe the signal we were sending had too low of a
frequency.
As stated earlier, the team should confirm with JWVM and NN
TASKS TO BE COMPLETED
o
o
o
o
o
Bring toolbox and store in locker
Bring oil for XY table
Meet with Ryan to discuss generating PWM signals with the PIC programmer in exchange for
lunch
Generate a square wave with the fxn generator to see if the X and Y-axis steppers are working.
HELP NEEDED WITH THIS STEP!
Ask Jesse about getting a working oscilloscope
JANUARY 29 2010
Cleaned work bench, XY table and stepper drivers of dust and dirt.
Tried to use a function generator generating a square wave, connected to the CMD-50 stepper driver to
step the motor. The motor was clicking back and forth and not rotating fully. Ask JWVM for help with
this problem.
TASKS TO BE COMPLETED
o
o
o
o
o
o
o
o
Data sheets need to be returned to JWVM asap.
Bring toolbox and store in locker
Confirm off hours access to the IAVS, from JWVM or NN
Bring Swiffer wipes and oil for XY table to clean the instrument of dust
Meet with Ryan to discuss generating PWM signals with the PIC programmer in exchange for
lunch
Generate a square wave with the fxn generator to see if the X and Y-axis steppers are working.
HELP NEEDED WITH THIS STEP!
Need to get the part number and the data sheet for the 2 Amp H-Bridge
Ask Jesse about getting a working oscilloscope
JANUARY 28 2010
Setup work bench in IAVS. Station now includes scope, multimeter, fxn generator and power supply.
Met with Professor Nattu briefly, discussed using PICs 16F690 + 2 Amp H Bridge? instead of stepper
driver. This part needs to be ordered, there are not too many parts in stock and we may have to March
if we don't order it quickly.
Set up ctools site for central file storage. This meets the group webpage requirement for senior design.
Uploaded stepper motor, stepper driver and XY table data sheets. Uploaded the PIC 16F690 data sheet
as well. As per the webpage requirement for senior design.
TASKS TO BE COMPLETED
o
o
o
o
o
o
o
Data sheets need to be returned to JWVM asap.
Bring toolbox and store in locker
Confirm off hours access to the IAVS, from JWVMor NN
Bring Swiffer wipes and oil for XY table to clean the instrument of dust
Meet with Ryan to discuss generating PWM signals with the PIC programmer in exchange for
lunch
Generate a square wave with the fxn generator to see if the X and Y-axis steppers are working
Need to get the part number and the data sheet for the 2Amp H-Bridge
JANUARY 26 2010
Acquired XY table with mounted steppers and drivers from Jesse, along with data sheet from JWVM.
TASKS TO BE COMPLETED
o
Data sheets need to be returned to JWVM asap.