PDA

View Full Version : DIY Laser levelling using webcam and laser level



Pages : 1 [2]

Kitwn
24-05-2020, 06:03 AM
Gret stuff Joe!
Having just found out how effective taut wires can be for machine alignment I can really appreciate the value of the new software. Do fishing shops sell stainless steel leader in the UK? It's what I used and may be more stable than nylon.

One measurement I was completely unable to make on my machine was the straightness of the fixed rails. That may have now changed. I just need to work out a carriage arrangement for the round supported rails.

Kit

devmonkey
24-05-2020, 09:40 AM
Gret stuff Joe!
Having just found out how effective taut wires can be for machine alignment I can really appreciate the value of the new software. Do fishing shops sell stainless steel leader in the UK? It's what I used and may be more stable than nylon.

One measurement I was completely unable to make on my machine was the straightness of the fixed rails. That may have now changed. I just need to work out a carriage arrangement for the round supported rails.

Kit

Hi Kit,

Yes they do sell steel leader, music wire is also an option. These axis are only 1300mm long so normal lightweight fishing line seems to be perfect, very uniform and black meaning it is easy to resolve in the software. It only flows for around 30s after tension is applied and under the microscope you can see when it stops. The length I put on the machine yesterday hasn't stretched at all over night.

Some things I noticed that maybe useful:
1. The microscope (£20) must be focused once at the beginning and then not touched. Turning the focus winder shifts the optical axis which would throw off any measurement. The focus winder is solid enough not to move on its own.
2. The microscope cable must be tied to the carriage to avoid any force being applied to the back of the scope pushing it off axis.
3. M6 bolts make perfect wire guides for 0.28mm wire, the wire locks into the V of the thread.

The depth of field (variation in objective distance where object remains in focus) of the microscope is probably <1mm so you need to get the wire guides to the same height so the wire is not sloped, I set mine level with the top of the epoxy bed using a ruler. The wire is then suspended a few mm outside the epoxy bed.

If there is enough interest I will share the app, needs a bit of a cleanup first as it was a quick hack.

Cheers, Joe

Kitwn
24-05-2020, 10:58 AM
Joe,
I think it would be well worth sharing the app. I know Johm McNamara shared a lot of very useful info regarding the use of electrical sensing of a wire during the earlier pages of this thread. I was inspired by his work to do my tramming with taut wires alignment a couple of weeks ago which proved very sucessful. But the simplicity and low cost of your solution (who hasn't got a laptop these days?) makes it accessible to everyone. I will have to think about how to make the most use of it AFTER I've spent the next couple of weeks tarting my house up to make it more saleable but I suspect another round of alignment could be on the cards in the future thanks to your efforts.

Fitting shims is cheap and easy. Working out WHERE to fit the shims is the trick!

Keep up the good work!

Kit

John McNamara
24-05-2020, 03:13 PM
Hi Joe

You just made my day.

Gee using a microscope with your software is a huge step, 3 um = 0.00011811 about a ten thousandth of an inch imperial. accuracy.

Using wire or fishing line allows the measured line to be accurately positioned. By anchoring each end of the wire to the machine frame precisely you can place the linear rail exactly where you want it. A lot easier than pointing a laser from one end. It also allows you to easily place two rails parallel to each other, by simply measuring the space between the ends.

I would really like to try your new software. In fact I am quite excited.
While tweaking it You mentioned that you used black fishing line piano wire is bright and I guess would require a dark background instead of the light background you used to enhance the contrast of the line you used in your experiments.
Maybe the ability to invert the pixel colour in the contrast discrimination code would be a useful addition.

Wire or mono filament fishing line? I can think of a number of applications where the the measuring system will need to be left in place for days or weeks when say a large machine installation or While a DIY machine is being built, All plastics will keep creeping and possibly break. Music wire will retain its elasticity indefinitely if it is not loaded above its elastic limit. I use Roslau music wire with great success. Size 0 is .009 Inches in diameter. I never reuse it (From the coil it is perfectly straight you do not want any kinks) a small coil will last for years of hobby use.

There is another use for this system! A non contact plumb line sensing system or maybe even a pair of plumb lines!!
Two suspended plumb lines will always remain parallel and perfectly vertical in relation to each other (Ignoring the curvature of the earth that is only measurable at great distances.)

The two wires define the edges of a rectangular flat plane that in this case is measurable to .0001 inches using wire and your software. I am going to think some more on this....... I have an idea.

Regards
John

devmonkey
24-05-2020, 08:09 PM
Hi John,

I've put up the first version of the wire app here:
https://github.com/betzuka/laserlevel/blob/master/builds/wire.zip

Extract and run wire.bat, needs java installed as per the laser app. The wire needs to be crossing the rectangular field of view of the sensor in the short dimension, e.g. if your sensor is 640 wide by 480 tall wire should be crossing the sensor from top to bottom.

It doesn't care whether it is looking at a bright wire on a dark background or vice versa, just needs a decent contrast and the microscope focused so that the wire edges appear reasonably crisp. My fishing line is just black mono filament, super cheap kids stuff that I already had. The main reason for the different algo from the laser is that the objective is lit from the front rather than behind, so it isn't acting like a shadow camera, this means you get lots of reflection off of the surface of the wire which would misslead anything searching for a gaussian, or indeed searching for anything other than the wire edges.

Your idea of using it to check for planar surfaces is brilliant ! I could stand my machine on end, drop two plumb lines and measure the relative error between the two lines from each respective rail.

At some point I will integrate it into the laser app so all the other error plotting stuff works. Do you have a microscope to test it with? If not this is the one I'm using, it is also very handy for SMD soldering etc.
https://www.amazon.co.uk/Microscope-Bysameyee-40X-1000X-Magnification-Endoscope/dp/B07BF86SRP

Cheers, Joe

John McNamara
25-05-2020, 12:26 AM
Hi Joe

I do have an optical microscope, A cheap student version I used to align my lathe in 2011 using wire. The is a longish post here that discusses lathe alignment and wire, https://www.model-engineer.co.uk/forums/postings.asp?th=136771 In this case I lashed up a measuring stage that allowed me to position the wire centrally in a slot by eye using my bio computer then measure off the error using a micrometer. It worked! Page down the thread to see photos.

In particular note the simple wire positioning stages clamped to the lathe bed made from scrap steel, rock solid.

Using a USB webcam or microscope with your software is clearly a better solution. It eliminates a number of sources of error.

I don't have a working USB microscope I will order one! I cant wait to test the software.

In many ways two cameras will be even more useful, for XY measurement, Ideally using one computer, although old PC's are easy to source for nothing or next to nothing, if two instances of the software could interface to two USB ports on one computer it would be more convenient.

Regards
John

PS stretched wire plumb lines are used to this day by heavy machinery installers, for instance passenger lifts and giant boring mills to align the column. Normally the bob weight is suspended in a container of thick oil to damp out any tendency to sway like a pendulum.

devmonkey
25-05-2020, 03:07 PM
Quick update,

I've managed to set the master rail reasonably straight with the setup. It is within +/-5um along the entire length. It was not easy for a few reasons I will outline:
1. The microscope axis is offset in both X+Y from the centre of the carriage, I did this because obviously it has to be offset in Y as you can't 'see through' the carriage but also in X since I couldn't fit the microscope next to the carriage and remain over the frame. This arrangement is highly non-optimal as you are measuring an offset AND an angle. Eventually you get used to how much adjustment to make, however there must be a better arrangement that avoids this coupling.
2. Twisting the carriage hard on the rail can induce a few um of error.
3. Pressing hard on the machine frame and deflect the entire frame a few um.

The conclusion is that with a machine constructed like mine from 80x80x3 box section over a long dimension of 1300mm aligning to an accuracy of +/-5um is probably the absolute limit and it isn't sensible to try to achieve any greater. Also the frame is unlikely to hold this in actual use due to the deflection under force measured. Still it is good to be able to measure these things to get an idea where the limits are.

So in conclusion I've managed to align to ~1/2 a thou with a setup that cost a few quid. It is all entirely dependent on the taut wire actually being straight, however if we assume it is then this setup is equivalent to a DIN 874/00 spec straight edge, one of those 1500mm long will cost £2k then you still have to actually align the rail with it.

Here is a snippet from the alignment:

https://www.youtube.com/watch?v=NbPxeObG100

Quite pleased, time to get the gantry on now!

Kitwn
26-05-2020, 12:49 AM
2. Twisting the carriage hard on the rail can induce a few um of error.

To me this says a lot about the quality of your rails and carriages. It also makes the case for a well aligned frame if you want smooth movement without binding.

devmonkey
26-05-2020, 09:41 AM
To me this says a lot about the quality of your rails and carriages. It also makes the case for a well aligned frame if you want smooth movement without binding.

I would say it says that standard hiwin rails and carriages are pretty good, would you agree? This is an artificial setup as carriages wouldn't be used singly in a machine. The related interesting fact is that with these 20mm hiwin rails, with a section bolted down hard, moving the microscope 60mm to the next unbolted hole, finger pressure is sufficient to deflect the rail +/-3um although a small contribution will be from frame deflection. As said before everything looks like jelly when you look closely enough.

Also torquing up the mounting bolts with light pressure on an allen key moves the rail 1-2um, I set the rail at -2um with the bolt snugged down, then tightened it with the allen key that brought it to zero. I've just redone the straightening procedure this way and I'm now +/-2um along the entire length, job done!

The rail I chose as the master had two 'bends' in it, it was 'S' shaped, with the two ends zero'd there were two intermediate points along the rail which were roughly +/-70um respectively. I verified this wasn't some artifact of the taut wire or the software algo by changing the wire twice, moving the wire guides and changing the end that had the hammer hanging on it.

This shows that you definitely need to straighten the rail, it is not sufficient to use it out of the box.

John McNamara
26-05-2020, 10:29 AM
Rails are never straight out of the box they always need to be bolted down. The bolting should be done with a torque wrench for uniformity. If you can get hold of this book or find it at the local library you will see a large section on mounting rails and other components.

https://www.amazon.com/Precision-Machine-Design-Alexander-Slocum/dp/0872634922

I got my copy at Foyles many years ago for a lot more, A great book if you build machinery.

In it he explains the way the rail distorts when tightening it down. Chasing microns is great fun to me! they hide in every corner of your design.

I would not be concerned about a small amount of movement when you rotate the carriage axially on the rail. If it is a brand name rail you should find the type number engraved on the rail and the bearing blocks. By looking up the manufacturers website you should be able to determine the bearing clearance or preload and accuracy for the particular combination you have. typically around 3 clearance levels may be offered in addition to different accuracy levels. If you are ordering a new rail and bearing set for a project it is tempting to order the maximum preload, this is not necessarily a good idea at all. maximum preloaded bearings are often rated for a shorter life span and more importantly they require more accurate mounting surfaces, using the wrong clearance type can seriously reduce the bearing life and greatly increase the force required to move the bearing placing a high load on the drive system. Fortunately all the bearing manufacturers offer excellent manuals available for free download.

I ran this Google search today and it yielded some interesting results.

precision machine design slocomb mounting linear rails

Or use the link below.

https://www.google.com/search?rlz=1C1ASUT_enAU791AU791&ei=EN_MXqmGJLSEmgeczr34Dg&q=precision%20machine%20design%20slocomb%20mountin g%20linear%20rails&oq=precision%20machine%20design%20slocomb%20mounti ng%20linear%20rails&gs_lcp=CgZwc3ktYWIQAzoECAAQR1DTkwFY1tUBYNDYAWgAcAF 4AIABnQKIAeAkkgEGMC4xOS42mAEAoAEBqgEHZ3dzLXdpeg&sclient=psy-ab&ved=0ahUKEwipzsu1mdHpAhU0guYKHRxnD-8Q4dUDCAw&uact=5

Regards
John

devmonkey
26-05-2020, 11:40 AM
Rails are never straight out of the box they always need to be bolted down. The bolting should be done with a torque wrench for uniformity. If you can get hold of this book or find it at the local library you will see a large section on mounting rails and other components.

https://www.amazon.com/Precision-Machine-Design-Alexander-Slocum/dp/0872634922

I got my copy at Foyles many years ago for a lot more, A great book if you build machinery.

In it he explains the way the rail distorts when tightening it down. Chasing microns is great fun to me! they hide in every corner of your design.

I would not be concerned about a small amount of movement when you rotate the carriage axially on the rail. If it is a brand name rail you should find the type number engraved on the rail and the bearing blocks. By looking up the manufacturers website you should be able to determine the bearing clearance or preload and accuracy for the particular combination you have. typically around 3 clearance levels may be offered in addition to different accuracy levels. If you are ordering a new rail and bearing set for a project it is tempting to order the maximum preload, this is not necessarily a good idea at all. maximum preloaded bearings are often rated for a shorter life span and more importantly they require more accurate mounting surfaces, using the wrong clearance type can seriously reduce the bearing life and greatly increase the force required to move the bearing placing a high load on the drive system. Fortunately all the bearing manufacturers offer excellent manuals available for free download.

I ran this Google search today and it yielded some interesting results.

precision machine design slocomb mounting linear rails

Or use the link below.

https://www.google.com/search?rlz=1C1ASUT_enAU791AU791&ei=EN_MXqmGJLSEmgeczr34Dg&q=precision%20machine%20design%20slocomb%20mountin g%20linear%20rails&oq=precision%20machine%20design%20slocomb%20mounti ng%20linear%20rails&gs_lcp=CgZwc3ktYWIQAzoECAAQR1DTkwFY1tUBYNDYAWgAcAF 4AIABnQKIAeAkkgEGMC4xOS42mAEAoAEBqgEHZ3dzLXdpeg&sclient=psy-ab&ved=0ahUKEwipzsu1mdHpAhU0guYKHRxnD-8Q4dUDCAw&uact=5

Regards
John

Mine are medium preload (ZA) mate not high preload, rail is now straight enough for me, although huge fun (not!) there is no point chasing down +/-2um when I can deflect 300mm of 80mm box section that the rail is mounted on between uprights by 5um just by leaning on it. I listed all those example measurements to show what the system is capable of, e.g. obviously the carriage will twist on the rail when twisted, if it didn't then it wouldn't move, but in reality this is only a problem if you have a microscope bolted to the carriage as in actual use two carriages would be used mounted to a rigid plate, I was highlighting this as a source of error with how I mounted the microscope not a criticism of the hiwin system. Possibly a better (although more work) microscope fixture would be to register to the reference edge machined on the hiwin rail rather than use a carriage at all, couldn't be bothered though...

John McNamara
26-05-2020, 04:08 PM
Hi Joe
I agree medium preload is a good choice, and when the carriage is installed there will be 4 bearing blocks distributing the load, as they are spaced apart any axial twist will be much reduced. I suspect that if you ran the test with the microscope mounted in the carriage running on your already precision aligned rails You may get even better numbers due to some of the residual errors in the rail alignments averaging out.

Hi Kitwin
You mentioned that you were working with round rails, Maybe if you first fit both rails with the mounting screws just tight enough to allow them to move sideways then after sliding on the bearing pairs onto each rail you fit the carriage plate on the bearings in the same manner just tight enough to move you will be able to align one as a master rail using wire alignment and the microscope before setting up the other.
It may take a couple of cycles of this procedure but it will iron out any errors.

This worked for me when building a small All laser cut CNC router with a mate for a Men's shed in Bright Victoria in 2012 It is still in use daily apart from the Covid shut down.

It uses round rails, and yes timing belt drives apart from the Z axis which is a ball screw. Remarkably the accuracy is a lot better than you would think. After wearing out 2 Makita routers due to the high usage It now has a Chinese 2.2kw high speed spindle.

https://www.google.com/search?q=Bright%20mens%20shed%20cnc%20router%20mcn amara%20-site%3Apinterest.*&rlz=1C1ASUT_enAU791AU791&source=lnms&tbm=isch&sa=X&ved=2ahUKEwi97rHj49HpAhVn6XMBHURQBjsQ_AUoAnoECAoQB A&biw=877&bih=429&oq=Bright%20mens%20shed%20cnc%20router%20mcnamara% 20-site%3Apinterest.*

Regards
John

devmonkey
26-05-2020, 04:38 PM
28205 28206

Will use gantry to space slave rail correctly, progress on this particular machine will continue in my build thread:
http://www.mycncuk.com/threads/13178-Joe-s-1000x600x200-steel-and-aluminium-router-started/page8

Kitwn
27-05-2020, 01:01 AM
I would say it says that standard hiwin rails and carriages are pretty good, would you agree?

That was my meaning, ' a few um' detected by the microscope is not much movement at the carriage. These rails are known to be intollerant of poor alignment, non-straight frames etc. and that's what you'd expect where there is so little play. When I decided to go for fully suported round rails on my machine part of the decision was that I was unsure I coud make the frame accurately enough for the more expensive Hi-Wins not to bind.

Kitwn
27-05-2020, 01:27 AM
Hi Kitwin
You mentioned that you were working with round rails, Maybe if you first fit both rails with the mounting screws just tight enough to allow them to move sideways then after sliding on the bearing pairs onto each rail you fit the carriage plate on the bearings in the same manner just tight enough to move you will be able to align one as a master rail using wire alignment and the microscope before setting up the other.
It may take a couple of cycles of this procedure but it will iron out any errors.

This worked for me when building a small All laser cut CNC router with a mate for a Men's shed in Bright Victoria in 2012 It is still in use daily apart from the Covid shut down.

It uses round rails, and yes timing belt drives apart from the Z axis which is a ball screw. Remarkably the accuracy is a lot better than you would think. After wearing out 2 Makita routers due to the high usage It now has a Chinese 2.2kw high speed spindle.



John,
My main concern with the round rails was that a single carriage will rotate around the rail so some form of 'gantry' going accross both will be required to mount the microscope. Probably not a real problem in fact, especially if the slave rail is quite losely mounted. Nearly all the error seen will be from the nearest rail and a few iterations should sort things out as you say.

I'm not sure you can fully adjust round rails in practice. The steel rail must be far more rigid than the aluminium support and whilst shims may well sort out vertical errors, I suspect any attempt to nudge the thing sideways will more likely distort the support than the rail. I don't speak from experience however.

One day I might decide to do a serious upgrade and build a mostly-new machine in which case I will be using all the wisdom gathered from you and Joe to chase down every micron I can. Alternatively somebody with better coding skills than I will come up with a method that can detect all the errors on my machine and writes a dedicated post-processor to take them out in software. Oh No! Not another rabbit hole to head down!!!

Very amused by your last comments, my version reads "After wearing out 2 Makita routers due to the owner being being stupid it now has a Chinese 2.2kw high speed spindle"

Kit

John McNamara
27-05-2020, 03:33 PM
When we built the router in 2012 it was for a community men's shed. we were on a parts budget, My mate and I put our time in for nothing so there was no cost there. A Makita router was available, from memory it was donated.
The Chinese spindle. Is much quieter than the Routers with their brush type motors. I guess I should of put this in a separate thread, it is a bit off topic. This thread is about Alignment and software.

Michael Gilligan
20-07-2020, 07:39 PM
Afternoon all.

[...]

Anyway the purpose of this post is to describe a new app I put together today for laying the master rail straight. I decided it would be easier to use a taut wire rather than the laser for this and a cheap USB microscope.
[...]

The microscope is attached to a hiwin carriage and the new app accurately locates the wire allowing you to zero the tool then reports the error as you slide the carriage back and forth.
[...]

Nothing new in the process that other people have performed other than the app that lets you achieve excellent accuracy with little effort.
[...]

The wire locating algo is quite different from the laser gausian model and seems extremely robust.
[...]

Cheers, Joe

.

With apologies for absence ... it's been a while since I was here :

That sounds like a great development, Joe
I obviously need to read the next couple of pages, but please let me join those requesting that you share the App

MichaelG.
.

Edit: Just off to grab that code :encouragement:

devmonkey
20-07-2020, 11:05 PM
.

With apologies for absence ... it's been a while since I was here :

That sounds like a great development, Joe
I obviously need to read the next couple of pages, but please let me join those requesting that you share the App

MichaelG.
.

Edit: Just off to grab that code :encouragement:

Hi Michael,

I actually wrote a different app for the taut wire method, I don't think I uploaded it anywhere. It has been a while but I think it made use of the wire not crossing the sensor exactly parallel to the pixel rows to gain excellent sub-pixel resolution and it also took a bisector of the line edges as the line shadow is not gaussian when lit from above by a microscope. This also takes care of the converging or diverging wire edges which you can see under high magnification and are caused by the wire stretching more in the centre of the span than at the edges as it flows.

Unfortunately I wont have access to the machine with the code on for a few weeks. Thanks for the offer of some wire but I don't really need it, I found that black fishing line worked perfectly since the app is tolerant of an imperfect wire as described above.

Edit:
Actually it turns out I did upload the code, fill ya boots!
https://github.com/betzuka/laserlevel/blob/master/builds/wire.zip

Cheers, Joe

Michael Gilligan
20-07-2020, 11:31 PM
Thanks, Joe

Yes, that’s the one I found

Opened it on the old MacBook Pro [just using the built-in camera] and it appears to run fine
... But it wouldn’t close
Then I remembered that I had the same problem with your laser App, and fixed it
Java had done another update today, so : Once again, I deleted Java completely and re-installed.
... All seems fine now

MichaelG.
.

P.S. __ The wire is a bit special, but if you’re happy that’s fine.

@ John McNamara ... I will send some to you.


.

John McNamara
21-07-2020, 01:15 AM
Hi All

The past couple of months have been pretty busy around our place, Time to get back to the workbench! Glad to see your input Micheal and thanks Joe I just grabbed the updated software. I am moving the workshop so soon I will have more room :)

Regards
John

mekanik
21-07-2020, 09:34 AM
Hi Joe
Tried the link but am unable to download it. I get to Github OK and am able to click on the builds/wire zip but nothing happens, also there is a note (binary file not shown)
Do i have to be signed in for the app to be available.
Kindest Regards
Mike

Michael Gilligan
21-07-2020, 10:49 AM
Mike,

May I suggest you try it again ... it was probably just a glitch

I have just successfully downloaded the zip file to my iPad
[not that it’s much use there]

MichaelG.

mekanik
21-07-2020, 02:48 PM
Mike,

May I suggest you try it again ... it was probably just a glitch

I have just successfully downloaded the zip file to my iPad
[not that it’s much use there]

MichaelG.

Hi Michael
managed to download the file and unzip it, i get wire.bat and wire.jar. when i try and run wire.bat i get no default application found. tried to run wire.jar and get java file "wire.jar" could not be launched.
I am currently running a very old iMac G5 with the tenfourfox browser and seem to recall that for security reasons Java is disabled. as you have probably gathered i am IT challenged but would really like to get this application working if possible, i do have another PC running Windows 7 so will try with that machine later.
Thanks for your help.
Regards
Mike

Michael Gilligan
21-07-2020, 03:03 PM
There are some helpful notes on the java.com website, Mike
https://www.java.com/en/download/faq/java_mac.xml

... Not sure how you will get on with G5 compatibility though

Best of luck

I’m no expert, but happy to discuss any issues; within my very limited ability !

MichaelG.

mekanik
21-07-2020, 03:10 PM
Hi Michael
I might take you up on your offer, i do have a more recent recent iMac that was given by my Daughter but have not got round to using it yet, which is a bit stupid as that will be approaching the no update stage soon. I have been following this thread from the start and the application looks to be very usefull. if i can get the app running i will purchase the camera that Joe linked too and add it to the come in handy box.
Regards
Mike

Michael Gilligan
21-07-2020, 05:17 PM
No problem, Mike ... Let me know which OS is on the iMac
I have one which I have ‘frozen’ on Snow Leopard, so we may be able to work in parallel if you are struggling with it.


MichaelG.

Michael Gilligan
25-07-2020, 05:39 AM
Disappointing news, Mike

wire.jar did not open in Java on Snow Leopard [OS X 10.6.8]

... it presumably needs a recent version of Java, and these are not available for Snow Leopard

ref. https://www.java.com/en/download/mac_sysreq-sm.jsp

MichaelG.

mekanik
25-07-2020, 09:36 AM
Hi Michael
Thanks for the update, i think the other iMac i have is El Capitain and also have the Windows 7 PC so all is not lost, have you had wire.jar running on another PC ?
Regards
Mike

Michael Gilligan
25-07-2020, 06:26 PM
It seems to be fine on el Capitan, Mike

Haven’t yet tried it on any version of MS Windows

MichaelG.

.

Edit: I may have 'spoken too soon'
Both applications are failing to shut-down, and I need to 'Force Quit'
... and their CPU usage, according to 'Activity Monitor' is over 150%

I will try them on a Windows machine

Michael Gilligan
27-07-2020, 10:12 PM
Update: [mostly for Mike]

I have just installed the latest java 8 on a little NetBook running Windows 7
laser.jar and wire.jar both load and run

The NetBook is so excruciatingly slow that this proved futile; but I’m sure that Win 7 on a better PC should be fine.

MichaelG.
.

Incidentally; I consulted a ‘learned friend’ on Sunday, regarding the CPU load on the Mac
When he saw what was being done, and how speedily, he was very impressed ... and not at all surprised that this required 150%

mekanik
28-07-2020, 07:41 AM
Thanks for your efforts Michael, at least it looks like i should be able to get this running with the PC or Mac. do you have a link to the USB microscope you are using.
Kindest Regards
Mike

Michael Gilligan
28-07-2020, 09:14 AM
You’re very welcome, Mike

As a hobby microscopist, and tinkerer, I have a number of cameras that I can use for what I am personally interested in doing with these applications ... but for the purposes of this thread, I think the ‘USB microscope’ linked earlier should be fine. https://www.amazon.co.uk/Microscope-.../dp/B07BF86SRP

It is claimed to work on both Mac and Windows, so is presumably a UVC webcam at heart
Note: UVC = USB Video Class and is widely supported.

Best Wishes
MichaelG.

Michael Gilligan
28-07-2020, 06:45 PM
I’ve just found the manufacturer’s web page for the recommended USB microscope
https://bysameyee.com/microscope

Uncommonly helpful, I would say !

MichaelG.

mekanik
29-07-2020, 10:45 AM
:cool:Thanks for that Michael
Just ordered one.
Regards
Mike

unromeo
09-09-2020, 08:11 PM
Hi everybody,

First, please excuse my limited englisch, as it's not my first language.

I must say, it was a very interesting thread. I have read it from the beginning with great interest. Having the possibility to achieve these kind of precision with just a couple of items that most people have around the house is really mind blowing.

I am also in the process of planning and hopefully also building a fixed gantry cnc mill / router, but aiming at a smaller working area and more rigidity to be able to mill aluminium parts. The work area should be at around 300x300x150mm. I am still contemplating which material to use for the frame, but I might go for welded steel square beams and milled aluminium tooling plates for the surfaces to mount the rails. For now, I just have a set of 20mm chinese square rails and ball screws.

Anyways, while reading through the thread, I was always thinking to myself, why use the cheap USB cams with crappy sensors, when there is such a good Hi-Res sensor in the PiCamera, and the Raspberry pi is a great platform for such projects... but of course, a few pages down the thread and the Pi Camera was used.

A few years ago, I tried building a crude autoguider for astrophotography and used OpenCV and a Raspberry pi with a camera. It worked quite well, and it was able to track a light point while controlling a mount using 4 GPIOs. I ended using PHD guiding in the end, but the effort showed me what can be done with the openCV platform. I was thinking of using it to build almost the same tool that Joe put together in Java, but since the work has already been done, why not use his tool ? :)
By the way, is the development on the Raspberry platform still active ? I have a bunch of Pi's with cameras laying around the house, I could spare one for this project.

Another question: using a laser pointer of decent quality, would it work by shining the laser at a very shallow angle to the sensor, practically stretching the dot into a very elongated oval ? Has this been tried ? I think a forum member already suggested this. Or better yet ditch the laser and use fishing line / piano wire instead ?

Ok, I think it should suffice for a first post :)

Cheers !

John McNamara
11-09-2020, 04:34 AM
Hi Unromeo
Hi All

A mate and I have been mulling over using a Raspberry Pi and Joe's excellent software.
Actually a pair of Pi's to position an XY positioning system probably using an Arduino to automate the process of generating a rail mount. It will use a simple cutting head that "Pecks" the surface to be flattened using a small cutter head. it will only need a small motor and the cutting forces will be very light so no big deal. The completed surface will look a bit like a scraped surface. The cutter head will be mounted on the rails that will later be used in the machine being built, these will be mounted on a temporary mount.
Maybe we could collaborate?

I am planning to design the device in 3D CAD with a primary objective of Laser cutting as many of the parts as possible out of Steel.

This will keep the costs very low. I would make the mechanical s open source.

Regards
John

unromeo
15-09-2020, 11:59 AM
Hi Unromeo
Hi All

A mate and I have been mulling over using a Raspberry Pi and Joe's excellent software.
Actually a pair of Pi's to position an XY positioning system probably using an Arduino to automate the process of generating a rail mount. It will use a simple cutting head that "Pecks" the surface to be flattened using a small cutter head. it will only need a small motor and the cutting forces will be very light so no big deal. The completed surface will look a bit like a scraped surface. The cutter head will be mounted on the rails that will later be used in the machine being built, these will be mounted on a temporary mount.
Maybe we could collaborate?

I am planning to design the device in 3D CAD with a primary objective of Laser cutting as many of the parts as possible out of Steel.

This will keep the costs very low. I would make the mechanical s open source.

Regards
John

Hi John,

sure, if I can help with anything I will gladly do it, the only problem is that my programming kung fu is not that strong :glee: and that project was a while ago, but I can crawl my way into a working program if I want to. I can also assist in CAD and 3d printing if there is the need.

I wonder, if the measuring sensor is ofset from the pecking axis (the cutting head) won't that be an issue ?

I have a different idea how to measure the center of the laser line that won't involve cameras and PC's, but it will need to be tested for precision. I want to try something old school and very simple: analog electronics. Two small photodiodes placed aprox. 1mm apart (depending on the thickness of the laser line) so that each will catch the side of the line. Some op-amps to compare and amplify the signal and an analog microampmeter to display when we are at the exact center. Any difference in amplitude between the two photodiodes will be amplified and shown on the meter.
I have to buy a decent laser module and will test this out soon.

Regards,
Romeo

devmonkey
15-09-2020, 12:08 PM
Hi John,

sure, if I can help with anything I will gladly do it, the only problem is that my programming kung fu is not that strong :glee: and that project was a while ago, but I can crawl my way into a working program if I want to. I can also assist in CAD and 3d printing if there is the need.

I wonder, if the measuring sensor is ofset from the pecking axis (the cutting head) won't that be an issue ?

I have a different idea how to measure the center of the laser line that won't involve cameras and PC's, but it will need to be tested for precision. I want to try something old school and very simple: analog electronics. Two small photodiodes placed aprox. 1mm apart (depending on the thickness of the laser line) so that each will catch the side of the line. Some op-amps to compare and amplify the signal and an analog microampmeter to display when we are at the exact center. Any difference in amplitude between the two photodiodes will be amplified and shown on the meter.
I have to buy a decent laser module and will test this out soon.

Regards,
Romeo

Just remember that there are no laser line generators that paint a straight line, for that you need a pentaprism which is v.expensive. So it depends what you are trying to do. I ultimately went to a taut wire system with the camera, worked very very well for me but I only used for straightening in 1D, a dot laser would have worked equally as well if you can mount it securely enough (which is extremely difficult). I used epoxy for generating the plane for the pair of rails to sit on.

Cheers, Joe

Kitwn
16-09-2020, 12:54 PM
Romeo,
I ended up following Joe's route and going with taut wires (we actually owe John McNamara for that idea) but went even more old school and simple than you are planning using a simple electrical contact to detect when my probe was just touching the wire. Details here if you're interested http://www.mycncuk.com/threads/13627-Tramming-With-Taut-Wires

John McNamara
21-09-2020, 05:35 AM
Hi All

Sorry I have not been around much we are moving house.

Below is a a few quick screen grabs of a concept design of a device to create a flat surface directly on the support tubes of a CNC router.

Apart from the long tubes the device is approx 270mm square.
I plan to reduce it down once I sort out how big the sensors need to be. The laser cutting will be cheap its all 5mm Plate.

Note the X and Y 12mm ball pairs used to level the platform, allowing it to rock X and Y.
In practice the pocket corners will be formed by Lightly pressing them in together in a vice, They will be very accurate.
Not shown will be some springs to keep them pressed against each other.

The drives for the X and Y rock will be at the bottom of the tube if a plumb bob is used.
Huge leverage so small steppers only will be needed nothing fancy just a threaded rod there will be little travel needed.

Again just a few of 5mm laser cut plates to mount them.

Do you know of a cheap IC chip that could be used instead of the plumb bob? I know they exist but where?
The wire alignment microscope as per Joe's design will be mounted on the vertical carriage.

I am not planning to use ball screws for the X and Z (Remember the Y is A belt), just the threaded rod drives used in 3 D printers. Quite cheap.

There will be a single wheel only carriage that rides on the opposite rail for stability
I have not shown the drive for the carriage itself It can be a timing belt Better or just a cable drum.
I have shown Ali Barba Bearings.

What do you think?
Regards J

28884
28885
28886

Kitwn
21-09-2020, 06:08 AM
John,
Snap! I'm in the process of packing up our house in tropical WA at the moment ready for the move to a new property in Tasmania. Bought a nice place on 2 acres with a 6x6m shed just for me to play in without ever being able to go over and see it! Covid has made us all do things we'd never have believed possible a year ago.I'm sooooo looking forward to the cooler climate. I'll also be a quik ferry ride from Melbourne so Might make it over to your model engineering exhibition one year.

Not entirely sure if this is what you want, but the chip you might be looking for is possibly one of these. The acelerometer is mainly used to correct for drift in the gyro (or is it the other way round?) hence the combined unit on one chip. There's loads of software examples for using these beasties, mostly on threads about self-balancing machines. Let me know if thi is the right thing and I'll look up some of the info I have. I've got one of these chips as part of a long-term plan to build my wife a self-balancing wheelchair.

https://www.sparkfun.com/products/11028

Kit

John McNamara
21-09-2020, 06:26 AM
Hi Kit

We are moving to the Hills outside Melbourne No Shed yet but room to build one. There is a big garage for now.

Thanks for the heads up on the IC chip, I would appreciate any feedback.
The levelling is needed to make sure the cutter head is truly vertical In X and Y. Before a cut is taken.
I thought for some time on this, It would probably work reasonably well without levelling, assuming the support rails were fairly straight. However reasonably is a word I would prefer not to use.

The way The machine will operate is to position the cutter head in X and Y before each peck.
Then using Joe's optical system position the Z at the wire before taking a peck down a known distance.

Regards
John

Kitwn
21-09-2020, 07:34 AM
John,
I remember you mentioning something about this further back up the thread. I've come to realise that 'reasonably' is a word that fits more in my vocabulary than yours, or Joe's for that matter. Once I'm retired and settled into the new home I may well be making use of the sort of back-yard presicion that the pair of you are making possible for us mere mortals.

I've got a list of useful sites for software for that chip somewhere but not on this computer it seems. I'll try to find it and give you some links. Might be a few days though.

Kit

Michael Gilligan
21-09-2020, 08:08 AM
Good to see you back, John

This design is only a single axis level, not a plumb ... but it might provide some inspiration.
https://www.allaboutcircuits.com/industry-articles/implementing-an-electronic-leveling-tool/

MichaelG.

Mud
23-11-2020, 05:11 PM
Just wanted to say thanks for the software - I used 0.26mm black fishing line and I would conservatively say I got my reference rail straight to within +/-5% of the line thickness with only manual adjustment (i.e. no fancy cams) without much bother. I did have trouble with reflections on the black line, so could not rely on the red/green/red gauge - I resorted to tape on my screen!

Image attached to show my lazy setup - whilst I wouldn't recommend ABS for metrology (nor my tape on the screen method) the idea clearly is a good one!

29195

leolfs
23-01-2021, 06:27 AM
Hi all,
first post.
If a digital output could be made available to indicate a when the wire is centered in the view field, then this would make a fantastic home switch for a variety of projects If coupled to say mach3. Presumably the axis would need to overshoot somewhat so as to detect the slope of the signal, but if this is consistent it would not matter. If all this could run on a RPi it could be a better alternative to any switch or sensor. .As this is beyond my skill level I wonder if the developer might be interested in adding this feature?
Regards....Leo

John McNamara
23-01-2021, 12:52 PM
Hi Joe
Hi All

Also see previous post LeoLFS

If you are wondering what we have been doing while holed up due to Covid the following design has occupied us for quite a while. I am also halfway through moving house.

The attached images show the CAD drawings for a machine that uses a microscope and two suspended wires to generate a reference plane. The wires are tensioned by a heavy weight suspended in a container of oil. Gravity will assure that the wires are parallel and coplanar. Music wire is easily obtainable down to about 0.003inches. The thickness is consistent and accurate to sub microns.

A microscope on each side of the carriage is used to position a cutting head that is used to machine a plane surface on the workpiece. It is planned that this is done using software.

The spindle carries a small cutter 2 to 3 mm in diameter. It will have two modes: one a small peck cut, then a re-reference of the wires by the software and a small positioning move of about half the cutter diameter then a cut. This will be the slowest mode however due to the averaging effect of so many small measurements (not unlike hand scraping), it is expected that this will create a very high quality result.

The second mode will create a reset of the carriage on a line by line basis. This will be considerably faster.

The plane of the wire and the cutting plane are aligned. As shown, the moving crossmember carries a platform that is aligned to the wires. The main frame of the machine is 2 x 100mm square tubes. Yes, there are no precision rails: the crossmember rides on ball bearings firmly against the frame tubes. It is certain that the tubes will have a small amount of curvature as delivered by the factory that made them. It certain therefore that there will be a small “tramming” error as the carriage moves up and down the tubes. This has been considered carefully. With the small cutter diameter planned the tilt error will be very small. Remember that the cutter height is aligned to the wires. Commercial tube suppliers in Australia quote a straightness error of about 0.5mm per meter, so with a very large radius - 250m - the error will be very small indeed.

The machine has been designed to use laser cut 5mm steel, assembled by the tab and slot and bolt method. No welding will be used to avoid distortion. This method has proven itself in many past projects. The x across motion is guided by 500mm linear rails - these need to be shimmed straight. Drive is via a 16mm ballscrew. The total travel across is 220mm, however in most cases the machined surface will be between 25 and 50mm. As shown a 100x100mm workpiece is mounted Blue and Red. Using a different clamp tubes up to 200mm square can be accommodated.

The spindle motion in and out is mounted on 300mm linear rails. Travel is 120mm to allow for easy cutter changing. In use the total travel will be a few mm as the spindle moves in and out of a cut. It is driven by a 16mm ballscrew.

The carriage moves up and down the column using a 50:1 Asian worm drive gearbox (Not shown) and counterbalanced 20mm T2.5 synchronised timing belts.

All drives are step motors.
It was not intended to create a general purpose CNC machine. This allows a much-simplified drive system. Only the precision needed to create small overlapping cuts to create a flat surface was considered.

As you can see there are two people contributing to this machine design The CAD by myself and control system design by LeoLFS We have been mates for a decade or two. The machine is made possible by the excellent software developed by Joe,” Devmonkey”

For a single builder some of the parts can be reused in the final machine they build. Or better still a few enthusiasts can team together and share its use.
We are well on the way to assembling a prototype with many parts in hand.

Once the design is finalised I will place the plans on Grabcad.

Regards
John

29421
29422
29423
29424
29425
29426
29427

Kitwn
23-01-2021, 10:45 PM
Great to hear from you again John. I have now completed my move to Tasmania and am in the process of reasssembling my own machine on a new, more rigid frame in between all the other jobs that go with a new house and garden. I'll be using the taught wires method inspired by yourself again to get it back in 'reasonable' alignment. I think there's what may be described as a wide margin between your construction methods and mine but I follow your progress with great interest.

That looks like a machine that people might wish to borrow or hire once you have it made and working.

Kit

John McNamara
24-01-2021, 07:06 AM
Hi All

Firstly, glad to hear you have moved to the Apple isle Kit, its a great place to live.
I have made the project open source.

I decided to open a GrabCAD page and have posted the CAD files there. I will update them as the design progresses. The model was built with AutoCAD 2017 so anyone with that version or later can view the files.

You can also download a free viewer from Autodesk. https://knowledge.autodesk.com/support/dwg-trueview/learn-explore/caas/sfdcarticles/sfdcarticles/Where-to-download-previous-versions-of-DWG-TrueView.html

The files are located on GrabCAD here:
https://grabcad.com/library/machine-to-mill-a-flat-surface-on-steel-tube-for-mounting-linear-rails-1

Regards
John

John McNamara
26-01-2021, 03:39 AM
Hi All
I uploaded version 28 to Grabcad replacing version 25
Regards
John

John McNamara
03-02-2021, 04:19 AM
Hi All

Hi Joe, (Devmonkey). I hope all is well with you, I have not seen you around here for a while.

I have upgraded the files stored on GrabCad to version 35. https://grabcad.com/library/machine-to-mill-a-flat-surface-on-steel-tube-for-mounting-linear-rails-1

This is a major update many of the laser cut joints have been placed.
It provides a good example of the possibilities made possible by laser cutting.

29458

Regards
John

John McNamara
16-02-2021, 06:47 AM
Hi All

The model is coming along nicely, Nearly build able at his stage. Next step is to sort out the computer interface.

29550

The files have been uploaded to Grabcad
https://grabcad.com/library/machine-to-mill-a-flat-surface-on-steel-tube-for-mounting-linear-rails-1

Regards
John

leolfs
18-03-2021, 02:00 AM
SOS devmonkey!
I've got together with John McNamara to implement his great mechanical design. I need to level long lengths of RHS for several router?laser projects. We are ready to cut and assemble the first two units for John and myself.(I live several hundred kilometres away) But... where is devmonkey? We are hoping he could make his great (but to me impenetrable) program output the wire zero to a physical output. We are hoping to use his code for 2 cameras on a rPi which could be used as a reference for a simple mach3 controller routine. If you are out there we would really appreciate your help.
I have come across a paper (Oleg Borisov) that uses a cheap slotted photodetector to produce some impressive accuracy that I may be able to reproduce, but the webcam seems to me the best option.
Hope to hear from you devmonkey.

lmclaren
06-08-2021, 10:52 AM
Hi leolfs, do you still need help with the sw?

I am not a great coder but might be able to phone a friend...

John McNamara
09-08-2021, 05:22 AM
Hi Imclaren

Your timing is good Leolfs and I have been discussing getting the project underway, We have already purchased the ball screws and linear rails. the initial design for the laser cut components is complete.

The need is to connect the machine to devmonkeys software he that he outputs to the screen, fairly simple I guess once we get a handle on the code he posted.

Any contribution will be appreciated.

I do hope devmonkey is well, if anyone knows him personally send him my regards.

Regards
John

lmclaren
09-08-2021, 08:22 AM
Hi Imclaren

Your timing is good Leolfs and I have been discussing getting the project underway, We have already purchased the ball screws and linear rails. the initial design for the laser cut components is complete.

The need is to connect the machine to devmonkeys software he that he outputs to the screen, fairly simple I guess once we get a handle on the code he posted.

Any contribution will be appreciated.

I do hope devmonkey is well, if anyone knows him personally send him my regards.

Regards
John


What sort of output would you like?
I am guessing that the error signal that is shown as a bar on the right is what you are after?
Are you running this on specific hardware that has a suitable hardware output or would you like a serial data stream from a comm port with an error value?

What sort of input does your motor controller want? step / dir or error signal?

devmonkey
02-09-2021, 08:28 AM
Hi Imclaren

Your timing is good Leolfs and I have been discussing getting the project underway, We have already purchased the ball screws and linear rails. the initial design for the laser cut components is complete.

The need is to connect the machine to devmonkeys software he that he outputs to the screen, fairly simple I guess once we get a handle on the code he posted.

Any contribution will be appreciated.

I do hope devmonkey is well, if anyone knows him personally send him my regards.

Regards
John

Hi John,

Yes all good here thanks just very busy on other projects and work.

On getting the error signal out of the java app and into your hardware there are two choices,
1. Integrate a serial library,
2. Make a small change to the app to print the error to standard out and then pipe this directly into a serial comm port.

I don't really have time to do this or test it right now but someone else could have a go, (2) is much easier if you don't want to mess about with the code too much, there is a tutorial on windows comm port piping here:
https://batchloaf.wordpress.com/2013/02/12/simple-trick-for-sending-characters-to-a-serial-port-in-windows/

Cheers, Joe

lmclaren
02-09-2021, 09:21 AM
Hi John,

Yes all good here thanks just very busy on other projects and work.

On getting the error signal out of the java app and into your hardware there are two choices,
1. Integrate a serial library,
2. Make a small change to the app to print the error to standard out and then pipe this directly into a serial comm port.

I don't really have time to do this or test it right now but someone else could have a go, (2) is much easier if you don't want to mess about with the code too much, there is a tutorial on windows comm port piping here:
https://batchloaf.wordpress.com/2013/02/12/simple-trick-for-sending-characters-to-a-serial-port-in-windows/

Cheers, Joe

Thanks devmonkey, I hadn't thought of the standard out, I will give it a go.

btw, if you have the code you compiled to run on linux / raspberry pi that might help for the next chapter.

regards

Lee

John McNamara
03-09-2021, 08:04 AM
Hi Joe

Firstly I am very glad to hear you are fit and well in these difficult times.

Thanks for the heads up on using standard IO as a way of getting the data out.
Soon it will be time to start building a machine to test all the hard work done by many hands.

Regards
John

Jayne_V
24-11-2021, 12:26 PM
Hi everyone,

Just read this thread from beginning to end nonstop... what a clever way to use cheap, easily obtainable parts to achieve such precise measurements. I will definitely be trying the wire app method when it comes time to setup my machine. Thank you for sharing all your hard work.

Jesal
15-12-2021, 10:52 PM
Thanks for this great thread. So if going the wire route, is it best to use the USB microscope?

Sent from my SM-G991W using Tapatalk

BryanHoward
28-02-2023, 04:36 AM
This is a great tool. There are some things I’d like to add to it, so I started writing my own version of it in python.

Written in python, uses imageio and the ffmpeg backend to capture the camera (opencv is slow and clunky). Multi threaded, I’ve got the camera part of the tool running in its own thread. Some things

I ran into some problems with the java tool as the measurement was off from the real world. I measured a glass slide with a dial indicator and compared that to the calculated scalar value i used for a physical pixel size it was off. The difference I think is due to the java tool reading the webcam sensor at 640x480 but the webcam I’m using has an FHD sized sensor 1920x1080. When it reads at a lower resolution it’s reading a center crop of the sensor so you’d need to account for the reduction of size of cropping the sensor vs using the full sensor.

Working on the sampling part of the GUI now. I think I’ll keep the functionality mostly the same as the java tool but add some extra things like filtering out a percentage of edge cases when it’s multisampling.

Thinking it's probably a good idea to setup PyInstaller so I can build the python app into an exe file. That way people can just download and run without needing to know anything about python.

The python code can be found here:
https://github.com/bhowiebkr/laser-level-webcam

Here's a video of how the tool functions in early development.

https://www.youtube.com/watch?v=bQF32YoB2ow

devmonkey
07-03-2023, 09:58 AM
Great to see you playing around with this method. I ended up using the wire version with a microscope to straighten the master rail, i.e. 1D. The original version you are copying works fine but unless you have access to a precision scanning laser it can't be used for 2D leveling (bringing two rails into plane), the optics in a normal line leveling laser are insufficient as the line is not straight enough.

Also we would need a different type of sensor to pick up a scanning laser.

What are you planning to use it for?

John McNamara
07-03-2023, 01:30 PM
Hi Bryan Howard

Gee It was great to see this project moving again.
Devmonkey inspired me when he first posted this great idea

I am still very keen to build an open source surface straightening device using a webcam and stretched wire. Using a small milling cutter to flatten a surface point by point. All I need is a signal that tells me the webcam software has found center of the wire, from a PC or microprocessor via a hardware port. Ideally a digital Value +- signal to enable me to find the wire more easily when moving the camera over the wire.

I know I can build the hardware and provide the XYZ Motion control, Its just the webcam reading code that is beyond me.

Extensive testing that proves the accuracy of stretched wire was done, all my results were posted earlier on this thread a few pages back.

I also posted an early concept open source 3D model on Github

Cheers
John

BryanHoward
07-03-2023, 10:45 PM
I’ll have to read up on the wire version, I saw mention of it buried in this thread but couldn’t find the description on how it works. I suppose it is along the lines of finding the center of a thin wire using a webcam sensor with a 40x-100x optical element on it? Correcting for the gravity dip over the span of the wire length?

I want to use this to measure the flatness for the surface of a single linear rail.

You mean the conical reflector in self leveling 360 degree lasers is just not good enough? I was thinking about that too but I guess if I’m trying to get just the surface for a linear rail flat all I gotta do is have the surface and the laser beam collinear? Then the precision of the reflector won’t be a factor.

I’ve found this whole method work well with a single point red laser pointer but without the IR filter it tends to blow out the sensor pixel values. It might work better in my case because the “self-leveling” part of the self leveling 360 deg lasers wobbles all over the place.

I don’t think I'd be able to get down to 1 um of flatness on the rails but if I can get down to 10um id be happy.

I’ve got most of your original code converted to python. I need to get the raw points transformed from the fitted line figured out and I’m not sure what you are showing in the scrape and shim vs the residual columns. I thought those should be the same?

Anyways, here's what I’ve got so far. I’ve found around 100 sub samples and throwing out up to 50% of the outliers gives me the most accurate measurements. I turned the camera on without letting it warm up so the values drift up and takes about 5 min of running before it equalizes. It kinda runs slow when recording and it not being compiled to C with nuitka.


https://youtu.be/WSVxxdArbII

Here is with a red laser pointer. Sensor gets blown out so probably need a filter or Neutral density (ND) filter so the peek isn't flat/clipped. Furnace turned on so there is a bit of vibration as well as not getting warmed up.


https://www.youtube.com/watch?v=nlGdif2jYvM

BryanHoward
07-03-2023, 10:54 PM
I think I might have seen the model on GrabCad as well? I think having a PC and sending values to a microcontroller like an arduino would be the way to go. Then your microcontroller would be driving the steppers/servos. Communication would look like this in Python:

import serial

# configure the serial connection
ser = serial.Serial('COM3', 9600) # change 'COM3' to the appropriate serial port name

# send the message
ser.write(b'Hello, world!\n') # the 'b' before the string converts it to bytes

# close the serial connection
ser.close()

John McNamara
09-03-2023, 03:48 AM
Using wire has the advantage over a laser beam when it comes to defining the boundary of the image formed on the webcam Microscope sensor. the thickness of the wire is known. and depending on the magnification of the microscope it will cover a certain number of pixels. There will always be aberrations; if the image not perfectly focused or if the lines in the camera sensor are not perfectly aligned to the wire. The the existing algorithm corrects for a fuzzy image rather elegantly.

Placing a black background behind the (illuminated wire) provides a very sharp contrast.

As I posted I got very good results using a manual lash up. using a micrometer. This method will provide all the data needed to flatten a surface. (Sag in the wire amounts to a couple of tenths over 2400mm, 8feet) You can use the Catenary formula to correct your measurements if you require higher accuracy.

The machine I posted on Grabcad simply automates the process and employs a small cutter to flatten a surface in this case held vertically, No sag to worry about. It moved the camera (It is mounted on the cutting head slide) until it is centered on the wire then makes a tiny cut. It will be a slow process, several hours but in the end there will be a very flat surface developed.

If this goes ahead I better dig up the ball screws and linear bearings I bought for this project. :)

John McNamara
09-03-2023, 07:19 AM
GrabCad Model

I made a 3d Model to be made from laser cut parts that should be able to prove the viability of using stretched wire and a webcam microscope sensor.

The design uses two webcams to sense two suspended vertical wires with a weighted end suspended in Oil. This will guarantee that the two wires are parallel in two planes. This will eliminate any twist in generated surface, it will be a true plane.

I designed the mechanism using a laser cut frame and 100mm square tube and parts I have on hand.
There is minimal machining to do mainly small size lathe work.

To clear up any uncertainty The webcam sensor is moved mechanically until the image of the wire is Is centered on the webcam sensor. The size of the image will be determined by the magnification used. Small errors in the optics can be ignored as we are always using the same part of the lens.

https://grabcad.com/library/machine-to-mill-a-flat-surface-on-steel-tube-for-mounting-linear-rails-1

BryanHoward
10-03-2023, 07:00 AM
I’ve got the whole python tool complete in comparison to the java tool minus an export csv button. Some other things I’ll add which would be nice - replacing the selected sample in the table with a new one. https://github.com/bhowiebkr/laser-level-webcam

Edit instead of adding another post bump. I've made another version fixing with export and some visual feedback on selecting table samples, a replace sample button which I'll find very useful as I can adjust an area and resample over and over till it's where I want it. Tooltips on everything so you should be able to figure out what everything does by just hovering over the widgets.

BryanHoward
15-03-2023, 02:19 AM
Here's my first real test of measuring the flatness of my gantry with a laser and webcam sensor. I’ll have to modify the laser level to disable the self-levelling of it because it’s wobbling all over the place.



https://youtu.be/hnHjrz_inQU

devmonkey
12-04-2023, 06:25 PM
My wire version I used for straightening a rail that was already sitting in plane with its pair since the surface had been epoxy leveled, it was looking down on the wire from above so gravity wasn't an issue. Your setup will work for a single rail in 1D as you have it setup in the video with the laser firing down the rail but you couldn't use it for bringing things into plane as the laser surface is not flat enough. You need a really expensive lens for generating a flat surface, if you look up commercial products for leveling machines in this way you can see the price of the laser source, that is all going into the lens.