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
Printable View
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
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.
I’ve just found the manufacturer’s web page for the recommended USB microscope
https://bysameyee.com/microscope
Uncommonly helpful, I would say !
MichaelG.
:cool:Thanks for that Michael
Just ordered one.
Regards
Mike
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 !
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
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
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...ith-Taut-Wires
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
Attachment 28884
Attachment 28885
Attachment 28886
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
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
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
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/ind...leveling-tool/
MichaelG.
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!
Attachment 29195
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
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
Attachment 29421
Attachment 29422
Attachment 29423
Attachment 29424
Attachment 29425
Attachment 29426
Attachment 29427
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
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/suppo...-TrueView.html
The files are located on GrabCAD here:
https://grabcad.com/library/machine-...linear-rails-1
Regards
John
Hi All
I uploaded version 28 to Grabcad replacing version 25
Regards
John
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-...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.
Attachment 29458
Regards
John
Hi All
The model is coming along nicely, Nearly build able at his stage. Next step is to sort out the computer interface.
Attachment 29550
The files have been uploaded to Grabcad
https://grabcad.com/library/machine-...linear-rails-1
Regards
John
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.
Hi leolfs, do you still need help with the sw?
I am not a great coder but might be able to phone a friend...
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?
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...rt-in-windows/
Cheers, Joe
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
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.
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
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
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?
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
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
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()
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. :)
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-...linear-rails-1
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.
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