项目作者: Hackuarium

项目描述 :
Create a box for a PCB using laser cutting machine
高级语言: OpenSCAD
项目地址: git://github.com/Hackuarium/laser-cut-box.git
创建时间: 2018-08-04T20:32:58Z
项目社区:https://github.com/Hackuarium/laser-cut-box

开源协议:

下载


It’s in the box

An OpenSCAD project to wrap your PCB in a box

Often we need to create custom boxes to wrap a printed circuit board (PCB) and this
may be time consuming.

In this project based on couple of parameters you can quickly and efficiently create DXF files that after laser cutting will provide the different elements to create the box. You may cut any number of holes (round or rectangle) on all the faces of the box and the coordinates will always be relative to the (0,0) that is the bottom left of the PCB.

Coordinates [x,y] of holes corresponds to the center.

You can render the box as a 3D image

And you can also export easily as a SVG of DXF file for laser cutting.

How to use it

Download OpenSCAD and open the file ‘testBox.scad’.

The comments in the file should be clear enough to use this code.

Exporting as DXF

You should change the following parameters before generating DXF:

  • showLabels = false
  • 3d = false

You may then render the image and export as DXF.

Code example

  1. $fn=40;
  2. use <pcbbox/pcb.scad>;
  3. pcb(
  4. length=100, // length of the PCB
  5. width=80, // width of the PCB
  6. padding=1, // space around the pcb (between pcb and box)
  7. thickness=3, // thickness of the material to create the box
  8. pcbThickness=1.6, // thickness of the box
  9. topToTop=20, // distance from the top of the PCB to the external top of the box
  10. bottomToBottom=40, // distance from the bottom of the PCB to the external bottom of the box
  11. extend=[10,10,0,0,0,0], // should top and bottom 'extend' in order to assemble the box without glue
  12. screws=[ // position of holes to fix the PCB
  13. [5,5],
  14. [10,70],
  15. [85,15],
  16. [80,60]
  17. ],
  18. screwDiameter=3, // diameter of the screws to fix the PCB
  19. topHoles=[ // holes to put on the top of the box
  20. [20,20,30,10] // 0,0 is the bottom left of the PCB
  21. ],
  22. bottomHoles=[ // holes to put on the bottom of the box
  23. [40,40,10], // array witlh 3 parameters = a circle [x,y,diameter]
  24. [20,20,5,5] // array with 4 parameters = a rectangle [x,y,width,depth]
  25. ],
  26. frontHoles=[ // holes in front of the box, over the PCB
  27. [20, 2.5, 5],
  28. [40,5,10,10]
  29. ],
  30. frontHolesB=[ // holes in front of the box, under the PCB
  31. [20,2.5,5],
  32. [40,5,10,10]
  33. ],
  34. backHoles=[ // holes in the back of the box, over the PCB
  35. [20,2.5,5],
  36. [40,5,10,10]
  37. ],
  38. backHolesB=[ // holes in front of the box, under the PCB
  39. [20,2.5,5],
  40. [40,5,10,10]
  41. ],
  42. leftHoles=[ // holes on the left of the box, over the PCB
  43. [20,2.5,5],
  44. [40,5,10,10]
  45. ],
  46. leftHolesB=[ // holes on the left of the box, under the PCB
  47. [20,2.5,5],
  48. [40,5,10,10]
  49. ],
  50. rightHoles=[ // holes on the right of the box, over the PCB
  51. [20,2.5,5],
  52. [40,5,10,10]
  53. ],
  54. rightHolesB=[ // holes on the right of the box, under the PCB
  55. [20,2.5,5],
  56. [40,5,10,10]
  57. ],
  58. showLabels=true, //should we show the labels
  59. labelsSize=10, // size of the labels
  60. 3d=true // 3d rendering or just 2d ?
  61. );

Screwing the PCB

We recently often use black nylon M3 screw, standoff and spacer.

In order to fix the PCB we have the following sequence:

  • M3 screw
  • top of the case
  • column standoff female spacer
  • PCB
  • column standoff male spacer
  • bottom of the case
  • M3 screw (we take 40 mm screws that we cut if needed)