Added Duet Ethernet and Duex PCB models.

Made green terminals parametric.
Separated pin_headers and green_terminals out from pcb.scad.
This commit is contained in:
Chris Palmer 2019-07-04 12:03:38 +01:00
parent 8014aadd1d
commit 55fd552c8f
17 changed files with 856 additions and 289 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 KiB

After

Width:  |  Height:  |  Size: 692 KiB

160
readme.md
View File

@ -22,19 +22,20 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
<tr><td> <a href = "#Batteries">Batteries</a> </td><td> <a href = "#O_ring">O_ring</a> </td><td> <a href = "#Butt_box">Butt_box</a> </td><td> <a href = "#Bezier">Bezier</a> </td><td> <a href = "#Clip">Clip</a> </td></tr>
<tr><td> <a href = "#Belts">Belts</a> </td><td> <a href = "#Pcbs">Pcbs</a> </td><td> <a href = "#Cable_grommets">Cable_grommets</a> </td><td> <a href = "#Dogbones">Dogbones</a> </td><td> <a href = "#Global">Global</a> </td></tr>
<tr><td> <a href = "#Blowers">Blowers</a> </td><td> <a href = "#Pillars">Pillars</a> </td><td> <a href = "#Carriers">Carriers</a> </td><td> <a href = "#Fillet">Fillet</a> </td><td> <a href = "#Polyholes">Polyholes</a> </td></tr>
<tr><td> <a href = "#Bulldogs">Bulldogs</a> </td><td> <a href = "#Psus">Psus</a> </td><td> <a href = "#Corner_block">Corner_block</a> </td><td> <a href = "#Hanging_hole">Hanging_hole</a> </td><td> <a href = "#Rounded_rectangle">Rounded_rectangle</a> </td></tr>
<tr><td> <a href = "#Buttons">Buttons</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Door_hinge">Door_hinge</a> </td><td> <a href = "#Layout">Layout</a> </td><td> <a href = "#Sphere">Sphere</a> </td></tr>
<tr><td> <a href = "#Cable_strips">Cable_strips</a> </td><td> <a href = "#Rails">Rails</a> </td><td> <a href = "#Door_latch">Door_latch</a> </td><td> <a href = "#Maths">Maths</a> </td><td> <a href = "#Teardrops">Teardrops</a> </td></tr>
<tr><td> <a href = "#Components">Components</a> </td><td> <a href = "#Ring_terminals">Ring_terminals</a> </td><td> <a href = "#Fan_guard">Fan_guard</a> </td><td> <a href = "#Offset">Offset</a> </td><td></td></tr>
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Rockers">Rockers</a> </td><td> <a href = "#Fixing_block">Fixing_block</a> </td><td> <a href = "#Quadrant">Quadrant</a> </td><td></td></tr>
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Rod">Rod</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Screws">Screws</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Bulldogs">Bulldogs</a> </td><td> <a href = "#Pin_headers">Pin_headers</a> </td><td> <a href = "#Corner_block">Corner_block</a> </td><td> <a href = "#Hanging_hole">Hanging_hole</a> </td><td> <a href = "#Rounded_rectangle">Rounded_rectangle</a> </td></tr>
<tr><td> <a href = "#Buttons">Buttons</a> </td><td> <a href = "#Psus">Psus</a> </td><td> <a href = "#Door_hinge">Door_hinge</a> </td><td> <a href = "#Layout">Layout</a> </td><td> <a href = "#Sphere">Sphere</a> </td></tr>
<tr><td> <a href = "#Cable_strips">Cable_strips</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Door_latch">Door_latch</a> </td><td> <a href = "#Maths">Maths</a> </td><td> <a href = "#Teardrops">Teardrops</a> </td></tr>
<tr><td> <a href = "#Components">Components</a> </td><td> <a href = "#Rails">Rails</a> </td><td> <a href = "#Fan_guard">Fan_guard</a> </td><td> <a href = "#Offset">Offset</a> </td><td></td></tr>
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Ring_terminals">Ring_terminals</a> </td><td> <a href = "#Fixing_block">Fixing_block</a> </td><td> <a href = "#Quadrant">Quadrant</a> </td><td></td></tr>
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Rockers">Rockers</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Rod">Rod</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Screws">Screws</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
@ -681,6 +682,55 @@ Can draw three styles: solid, open frame and open frame with screw bosses.
| 1 | ```fuseholder(6)``` | Fuse holder 20mm |
<a href="#top">Top</a>
---
<a name="Green_terminals"></a>
## Green_terminals
Parametric green terminal blocks
[vitamins/green_terminals.scad](vitamins/green_terminals.scad) Object definitions.
[vitamins/green_terminal.scad](vitamins/green_terminal.scad) Implementation.
[tests/green_terminals.scad](tests/green_terminals.scad) Code for this example.
### Properties
| Function | Description |
|:--- |:--- |
| ```gt_back_depth(type)``` | Back ledge depth |
| ```gt_back_height(type)``` | Height at the back |
| ```gt_box_h(type)``` | Height of the cable entry box |
| ```gt_box_w(type)``` | Width inside the cable entry box |
| ```gt_depth(type)``` | Total front to back depth |
| ```gt_front_depth(type)``` | Front ledge depth |
| ```gt_front_height(type)``` | Height at the front |
| ```gt_front_t(type)``` | Thickness of frame around the front aperture |
| ```gt_height(type)``` | Height of the flat top |
| ```gt_pitch(type)``` | Pitch between terminals |
| ```gt_screw_r(type)``` | Screw head radius |
| ```gt_top(type)``` | Depth at the top |
| ```gt_tube_h(type)``` | Height of optional tubes around the screws |
| ```gt_y_offset(type)``` | Offset of the pins from centre of the depth |
| ```gt_y_offset2(type)``` | Offset of the pins screws from the screws |
### Modules
| Module | Description |
|:--- |:--- |
| ```green_terminal(type, ways, skip = [])``` | Draw green terminal blocks, skip can be used to remove pins. |
| ```terminal_254(ways, skip = [])``` | Draw 0.1" terminal block |
![green_terminals](tests/png/green_terminals.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```green_terminal(gt_6p35, 2)``` | Terminal block 2 way 0.25" |
| 1 | ```green_terminal(gt_3p5, 3)``` | Terminal block 3 way 3.5mm |
| 1 | ```green_terminal(gt_2p54, 4)``` | Terminal block 4 way 0.1" |
<a href="#top">Top</a>
---
@ -1473,13 +1523,6 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
### Properties
| Function | Description |
|:--- |:--- |
| ```hdr_base_colour(type)``` | Header insulator colour |
| ```hdr_pin_below(type)``` | Header pin length underneath |
| ```hdr_pin_colour(type)``` | Header pin colour |
| ```hdr_pin_length(type)``` | Header pin length |
| ```hdr_pin_width(type)``` | Header pin size |
| ```hdr_pitch(type)``` | Header pitch |
| ```hdr_socket_depth(type)``` | Socket depth for female housing |
| ```pcb_accessories(type)``` | List of accessories to go on the BOM, SD cards, USB cables, etc. |
| ```pcb_colour(type)``` | Colour of the subtrate |
| ```pcb_components(type)``` | List of components |
@ -1505,10 +1548,9 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| Module | Description |
|:--- |:--- |
| ```barrel_jack(cutout = false)``` | Draw barrel power jack |
| ```chip(length, width, thickness, cutout = false)``` | Draw a black cube to represent a chip |
| ```chip(length, width, thickness, colour, cutout = false)``` | Draw a coloured cube to represent a chip, or other rectangular component |
| ```flex(cutout = false)``` | Draw flexistrip connector |
| ```hdmi(cutout = false)``` | Draw HDMI socket |
| ```idc_transition(type, cols = 5, skip = [], cutout = false)``` | Draw IDC transition header |
| ```jack(cutout = false)``` | Draw 3.5mm jack |
| ```molex_254(ways)``` | Draw molex header |
| ```pcb(type)``` | Draw specified PCB |
@ -1520,12 +1562,9 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| ```pcb_grid(type, x, y, z = 0)``` | Positions children at specified grid positions |
| ```pcb_screw_positions(type)``` | Positions children at the mounting hole positions |
| ```pcb_spacer(screw, height, wall = 1.8)``` | Generate STL for PCB spacer |
| ```pin(type = 2p54header, length = undef)``` | Draw a header pin |
| ```pin_header(type = 2p54header, cols = 1, rows = 1, smt = false, cutout = false)``` | Draw pin header |
| ```pin_socket(type = 2p54header, cols = 1, rows = 1, right_angle = false, height = 0, cutout = false)``` | Draw pin socket |
| ```rj45(cutout = false)``` | Draw RJ45 Ethernet connector |
| ```terminal_254(ways, skip = [])``` | Draw 0.1" terminal block |
| ```terminal_35(ways)``` | Draw 3.5mm terminal block |
| ```uSD(size, cutout = false)``` | Draw uSD socket |
| ```usb_Ax2(cutout = false)``` | Draw USB type A dual socket |
| ```usb_B(cutout = false)``` | Draw USB B connector |
| ```usb_uA(cutout = false)``` | Draw USB micro A connector |
@ -1536,18 +1575,21 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```pcb(ArduinoUno3)``` | Arduino Uno R3 |
| 1 | | Cat 5 patch cable 300mm |
| 1 | ```d_plug(DCONN15, pcb = true)``` | D-type 15 way PCB mount plug |
| 1 | ```pcb(DuetW)``` | Duet WiFi electronics |
| 1 | ```pcb(DuetE)``` | Duet 2 Ethernet electronics |
| 1 | ```pcb(Duex2)``` | Duex2 expansion board |
| 1 | ```pcb(Duex5)``` | Duex5 expasnion board |
| 1 | ```pcb(ExtruderPCB)``` | Extruder connection PCB |
| 1 | ```pcb(Keyes5p1)``` | Keyes5.1 Arduino Uno expansion board |
| 1 | ```pcb(Melzi)``` | Melzi electronics |
| 2 | | Micro SD card |
| 3 | | Micro SD card |
| 1 | ```molex_254(2)``` | Molex KK header 2 way |
| 1 | ```molex_254(3)``` | Molex KK header 3 way |
| 16 | ```nut(M2_nut, nyloc = true)``` | Nut M2 x 1.6mm nyloc |
| 12 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 x 2.2mm nyloc |
| 12 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 12 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 1 | ```pcb(PI_IO)``` | PI_IO V2 |
| 1 | ```pcb(PSU12V1A)``` | PSU 12V 1A |
| 1 | ```pcb(PERF60x40)``` | Perfboard 60 x 40mm |
@ -1563,14 +1605,14 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 8 | ```screw(M2p5_pan_screw, 20)``` | Screw M2.5 pan x 20mm |
| 8 | ```screw(M3_cap_screw, 25)``` | Screw M3 cap x 25mm |
| 4 | ```screw(M3_cap_screw, 30)``` | Screw M3 cap x 30mm |
| 4 | ```screw(M4_cap_screw, 30)``` | Screw M4 cap x 30mm |
| 12 | ```screw(M4_cap_screw, 30)``` | Screw M4 cap x 30mm |
| 3 | ```terminal_35(2)``` | Terminal block 2 way 3.5mm |
| 2 | ```terminal_254(4)``` | Terminal block 4 way 0.1" |
| 2 | ```green_terminal(gt_2p54, 4)``` | Terminal block 4 way 0.1" |
| 1 | | USB A to Mini B lead |
| 16 | ```washer(M2_washer)``` | Washer M2 x 5mm x 0.3mm |
| 12 | ```washer(M2p5_washer)``` | Washer M2.5 x 5.9mm x 0.5mm |
| 12 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 4 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
| 12 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
### Printed
| Qty | Filename |
@ -1585,8 +1627,10 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 4 | pcb_spacer2590.stl |
| 4 | pcb_spacer30140.stl |
| 4 | pcb_spacer30150.stl |
| 4 | pcb_spacer30170.stl |
| 4 | pcb_spacer30190.stl |
| 4 | pcb_spacer40160.stl |
| 4 | pcb_spacer40170.stl |
| 4 | pcb_spacer40180.stl |
<a href="#top">Top</a>
@ -1637,6 +1681,52 @@ Threaded pillars. Each end can be male or female.
| 1 | ```pillar(M4x17_nylon_pillar)``` | Pillar nylon M/F M4x20 |
<a href="#top">Top</a>
---
<a name="Pin_headers"></a>
## Pin_headers
Pin headers and sockets, etc.
[vitamins/pin_headers.scad](vitamins/pin_headers.scad) Object definitions.
[vitamins/pin_header.scad](vitamins/pin_header.scad) Implementation.
[tests/pin_headers.scad](tests/pin_headers.scad) Code for this example.
### Properties
| Function | Description |
|:--- |:--- |
| ```hdr_base_colour(type)``` | Header insulator colour |
| ```hdr_pin_below(type)``` | Header pin length underneath |
| ```hdr_pin_colour(type)``` | Header pin colour |
| ```hdr_pin_length(type)``` | Header pin length |
| ```hdr_pin_width(type)``` | Header pin size |
| ```hdr_pitch(type)``` | Header pitch |
| ```hdr_socket_depth(type)``` | Socket depth for female housing |
### Modules
| Module | Description |
|:--- |:--- |
| ```box_header(type, cols = 1, rows = 1, smt = false, cutout = false)``` | Draw box header |
| ```idc_transition(type, cols = 5, skip = [], cutout = false)``` | Draw IDC transition header |
| ```pin(type, length = undef)``` | Draw a header pin |
| ```pin_header(type, cols = 1, rows = 1, smt = false, cutout = false)``` | Draw pin header |
| ```pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, cutout = false)``` | Draw pin socket |
![pin_headers](tests/png/pin_headers.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```idc_transition(2p54header, 10)``` | IDC transition header 10 x 2 |
| 1 | ```pin_header(2p54header102)``` | Pin header 10 x 2 |
| 1 | ```box_header(2p54header102)``` | Pin header 10 x 2 |
| 1 | ```pin_socket(2p54header, 10, 2)``` | Pin socket 10 x 2 |
| 1 | ```pin_socket(2p54header, 10, 2, right_angle = true)``` | Pin socket 10 x 2 right_angle |
<a href="#top">Top</a>
---
@ -2641,7 +2731,7 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c
| 2 | ```idc_transition(2p54header, 10)``` | IDC transition header 10 x 2 |
| 4 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```screw(M3_dome_screw, 25)``` | Screw M3 dome x 25mm |
| 2 | ```terminal_254(10)``` | Terminal block 10 way 0.1" |
| 2 | ```green_terminal(gt_2p54, 10)``` | Terminal block 10 way 0.1" |
| 2 | ```veroboard(z_vb)``` | Veroboard 5 holes x 22strips |
| 8 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
@ -2899,7 +2989,7 @@ Normally the side sheets are the same type but they can be overridden individual
| ```box_left_blank(type, sheet = false)``` | Generates a 2D template for the left sheet, ```sheet``` can be set to override the type |
| ```box_right(type)``` | Default right side, can be overridden to customise |
| ```box_right_blank(type, sheet = false)``` | Generates a 2D template for the right sheet, ```sheet``` can be set to override the type |
| ```box_shelf_blank(type)``` | Generates a 2D template for a shelf sheet |
| ```box_shelf_blank(type, sheet = false)``` | Generates a 2D template for a shelf sheet |
| ```box_top(type)``` | Default top, can be overridden to customise |
| ```box_top_blank(type)``` | Generates a 2D template for the top sheet |
| ```grill(width, height, r = 1000, poly = false, h = 0)``` | A staggered array of 5mm holes to make grills in sheets. Can be constrained to be circular. Set ```poly``` ```true``` for printing, ```false``` for milling. |

View File

@ -0,0 +1,29 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
use <../utils/layout.scad>
include <../vitamins/green_terminals.scad>
module green_terminals()
layout([for(t = green_terminals) gt_depth(t)], 15)
rotate(180)
green_terminal(green_terminals[$i], len(green_terminals) + 1 - $i);
if($preview)
green_terminals();

45
tests/pin_headers.scad Normal file
View File

@ -0,0 +1,45 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
include <../core.scad>
use <../utils/layout.scad>
include <../vitamins/pin_headers.scad>
pins = 10;
module pin_headers()
layout([for(p = pin_headers) hdr_pitch(p) * pins], 15) {
idc_transition(pin_headers[$i], 10);
translate([0, 20])
pin_header(pin_headers[$i], 10, 2);
translate([0, 40])
box_header(pin_headers[$i], 10, 2);
translate([0, 65])
pin_socket(pin_headers[$i], 10, 2);
translate([0, 95])
pin_socket(pin_headers[$i], 10, 2, right_angle = true);
}
if($preview)
pin_headers();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 155 KiB

BIN
tests/png/pin_headers.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -61,7 +61,7 @@ function rotate_from_to(a, b) =
//
function calculate_twist(A, B) = let(D = transpose3(B) * A) atan2(D[1][0], D[0][0]);
//
// Compute a 4x4 matrix to orientate a frame of the sweep given the position and a 3x3 rotation matrix.
// Compute a 4x3 matrix to orientate a frame of the sweep given the position and a 3x3 rotation matrix.
//
function orientate(p, r) =
let(x = r[0], y = r[1], z = r[2])
@ -113,7 +113,7 @@ function skin_points(profile, path, loop, twist = 0) =
function cap(facets, segment = 0) = [for(i = [0 : facets - 1]) segment ? facets * segment + i : facets - 1 - i];
function quad(p, a,b,c,d) = norm(p[a] - p[c]) > norm(p[b] - p[d]) ? [[b, c, d], [b, d, a]] : [[a, b, c], [a, c, d]];
function quad(p, a, b, c, d) = norm(p[a] - p[c]) > norm(p[b] - p[d]) ? [[b, c, d], [b, d, a]] : [[a, b, c], [a, c, d]];
function skin_faces(points, segs, facets, loop) = [for(i = [0 : facets - 1], s = [0 : segs - (loop ? 1 : 2)])
each quad(points,

View File

@ -0,0 +1,183 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
//
//! Parametric green terminal blocks
//
include <../core.scad>
use <../utils/tube.scad>
function gt_pitch(type) = type[1]; //! Pitch between terminals
function gt_depth(type) = type[2]; //! Total front to back depth
function gt_height(type) = type[3]; //! Height of the flat top
function gt_top(type) = type[4]; //! Depth at the top
function gt_front_height(type) = type[5]; //! Height at the front
function gt_front_depth(type) = type[6]; //! Front ledge depth
function gt_back_height(type) = type[7]; //! Height at the back
function gt_back_depth(type) = type[8]; //! Back ledge depth
function gt_screw_r(type) = type[9]; //! Screw head radius
function gt_front_t(type) = type[10]; //! Thickness of frame around the front aperture
function gt_box_w(type) = type[11]; //! Width inside the cable entry box
function gt_box_h(type) = type[12]; //! Height of the cable entry box
function gt_y_offset(type) = type[13]; //! Offset of the pins from centre of the depth
function gt_y_offset2(type) = type[14]; //! Offset of the pins screws from the screws
function gt_tube_h(type) = type[15]; //! Height of optional tubes around the screws
module green_terminal(type, ways, skip = []) { //! Draw green terminal blocks, skip can be used to remove pins.
pitch = gt_pitch(type);
imperial = str(pitch / inch(1));
vitamin(str("green_terminal(", type[0], ", ", ways, "): Terminal block ", ways, " way ", len(imperial) < 5 ? str(pitch / inch(1), "\"") : str(pitch, "mm")));
width = ways * pitch;
depth = gt_depth(type);
height = gt_height(type);
ledge_height = gt_front_height(type);
ledge_depth = gt_front_depth(type);
top = gt_top(type);
back = gt_back_height(type);
back_ledge = gt_back_depth(type);
tube_h = gt_tube_h(type);
module single(skip = false) {
screw_r = gt_screw_r(type);
box_w1 = pitch - 2 * gt_front_t(type);
box_h1 = ledge_height - 2 * gt_front_t(type);
box_w2 = gt_box_w(type);
box_h2 = gt_box_h(type);
y = gt_y_offset(type);
y2 = gt_y_offset2(type);
box_front = y + depth / 2 - 2;
box_back = y - depth / 2 + 1;
module horizontal_section()
difference() {
translate([y, 0])
square([depth, pitch], center = true);
translate([y + 1, 0])
square([depth, box_w2], center = true);
translate([y + depth / 2, 0])
hull() {
square([1, box_w1], center = true);
square([4, box_w2], center = true);
}
}
color("lime") {
rotate([90, 0, 0])
linear_extrude(height = pitch, center = true, convexity = 5)
polygon(points = [ // Vertical section
[y + depth / 2, 0],
[y + depth / 2, ledge_height / 2 - box_h1 / 2],
[y + depth / 2 - 0.5, ledge_height / 2 - box_h1 / 2],
[box_front, ledge_height / 2 - box_h2 / 2],
[box_back, ledge_height / 2 - box_h2 / 2],
[box_back, ledge_height / 2 + box_h2 / 2],
[box_front, ledge_height / 2 + box_h2 / 2],
[y + depth / 2 - 0.5, ledge_height / 2 + box_h1 / 2],
[y + depth / 2, ledge_height / 2 + box_h1 / 2],
[y + depth / 2, ledge_height],
[y + depth / 2 - ledge_depth, ledge_height],
[y2 + top / 2, height],
[y2 + screw_r + eps, height],
[y2 + screw_r + eps, ledge_height / 2 + box_h2 / 2],
[y2 - screw_r - eps, ledge_height / 2 + box_h2 / 2],
[y2 - screw_r - eps, height],
[y2 -top / 2, height],
[y - depth / 2 + back_ledge, back],
[y - depth / 2, back],
[y - depth / 2, 0],
]);
translate([y2, 0, ledge_height / 2 + box_h2 / 2]) // Screw socket
linear_extrude(height = height - ledge_height / 2 - box_h2 / 2)
difference() {
square([screw_r * 2 + 0.1, pitch], center = true);
circle(screw_r);
}
linear_extrude(height = ledge_height)
intersection() {
horizontal_section();
translate([0, -5])
square([10, 10]);
}
linear_extrude(height = back)
intersection() {
horizontal_section();
translate([-10, -5])
square([10, 10]);
}
if(tube_h)
translate([y2, 0, height])
linear_extrude(height = tube_h - height)
intersection() {
ring(or = top / 2, ir = screw_r);
square([10, pitch], center = true);
}
}
if(!skip)
color("silver") {
slot_depth = 1;
screw_top = height - 0.5;
pin_l = 3.3;
translate([y2, 0]) {
translate_z(screw_top - 2 * slot_depth) // screw head
cylinder(r = screw_r, h = slot_depth);
translate_z(screw_top - slot_depth) // screw head
linear_extrude(height = slot_depth)
difference() {
circle(screw_r);
square([10, screw_r / 4], center = true);
}
}
translate([box_back, 0, ledge_height / 2]) {
rotate([0, 90, 0])
linear_extrude(height = box_front - box_back)
difference() {
square([box_h2, box_w2], center = true);
square([box_h2 - 0.1, box_w2 - 0.1], center = true);
}
cube([1, box_w2, box_h2], center = true); // terminal back
}
translate_z(-pin_l)
cube([0.44, 0.75, pin_l]); // pin
}
}
for(i = [0: ways - 1])
translate([0, i * pitch - width / 2 + pitch / 2])
single(in(skip, i));
}
module terminal_254(ways, skip = []) //! Draw 0.1" terminal block
green_terminal(gt_2p54, ways, skip);

View File

@ -0,0 +1,27 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
// Green terminal blocks
//
gt_2p54 = ["gt_2p54", 2.54, 6.6, 10, 3, 6, 0.4, 6.4, 1, 1, 0.2, 2, 2, 0, 0, 0];
gt_3p5 = ["gt_3p5", 3.5, 7.3, 8.5, 4, 5, 0.4, 4, 0, 1.35, 0.4, 1.8, 2, 0, 0, 0];
gt_6p35 = ["gt_6p35", 6.35, 12.6, 17.4, 6.8, 12, 0.4, 11, 2, 2.7, 0.8, 3.4, 4.2, 1.8, 1.1, 21.4];
green_terminals = [gt_2p54, gt_3p5, gt_6p35];
use <green_terminal.scad>

View File

@ -25,7 +25,7 @@
//! Uses STL files copyright geekammo and licenced with MIT license, see [microview/LICENSE.txt](vitamins/microview/LICENSE.txt).
//
include <../core.scad>
use <pcb.scad> // for pin
include <pin_headers.scad>
panel_clearance = 0.2;
@ -54,6 +54,6 @@ module microview(cutout = false) { //! Draw microview or generate a panel cutou
for(side = [-1, 1], i = [0 : 7])
translate([side * inch(0.35), (i - 3.5) * inch(0.1)])
pin();
pin(2p54header);
}
}

View File

@ -25,6 +25,9 @@ panel_clearance = 0.2;
include <../core.scad>
include <screws.scad>
include <buttons.scad>
include <green_terminals.scad>
include <pin_headers.scad>
use <../utils/rounded_cylinder.scad>
use <../utils/dogbones.scad>
use <../utils/tube.scad>
@ -53,8 +56,8 @@ module pcb_grid(type, x, y, z = 0) //! Positions children at specified grid pos
// allows negative ordinates to represent offsets from the far edge
function pcb_coord(type, p) = let(l = pcb_length(type), w = pcb_width(type)) //! Convert offsets from the edge to coordinates relative to the centre
[(p.x > 0 ? p.x : l + p.x) - l / 2,
(p.y > 0 ? p.y : w + p.y) - w / 2];
[(p.x >= 0 ? p.x : l + p.x) - l / 2,
(p.y >= 0 ? p.y : w + p.y) - w / 2];
module pcb_screw_positions(type) { //! Positions children at the mounting hole positions
holes = pcb_holes(type);
@ -66,145 +69,10 @@ module pcb_screw_positions(type) { //! Positions children at the mounting hole p
children();
}
}
// p p b p p b
// i i e i i a
// t n l n n s
// c o e
// h l w w c
// c
//
2p54header = ["2p54header", 2.54, 12, 3.2, 0.66, "gold", grey20, 8.5];
function hdr_pitch(type) = type[1]; //! Header pitch
function hdr_pin_length(type) = type[2]; //! Header pin length
function hdr_pin_below(type) = type[3]; //! Header pin length underneath
function hdr_pin_width(type) = type[4]; //! Header pin size
function hdr_pin_colour(type) = type[5]; //! Header pin colour
function hdr_base_colour(type) = type[6]; //! Header insulator colour
function hdr_socket_depth(type) = type[7]; //! Socket depth for female housing
module pin(type = 2p54header, length = undef) { //! Draw a header pin
w = hdr_pin_width(type);
l = length == undef ? hdr_pin_length(type) : length;
chamfer = w / 2;
color(hdr_pin_colour(type))
translate_z(l / 2 -hdr_pin_below(type))
hull() {
cube([w, w, l - 2 * chamfer], center = true);
cube([w - chamfer, w - chamfer, l], center = true);
}
}
module pin_header(type = 2p54header, cols = 1, rows = 1, smt = false, cutout = false) { //! Draw pin header
pitch = hdr_pitch(type);
h = pitch;
if(cutout)
dogbone_rectangle([cols * pitch + 2 * panel_clearance, rows * pitch + 2 * panel_clearance, 100], center = false);
else
vitamin(str("pin_header(", type[0], cols, rows, arg(smt, false, "smt"), "): Pin header ", cols, " x ", rows));
translate_z(smt ? 3.5 - h : 0) {
for(x = [0 : cols - 1], y = [0 : rows - 1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type);
color(hdr_base_colour(type))
linear_extrude(height = h)
for(x = [0 : cols - 1], y = [0 : rows - 1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), pitch / 2])
hull() {
chamfer = pitch / 4;
square([pitch + eps, pitch - chamfer], center = true);
square([pitch - chamfer, pitch + eps], center = true);
}
}
}
module idc_transition(type, cols = 5, skip = [], cutout = false) { //! Draw IDC transition header
rows = 2;
pitch = hdr_pitch(type);
height = 7.4;
width = 6;
length = cols * pitch + 5.08;
if(cutout)
;
else {
vitamin(str("idc_transition(", type[0], ", ", cols, "): IDC transition header ", cols, " x ", rows));
color(hdr_base_colour(type))
rotate([90, 0, 0])
linear_extrude(height = width, center = true, convexity = cols * rows)
difference() {
translate([0, height / 2])
square([length, height], center = true);
for(i = [0 : cols * rows - 1])
translate([pitch / 2 * (i - (cols * rows - 1) / 2), height / 2])
circle(d = pitch / 2 + eps);
slot = pitch / 3;
translate([0, height / 2 - pitch / 4 + slot / 2])
square([cols * pitch, slot], center = true);
}
for(x = [0 : cols - 1], y = [0 : rows -1])
if(!in(skip, x))
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type, 2);
}
}
module pin_socket(type = 2p54header, cols = 1, rows = 1, right_angle = false, height = 0, cutout = false) { //! Draw pin socket
pitch = hdr_pitch(type);
length = pitch * cols + 0.5;
width = pitch * rows - 0.08;
depth = max(hdr_socket_depth(type), height);
ra_offset = 1.5;
if(cutout)
;
else {
vitamin(str("pin_socket(", type[0], ", ", cols, ", ", rows, arg(right_angle, false, "right_angle"), arg(height, 0, "height"),
"): Pin socket ", cols, " x ", rows, right_angle ? " right_angle" : ""));
color(hdr_base_colour(type))
translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0])
rotate([right_angle ? 90 : 0, 0, 0])
translate_z(depth / 2)
linear_extrude(height = depth, center = true)
difference() {
square([length, width], center = true);
for(x = [0 : cols - 1], y = [0 : rows -1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2)])
square(hdr_pin_width(type), center = true);
}
color(hdr_pin_colour(type))
for(x = [0 : cols - 1], y = [0 : rows -1]) {
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type, hdr_pin_below(type) + width / 2 + (y - 0.5) * pitch);
if(right_angle) {
rotate([-90, 0, 0])
translate([pitch * (x - (cols - 1) / 2), -pitch * (y - (rows - 1) / 2) -width / 2, 0])
pin(type, hdr_pin_below(type) + (y - 0.5) * pitch);
w = hdr_pin_width(type);
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2) - w / 2, pitch * (y - (rows - 1) / 2) + width / 2 - w / 2])
rotate([0, -90, 0])
rotate_extrude(angle = 90, $fn = 32)
translate([0, -w / 2])
square(w);
}
}
}
}
module chip(length, width, thickness, cutout = false) //! Draw a black cube to represent a chip
module chip(length, width, thickness, colour, cutout = false) //! Draw a coloured cube to represent a chip, or other rectangular component
if(!cutout)
color(grey20)
color(colour)
translate_z(thickness / 2) cube([length, width, thickness], center = true);
module usb_Ax2(cutout = false) { //! Draw USB type A dual socket
@ -552,6 +420,40 @@ module barrel_jack(cutout = false) { //! Draw barrel power jack
}
}
module uSD(size, cutout = false) { //! Draw uSD socket
min_w = 12;
w = size.x - min_w;
t = 0.15;
if(cutout)
;
else
translate_z(size.z / 2) {
color("silver")
rotate([90, 0, 90]) {
linear_extrude(height = size.y, center = true)
difference() {
square([size.x, size.z], center = true);
square([size.x - 2 * t, size.z - 2 * t], center = true);
}
translate_z(-size.y / 2 + t / 2)
cube([size.x, size.z, t], center = true);
}
if(w > 0)
color(grey20)
rotate([90, 0, 90])
translate_z(t)
linear_extrude(height = size.y - t, center = true)
difference() {
square([size.x - 2 * t, size.z - 2 * t], center = true);
translate([-size.x / 2 + min_w / 2 + 0.7, size.z / 2 - t])
square([min_w, 2.2], center = true);
}
}
}
module flex(cutout = false) { //! Draw flexistrip connector
l = 20.6;
w = 3;
@ -693,109 +595,6 @@ module terminal_35(ways) { //! Draw 3.5mm terminal block
single();
}
module terminal_254(ways, skip = []) { //! Draw 0.1" terminal block
vitamin(str("terminal_254(", ways, "): Terminal block ", ways, " way 0.1\""));
pitch = 2.54;
width = ways * pitch;
depth = 6.2;
height = 8.5;
ledge_height = 5;
ledge_depth = 0.7;
top = 3;
back = 3;
module single(skip = false) {
screw_r = 1;
box_w1 = pitch - 0.4;
box_h1 = ledge_height - 0.4;
box_w2 = 2;
box_h2 = 2;
color("lime") {
rotate([90, 0, 0])
linear_extrude(height = pitch, center = true, convexity = 5)
polygon(points = [
[ depth / 2, 0],
[ depth / 2, ledge_height / 2 - box_h1 / 2],
[ depth / 2 - 0.5, ledge_height / 2 - box_h1 / 2],
[ depth / 2 - 2, ledge_height / 2 - box_h2 / 2],
[-depth / 2 + 1, ledge_height / 2 - box_h2 / 2],
[-depth / 2 + 1, ledge_height / 2 + box_h2 / 2],
[ depth / 2 - 2, ledge_height / 2 + box_h2 / 2],
[ depth / 2 - 0.5, ledge_height / 2 + box_h1 / 2],
[ depth / 2, ledge_height / 2 + box_h1 / 2],
[ depth / 2, ledge_height],
[ depth / 2 - ledge_depth, ledge_height],
[ top / 2, height],
[ screw_r + eps, height],
[ screw_r + eps, ledge_height / 2 + box_h2 / 2],
[-screw_r - eps, ledge_height / 2 + box_h2 / 2],
[-screw_r - eps, height],
[ -top / 2, height],
[-depth / 2, back],
[-depth / 2, 0],
]);
translate_z(ledge_height / 2 + box_h2 / 2)
linear_extrude(height = height - ledge_height / 2 - box_h2 / 2)
difference() {
square([screw_r * 2 + 0.1, pitch], center = true);
circle(screw_r);
}
linear_extrude(height = ledge_height)
difference() {
translate([0.5, 0])
square([depth - 1, pitch], center = true);
translate([depth / 2, 0]) {
square([9, box_w2], center = true);
hull() {
square([1, box_w1], center = true);
square([4, box_w2], center = true);
}
}
}
}
if(!skip)
color("silver")
translate_z(1) {
slot_depth = 1;
screw_top = height - 1.5;
pin_l = 3.3 + ledge_height / 2 - 2;
translate_z(ledge_height / 2) // screw
cylinder(r = 1, h = screw_top - slot_depth - ledge_height / 2);
translate_z(screw_top - slot_depth) // screw head
linear_extrude(height = slot_depth)
difference() {
circle(1);
square([4, 0.5], center = true);
}
translate_z(ledge_height / 2 - 1)
rotate([0, 90, 0])
linear_extrude(height = 2, center = true)
difference() {
square([2, 2], center = true);
square([1.5, 1.9], center = true);
}
translate([-1.5, 0, ledge_height / 2 - 1]) // terminal back
cube([1, 2, 2], center = true);
translate_z(ledge_height / 2 - 2 - pin_l / 2)
cube([0.44, 0.75, pin_l], center = true); // pin
}
}
for(i = [0: ways -1])
translate([0, i * pitch - width / 2 + pitch / 2])
single(in(skip, i));
}
module molex_254(ways) { //! Draw molex header
vitamin(str("molex_254(", ways, "): Molex KK header ", ways, " way"));
pitch = 2.54;
@ -822,12 +621,27 @@ module molex_254(ways) { //! Draw molex header
cube([0.44, 0.75, above + below], center = true);
}
module standoff(h, d, h2, d2) {
color("white") {
cylinder(d = d, h = h);
hull() {
translate_z(-(h2 - h) / 2 + d2 / 2)
sphere(d = d2);
translate_z(h +(h2 - h) / 2 - d2 / 2)
sphere(d = d2);
}
}
}
module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb component from description
function show(comp, part) = (comp[3] == part || comp[3] == str("-",part)) && (!cutouts || angle == undef || angle == comp.z);
rotate(comp.z) {
if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], len(comp) > 5 ? comp[6] : false, cutouts);
if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], len(comp) > 5 ? comp[6] : false, cutouts);
if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], comp[6], len(comp) > 7 ? comp[7] : 0, cutouts);
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], cutouts);
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], len(comp) > 7 ? comp[7] : grey30, cutouts);
if(show(comp, "rj45")) rj45(cutouts);
if(show(comp, "usb_Ax2")) usb_Ax2(cutouts);
if(show(comp, "usb_uA")) usb_uA(cutouts);
@ -838,13 +652,18 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "flex")) flex(cutouts);
if(show(comp, "D_plug")) if(!cutouts) translate_z(d_pcb_offset(comp[4])) d_plug(comp[4], pcb = true);
if(show(comp, "molex_hdr")) if(!cutouts) molex_254(comp[4]);
if(show(comp, "term254")) if(!cutouts) terminal_254(comp[4], comp[5]);
if(show(comp, "term254")) if(!cutouts) green_terminal(gt_2p54,comp[4], comp[5]);
if(show(comp, "gterm35")) if(!cutouts) green_terminal(gt_3p5, comp[4], comp[5]);
if(show(comp, "gterm635")) if(!cutouts) green_terminal(gt_6p35, comp[4], comp[5]);
if(show(comp, "term35")) if(!cutouts) terminal_35(comp[4]);
if(show(comp, "transition")) if(!cutouts) idc_transition(2p54header, comp[4], comp[5]);
if(show(comp, "block"))
color(comp[7]) if(!cutouts) translate_z(comp[6] / 2) cube([comp[4], comp[5], comp[6]], center = true);
else if(comp[8]) translate([-50, 0, comp[6] / 2 - panel_clearance]) cube([100, comp[5] + 2 * panel_clearance, comp[6] + 2 * panel_clearance], center = true);
if(show(comp, "button_6mm")) square_button(button_6mm);
if(show(comp, "pcb")) if(!cutouts) translate_z(comp[4]) pcb(comp[5]);
if(show(comp, "standoff")) if(!cutouts) standoff(comp[4], comp[5], comp[6], comp[7]);
if(show(comp, "uSD")) uSD(comp[4], cutouts);
}
}

View File

@ -28,10 +28,168 @@ include <screws.scad>
// s
// s
//
DuetW = ["DuetW", "Duet WiFi electronics",
123, 100, 1.6, 0, 4.2, 0, "mediumblue", false, [[119, 4], [119, 96], [4, 96],[4, 4]],
[],
Ethernet = ["Ethernet", "Duet Ethernet piggy back",
33.8, 37.5, 1.6, 0, 2.54, 0, "#1D39AB", false, [[27.1, -6.3], [7.5, -2.7], [21.3, -31.1]],
[[10.7, -13.1, 180, "rj45"],
[7.75, -36.2, 0, "-2p54header", 6, 1],
[7.75, -26.04, 0, "-2p54header", 6, 1],
[27.1, -6.3, 0, "-standoff", 5, 4.5, 12.5, 2.54],
[7.5, -2.70, 0, "-standoff", 5, 4.5, 12.5, 2.54],
[21.3, -31.1, 0, "-standoff", 5, 4.5, 12.5, 2.54],
],
[]];
DuetE = ["DuetE", "Duet 2 Ethernet electronics",
123, 100, 1.6, 0, 4.2, 0, "#2140BE", false, [[-4, 4], [-4, -4], [4, -4],[4, 4]],
[[ 18.5, -69.15, 0, "pcb", 5, Ethernet],
[ 42.9, -3.2, 90, "molex_hdr", 4],
[ 59.8, -3.2, 90, "molex_hdr", 4],
[ 76.2, -3.2, 90, "molex_hdr", 4],
[ 92.6, -3.2, 90, "molex_hdr", 4],
[109.9, -3.2, 90, "molex_hdr", 4],
[109.9, -9.6, 90, "molex_hdr", 4],
[119.7, -31, 0, "molex_hdr", 3],
[119.7, -88.6, 0, "molex_hdr", 2],
[114.9, -75.1, 0, "gterm635", 2],
[114.9, -43.5, 0, "gterm635", 2],
[ 39, -97, -90, "molex_hdr", 4],
[ 27.9, -97, -90, "molex_hdr", 4],
[ 83.7, -38.7, -90, "molex_hdr", 3],
[ 74.3, -40.7, -90, "molex_hdr", 3],
[ 64.0, -40.7, -90, "molex_hdr", 3],
[ 54.0, -40.7, -90, "molex_hdr", 3],
[ 44.1, -40.7, -90, "molex_hdr", 3],
[ 35.0, -40.7, -90, "molex_hdr", 2],
[ 28.9, -40.7, -90, "molex_hdr", 2],
[103.0, -48.8, -90, "molex_hdr", 2],
[ 97.0, -48.8, -90, "molex_hdr", 2],
[ 90.3, -48.8, -90, "molex_hdr", 2],
[ 84.1, -48.8, -90, "molex_hdr", 2],
[ 77.9, -48.8, -90, "molex_hdr", 2],
[105.2, -54.9, 0, "2p54header", 2, 1],
[ 98.4, -54.9, 0, "2p54header", 2, 1],
[ 90.2, -54.9, 0, "2p54header", 3, 1],
[ 61.7, -83.1, 0, "2p54header", 5, 2],
[ 29.5, -3.6, 90, "gterm35", 4],
[ 45.0, -70.8, 45, "chip", 19, 19, 1.5],
[ 34.6, -18.8, 0, "chip", 10, 10, 2],
[ 53.2, -18.8, 0, "chip", 10, 10, 2],
[ 71.8, -18.8, 0, "chip", 10, 10, 2],
[ 90.4, -18.8, 0, "chip", 10, 10, 2],
[109.9, -22.0, 0, "chip", 10, 10, 2],
[105.8, -86.3, 0, "2p54boxhdr", 5, 2],
[ 85.2, -86.3, 0, "2p54boxhdr", 5, 2],
[ 79.9, -95.7, 180, "2p54boxhdr", 25, 2],
[ 2.0, -47.3, 180, "usb_uA"],
[ 8.4, -63.3, 180, "uSD", [15, 14.5, 2]],
[ 2.2, -9.7, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E1 heater
[ 2.2, -13.2, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E0 heater
[ 2.2, -16.7, 0, "chip", inch(0.03), inch(0.06), 1, "blue"], // Vin
[ 2.2, -20.2, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // 5V
[ 2.2, -24.0, 0, "chip", inch(0.03), inch(0.06), 1, "green"], // 3.3V
[ 1.8, -41.8, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // USB
[ 2.3, -53.5, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // Diag
[ 49.8, -2.0, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E1 stop
[ 52.9, -2.0, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E0 stop
[ 68.8, -2.4, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // X stop
[ 85.4, -2.4, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // Y stop
[101.6, -1.8, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // Z stop
[109.8, -58.8, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // Bed heater
[ 2.3, -37.2, 0, "chip", 3.6, 4.8, 2.0, "silver"], // Reset switch
[ 0.0, -37.2, 0, "chip", 2.0, 2.6, 1.4, grey20], // Reset button
],
[": Micro SD card", ": Cat 5 patch cable 300mm"]];
Duex2 = ["Duex2", "Duex2 expansion board",
123, 100, 1.6, 0, 4.2, 0, "#2140BE", false, [[-4, 4], [-4, -4], [4, -4],[4, 4]],
[ [ 79.8, -4.3, 180, "2p54boxhdr", 25, 2],
[ 27.8, -3.0, 0, "2p54header", 10, 1],
[ 45.7, -14.7, 0, "2p54header", 3, 1], // Endstop voltage select
[ 34.8, -15.1, 0, "2p54header", 3, 2], // Fan voltage select
[ 4.8, -55.2, 90, "2p54header", 1, 2], // 12V EN
[ 59.5, -30.3, 0, "2p54header", 3, 1], // 5V Aux select
[ 31.6, -41.4, 0, "2p54header", 2, 5], // SPIO
[ 4.7, -11.8, -90, "molex_hdr", 2], // Fan / LED 8
[ 4.9, -23.9, -90, "molex_hdr", 2], // Fan / LED 7
[ 12.0, -23.9, -90, "molex_hdr", 2], // Fan / LED 6
[ 19.7, -23.9, -90, "molex_hdr", 2], // Fan / LED 5
[ 27.3, -23.9, -90, "molex_hdr", 2], // Fan / LED 4
[ 34.9, -23.9, -90, "molex_hdr", 2], // Fan / LED 3
[ 44.3, -23.9, -90, "molex_hdr", 3], // E6 stop
[ 54.5, -23.9, -90, "molex_hdr", 3], // E5 stop
[ 64.6, -23.9, -90, "molex_hdr", 3], // E4 stop
[ 74.8, -23.9, -90, "molex_hdr", 3], // E3 stop
[ 84.9, -23.9, -90, "molex_hdr", 3], // E2 stop
[ 57.0, -46.8, -90, "molex_hdr", 2], // E6 temp
[ 64.6, -46.8, -90, "molex_hdr", 2], // E5 temp
[ 57.0, -36.6, -90, "molex_hdr", 2], // E4 temp
[ 64.6, -36.6, -90, "molex_hdr", 2], // E3 temp
[ 72.2, -36.6, -90, "molex_hdr", 2], // E2 temp
[ 26.5, -58.2, -90, "molex_hdr", 3], // PWM_5
[ 36.7, -58.2, -90, "molex_hdr", 3], // PWM_4
[ 46.8, -58.2, -90, "molex_hdr", 3], // PWM_3
[ 57.0, -58.2, -90, "molex_hdr", 3], // PWM_2
[ 67.2, -58.2, -90, "molex_hdr", 3], // PWM_1
[ 83.2, -18.3, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E2 stop
[ 74.5, -18.3, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E3 stop
[ 63.8, -18.7, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E4 stop
[ 54.7, -18.3, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E5 stop
[ 44.3, -18.4, 90, "chip", inch(0.03), inch(0.06), 1, "red"], // E6 stop
[112.4, -15.5, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E2 heat
[112.4, -22.9, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E3 heat
[112.4, -29.1, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E4 heat
[112.4, -36.1, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E5 heat
[112.4, -43.4, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // E6 heat
[118.6, -30.3, 0, "gterm35", 10], // Heaters
[114.9, -56.5, 0, "gterm635", 2], // VIN
[119.6, -69.0, 0, "molex_hdr", 2], // 5V AUX in
[ 4.5, -49.4, 90, "molex_hdr", 2], // 12V
[110.7, -81.2, 0, "chip", 10, 10, 2],
[ 86.1, -81.2, 0, "chip", 10, 10, 2],
[109.9, -96.8, -90, "molex_hdr", 4],
[ 86.1, -96.8, -90, "molex_hdr", 4],
],
[]];
Duex5 = ["Duex5", "Duex5 expasnion board",
123, 100, 1.6, 0, 4.2, 0, "#2140BE", false, [[-4, 4], [-4, -4], [4, -4],[4, 4]],
concat(Duex2[11], [
[ 61.5, -81.2, 0, "chip", 10, 10, 2],
[ 36.9, -81.2, 0, "chip", 10, 10, 2],
[ 12.3, -81.2, 0, "chip", 10, 10, 2],
[ 61.5, -96.4, -90, "molex_hdr", 4],
[ 36.9, -96.4, -90, "molex_hdr", 4],
[ 14.3, -96.4, -90, "molex_hdr", 4],
]),
[]];
Melzi = ["Melzi", "Melzi electronics", 203.2, 49.53, 1.6, 3.81, 3.1, 6, "green", false, [[3.81, 3.81], [-3.81, 3.81], [-3.81, -3.81], [3.81, -3.81]],
[],
@ -49,10 +207,11 @@ RPI3 = ["RPI3", "Raspberry Pi 3", 85, 56, 1.4, 3, 2.75, 6, "green"
[10.6, 2, -90, "usb_uA"],
[3.6, 28, 90, "flex"],
[45, 11.5,-90, "flex"],
[7.75, 28, 180, "-uSD", [12, 11.5, 1.28]],
],
[": Micro SD card"]];
ArduinoUno3 = ["ArduinoUno3", "Arduino Uno R3", 68.58, 53.34, 1.6, 0, 3.3, 0, "mediumblue", false, [[15.24, 50.8],[66.04, 35.56],[66.04, 7.62],[13.97, 2.54]],
ArduinoUno3 = ["ArduinoUno3", "Arduino Uno R3", 68.58, 53.34, 1.6, 0, 3.3, 0, "#2140BE", false, [[15.24, 50.8],[66.04, 35.56],[66.04, 7.62],[13.97, 2.54]],
[[30.226, -2.54, 0, "2p54socket", 10, 1],
[54.61, -2.54, 0, "2p54socket", 8, 1],
[36.83, 2.54, 0, "2p54socket", 8, 1],
@ -78,7 +237,7 @@ ArduinoUno3 = ["ArduinoUno3", "Arduino Uno R3", 68.58, 53.34, 1.6, 0, 3.3, 0, "m
M2p5_pan_screw
];
Keyes5p1 = ["Keyes5p1", "Keyes5.1 Arduino Uno expansion board", 68.58, 53.34, 1.6, 0, 3.3, 0, "mediumblue", false, [[15.24, 50.8],[66.04, 35.56],[66.04, 7.62],[13.97, 2.54]],
Keyes5p1 = ["Keyes5p1", "Keyes5.1 Arduino Uno expansion board", 68.58, 53.34, 1.6, 0, 3.3, 0, "#2140BE", false, [[15.24, 50.8],[66.04, 35.56],[66.04, 7.62],[13.97, 2.54]],
[[30.226, -2.54, 0, "-2p54header", 10, 1],
[54.61, -2.54, 0, "-2p54header", 8, 1],
[36.83, 2.54, 0, "-2p54header", 8, 1],
@ -128,6 +287,6 @@ PERF74x51 = ["PERF74x51", "Perfboard 74 x 51mm", 74, 51, 1.0, 0, 3.0, 0, "sienna
PSU12V1A = ["PSU12V1A", "PSU 12V 1A", 67, 31, 1.7, 0, 3.9, 0, "green", true, [[3.5, 3.5], [-3.5, 3.5], [-3.5, -3.5], [3.5, -3.5]], [], []];
pcbs = [ExtruderPCB, PI_IO, RPI3, ArduinoUno3, Keyes5p1, PERF80x20, PERF70x50, PERF70x30, PERF60x40, PERF74x51, PSU12V1A, DuetW, Melzi];
pcbs = [ExtruderPCB, PI_IO, RPI3, ArduinoUno3, Keyes5p1, PERF80x20, PERF70x50, PERF70x30, PERF60x40, PERF74x51, PSU12V1A, DuetE, Duex2, Duex5, Melzi];
use <pcb.scad>

184
vitamins/pin_header.scad Normal file
View File

@ -0,0 +1,184 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
//! Pin headers and sockets, etc.
include <../core.scad>
use <../utils/dogbones.scad>
panel_clearance = 0.2;
function hdr_pitch(type) = type[1]; //! Header pitch
function hdr_pin_length(type) = type[2]; //! Header pin length
function hdr_pin_below(type) = type[3]; //! Header pin length underneath
function hdr_pin_width(type) = type[4]; //! Header pin size
function hdr_pin_colour(type) = type[5]; //! Header pin colour
function hdr_base_colour(type) = type[6]; //! Header insulator colour
function hdr_socket_depth(type) = type[7]; //! Socket depth for female housing
module pin(type, length = undef) { //! Draw a header pin
w = hdr_pin_width(type);
l = length == undef ? hdr_pin_length(type) : length;
chamfer = w / 2;
color(hdr_pin_colour(type))
translate_z(l / 2 -hdr_pin_below(type))
hull() {
cube([w, w, l - 2 * chamfer], center = true);
cube([w - chamfer, w - chamfer, l], center = true);
}
}
module pin_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! Draw pin header
pitch = hdr_pitch(type);
h = pitch;
if(cutout)
dogbone_rectangle([cols * pitch + 2 * panel_clearance, rows * pitch + 2 * panel_clearance, 100], center = false);
else
vitamin(str("pin_header(", type[0], cols, rows, arg(smt, false, "smt"), "): Pin header ", cols, " x ", rows));
translate_z(smt ? 3.5 - h : 0) {
for(x = [0 : cols - 1], y = [0 : rows - 1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type);
color(hdr_base_colour(type))
linear_extrude(height = h)
for(x = [0 : cols - 1], y = [0 : rows - 1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), pitch / 2])
hull() {
chamfer = pitch / 4;
square([pitch + eps, pitch - chamfer], center = true);
square([pitch - chamfer, pitch + eps], center = true);
}
}
}
module box_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! Draw box header
pitch = hdr_pitch(type);
w = cols * pitch + 7.62;
l = rows * pitch + 3.52;
h = 8.7;
base = h - 6.4;
if(cutout)
dogbone_rectangle([cols * pitch + 2 * panel_clearance, rows * pitch + 2 * panel_clearance, 100], center = false);
else
vitamin(str("box_header(", type[0], cols, rows, arg(smt, false, "smt"), "): Pin header ", cols, " x ", rows));
translate_z(smt ? 3.5 - h : 0) {
for(x = [0 : cols - 1], y = [0 : rows - 1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type);
color(hdr_base_colour(type)) {
linear_extrude(height = base)
square([w, l], center = true);
linear_extrude(height = h)
difference() {
square([w, l], center = true);
square([w - 2.4, l - 2.4], center = true);
translate([0, -l / 2])
square([4.5, 4.5], center = true);
}
}
}
}
module idc_transition(type, cols = 5, skip = [], cutout = false) { //! Draw IDC transition header
rows = 2;
pitch = hdr_pitch(type);
height = 7.4;
width = 6;
length = cols * pitch + 5.08;
if(cutout)
;
else {
vitamin(str("idc_transition(", type[0], ", ", cols, "): IDC transition header ", cols, " x ", rows));
color(hdr_base_colour(type))
rotate([90, 0, 0])
linear_extrude(height = width, center = true, convexity = cols * rows)
difference() {
translate([0, height / 2])
square([length, height], center = true);
for(i = [0 : cols * rows - 1])
translate([pitch / 2 * (i - (cols * rows - 1) / 2), height / 2])
circle(d = pitch / 2 + eps);
slot = pitch / 3;
translate([0, height / 2 - pitch / 4 + slot / 2])
square([cols * pitch, slot], center = true);
}
for(x = [0 : cols - 1], y = [0 : rows -1])
if(!in(skip, x))
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type, 5);
}
}
module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, cutout = false) { //! Draw pin socket
pitch = hdr_pitch(type);
length = pitch * cols + 0.5;
width = pitch * rows - 0.08;
depth = max(hdr_socket_depth(type), height);
ra_offset = 1.5;
if(cutout)
;
else {
vitamin(str("pin_socket(", type[0], ", ", cols, ", ", rows, arg(right_angle, false, "right_angle"), arg(height, 0, "height"),
"): Pin socket ", cols, " x ", rows, right_angle ? " right_angle" : ""));
color(hdr_base_colour(type))
translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0])
rotate([right_angle ? 90 : 0, 0, 0])
translate_z(depth / 2)
linear_extrude(height = depth, center = true)
difference() {
square([length, width], center = true);
for(x = [0 : cols - 1], y = [0 : rows -1])
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2)])
square(hdr_pin_width(type), center = true);
}
color(hdr_pin_colour(type))
for(x = [0 : cols - 1], y = [0 : rows -1]) {
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), 0])
pin(type, hdr_pin_below(type) + width / 2 + (y - 0.5) * pitch);
if(right_angle) {
rotate([-90, 0, 0])
translate([pitch * (x - (cols - 1) / 2), -pitch * (y - (rows - 1) / 2) -width / 2, 0])
pin(type, hdr_pin_below(type) + (y - 0.5) * pitch);
w = hdr_pin_width(type);
translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2) - w / 2, pitch * (y - (rows - 1) / 2) + width / 2 - w / 2])
rotate([0, -90, 0])
rotate_extrude(angle = 90, $fn = 32)
translate([0, -w / 2])
square(w);
}
}
}
}

31
vitamins/pin_headers.scad Normal file
View File

@ -0,0 +1,31 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
// p p b p p b
// i i e i i a
// t n l n n s
// c o e
// h l w w c
// c
//
2p54header = ["2p54header", 2.54, 12, 3.2, 0.66, "gold", grey20, 8.5];
pin_headers = [ 2p54header ];
use <pin_header.scad>