Pick and place So here we are with…

Pick and place;

So here we are with part two of the build. We’ve figured out most of it, started the build of the arm board and so on, then on Friday night late I have one of those, hmmm, moments and say wait we have a lot of ADK mega arduino boards lying around (because we made a tonne of them for defcon 19). So a quick count of the IO pins needed vs the mega and we find it can be done. 

We test fire the MOSFETs with our ADK arduino, using one of the ATC( tool changer) pneumatic switches. That works just fine, the modern MOSFETs are amazing even though we need no where near the level of current this thing can handle.

 

We wired up a quick test.

Breakout board for the TUMT6 MOSFET

 

Just as ping is the ubiquitous test on the internet, blink.pde is on the arduino.

Success, yes the tool did go flying off but that’s ok! We simply connected up pin 13 of the mega to the electro switches in the top left, the board is bypassed since it does a BCD decode and select.

Blink does it’s thing.

 

So time to build up the new interface card, a quick search through some of the old machines we find the right floppy pin cable for the board, and the old 50 pin scsi type.. thanks petty!..

So  next step is to CNC up a header quick board, its an extremely simple board. Bust out eagle and start making the board, the Juki has one oddness that the connectors run 1-2-3-4-5-6… etc vs 1.3.5.7.9.. so I had to build a custom part in eagle..

So I start off modifying our ARM board by sticking an arduino mega shield in the middle with the idea of wiring it upto all the mosfets etc.

But then I think, wait a second why do that? Lets just leave the IO board and make a shield that plugs into the Juki’s existing IO connectors. So another project in eagle and its even simpler this time.

Yeah that’s slightly less complicated. So  basically we’re just mapping each of the IO’s to the arduino, I’m not much of an arduino person myself I prefer ARM for embedded, but we had lots of parts lying around and it was super simple form factor which is the point of the arduino and we sold out of all our arm based arduinos at defcon. So I ended up using the tx/rx as  an that has to be rerouted later, but luckily I mapped it to the down switch for the teaching panel, which we no longer need. However that’s not how we do things at NSL so it’ll be remade and milled.

Now add the headers, this is a real chore they’re simple to obtain, but so cheap but a bitch to solder onto a board that’s not plated…

Also someone missed some pads..

 

Whoohoo perfect, (well sort of)

Now for a test fit onto the machines IO board.

 

Check continuity etc. Make sure that GND is mapped…

 

Getting ready to fire it up

Plugged into into the ADK arduino

 

Lets test fire one of the air lines…. Power up the compressor, write a quick bit of arduino code and !

 

One of the lines we ‘repaired’ pops off and attacks KRS and mmca, But it works ! We haven’t replaced all the airlines yet and they’re hard to get locally it seems. We test the switches here too, things are looking good.

We skipped a little ahead above, the test code required some simple though into it.

First set all the pins to input
Next set the individual output pins to output

Which wasn’t enough to make anything read.. So a quick poke around and some head scratching and the answers simple, we have to make the pins  for input set to HIGH first, so a quick change and off it goes.

All the defaults for out pins are set HIGH too.

So now it’s a case of mapping all the IOs in arduino and writing bits of code.

we decide to decode the ATC (toolchanger) first, it uses a select + 3 lines of BCD. 4 lines are assigned to the ardunio and then we figure out which bit controls which tool changer.

Obviously the smart thing to do is make it do this :-

with more gusto!

this is more fun that the pnp itself

So next the motors themselves , this is just a case of doing a train of pulses __–__–_–_– etc http://www.flickr.com/photos/krs_/6117717455/

We have to determine the length of the pulses, its moving very slowly in the video because we’re at the +ms speed, eventually we move to microseconds.

Adding the limit switches, and this is why i spent $600 on a compressor for airbrushing btw

Now we’ve done a better job of finding a good speed for the motors, so a quick walk test. This is just doing a limit, change direction test.

On the motor front now all we have to do is convert pulses to mm and then we can do a gotoxy() function! Which is pretty much all we need

The X and Y home sensors still aren’t working yet, so while i’m writing this blog and uploading all of our videos to flickr ( since google+ doesn’t seem to have an easy way of embedding videos) I’m working out why the XY home doesn’t work. I’m adjusting the walk function to print out the XHM and YHM sensors after each pulse to see if it only does home when the rotary encoder hit and the home sensor are both on. And we just did a quick test and that indeed is the answer woo!!

So now to write a quick home function, i’ll have the machine do a bottom left limit find,, move back a little bit up to the right and then slowly move back til it finds home..

be right back!!

and now krs is filming me,,, awkard…

Ok so the home function is now working, the machine goes to top right/back quickly, then left,front quickly, steps back to the right 100 pulses, and back 100 pulses so its definitely not at home, then slowly scans left to find x home, then slowly scans hither to find y home.

Next steps are to convert the pulses to actual distances so we can do x,y instead of pulses. I also want to do some repeatability tests, in other words go to home, go to position, go to home, go back to position and see if its always the same place. So lets home it, center it, switch on the spot light mark it, and repeat, or use a sharpie

The spot light had a broken wire in the middle, it’d been poorly repaired once before so we stripped it off and resoldered it.

We used a ruler to calculate the pulses to mm, using 100 and 500 pulses to see the distance travelled in each X and Y ( the same amount )

Seeing how far it goes.

 

I added the home switch, teach switch as the spot light toggle and the cursor pads to move the head. the down button is mapped to RX on the arduino mega so I cheated and used FAST button, we’ll remill a new board tonight with a different layout

We’re pretty close to getting the full functionality of what we had before with the factory software. Just tool changer positions etc, which is all just finding the spots.

The speed of the machine has been pedestrian so far, so looking at the original specs the pulses are ramped (since physics) and it moves much faster. So next lets try to match that.

Scope/LabView looks like this for the original.

 

The X and Y’s have different stepper controllers, so it has different max speeds. The idea is now to add ramps to the move functions, i threw together a quick ramp into the limit finder test code, of course this means it has a nasty bump as it stops for the limiter. Once we’ve got a good speed going, the new gotoxy() function will do a /~~~~~\ ramp, slow to fast to slow.

 

Various speed tests

Goes wrong! We can play a mean mario with this

 

Yeah! we’ve got a decent speed now. Its hitting the limiter rather than slowing down as it should. The arduino starts off ramping up but since its looking for the limiter it bangs to a  stop, we’re going to calculate the number of pulses needed to get to just before the limits. That way the machine knows how far it can go, even though during most of its working life it’ll never go to the limits.

 

[Null Space Labs] like most hackerspaces is very srs bizness indeed.

 

So next I wrote a piece of test code that moves each of the axis slowly, limit to limit for  a few passes the Y result was this :-

Found Y+ limit = 4202
Found Y- limit = 10597
Found Y+ limit = 10597
Found Y+ limit = 0 (oddity!)
Found Y- limit = 10597
Found Y+ limit = 10597
Found Y- limit = 10597
Found Y+ limit = 10597

At faster speeds in the X axis, it deviates but interestingly settles after a few :-

Found x left limit = 7433
Found X right limit = 7447
Found x left limit = 7276
Found X right limit = 7446
Found x left limit = 7266
Found X right limit = 7446
Found x left limit = 7266
Found X right limit = 7446
Found x left limit = 7266
Found X right limit = 7446
Found x left limit = 7266
Found X right limit = 7446
Found x left limit = 7266
Found X right limit = 7446

Running the X at a slower speed gives us this :-

Found X right limit = 7432
Found x left limit = 7432
Found X right limit = 7432
Found x left limit = 7432
Found X right limit = 7432
Found x left limit = 7432
Found X right limit = 7432

Which is great, since as it should be its very consistent.

Our ruler based figurin’ from before gave us the following info :-

500 pulses = 25mm
100 pulses = 5mm

So using that info from above we get

431 pulses X axis (left to right limit to limit) = 370mm
10597 pulses for the Y axis(limit to limit ) = 529.85mm

This is good since it means our speed is workable, and we can now write a function that can start off slow, speed up and slow down, as the machine knows how many pulses it can do before hitting a limit, but we first have to calculate the distance from home to limit for each X and Y axis.  Though most of the time the machine will not be attempting to get to the limit.

The machines minimum step size is .05mm or 1.9mil’s but we are going to improve to .025mm or 0.984251969 mil! Which is 0.000984251969 inches.

So now we have converted it to double the resolution of the original equipment we get

Found x left limit = 14867
Found X right limit = 14864
Found x left limit = 14863
Found X right limit = 14863

Found Y- limit = 21174
Found Y+ limit = 21173
Found Y- limit = 21172
Found Y+ limit = 21172
Found Y- limit = 21172
Found Y+ limit = 21172
Found Y- limit = 21173

It’s now 1000 steps per 25mm or 1 step is 0.025mm!

Awwh yeah!!! Our machine is now able to do smaller parts and greater resolution  than the original!

So far for this post, it is about 11:00PM west coast time and its been a busy few days, we’ve put about 6 nights work into this and progress has been pretty good. We’ve saved ourselves a lot of money, since a machine that’s not got as good specs would cost us nearly 20K. The machines minimum step size was .05mm or 1.9mil’s but we have improved it to .025mm or 0.984251969 mil! Which is 0.000984251969 inches..

To recap

Built arduino shield
Wrote arduino code
All pneumatics working
Repaired reed switch
Fixed all the broken mechanicals in the head.
All input switches working on the panel (except down as it was wired to RX oops)
Limit switches working
Home sensor working, home written
Figured out how to ramp up and down the speeds to get the the machine moving quickly
Automatic Tool Changer all works
Head down, head up
Vacuum on and off
Teach light repaired and working, controllable
Rotation and centering arms working
Reed sensor on head up
Verified our code and board homes the machine to the exact place the original did.
Calculated travel pulse speed and size of board, machine can gotoxy without a problem
Doubled the resolution!

We’ve still got to replace all the hoses as they’re really in bad shape but that’s easy. The next step is software to do the pick and placing, that’s easy too. I’ve already written a gui and added opencv.