ReeceEngineering
Posts: 3
Joined: Thu Jun 06, 2019 3:50 pm

Raspberry Pi distance measuring

Fri Jun 07, 2019 3:01 am

I built a hand driven rig that allows me to polish the barrels from airsoft guns. They are toys that shoot plastic BBs at safe velocities for those who are interested. I am now going to automate the process. This involves a rod moving linerally through about 570mm of travel. To do this I have decided on using some stepper motors with a belt and pulley system.

The question I have now is what devices are on the market that can measure distance? Im going to need to pair this with a spring in order to determine the force being applied to the rod to move it. Basically a caliper mechanism that can read into a Raspberry Pi paired with a spring will allow me to make a scale of sorts.

Im new to this sort of thing and not sure what search terms to even begin with haha. This distance measuring device will only need to measure in a range of roughly 30mm. Not very far, just a little.

Any input would be appriciated!

User avatar
omegaman477
Posts: 147
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: Raspberry Pi distance measuring

Sat Jun 08, 2019 10:39 am

Trying to keep things simple, If the drive train to the push rod is solid and will not slip, I would use a rotary encoder on the stepper motor shaft, or even simpler a closed loop, servo style stepper motor, when you can be sure that no steps are missed. There are many options here available, all fuelled by the 3D printing craze, and cheap.

Always have at least a zero or better and end and zero stop sensors by way of limit switches. Makes startup calibration easy. Look to how 3D printers initialise their steppers, find zero and calibrate.

You would then calibrate your software to equate a given distance to a number of steps.

if you want to measure the length of the work, without moving the push rods, then it gets more challenging. Distance finding, over short distances, with accuracy is hard using non tactile sensors (IR, LAser, LIdar). All depends on the accuracy required.

Machine tools (lathes, mills etc) use linear optical encoders, a graduated glass or metal strip, with reflective markings that a sliding reader head reads off or counts the markings. Making a linear encoder is beyond a hobbyist, but repurposing a cheap chinese lathe XY sensor would be feasible.

Machine vision is an option, proving you compensate for parallax error and calibrate in software.

Can you explain more why and what you need to measure? Can you give us a simple sketch of the mechanicals.

Its an interesting project.
..the only thing worse than a stupid question is a question not asked.

ReeceEngineering
Posts: 3
Joined: Thu Jun 06, 2019 3:50 pm

Re: Raspberry Pi distance measuring

Sat Jun 15, 2019 8:58 pm

Omegaman477, Thank you for the suggestions. I will begin searching for a lathe XY sensor & keep my eyes open for more search terms that could lead to this kind of device.

Here is a video I made showing the hand driven rig I wish to mechanize, the parts I have thus far gathered, and a diagram of the remaining steps: https://www.youtube.com/watch?v=WhsNTUPkNVQ

My plan is to get the machine built physically and then begin developing the software that will breath life into the project

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspberry Pi distance measuring

Sun Jun 16, 2019 6:18 am

In most cases when people uses stepper motors on CNC type machines they don't usually have measuring device but rather use step count for the stepper motor. i.e they have a limit switch and on start up it moves all the way till it triggers the limit switch then counts the steps that the stepper motor has moved from the limit switch to determine the position it is currently in.

ReeceEngineering
Posts: 3
Joined: Thu Jun 06, 2019 3:50 pm

Re: Raspberry Pi distance measuring

Mon Jun 17, 2019 12:12 am

In this case the area where distance needs to be measured has no stepper motor involved. See the video I posted as it outlines where the measurement comes into the project

Return to “Automation, sensing and robotics”