Hello Guest it is March 28, 2024, 01:04:12 PM

Author Topic: Isolation Routing PCB's and Local System Rotate.  (Read 50848 times)

0 Members and 1 Guest are viewing this topic.

Re: Isolation Routing PCB's and Local System Rotate.
« Reply #10 on: November 25, 2012, 05:30:50 AM »
Thanks Tweakie,
Just ordered one.
John

Offline Ody

*
  •  7 7
    • View Profile
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #11 on: November 25, 2012, 11:02:19 PM »
Is there a link for the one you bought?
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #12 on: November 26, 2012, 07:49:18 AM »
I purchased from a seller on eBay.  Since I have not received it yet, I am hesitant to post a link to a specific seller as a recommendation.  Just do a search on "endoscope" and lots of choices will be displayed.

Regards,
John Champlain
www.picengrave.com

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #13 on: November 26, 2012, 08:31:21 AM »
This is the 10mm diameter webcam and home made mounting bracket ready to be fitted to my Z axis.

Tweakie.
PEACE

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #14 on: December 01, 2012, 04:24:59 AM »
I have just discovered a problem with my particular little webcam – it appears that the guts are assembled to the cable then drawn into the housing and only secured at the cable exit end. When fitted to the machine, if the cable is moved (twisted) the internal image sensor can rotate slightly thus spoiling the accuracy of the positioning / setup.

My solution was to remove (destroy) the front window, apply a couple of spots of adhesive to secure the image sensor PCB to the housing then fit a new window (it was doubtful if the existing window could be removed without damaging it). There is probably a better (easier) way to solve this problem but the image sensor PCB is now secure and all is well again.

Tweakie.
PEACE
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #15 on: December 01, 2012, 07:11:47 AM »
...are the LEDs the right brightness level or do they 'white out' your view of the stock? (I've read the some have had real problems getting the correct levels wrt leds & webcams)

Do you have the link to where you bought it from?

Edit: "Seek & ye shall find" as they say...

http://www.ebay.co.uk/itm/2M-Mini-USB-Borescope-Endoscope-Waterproof-Inspection-Snake-Tube-Video-Camera-/180834989844?pt=UK_Computing_Other_Computing_Networking&hash=item2a1a9af714

I see it has an LED brightness control onboard :-)
« Last Edit: December 01, 2012, 07:22:47 AM by peskywinnets »

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #16 on: December 09, 2012, 03:35:13 AM »
After some experimentation, this is what I have finally ended up with…

The camera can be used for X - Y tool positioning as follows;

By adding two new VB buttons to the Mach3 screen labeled Camera and Home;
Clicking the Camera button opens the video window, sets a slow jog rate and prompts for the Datum to be located.
Clicking the Home button closes the video window, resets the slow jog rate and moves both the X and Y axis (applying the offset) so that the spindle / tool is centered at the datum point.

The VB (Cypress Enable) scripts I have used to achieve this are as follows;

Camera button script;
 
Call SetUserLed(1102,1) 'open Klaus's video window
Call SetOemDRO(3,1) 'set slow jog rate to 1%
Code "(Locate Datum then click HOME)" 'message for status bar


Home button script;
 
SetUserLED(1103,1) 'close Klause’s video window
Call SetOemDRO(3,80) 'reset jog rate to 80%
Xs=GetOemDRO(59) 'read Xscale DRO
Ys=GetOemDRO(60) 'read Yscale DRO
Xmove = 70.850 * 1/Xs 'enter your camera offset here
Ymove = 1.070 * 1/Ys 'enter your camera offset here
Code "G91 G0 X" &Xmove & "Y" &Ymove 'make incremental move
While IsMoving () 'wait while that happens
Wend
Code "G90" 'go back to absolute moves
DoOEMButton (1008) 'zero X axis DRO
DoOEMButton (1009) 'zero Y axis DRO
Code "(Homing to Datum Complete)" 'message for status bar



To take advantage of the Local System Rotate function I have added 3 new VB buttons labeled A, B & C.

Button A opens the video window, sets a slow jog rate and prompts for the Datum to be located.
Button B resets the X an Y axis DRO’s to zero and prompts for the reference to be located.
Button C closes the video window, resets the slow jog rate, performs the calculations and moves the X an Y axis so the spindle / tool position is centered on the Datum location then sets the Local System Rotated DRO to the calculated value. The scripts I have used are as follows;

Button A script;
 
Call SetUserLed(1102,1) 'open Klaus's video window
Call SetOemDRO(118,0) 'reset system rotate DRO
Code "(Locate Datum then click Button B)" 'message for status bar
Call SetOemDRO(3,1) 'set slow jog rate to 1%


Button B script;
 
DoOEMButton (1008) 'zero X axis DRO
DoOEMButton (1009) 'zero Y axis DRO
Code "(Locate Reference then click Button C)" 'message for status bar


Button C script;
 
Sub Main()
Call SetUserLed(1103,1) 'close Klaus's video window
X1pos = GetOemDRO(800) 'read x axis DRO
Y1pos = GetOemDRO(801) 'read y axis DRO
If (Y1pos=0) Then GoTo Label1 'avoid divide by zero error
b = Atn(X1pos/Y1pos)*(180/(4*Atn(1))) 'calculate angle
b = b - (b*2) 'change sign (+/-)
Code "G0 X0 Y0" 'move to datum
While IsMoving () ‘wait for task to be completed
Wend
Xmove = 70.850 'enter your camera offset here
Ymove = 1.070 'enter your camera offset here
Code "G91 G0 X" &Xmove & "Y" &Ymove 'make incremental move
While IsMoving () ‘wait while that happens
Wend
Code "G90" 'go back to absolute moves
Call SetOemDRO(118,b) 'set system rotate DRO
Label1:
DoOEMButton (1008) 'zero X axis DRO
DoOEMButton (1009) 'zero Y axis DRO
Call SetOemDRO(3,80) 'reset jog rate to 80%
Code "(Process complete)" 'message for status bar
End Sub


(With both the Home button and the C button scripts my camera offset should be changed to suit your particular machine).

Obviously, everything is ‘work in progress’ and there will always be room for improvement so please feel free to change these scripts, as necessary, to suit your own particular application. My solution is presented here just as a guide for future development.

One further thought…
 
If, for example, a round circuit board was made and a datum and a reference had been established and the angle calculated (as mentioned above). This angle (angle1) could be stored as a VAR. If the round circuit board was removed from the work table then replaced (at a different angle) then by locating the same datum and reference and again calculating the angle (angle2) by subtracting one from the other the resultant angle when entered into the Local System Rotated DRO would be correct for work to be re-commenced on the circuit board as if it had never been removed and replaced.
 
It would perhaps be quite complicated to perform all the necessary math’s using a calculator but by using a VB script it could not be made more easy.

Tweakie.


PEACE

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #17 on: December 09, 2012, 12:18:19 PM »
Tweaks does this assume that the 2 points are inline with the axis when referenced back to the drawing ?  IF not you have to account for that offset as well. 

Just a thought, (;-) TP
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #18 on: December 09, 2012, 10:46:30 PM »
Tweakie,

I mounted my camera today and will install buttons and macros tomorrow.

Perhaps I'm just lucky, or it simply speaks to Chinese quality non-control, but my camera is solidly fixed in its housing and does not move as you described yours.

Thanks for once again developing a project that makes cnc easier.

My Best Regards,
John Champlain
www.picengrave.com

Offline Ody

*
  •  7 7
    • View Profile
Re: Isolation Routing PCB's and Local System Rotate.
« Reply #19 on: December 09, 2012, 11:35:08 PM »
I am also lucky as mine is mounted in a solid brass tube. The cable exits the tube and appears CA or something similar was used to secure the cable from twisting.

Very interesting thread. Thanks to Tweakie for his usual good job.

Jack