PCB depth sensing software for Grbl

kosme
Posts: 5
Joined: Mon Apr 09, 2012 10:08 pm

PCB depth sensing software for Grbl

Post by kosme » Sun Aug 26, 2012 5:05 pm

I am currently developing a fork of Grbl and its correspondig software for the PC that will allow to sense the surface of the clad board for uneveness and adjust the gcode acording to it. It is currently in alpha version but I hope to release a first version next week.

Kosme

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: PCB depth sensing software for Grbl

Post by cvoinescu » Sun Aug 26, 2012 5:54 pm

Cool! Definitely something I would try if I had a ShapeOko. Unfortunately, I'm in batch #3.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

kosme
Posts: 5
Joined: Mon Apr 09, 2012 10:08 pm

Re: PCB depth sensing software for Grbl

Post by kosme » Mon Aug 27, 2012 4:50 pm

I don't really see being on batch 3 as such a big deal. Lots of stuff are getting improved and developed by people from previous batches that will make the life easier for people on future batches.

Kosme

edwardrford
Posts: 1250
Joined: Mon Apr 09, 2012 5:40 pm
Location: Dixon, IL
Contact:

Re: PCB depth sensing software for Grbl

Post by edwardrford » Mon Aug 27, 2012 5:14 pm

Hi Kosme! Welcome back.

I think cvoinescu was just eluding to they fact that batch #3 has not shipped yet, so the feature is something they can't use for themselves right now.

Regarding your software: I'm wondering how much of a stretch it will be to fork this into an 'auto sensing Z depth finder?'. I've been wanting something like that for the last few weeks in an attempt to get more predictable (and easier) re-zeroing of the z-axis after a tool change. Just a thought!

-Edward
Shapeoko 1 #0 - a couple of upgrades.
Shapeoko 2 #0 - a couple of upgrades.
Shapeoko 3 #2 - Stock

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: PCB depth sensing software for Grbl

Post by cvoinescu » Mon Aug 27, 2012 7:57 pm

I was indeed complaining, bitterly, about not having a ShapeOko to play with -- yet. And even after I get it, I won't be able to play, because I will be away from home until the 9th. Oh well.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

kosme
Posts: 5
Joined: Mon Apr 09, 2012 10:08 pm

Re: PCB depth sensing software for Grbl

Post by kosme » Tue Aug 28, 2012 7:37 pm

Edward, indeed this could be used for leveling the head after tool change, but right now I have to solve something that just appeared. The software and the firmware mod work fine together BUT the motors generate lots of electrical noise and that messes the sensing. Have to figure out how to filter the noise. Any suggestions anyone?

Kosme

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: PCB depth sensing software for Grbl

Post by cvoinescu » Tue Aug 28, 2012 8:31 pm

How does your detector work? Are you simply detecting contact between the tool and the copper cladding of the PCB? If that's the case, a low enough pull-up resistor should eliminate most of the noise. There's no harm in sinking, say, 20 mA when the tool is in contact, so you could use a 220 ohm pull-up resistor to 5 V. Ideally, the input would be a Schmitt trigger. I'm not sure whether the pins of the microcontroller can be configured as Schmitt trigger inputs. If not, something like a 74HC14 should help tremendously. A small capacitor (100 pF) between the input and ground can't hurt. A resistor (say 100 ohm) in series with the input protects the pin somewhat, and, together with the capacitor, forms a low-pass filter that reduces noise even further.
Attachments
low_pass_schmitt.jpg
Input circuit for touch sensing
low_pass_schmitt.jpg (28.17 KiB) Viewed 4819 times
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

kosme
Posts: 5
Joined: Mon Apr 09, 2012 10:08 pm

Re: PCB depth sensing software for Grbl

Post by kosme » Tue Aug 28, 2012 8:43 pm

Thanks for the sugestion Cvoinesu, I will give it a try. Indeed the detector functions like you described. The analog 0 pin of the microcontroller is pulled up by the internal pull-up resistors and detects when the tool touches the copper cladding that is connected to GND. I implemented a "debounce routine" on the firmware and eliminated the noise that way.

Kosme

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: PCB depth sensing software for Grbl

Post by cvoinescu » Tue Aug 28, 2012 9:53 pm

If it's an analog pin, you don't need the Schmitt trigger, just the three passive components. Assuming 10-bit conversion with VDD as reference, you can begin to register "touch" if the value drops below 512-H/2, and keep registering "touch" until the value raises above 512+H/2, where H is a suitable hysteresis value (H=768 should work). That's a software Schmitt trigger. I think you care only about the transition from "no touch" to "touch", so you don't even need a full debouncing routine: first time the analog reading drops under 128, that's when the tool touched.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

PsyKo
Posts: 430
Joined: Thu Aug 30, 2012 8:42 pm
Location: France

Re: PCB depth sensing software for Grbl

Post by PsyKo » Fri Nov 16, 2012 10:06 am

Hi,

Any news on that topic ? I might be interested as well.

Thanks
Shapeoko #736
Kress 800, Z Axis upgrade, dual Y, 600mm X&Y rails, metal spacers and V Wheels, home switches, 4th axis
Goko - Free CNC Control Software - http://www.shapeoko.com/forum/viewtopic ... 380#p44380

Post Reply