diff --git a/libtest.png b/libtest.png index cef9679..200b76b 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index e553130..c34b931 100644 --- a/libtest.scad +++ b/libtest.scad @@ -91,6 +91,7 @@ use use use use +use x5 = 800; @@ -304,6 +305,9 @@ translate([x3, veroboard_y]) translate([x3 + 70, veroboard_y + 30]) geared_steppers(); +translate([x3 + 140, veroboard_y + 20]) + pcb_mounts(); + translate([x3, d_connectors_y]) d_connectors(); diff --git a/printed/pcb_mount.scad b/printed/pcb_mount.scad new file mode 100644 index 0000000..edfe6a5 --- /dev/null +++ b/printed/pcb_mount.scad @@ -0,0 +1,124 @@ +// +// NopSCADlib Copyright Chris Palmer 2019 +// 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 . +// + +// +//! A frame to mount a PCB by its corners when it has no mounting holes. +//! The stl must be given a parameterless wrapper in the project that uses it. +// +include <../core.scad> +include <../vitamins/screws.scad> +use <../vitamins/pcb.scad> + +clearance = 0.2; +min_wall = extrusion_width * 2; +wall = 2; + +overlap = 2; + +screw = M3_cap_screw; +screw_clearance_r = 3.1 / 2; +pillar_r = corrected_radius(screw_clearance_r) + wall; + +function pillar_x_pitch(pcb) = pcb_length(pcb) + 2 * clearance + 2 * (pillar_r - overlap) / sqrt(2); //! x pitch of screw pillars +function pillar_y_pitch(pcb) = pcb_width(pcb) + 2 * clearance + 2 * (pillar_r - overlap) / sqrt(2); //! y pitch of screw pillars + +function pcb_mount_length(pcb) = pillar_x_pitch(pcb) + 2 * pillar_r; //! Outside length of the mount +function pcb_mount_width(pcb) = pillar_y_pitch(pcb) + 2 * pillar_r; //! Outside width of the mount + +frame_w = 3; +frame_t = 2; + +washer_thickness = 1.25; + +module pcb_mount_screw_positions(pcb) //! Positions of the screws and pillars + for(x = [-1, 1], y = [-1, 1]) + translate([x * pillar_x_pitch(pcb) / 2, y * pillar_y_pitch(pcb) / 2]) + children(); + +module pcb_mount_holes(pcb, h = 0) //! Drill holes for PCB mount + pcb_mount_screw_positions(pcb) + drill(screw_clearance_radius(screw), h); + +module pcb_mount_ring() + difference() { + circle(pillar_r); + + poly_circle(screw_clearance_r); + } + +module pcb_mount_washer_stl() //! A plastic washer to clamp a PCB + linear_extrude(height = washer_thickness) + pcb_mount_ring(); + +module pcb_mount(pcb, height = 5, washers = true) { //! Make the STL of a pcb mount for the specified PCB. + stl(str("pcb_mount_", pcb[0], "_", height)); + + y_pitch = pcb_width(pcb) > 4 * pillar_r + 4 ? pillar_r + 1 + : pcb_width(pcb) / 2 + frame_w + 1 + pillar_r; + + if(washers) + for(x = [-1, 1], y = [-1, 1]) + translate([x * (pillar_r + 1), y * y_pitch, 0]) + pcb_mount_washer_stl(); + + for(x = [-1, 1]) + translate([x * pillar_x_pitch(pcb) / 2, 0, frame_t / 2]) + cube([frame_w, pillar_y_pitch(pcb) - 2 * wall, frame_t], center = true); + + for(y = [-1, 1]) + translate([0, y * pillar_y_pitch(pcb) / 2, frame_t / 2]) + cube([pillar_x_pitch(pcb) - 2 * wall, frame_w, frame_t], center = true); + + pcb_mount_screw_positions(pcb) + linear_extrude(height = height) + pcb_mount_ring(); + + linear_extrude(height = height + pcb_thickness(pcb) - layer_height) + difference() { + pcb_mount_screw_positions(pcb) + pcb_mount_ring(); + + square([pcb_length(pcb) + 2 * clearance, pcb_width(pcb) + 2 * clearance], center = true); + } +} + +module pcb_mount_assembly(pcb, thickness, height = 5) { //! A PCB mount assembly with fasteners + translate_z(height) + pcb(pcb); + + color(pp1_colour) pcb_mount(pcb, washers = false); + + washer = screw_washer(screw); + nut = screw_nut(screw); + t = pcb_thickness(pcb); + screw_length = screw_longer_than(height + t + washer_thickness + thickness + washer_thickness(washer) + nut_thickness(nut, true)); + + pcb_mount_screw_positions(pcb) { + translate_z(height + t) { + color(pp2_colour) pcb_mount_washer_stl(); + + translate_z(washer_thickness) + screw(screw, screw_length); + } + + translate_z(-thickness) + vflip() + nut_and_washer(nut, true); + } +} diff --git a/readme.md b/readme.md index fe20496..b1e8f41 100644 --- a/readme.md +++ b/readme.md @@ -30,13 +30,13 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa Displays Ring_terminals Flat_hinge Round Fans Rockers Foot Rounded_cylinder Fuseholder Rod Handle Rounded_polygon - Geared_steppers Screws Psu_shroud Sector - Green_terminals Sealing_strip Ribbon_clamp Sweep - Hot_ends Sheets Screw_knob Tube - Hygrometer Spades Socket_box - Iecs Spools Ssr_shroud - Inserts Springs Strap_handle - Jack Ssrs + Geared_steppers Screws Pcb_mount Sector + Green_terminals Sealing_strip Psu_shroud Sweep + Hot_ends Sheets Ribbon_clamp Tube + Hygrometer Spades Screw_knob + Iecs Spools Socket_box + Inserts Springs Ssr_shroud + Jack Ssrs Strap_handle Ldrs Stepper_motors Leadnuts Toggles Leds Transformers @@ -3851,6 +3851,54 @@ Printed handle that can be printed without needing support material due to its t | 1 | handle_assembly | +Top + +--- + +## Pcb_mount +A frame to mount a PCB by its corners when it has no mounting holes. +The stl must be given a parameterless wrapper in the project that uses it. + + +[printed/pcb_mount.scad](printed/pcb_mount.scad) Implementation. + +[tests/pcb_mount.scad](tests/pcb_mount.scad) Code for this example. + +### Functions +| Function | Description | +|:--- |:--- | +| ```pcb_mount_length(pcb)``` | Outside length of the mount | +| ```pcb_mount_width(pcb)``` | Outside width of the mount | +| ```pillar_x_pitch(pcb)``` | x pitch of screw pillars | +| ```pillar_y_pitch(pcb)``` | y pitch of screw pillars | + +### Modules +| Module | Description | +|:--- |:--- | +| ```pcb_mount(pcb, height = 5, washers = true)``` | Make the STL of a pcb mount for the specified PCB. | +| ```pcb_mount_assembly(pcb, thickness, height = 5)``` | A PCB mount assembly with fasteners | +| ```pcb_mount_holes(pcb, h = 0)``` | Drill holes for PCB mount | +| ```pcb_mount_screw_positions(pcb)``` | Positions of the screws and pillars | +| ```pcb_mount_washer_stl()``` | A plastic washer to clamp a PCB | + +![pcb_mount](tests/png/pcb_mount.png) + +### Vitamins +| Qty | Module call | BOM entry | +| ---:|:--- |:---| +| 4 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc | +| 1 | ```pcb(PI_IO)``` | PI_IO V2 | +| 1 | ```pin_socket(2p54header, 13, 2)``` | Pin socket 13 x 2 | +| 4 | ```screw(M3_cap_screw, 16)``` | Screw M3 cap x 16mm | +| 3 | ```terminal_35(2)``` | Terminal block 2 way 3.5mm | +| 4 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm | + +### Printed +| Qty | Filename | +| ---:|:--- | +| 1 | pcb_mount_PI_IO_5.stl | + + Top --- diff --git a/tests/pcb_mount.scad b/tests/pcb_mount.scad new file mode 100644 index 0000000..6aa6500 --- /dev/null +++ b/tests/pcb_mount.scad @@ -0,0 +1,35 @@ +// +// NopSCADlib Copyright Chris Palmer 2019 +// 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 . +// +include <../lib.scad> +use <../printed/pcb_mount.scad> + +PI_IO = ["PI_IO", "PI_IO V2", 35.56, 25.4, 1.6, 0, 0, 0, "green", true, [], + [[(3.015 - 2.7) * 25.4 - 3.5 /2, (4.5 - 3.685) * 25.4, 90, "term35", 2], + [(3.46 - 2.7) * 25.4 - 3.5 /2, (4.5 - 3.69) * 25.4, 90, "term35", 2], + [(3.91 - 2.7) * 25.4 - 3.5 /2, (4.5 - 3.69) * 25.4, 90, "term35", 2], + [(3.4 - 2.7) * 25.4, (4.5 - 4.15) * 25.4, 0, "2p54socket", 13, 2], + ], []]; + +module pcb_mounts() + if($preview) + pcb_mount_assembly(PI_IO, 3); + else + pcb_mount(PI_IO); + +pcb_mounts(); diff --git a/tests/png/pcb_mount.png b/tests/png/pcb_mount.png new file mode 100644 index 0000000..a4f662b Binary files /dev/null and b/tests/png/pcb_mount.png differ