Calibration

Started by spiyda, August 16, 2016, 05:16:21 PM

Previous topic - Next topic

arvydas

I've been reverse engineering the code from time to time whenever I have some spare time. I have quite good knowledge of how the software is structured now internally and I am able to extract functions into pseudo readable code, then convert them manually into something a bit more understandable. Calibration code was my next step, but it is quite difficult without actually seeing what the machine does during calibration as I need the jig. It's mostly being limited to finding the pieces of code that represent events on the machine like displaying dialog boxes.

Spiyda, can you please let me know the exact steps that don't make sense to you and I will see if I can extract the logic behind the code on the machine. Maybe with combined effort we might be able to fully reverse engineer the functionality?

spiyda

I have a couple of orders to get out in the next couple of days, but after that, I plan to remove the feeders, fit the calibration plate and attempt to run through the whole process.

I've got some opal acrylic on the way to play with as well as a smaller camera (I know I had some somewhere but they have escaped)

I will document each step properly with more detail on any parts not understood.

I'm not quite sure why the nozzle doesn't automatically rotate 180 degrees between passes (as would be logical if my hypothesis is correct) but some index mark on the jig will be required to get the 180


I honestly don't think we are far off, but the run through is bound to throw up something new !

Sixexe

Just started reading this thread with interest, great work.  I believe you are on the correct track fitting a camera centred on the nozzel location as speaking to an ex versatronics engineer he explained that to calibrate the machine a camera needed to fitted inplace of the nozzel.

spiyda

Quote from: Sixexe on September 05, 2016, 10:15:10 PM
Just started reading this thread with interest, great work.  I believe you are on the correct track fitting a camera centred on the nozzel location as speaking to an ex versatronics engineer he explained that to calibrate the machine a camera needed to fitted inplace of the nozzel.

Thanks for that, it gives me a bit more confidence that we are not far off... !

I'm still waiting for the smaller camera to arrive  :(
For the test, I will be mounting the camera on an M6 Nylon bolt, which perfectly screws up into the center of the nozzle stub !
This gives a more positive and better alignment than slipping something over the two "O" rings, without doing any harm.

Sixexe

I guess it is critical to align the calibration camera perfectly in the centre of the nozzel axis or is this the purpose of reversing the camera?  If the camera is rotated in the head 180deg then it would be possible to calculate and compensate for a non centred camera?

spiyda

Quote from: Sixexe on September 06, 2016, 01:15:03 PM
I guess it is critical to align the calibration camera perfectly in the centre of the nozzel axis or is this the purpose of reversing the camera?  If the camera is rotated in the head 180deg then it would be possible to calculate and compensate for a non centred camera?

That is exactly what I'm assuming, but getting the camera as near as possible to the nozzle centre won't do any harm !

spiyda

Finished the boards I needed to do, so the feeders are off and  tried a first fit of the calibration plate.

It sits nice and level, a tight fit to get in, but looks good.. 

I need to ream out the dowel location holes to 6mm (not 8mm as per the drawing).
The original dowels may have been stepped, but mine are plain 6mm

Hopefully the new camera will arrive tomorrow and will just need the lens swapping to a pinhole  ( greater depth of field)

The rotating shield with the slot for nozzle rotation indexing seems to have a hole exactly opposite the slot..
If that is the case then adjusting the camera 180 degrees between passes should be easy.


spiyda

More progress today.

I printed 4 off a3 sheets and joined them as a temporary grid.
The joins are not perfect and would not be good enough for an actual calibration, but OK for a test.

I went through the procedure as far as "grid head"

Results were encouraging. 

after a tweak.. the first half of the  grid head calibration procedure runs all the way through

The tweak was to ignore the automatic nozzle height at the start of the procedure and move the camera further from the grid.
This means that slight variations in height of the grid have less effect on the image.

I ran the procedure until the machine asked for the shaft to be rotated 180 degrees.  (as previously discussed)
I didn't proceed as at this stage the diffuser was held on by elastic band and would have dropped off !

videos on youtube

https://youtu.be/bNJtTmpBflk

https://youtu.be/S4CqeLFYCpg

Mike

Have you been looking at what it's putting in the cal files?

spiyda

Quote from: Mike on September 12, 2016, 10:42:30 AM
Have you been looking at what it's putting in the cal files?

I'm deliberately holding off until I can run through the "Grid Fiducial" with a decent grid..
I can't see there is much to learn until the data produced is decent
hopefully this week.

Too bad that proper work gets in the way !

spiyda

I'm waiting for a better printed grid to try the process end to end, then I can compare the calibration files.

But in the meantime a couple of observations, notes on what I have learned.

The plate specified in the drawings upon which to mount the grid, is bigger than it needs to be. Its about the maximum size you could possibly fiddle in while the machine is in its case.
One job to do is to redraw it to the minimum size needed to do the calibration. It could also easily be made in two parts to make posting it easier if required.
It would easily work with just a chunk of MDF or Worktop.  The precise alignment using the dowels is only required if you want to stop the process half way through, remove the jig and come back again, or just recalibrate the fid cam without recalibrating the head.


The Camera definitely works best with a small CMOS camera with a pinhole lens, (greater depth of field)
It needs to be mounted on the nozzle shaft, (I used a nylon M6 bolt, which screws nicely up the centre of the nozzle.)
Any led illuminator needs a diffuser
It works better further away from the grid than the default position, and the software allows for the z position to be adjusted before starting the procedure.
A soft foam pad is needed in the park position as unless you are careful, the arm dumps the camera with some force onto the grid plate !  (yep, I lost a camera that way !)

An M3 set screw or bolt, fits into an existing threaded hole on the side of the head to hold the mirror up out of the way while this is all going on.


So far, I'm impressed with the calibration routines. For code written for Versatronics staff to use, the quality is as good as the production part of the package. For example, if the camera fails to image the dot properly, it tries again by adjusting the threshold, and if that fails, it pauses and gives the user the option of skipping that dot and using calculated co-ordinates.  So a failed dot doesn't mean starting again !

The test I have done show the imaging is remarkably forgiving, it coped with misaligned dots, greyish print, the join sticking up several mm and still managed to keep going.

Just waiting for a call from the printer !


Mike

If close focus is an issue, Cameras can generally be made to focus closer by screwing the lens out further from the sensor.

spiyda

Quote from: Mike on September 13, 2016, 04:14:44 PM
If close focus is an issue, Cameras can generally be made to focus closer by screwing the lens out further from the sensor.

Hi Mike, its not the ability to focus closely, but when the camera is close, any variation of the distance between the grid and the lens makes a large difference to the apparent diameter of the dot...  and also to the brightness of the image. 

When the camera is further away the same difference in grid height makes less difference to the image size or brightness.

I suppose the best way to explain it is that a 5mm difference in height when the lens is 25mm away is   20%
when the lens is 50mm away, a 5mm difference is only 10% 

and somewhere in there is the square law..  but I give up on the maths..   I'm sure you get the gist...

But now from practical experience, I know it  actually makes a huge difference to how well the routine copes with the small variations.

Oddly, when I tested it, with the camera further away, not only were there less errors, but the process was much faster, probably twice as fast !

ps  ( reminds me of father ted !    ;)


Sixexe

Do you know if the absolute location of the grid dots is important, or the size of the grid dots, or the height of the grid?  I was thinking about how you were going to get your grid printed and wondered if you had considered getting a photoplot from gerber data.  I found jd-photodata.co.uk could supply a photo plotted image size of 556 mm x 695mm at 4k dpi for £38.


spiyda

Quote from: Sixexe on September 13, 2016, 11:45:29 PM
Do you know if the absolute location of the grid dots is important, or the size of the grid dots, or the height of the grid?  I was thinking about how you were going to get your grid printed and wondered if you had considered getting a photoplot from gerber data.  I found jd-photodata.co.uk could supply a photo plotted image size of 556 mm x 695mm at 4k dpi for £38.

I don't actually know anything !

Its all educated guesswork, Ive certainly never seen anyone calibrate a machine or seen the kit used to do it !

So this is a bit of a rambling reply !

But from what I understand, and trying to imagine how I would design a calibration process,  I don't think the absolute location or the exact size of the grid dots is crucial.

The purpose of the head calibration is to get build a data file that relates the arm positions to the actual x,y coordinates

My thinking is this.. there are two distinct types of points.

Points that are stored based on the current head position or the current fiducial camera position + offset (the precise data in the co-ordinate pairs is unimportant as the stored position will be calculated using data which will be the same data the head uses to get back there.. so even if it is incorrect, the head will still return to the same location)

Points that are derived from the gerber and are always relative to the fiducials. (these will need to use the x,y co-ordinate data) If the data is out, the placement of components will be distorted away from the fiducials.

What I don't yet understand is how the fiducial calibration procedure and the fiducial offset are related, but hopefully that will come.

My point is that provided the dots are evenly spaced over the working area, and are reasonably close to 0.5" apart, I think the machine will cope with the scaling reasonably well, That is part of the function of using the fiducials.  As for the dot size, again, as long as they are consistent and approximately the right size, the first part of the routine automatically scales them so it should be OK. The imaging seems to cope fairly well with small differences in the dots, and if they are outside the parameters, allows a manual overide.

I'm happy to be shot down in flames if it doesn't work properly with a 600dpi printed grid, but that's part of the fun.

That jd-photodata.co.uk  info is useful though,  The grid needs to be 800 wide but there is no reason it couldn't be in two halves as long as they are aligned on the board.

As far as height is concerned, it needs to be a height that is in focus for the fiducial camera. On one of my machines the pcb sits a good 10mm lower than the feeders but I may change that so that they are the same height and adjust the grid to a similar height.

So far my guesses seem to be working, the next step will be to try and run the process from end to end, compare the data generated with the original data file, then try actually using the machine with the new data file.   It should be quickly obvious if it isn't working properly.

Just waiting on a full size grid printed in one piece.