mbed controlled PCB drilling machine

i hate drilling prototype PCB's by hand. Maybe a NXP powered mbed can do this job for me :-)

This project is about a low cost CNC machine to use for drilling PCB's, completely controlled with a NXP powered LPC1768 mbed micro controller module.
I will try to keep this project very flexible in a way that an EABaseboard could be used or just a mbed mounted at a cheap breadboard.
There are already quite a lot of functions implemented what a EABaseboard can offer for this project. Also, some nice external add-on functions will be created, too.
The nice thing about the EABaseboard is that there are two 2 x 25 pin expansion connector's available for further plug and play ideas.  For example, this could be an interface for a RFID tag reader to select and start drill jobs. This is crazy but also big fun :-)
What components are needed for this project?

What this machine already can do?

What this machine maybe can do in the future?

About this project page

This is just a notebook page and the following information is written down very "fast and dirty"!!! All ideas and all functions are tested on a running CNC machine and not on just a "naked" mbed. But, there can be still software bugs, hardware errors, produced and created with my bad old mind or whatever problems i did not recognize yet. Please keep in mind that playing around with a CNC machine is dangerous. It is not a toy and you always need to know what you are doing!

Why this project?

Hardware cost's of this project?

Project promotion video


Project Foto

stepper Library

here are the basic stepper functions

stepper


Ramp up measurement



Reference switch

mbed needs to know the actual position of all axis.
Therefore a reference movement has to be done before starting a drill-job.


Procedure searching for a reference switch

  • axis starts moving to the reference switch direction with start/stop speed
  • switch is changing the level and motor stops
  • axis moves with low speed in opposite direction till switch changes level again
  • motor stops and reference point is set to zero

 

The Excellon file format
I am going to use the excellon file format for this project. Here are some basic notes about:

So, the big question is: How to handle these excellon files?
Well, i think i like to have two operating modes available.
  1. handle the file with a drill change function
  2. drilling all holes with a fixed drill tool in one go
The second procedure should be easy to create. The mbed ignores all special drill change commands in the file and starts the drill motor when a
M48 command reads in. If the mbed reads a M30 command the drill motor stops and x/y/z axis move to their home positions. PCB drilling is ready.

 

hm...like this?


Procedure 1 is missing an important function. Drills can have a different length. If we go on with a shorter drill the PCB
maybe does not get drilled probably, if we keep on going with a longer drill some bad things can happen to the drill tool or to the PCB ...
We need a position at the machine table where the length of a new drill tool can be measured and z-movement can get re-calculated.
This work could do a simple micro switch, mounted at the table, and the CNC knows the position of this switch. The machine moves
to this switch position, lowers the z-axis as long as the switch does not change it's signal level and bingo ....... we can calculate an offset.
What,s next? Ok, i go for the easy part first. Drilling a PCB using procedure 2. But first i need to tell the Eagle CAD system a "story" about
my used hardware (the CNC machine). There is a eagle config file called "eagle.def". I have to change some parameters in the eagle
excellon driver about the resolution of the steppers. By default this is set to 10000 steps/inch. My machine needs (533.3333 x 25,4) steps/inch.
That gives me a value of 13547 steps/inch for ResX and ResY.
eagle def file
What else is needed? Of course, a CAD drawing :-)
mbed sheet
mbed board
Now, i need CAM data,s. Let's start the CAM processor and save the drill datas (in a file "test.txt") direct to the mbed file system.
CAM processor
Time to test procedure 2 at the running machine. I use pc.printf to get some messages out via mbed's serial interface. This is very handy for debug things. The mbed opens the file "test.txt", this is the drill file, and processes it. Mbed ignores all tooling stuff, get a start with "M48", reads x and y values, goto that point, gets the hole drilled, looks for new datas and if there is a "M30", mbed stops drilling and the machine's axis move to their home positions.
drill file Terminal output

Oh, i think, this is looking not bad :-)

some code.....

drill_excellon move_x_y_z

Modified Bresenham line algorithm. Works with my CNC but acceleration/deceleration is not supported, yet.

Bresenham

 

So, the machine can already drill a PCB, generated by a CAM processor (excellon file).

Having a look what space is wasted in the mbed's LPC1768 flash so far :

used flash space

great :-)

The mbed file system holds, besides the mbed.bin file and the excellon drill file, a machine configuration file.
With this file i can read value's for some important machine parameter (speeds, steps, name of the job-file etc).

ok, let me have a look if all implemented functions are working at the machine. Get the drill job started.

Have created a fast and dirty function that i can "adjust the machine" to a bare PCB using a serial terminal.
All axis can now be moved via serial key commands to the place i like to start a drill job. The zero-point of a PCB.

update: 21.11.2010

Having more and more fun with my project. Got a nice Embedded Artists Baseboard Rev.B at Elektor Live 2010 in Eindhoven. This Baseboard can be used for the LPCXpresso or for my mbed. It,s all just plug and play being ready to go for some electronic playings within minutes. I could use this board for my PCB drilling project because all i need is available at this nice Baseboard. A rotary-switch, a joystick, a OLED, more flash and also a connector for a XBee module. So, i will make my software ready to go for this board, too, using a Compiler-switch (#ifdef BASEBOARD).

update: 19.12.2010

Rotory switch function implemented. Now its possible applying "fine-moves" to the selected axis using the baseboard's rotory switch. With the joystick i can move X and Y axis by 1000 steps per klick. If i hold down the baseboards switch (SW_4) Z-movement is enabled and the Z-axis can be moved with the joysticks y+/y- switches. With the rotary switch the stepper makes 10 steps per change and its function always stays enabled to the last selected axis. (19.12.2010: Connections for RFID reader and I2C added).

running out of pins ???. Oh, i have 3 mbed-pins left :-)

Maybe i have 4 pins left, do i need that OLED_POWER signal at all? Difficult question at this time because i had to many beers :-)

 

update: 28.11.2010

Function overview so far:

first real pcb drilling job done :-) What a mess, i need a vacuum cleaner!!!

just for testing (placed a mbed and two DIL's):

mbed and some DIL socket's. A perfect fit. Drill diameter is 1 mm, z-move is 4 mm.

update: 1.12.2010

Jumpersetting of the Embedded Artist Base Board:

update: 14.12.2010

PCA9532 I2C 16-bit Port Expander
There is a nice I2C port expander at the EAbaseboard which controls 16 LED's. I use these LED's for:
  • how many files are found in the mbed file system (number of LED's = number of files)
  • LED4 blinks  with 2 Hz if no config file is found
  • LED4 blinks with 1 Hz if there is a syntax error found in this file
  • LED5 blinks with 2 Hz if no excellon job file is found
  • LED5 blinks with 1 Hz if there is a syntax error found in this file
  • LED6 blinks with 2 Hz if there is a unknown command received via the serial interface
  • LED7 blinks with 1 Hz if the mbed filesystem is open
update: 19.12.2010

some more fun added. RFID reader to get a job selected and finally start this machine with the RFID selected drill job.

update: 20.12.2010

Schematic diagram and a possible pcb layout of the interface
Interface Cable
simple connection from the EABaseboard to the stepper driver
What should come up next to work on?
  • reference a PCB using a laser?
  • remote control using the XBee module of the embedded artist board?
  • Bresenham algorithm with acceleration/deceleration function
  • improving the stepper speed
  • ????

Links and datasheets:

L297 datasheet
L298 datasheet
mbed details
Sable CNC machine
LPCXpresso Base Board
EAGLE Layout Editor
RFID ID-12
Project Video


26 comments

06 Nov 2010

Looks really good. Where did you get the CNC platform from?

06 Nov 2010

user Sukkin Pang wrote:

Looks really good. Where did you get the CNC platform from?

Hi Sukkin,

the CNC is from http://www.cnc-sable.nl/

best regards

Franz

06 Nov 2010

Franz

 

Well done. Looks a lot like this one http://members.home.nl/hobbycorner/movies/drillxx.wmv

 

Greetings

Theo and Ben

 

07 Nov 2010

user Theo Kleijn wrote:

Franz

 

Well done. Looks a lot like this one http://members.home.nl/hobbycorner/movies/drillxx.wmv

 

Greetings

Theo and Ben

 

Hi Theo, hi Ben,

thanks. Yes, there are so many machine's like yours out there and most of them are still 8-bit controlled.

Will have a look how far i can go with an mbed for this.

By the way i hope to get it managed seeing you guys at  Elektor Live 2010 in about two weeks.

best regards

Franz

14 Nov 2010

What about milling out the tracks??

I have been looking at this myself, and processing the COMP files is the same.

 

how much is the milling machine?

15 Nov 2010

user ceri clatworthy wrote:
how much is the milling machine?
See http://www.cnc-sable.nl/sable-2015-p-21.html (prices are in euro I presume. BTW means VAT)

15 Nov 2010

user Simon Brouwer wrote:

 

user ceri clatworthy wrote:
how much is the milling machine?
See http://www.cnc-sable.nl/sable-2015-p-21.html (prices are in euro I presume. BTW means VAT)

 

the Sable is about 780 Euro excl. VAT.

This is also included in the shipping:

1. Stepper driver 
2. DC power supply
3. Motor cables
4. Mini miller
5. Mounting for mini miller
6. Extension board

The Stepper driver card is designed for using it at a PC LPT port but i have connected a mbed.

Franz


15 Nov 2010

user Franz Achatz wrote:

 

user Simon Brouwer wrote:

 

user ceri clatworthy wrote:
how much is the milling machine?
See http://www.cnc-sable.nl/sable-2015-p-21.html (prices are in euro I presume. BTW means VAT)

 

the Sable is about 780 Euro excl. VAT.

 

This is also included in the shipping:

1. Stepper driver 
2. DC power supply
3. Motor cables
4. Mini miller
5. Mounting for mini miller
6. Extension board

The Stepper driver card is designed for using it at a PC LPT port but i have connected a mbed.

Franz


Hi all,

there is wrong information at http://www.cnc-sable.nl/sable-2015-p-21.html

travel for X and Y is X = 210 mm and Y = 190 mm and NOT X = 200 and Y = 150 !!!

Franz

21 Nov 2010

Very nice work.  That is a fairly expensive CNC (for my budget) but I'm sure your code is easily useable for just about any low cost CNC.  This may be a silly question, but do you know where to get the PCB material before it is milled?  I've been interested in getting a CNC for doing PCBs but I'm not sure where you get the board material.

21 Nov 2010

user Aaron Goselin wrote:

...but do you know where to get the PCB material before it is milled?

You can buy this at www.rs-online.com

22 Nov 2010

user Ben Schueler wrote:

 

user Aaron Goselin wrote:

...but do you know where to get the PCB material before it is milled?

You can buy this at www.rs-online.com

 

Hello Aaron,

you could try Radioshack or DigiKey, too. Ask for photoresist laminates.

best regards

Franz

24 Nov 2010

Ok thank you both.

 

I was actually thinking of PC board for milling but the photoresist is a good idea too.  I'm thinking that what I want is copper clad FR4?

28 Nov 2010

Nice work Franz

01 Dec 2010

Hi Franz,

What do you think of using this platform as a pick and place machine? Do you think it is a good idea?

01 Dec 2010

Hi Sukkin,

i was already thinking about that:

- dispenser machine for smd

- pick and place but the needed mechanics is a bit complicated i think :-(

the picker-unit only needs a separate stepper and a vacuum unit (that's easy) but you need an automated place

which supports the picker with components.

01 Dec 2010 . Edited: 01 Dec 2010

I think the pick up head is going to be the hard part. It needs to be able to pick up the component, rotate it then place.

You also need something to align the component is well as when it pick up a component it may not be in the centred.

Commercial machine are so expensive. I'm doing my boards by hand and it is very time consuming. QFN package is challenging.

01 Dec 2010 . Edited: 01 Dec 2010

i think the key-thing is that you get it managed picking a component at the centre. Therefore the component supporter must work very accurate. The other stuff like rotating and placing is just handling CAM datas.

02 Dec 2010

Hi Sukkin,

this is interesting. Generated pick and place datas with mountsmd.ulp. Get nice datas for the partname to pick and x/y datas where to place it. Also rotation datas are there (for the Steppermotor Nr. 4).

 

02 Dec 2010

All the CAM data are there but what I'm saying is the pick up head need to be able to rotate the component. Quite a lot of mechanic involved.

Question for you. How fast can you move the platform? I've seen some DIY pick and place on Youtube and they move very slow.

02 Dec 2010

for the pick up head a vacuum pen could be used. A stepper motor could rotate the vacuum pen (0, 90, 180, 270) and a function is needed for switching the vacuum on/off. At this moment the machine runs at about 20 mm/sec. This is not very fast but ok for a hobby project :-) Maybe i can optimize it to 30 mm/sec.

02 Dec 2010

A simple servo could be used to drive the vacuum pen.
Well, if you mean one like this: Vacuum pen

Lerche

02 Dec 2010

user Christian Lerche wrote:

A simple servo could be used to drive the vacuum pen.
Well, if you mean one like this: Vacuum pen

Lerche

Hi Christian,

yes i mean a pen like this. It should be as simple and cheap as possible :-) Using a servo for rotating the pen is good idea, too.

02 Dec 2010

a funny pick and place head :-)

"this is a vacuum pick-and-place head design for automated electronic assembly. It features a stepper-driven rotary head with Luer-Lock port for interchangeable needles, and a feature for attachment of an "eyeball" style Webcam for optical placement. Vacuum is provided to the head via flex (fishpump) tubing."

source from Drmn4ea

23 Feb 2011

Excellent Job!!! I my self have a CNC that uses a dedicated PC... can't run anything else when milling because of the resources it requires to toggle the parallel port. Having a standalone CNC controller is awesome. Maybe you wrote it, but how many steps/s can you drive?

Good luck on the contest.

WBB

24 Feb 2011

Hi Walter,

if the machine has fully accelerated it runs with about 10.000 1/4steps a second.

02 Mar 2011

That is good... doing my math 2500 steps/s with a 10 TPI screw is about 1.25"/s (3.175cm/s)... 75IPM or  1.9m/min at max speed. Am I write by saying that the interpolation of points is the bottleneck? In my case, the driver I use (G540) needs 10 usteps/step... do you think the steps/s can be increased to 20000 only to comply with this microstepping requirement?

Please log in to post a comment.