Author Topic: Kinda a robot - building an autofocus for my laser... brainstorming/help?  (Read 929 times)

0 Members and 1 Guest are viewing this topic.

Offline lorddamaxTopic starter

  • Jr. Member
  • **
  • Posts: 27
  • Helpful? 0
Been a member of the forum for a while not, havent posted much, but working on a project now I need some help with...


I have a laser engraver, and it's a manual focus. It's a pain in the butt. I always forget to focus it when changing materials.

I have a few arduino, some wire, and a lot of evil genius to use, so I thought I'd make an autofocus.

Here's what I have so far:

Sharp GP2D120 short range infrared rangefinder.
Arduino Pro 328.
Easydriver
200 step stepper motor from sparkfun.

The plan is to use the rangefinder to sense the distance from the laser head to the work table. The Arduino then knows how far it needs to turn the motor, to engage a gear, to raise or lower the table. I just put all the parts away after playing with the parts and code, that makes the motor turn based on how far my hand is from the sensor. Pretty cool.

The problem: The sharp sensor isnt that accurate. I set up a sketch that averaged out the last 25 reads (and each read itself was an average of the last 3) from the sensor, and sitting completely still, it still bounced up and down by 4 or so. Some very inaccurate ruler and math work tells me that each # in my reading range is ABOUT .5mm. Yes, I know it's not linear, but for prototyping purposes, its close enough. Now, a 4-5 digit swing will throw the focus up and down by +/- 2mm, which, for a laser, is a big movement. For cutting, its not the end of the world. For engraving, thats the difference between being in focus, and not.

So, the brainstorm...
A) Is there any way to make the sharp sensor more accurate? I tried the capacator between V and G, that had no effect whatsoever. Last 25 reads average still bounces about.
B) Is there another, more accurate sensor I could use, that will give a good reading at about 2-3"? I'd go laser if I could find one in the sub $100 range that would work at that small a range.
C) Is there something I could build myself? I'm not above learning something new.
D) Is there another solution? I considered placing a button switch on the laser head, and using a pre-defined spacer, like an acrylic die, placing it on the item I'm lasering, place the button over it, and activate the focus device... it would raise the table until the button were pressed, thus the laser knowing the exact distance, then lower back down by a set number and it would be in focus. The problem there is I'm making the process more manual than I'd like... and if I lose the die (I do it a LOT - I cant tell you how many times I've lost my digital calipers I use for focusing now) then I'm back at square one. (There'd have to be a removable item, the table cannot raise high enough to touch the laser head, and if I extend the button down on, say, an arm, that could hit things on the table - often the lasered item is weighted down with objects so as to not move - if the arm hit though items it could be bad)

So, any thoughts on this? I dont want to build something thats only kinda close to focusing.

I figure since this is a robot forum, there's a lot of experience with range sensors... I'm not sure if any robots need the kind of accuracy I'm looking for, but it cant hurt to ask...

Oh, and if any of this sounds odd, I'm mostly cutting and pasting my post from the sparkfun forums. I edited it where appropriate, but, I may have missed some off reference...

Thanks in advance for any thoughts/ideas/guidance!

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Kinda a robot - building an autofocus for my laser... brainstorming/help?
« Reply #1 on: November 09, 2011, 05:55:36 PM »
Hi,

I have [...] a lot of evil genius to use, [...]
Apparently the evil part took precedence over the genius part ;)


Here's what I have so far:
You left out the most important data... Not what you have tried, but the hard specs of your LASER setup:
What is the max. range of the work table needed (I assume you compensate for large material thickness differences manually, to get it into a certain focus range)?
What precision is needed?
What resolution is needed?

When a given work piece is mounted to the table, you initially adjust the focus. Will it need to refocus during a single run then?
If so, how often/how many times each run?

If you just wanna focus by keeping a certain distance, table-LASER, an analog solution could be made much smaller (and more reliable). Is the Arduino something you'd prefer to include, or would an analog solution be just as good?


I don't think that a range finder is the ticket here, but instead of the (double) averaging that you do, you could increase the precision by oversampling. Getting n extra bits takes 4^n samples (1 extra bit takes 4 samples, 2 extra bits takes 16 samples etc). If you just want to increase resolutions to the 4..5 counts, 2 to 3 bits should do the trick.
However, 0.5mm isn't very impressive. You can have much more precise control using the right method (which cannot be found until the missing data is added).


So, any thoughts on this? I dont want to build something thats only kinda close to focusing.
If you've got any photos of the setup, please post them, so we can see how it can be done (difficult to device anything, when you don't know the specifics of where it has to go).

Is there any restraints in where on the setup the hardware for the sensing system is placed (except for directly on the work piece of course)?

Do you have access to power tools and general (metal) workshop tools?


Oh, and if any of this sounds odd, I'm mostly cutting and pasting my post from the sparkfun forums. I edited it where appropriate, [...]
Bad form - keep to one forum at a time. You can always skip to another board if/when you think there's nothing mo to learn in one place, but scattering more than one board at a time is bordering rude to people at both (all) boards.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline lorddamaxTopic starter

  • Jr. Member
  • **
  • Posts: 27
  • Helpful? 0
Re: Kinda a robot - building an autofocus for my laser... brainstorming/help?
« Reply #2 on: November 09, 2011, 08:17:50 PM »
Max up/down range of the table is about 3-4 inches. Its not much, it's a small 40watt laser. And the only reason it'd be down that low is if I'm lasering something REALLY thick. Its usually not the case. I cant imagine it ever goes down more than 1.5 inches.

The precision needed is, IDEALLY, .01 inch. I'd accept .02 inches, which is about half a MM. .05 I guess would work, the focus range is ok there...

No, it will not need to refocus, only once before a cut job.

I'm not sure what you mean by an analog solution...

Also not a ton sure what you mean by oversampling and the extra bits... can you explain, or provide a link?

No photos yet, I'll try to take some soon.

No real restrictsions on the sensor location - it just needs to be on the laser head so that it can be over the material to be cut. And it's a large head I've plenty of space to mount something.

Yes to power tools, kinda to metal tools... and with a laser itself, I can fabricate just about anything I need out of wood or acrylic. I've already cut my own gears for my stepper to turn the z-table focus bolt out of the laser.


Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Kinda a robot - building an autofocus for my laser... brainstorming/help?
« Reply #3 on: November 10, 2011, 01:02:06 PM »
Hi,

The precision needed is, IDEALLY, .01 inch. I'd accept .02 inches, which is about half a MM. .05 I guess would work, the focus range is ok there...

If you want to use the Sharp sensor, take a look at this page on how to kill noise and this page on how to increase the resolution (and lowering the range)


I'm not sure what you mean by an analog solution...

A circuit not using digital/microcontroller circuit.


Also not a ton sure what you mean by oversampling and the extra bits... can you explain, or provide a link?

Then we better leave that alone for now, but you can always Google the subject if you have spare "learning capacity" :)


No photos yet, I'll try to take some soon.

That would help.

Not knowing how it looks, I don't know if it's possible to implement it, but if it is, you could use a hinged measuring arm to move the actual measuring point and then use eg. capacitive measuring to get a very high precision.
This could integrate with an optical interrupter cutting power for the unit when it's down for measuring - then there's no way to forget moving it out of the way (it could even me moved out of harms way by a motor, if you feel like making the extra work).
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


Get Your Ad Here

data_list