Thursday, June 28, 2012

Simple CNC Switch Plate Cover

This post has been updated. To see the updates look for the items in red labeled "Update".

  I have been playing with a little CNC machine for about 2 years now and it has been fun. Still, as much fun as it has been, I think it would be nice if it started to pay for itself. So, I started to think about all the things I might make with a small (about 6.5"x6.5" cutting area) that I could sell. There are lots of ideas but after some considerations I have started making some light switch covers. After a little searching and a bunch of measuring I have a sort of basic template that I can start making covers with.

    Before I settled on light switch covers I ran through many ideas. There are a few things I needed to keep in mind. I have a Zen Toolworks 7x7 inch CNC. (http://www.zentoolworks.com). So, what ever I make needs to have parts that will fit on the table. Also, I would like to start selling some things on Etsy pretty soon so nothing too complicated. A clock kit with lots of gears was one early idea. I have been working on this for a while and it will have to be a future story. I am really fascinated by the notion of a mechanical computer, something like a mechanical Arduino. This is also for the future. These things might be a little involved to be my first jump into making a little money with a CNC.


After some more thought I hit on switchplate covers. They should be pretty straight forward and I think there is a lot of room for customization. The plates in the hardware stores are pretty plain (even the fancy ones). After making a few plain plates there aught to be able to move into more involved designed. So, I got out a couple covers and started measuring.





(Update (Sept 26, 2012): The distance between the screw holes should read "2.375"))
The outside of the plates that I measured were 2 3/4"x4 1/5". The standard screws are #6x32 ovel head screws and would normally use a hole about 0.1440" but I just drilled 1/8" holes. They are a little tight but it is wood and does not present a problem and it holes the screw in place. The holes are 2 13/32" apart (that is center to center). I counter sunk the holes making the to diameter 1/4" and 3/32" deep. The hole for the toggle switch is 7/16" x 15/16". I am making the plates from 1/4 plywood and it might be a tiny bit thick but it works fine. I route out the back of the plate 1/8" deep and leave about 1/4" around the edge.



DXF file:
    coming soon (I need to find a place to host the file)
    (Update (Sept 26, 2012):   basicSwitchPlate.dxf. 
      This is a file in my github repository. To download the file look down the page and find the file called "basicSwitchPlate.dxf". Right click on the file and choose "Save link as ...". If you left click on the file the dxf will open in your browser and you will see the text file that makes up a dxf file. The distance in the dxf file between the screw holes has changed in the dxf file. It should be 2.375" .)

Gcode file:
      Before you use the gcode take a look at it. It is what I am using but your setup is likely different. I used a 1/8" bit for the front of the plate. The bit I used for the back is a little less than 1/2". I think it is undersized to cut groves for 1/2" plywood to fit into.

     I added little tabs so the plate does not break out of the plywood panel while it is cutting. There are four around the outside and two in the little  piece that gets cut out for the toggle switch. Also, I call the subroutine to cut the screw holes twice. I find this helps make the holes smoother.

BasicFront.ngc
#1 = 0         ; Set project vars and material vars
#1  =  15.0;    feed-rate
#2  =  0.25;    up
#3  =  0.0;    down
#4  =  1;    tool number for using the cutter diameter compensation
#5  =  0.12500;    cutter diameter for initial move
#6  =  #3;    to keep track of current cutter depth
#7  = -0.25000;    material thickness
#8  =  0.04100;    cutter step - depth

; Modal settings
G17      ;XY plane
G20      ;inch mode
G40      ;cancel diameter compensation
G49      ;cancel length offset
G54      ;coordinate system 1
G80      ;cancel motion
G90 F#1      ;non-incremental motion
G94      ;feed/minute mode

; counter sunk hole
O500 Sub
  #11 = [#11 - [#5 / 2]] ; subtract cutter diameter
  #12 = [#12 - [#5 / 2]] ; subtract cutter diameter
  #14 =  0.01000 ; step for depth
  #16 =  [[#11 - #12] / [-1 * #13 / #14]]
  G90 F#1  
  G0 X [#9 + [#11 / 2]] Y [#10 + 0.0000]
  O501 Do
    G1 X [#9 + [#11 / 2]] Y [#10 + 0.0000]
    G1 Z #6
    G3 X [#9 + [#11 / 2]] Y [#10 + 0.0000] I [-1 * [#11 / 2]] J 0.0000
    #6 = [#6 - #14]
    #11 = [#11 - #16]
  O501 While [#6 ge #13]
  G0 Z #2;    move tool up to safe heights
  #6 = #3;    reset working depth

  G0 X  #9 Y  #10
  G1 Z  #3 F#1
  G1 Z  #7 F5.0
  G1 Z  #2 F#1
O500 Endsub

; Initial position
G0 Z #2 ;      
G0 X  0.00000 Y  0.00000
G0 X  1.00000 Y  1.00000

; Screw holes
; counter sink hole
#9  =  1.37500 ; center X
#10 =  3.45629 ; center y
#11 =  0.25000 ; max diameter
#12 =  0.13000 ; min diameter
#13 = -0.09000; depth
O500 Call [#1] [#2] [#3] [#4] [#5] [#6] [#7] [#8] [#9] [#10] [#11] [#12] [#13]
O500 Call [#1] [#2] [#3] [#4] [#5] [#6] [#7] [#8] [#9] [#10] [#11] [#12] [#13]

; second hole
; counter sink hole
#9  =  1.37500 ; center X
#10 =  1.04687 ; center y
#11 =  0.25000 ; max diameter
#12 =  0.13000 ; min diameter
#13 = -0.09000; depth
O500 Call [#1] [#2] [#3] [#4] [#5] [#6] [#7] [#8] [#9] [#10] [#11] [#12] [#13]
O500 Call [#1] [#2] [#3] [#4] [#5] [#6] [#7] [#8] [#9] [#10] [#11] [#12] [#13]


; Switch hole
G0 X  [1.15625 + #5] Y  [2.25000 + #5]
G41 D#4
G1 X  1.15625 Y  2.25000

O200 Do
  G1 Z  #6
  G1 X  1.15625 Y  1.78125

  O201 If [#6 ge #7 + 0.0625]  ; tab    G1 X  1.59375 Y  1.78125
  O201 Else
    G1 Z  [#7 + 0.06250]
     G1 X  1.59375 Y  1.78125
    G1 Z  #6
  O201 EndIf
  G1 X  1.59375 Y  2.71875
  O202 If [#6 ge #7 + 0.0625]
  ; tab
      G1 X  1.15625 Y  2.71875
  O202 Else
    G1 Z  [#7 + 0.06250]
       G1 X  1.15625 Y  2.71875
    G1 Z  #6
  O202 EndIf
  G1 X  1.15625 Y  2.25000
  #6 = [#6 - #8]
O200 While [#6 ge #7]
G0 Z #2
G40
#6 = #3;  reset working depth

; Outside
G0 X  [1.37500 - #5] Y  [0.00000 - #5]
G42 D#4
G1 X  1.37500 Y  0.00000

O201 Do
  G1 Z  #6
  G1 X  2.68749 Y  0.00000
  G3 X  2.75000 Y  0.06250 I  0.00000 J  0.06250
  O202 If [#6 ge #7 + 0.0625]
    G1 X  2.74500 Y  3.76284
  ; tab
  O202 Else
    G1 Z  [#7 + 0.06250]
    G1 X  2.74500 Y  0.37500
    G1 Z  #6
    G1 X  2.74500 Y  3.38784
    G1 Z  [#7 + 0.06250]
    G1 X  2.74500 Y  3.76284
    G1 Z  #6
  O202 EndIf

  G1 X  3.28364 Y  3.76284
  G3 X  3.32971 Y  3.86757 I  0.00000 J  0.06250
  G1 X  1.41739 Y  5.95374
  G3 X  1.33261 Y  5.95374 I -0.04239 J -0.04620
  G1 X -0.57972 Y  3.86757
  G3 X -0.53365 Y  3.76284 I  0.04607 J -0.04223
  G1 X  0.00000 Y  3.76284

  O203 If [#6 ge #7 + 0.0625]
  ; tab
    G1 X  0.00000 Y  0.06250
  O203 Else
    G1 Z  [#7 + 0.06250]
    G1 X  0.00000 Y  3.38784
    G1 Z  #6
    G1 X  0.00000 Y  0.37500
    G1 Z  [#7 + 0.06250]
    G1 X  0.00000 Y  0.06250
    G1 Z  #6
  O203 EndIf
  G3 X  0.06250 Y  0.00000 I  0.06250 J  0.00000
  G1 X  1.37500 Y  0.00000
  #6 = [#6 - #8]
O201 While [#6 ge #7]
G0 Z #2
G40
#6 = #3;  reset working depth

; Go back to Initial position
G0 Z #2 ;            move cutter up
G0 X  0.00000 Y  0.00000 ;    move cutter up
; End File
M2

BasicBack.ngc
#1 = 0        ; Set project vars and material vars
#1  =  17;    feed-rate
#2  =  0.5;    up
#3  =  0.0;    down
#4  =  4;    tool number for using the cutter diameter compensation
#5  =  0.46875;    cutter diameter for initial move
#6  =  #3;    to keep track of current cutter depth
#7  = -0.12500;    material thickness
#8  =  0.0625;    cutter step - depth


; Modal settings
G17      ;XY plane
G20      ;inch mode
G40      ;cancel diameter compensation
G49      ;cancel length offset
G54      ;coordinate system 1
G80      ;cancel motion
G90 F#1      ;non-incremental motion
G94      ;feed/minute mode


; Initial position
G0 Z #2 ;       
G0 X  0.00000 Y  0.00000
G0 X  1.00000 Y  1.00000


; Inside Faceing
G0 X  0.56260 Y  0.56260
#9 = 0.56260

O200 Do
  G1 Z #6 F#1
  O201 Do
    G1 X  #9 Y  0.56260
    G1 X  #9 Y  3.93739
    #9 = [#9 + 0.23625]
    G1 X  #9 Y  3.93739
    G1 X  #9 Y  0.56260
    #9 = [#9 + 0.23625]
  O201 While [#9 le 2.43740]
  G1 Z #2
  G0 X  0.56260 Y  0.56260
  #9 =  0.56260
  #6 = [#6 - #8]
O200 While [#6 ge #7]

G0 Z #2
#6 = #3;  reset working depth


; Inside Edge
G0 X  [0.18750 + #5] Y [0.18750 + #5]
G42 D#4
G0 X  0.18750 Y  0.18750
G1 Z  #7
G1 X  0.18750 Y  4.31249
G1 X  2.56249 Y  4.31249
G1 X  2.56249 Y  0.18750
G1 X  0.18750 Y  0.18750
G1 X  0.18750 Y  1.00000
G0 Z #2
G40


; Go back to Initial position
G0 Z #2 ;            move cutter up
G0 X  0.00000 Y  0.00000 ;    move cutter up
; End File
M2

     This seams to work ok for me. I have put a few up for sale on Etsy. Hopefully I will soon be making some more and slightly more elaborate plates.