. .
Page 1 of 33 12311 ... LastLast
  1. #1
    Hi,

    Update 26/8/2019
    Software to experiment with can be downloaded from here:
    https://github.com/betzuka/laserleve...r.zip?raw=true
    Unzip and run (double click) the laser.bat file. You need to have java installed on your system.

    The source code is available on github:
    https://github.com/betzuka/laserlevel


    I'm a long time follower of this group but this is my first post. I built a 1500x1500 steel and aluminium and servo driven gantry machine about 10 years ago. This machine has been badly rusted during a house rebuild (was stored in a tent!) and long story short I'm about to build a new one, that will be a separate thread.

    The focus (no pun intended) of this thread is to explore using a very cheap webcam (~£15) and a laser level to achieve both accurate planar and line (straight) alignment.

    I've been playing with some projects using cheap webcams for various measuring tools and other things they weren't designed for. In thinking of how to perform the various levelling operations my new machine build will need I looked at the laser line level and detector I used during my house build. This is a dewalt model (line generator lens, not rotary), works great for tiling and putting up shelves/lights and for building straight walls, however with the matching dewalt detector in high sensitivity mode it only resolves down to 0.5mm at best.

    Anyway I figured a webcam and a bit of custom software could do better. I put together a very crude test using a usb webcam (actually a microscope but that isn't relevant). The webcam is placed in a box to shield it from stray light and a small window is cut in the end of the box. The window is 'glazed' with a bit of white paper to act as a screen. The webcam is focused on this screen.

    The laser line is then fired at the screen. I wrote a quick and dirty program to grab the webcam frames and perform some image processing. In short this takes the sum of brightness across each row of the frame to plot the natural gaussian of the laser beam then uses some clever maths (not mine) to fit this gaussian. The mean of the gaussian is the centre of the beam with respect to the cmos sensor.

    With the laser a few meters away (all though distance doesn't matter within reason) the tool can resolve height variations down to ~0.01mm (a piece of copy paper that is 0.08mm thick resolves to a height change of ~12 pixels of the cmos sensor). This could be increased by increasing the magnification of the sensor, currently I have it set quite low and this setup is extremely crude thrown together in a few minutes.

    Anyway I thought I post some pics of the setup here to see if you guys thought it has any legs. It could be extended to read horizontal variations using the laser in vertical mode which could be used to lay rails straight for example. If I progress this the next step will be to build a solid metal housing for the image sensor (discarding the body of the webcam) then it can be clamped to things like hiwin carriages. I would then extend the software to take multiple samples say along each X axis and display the error from the plane so that this can be corrected. First use will be to get the table i'm going to weld the frame on into plane.

    Cheers, Joe


    Click image for larger version. 

Name:	laser_level.png 
Views:	1198 
Size:	359.1 KB 
ID:	26192
    Click image for larger version. 

Name:	IMG_20190811_230006.jpg 
Views:	1323 
Size:	299.6 KB 
ID:	26193
    Click image for larger version. 

Name:	IMG_20190811_225913.jpg 
Views:	1300 
Size:	220.7 KB 
ID:	26194
    Click image for larger version. 

Name:	IMG_20190811_225938.jpg 
Views:	1398 
Size:	261.4 KB 
ID:	26195
    Last edited by devmonkey; 26-08-2019 at 03:53 PM.

  2. The Following 2 Users Say Thank You to devmonkey For This Useful Post:


  3. #2
    Your workshop is as neat and tidy as mine!
    I'm all in favour of using your head to save your wallet, that's a really interesting project.

    Kit
    An optimist says the glass is half full, a pessimist says the glass is half empty, an engineer says you're using the wrong sized glass.

  4. #3
    Here's an interesting thread that may provide useful input to, or even solve, part of the problem you're looking at :

    http://www.mycncuk.com/threads/12534...-and-reference

  5. #4
    I was just wondering (mentally wandering !) if you could get three mirrors on right-angle blocks, you could set up your rails to be co-planar by directing the laser back to the sensor at the same place.

  6. #5
    A little bit more experimentation, some good news and some irritation. Firstly I stripped the sensor out of the microscope and used it without a lens, to my surprise this works very well. Effectively we are using the cmos sensor as a very high density light detector, it seem undamaged with direct exposure to the laser beam. This also means I can repackage it in a nice compact unit.

    Click image for larger version. 

Name:	IMG_20190812_165558.jpg 
Views:	901 
Size:	245.3 KB 
ID:	26201

    The new issue that has appeared having removed the optics entirely is that this Dewalt laser level is crudely modulating its beam. I presume this is some sort of vendor lock in mechanism so that if you buy a Dewalt detector it will only work with Dewalt laser, or maybe i'm being unfair and it is to discriminate the laser source from other light ;-) Anyway this screws up the rolling shutter on the cmos image sensor, you can see the banding in the left hand frame grab below, not present in the next frame.

    Click image for larger version. 

Name:	dewalt_modulation.png 
Views:	766 
Size:	446.7 KB 
ID:	26202

    So either I need to detect and discard frames that contain this banding, open the laser level and disable the modulation or buy a laser line generator from amazon for a couple of quid, although this wouldn't be a self levelling pendulum, which will make setting it up more of a hassle. On the last point although the dewalt unit is self levelling this isn't useful as a repeatable (between measuring sessions) reference plane, it just means the reference plane generated between switching the laser on and off after the session is roughly (~0.3mm per meter) level with earth.

  7. #6
    Quote Originally Posted by cropwell View Post
    I was just wondering (mentally wandering !) if you could get three mirrors on right-angle blocks, you could set up your rails to be co-planar by directing the laser back to the sensor at the same place.
    I was thinking you'd put the laser on some fixed external support, e.g. a stack of bricks, and mounting the sensor on a hiwin block and plotting heights relative to the laser reference plane by sliding the block up and down the rail, then off the rail and onto the other rail. Best fit a plane to these 3D points and show the height error to each point, then shim and repeat. This is the same process you would use with a machinist level but possible more accurate.

  8. #7
    I've now fixed the problem with the dewalt modulation, quite elegantly I think. The modulation was interfering with the rolling shutter on the sensor. All cheap camera sensors employ a rolling shutter, what this means is unlike a real film camera or a DSLR that have global shutters, i.e. the entire frame is exposed simultaneously, a rolling shutter is simply the sensor allows each row to integrate (usually from when it was last read out) and then reads the pixel value for that row after the previous row. This means that each row of the image is exposed at a slightly different time leading to horizontal artifacts such as banding due to 50hz AC lighting, motion blur where an object moving horizontally across the camera may appear to have the bottom leading the top, or vica versa, or in the case of a Dewalt laser level the light source being annoyingly flickered on and off a banding of black lines that moves up the image frame to frame.

    Since we are only interested in one dimension (height) the simple fix is to make this dimension perpendicular to the direction of the rolling shutter, i.e turn the sensor through 90 degrees! This has the added advantage given the aspect ratio of the sensor is wider than tall like your TV screen, in giving us more vertical resolution.

    Now works like a dream, short video of me deflecting my desk which the sensor is sitting on with light finger pressure, maybe 0.1-0.2mm, watch the PC screen behind reacting. Note you can still see the banding from the modulation but this is now vertically aligned and traveling horizontally so doesn't interfere with our nice gaussian beam.
    Last edited by devmonkey; 12-08-2019 at 07:16 PM.

  9. #8
    Great little project, right up my street! You're making a good amount of progress in a short time as well!

    I would have started with a simplistic full-width half-max of the profile, but Gaussian fitting is probably better and more noise tolerant (but as you say, more complex!).

    I assume you're summing the image across the horizontal. r.e. rolling shutter, might be helpful to perform some frame averaging?

    Out of interest, whats the cost of the laser? I can see it replacing a DTI and precision straight edge, and being very useful for performing the measurements in the same plane.

  10. #9
    Quote Originally Posted by AndyUK View Post
    Great little project, right up my street! You're making a good amount of progress in a short time as well!

    I would have started with a simplistic full-width half-max of the profile, but Gaussian fitting is probably better and more noise tolerant (but as you say, more complex!).

    I assume you're summing the image across the horizontal. r.e. rolling shutter, might be helpful to perform some frame averaging?

    Out of interest, whats the cost of the laser? I can see it replacing a DTI and precision straight edge, and being very useful for performing the measurements in the same plane.
    I think the laser cost about £100 but you can buy the same thing on amazon without the pendulum for £5 see here:
    https://www.amazon.co.uk/Focusable-L...dp/B07PVPT44K/
    Also they sell units like mine from non-brands for about £20-£30, would do extactly the same job.

    Yes frame averaging would maybe help a bit although it is pretty stable. I could take a moving average of the gaussian beam centre to stop it wobbling too much as you slide it around, can do anything to the software really.

    The major unknown at the moment is how straight the line from the line generator in the laser actually is, I expect it is pretty good over the 30 degrees or so we would need, I can't test this until I have the sensor mounted in a decent fixture. Any ideas how to test this without a precision straight edge would be much appreciated.
    Last edited by devmonkey; 13-08-2019 at 10:38 AM.

  11. #10
    To give you some background, I'm a physicist, and at work I use similar lasers on each wall of the room (ceiling, left wall, right wall, and back wall), all pointing to a single point in space at the middle of the room - part of the job is to ensure these lasers are accurate and are planar with one another.

    Assuming the laser is meant to self level. I'd mount it at one end of my garage, with the CNC at the other end. I'd then get a long transparent flexible pipe, and mount one end infront of the laser. I'd then take the other end of the pipe to the other end of the garage past the machine.

    Then, fill water into the pipe up to the level of the laser; the meniscus will be at the same height in the room on both ends; the laser should pass through both meniscuses. The deviation (or depth of the meniscus as an error measurement) and distance between the two points will tell you how accurate the laser is self levelling. By moving left to right this will show any 'twist' in the horizontal projection of the laser.

    The 'straightness' of the laser isn't an issue - light travels in straight lines unless you're bending it with something in the middle ;) The laser will defocus with distance, but as you're looking at the centre of the profile I don't think its a problem.
    Last edited by AndyUK; 13-08-2019 at 01:11 PM.

Page 1 of 33 12311 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. WANTED: K40 laser
    By dfox1787 in forum Items Wanted
    Replies: 0
    Last Post: 23-10-2018, 08:34 PM
  2. Newbie - Help With Laser Cutting Speed And Power - 60W Laser
    By nickpscott in forum Laser Machines & Building
    Replies: 2
    Last Post: 11-11-2015, 10:07 PM
  3. FOR SALE: K40 laser not working (laser fires)
    By calida in forum Items For Sale
    Replies: 0
    Last Post: 31-03-2015, 08:45 PM
  4. WANTED: GCc Laser Pro or Epilog Laser Cutter Machine
    By Brownhills school in forum Items Wanted
    Replies: 1
    Last Post: 10-05-2012, 04:30 PM
  5. help with cnc laser
    By swinds in forum Laser Machines & Building
    Replies: 11
    Last Post: 09-01-2012, 10:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •