diff --git a/libtest.png b/libtest.png index f3e2983..eef7a1a 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index 80e798c..2e891ee 100644 --- a/libtest.scad +++ b/libtest.scad @@ -29,6 +29,7 @@ use use use use +use use use use @@ -334,6 +335,9 @@ translate([x3 + 70, veroboard_y + 30]) translate([x3 + 140, veroboard_y + 20]) pcb_mounts(); +translate([x3 + 170, veroboard_y + 16]) + cameras(); + translate([x3, d_connectors_y]) d_connectors(); diff --git a/readme.md b/readme.md index 7e58ca8..5ed10d3 100644 --- a/readme.md +++ b/readme.md @@ -26,22 +26,22 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa Bulldogs Leadnuts SK_brackets Door_hinge Layout Sphere Buttons Light_strips SMDs Door_latch Maths Teardrops Cable_strips Linear_bearings SSRs Fan_guard Offset - Circlips Mains_sockets Screws Fixing_block Quadrant - Components Microswitches Sealing_strip Flat_hinge Round - DIP Microview Sheets Foot Rounded_cylinder - D_connectors Modules Spades Handle Rounded_polygon - Displays Nuts Spools PCB_mount Sector - Extrusion_brackets O_ring Springs PSU_shroud Sweep - Extrusions Opengrab Stepper_motors Printed_box Thread - Fans PCB Swiss_clips Ribbon_clamp Tube - Fuseholder PCBs Toggles SSR_shroud - Geared_steppers PSUs Transformers Screw_knob - Green_terminals Panel_meters Tubings Socket_box - Hot_ends Pillars Variacs Strap_handle - Hygrometer Pin_headers Veroboard - IECs Pulleys Washers - Inserts Wire - Zipties + Cameras Mains_sockets Screws Fixing_block Quadrant + Circlips Microswitches Sealing_strip Flat_hinge Round + Components Microview Sheets Foot Rounded_cylinder + DIP Modules Spades Handle Rounded_polygon + D_connectors Nuts Spools PCB_mount Sector + Displays O_ring Springs PSU_shroud Sweep + Extrusion_brackets Opengrab Stepper_motors Printed_box Thread + Extrusions PCB Swiss_clips Ribbon_clamp Tube + Fans PCBs Toggles SSR_shroud + Fuseholder PSUs Transformers Screw_knob + Geared_steppers Panel_meters Tubings Socket_box + Green_terminals Pillars Variacs Strap_handle + Hot_ends Pin_headers Veroboard + Hygrometer Pulleys Washers + IECs Wire + Inserts Zipties --- @@ -430,6 +430,42 @@ When the sides are constrained then a circular model is more accurate. | 3 | ```cable_strip(20, 25, 100, 30)``` | Polypropylene strip 189mm x 24mm x 0.8mm | +Top + +--- + +## Cameras +PCB cameras. + + +[vitamins/cameras.scad](vitamins/cameras.scad) Object definitions. + +[vitamins/camera.scad](vitamins/camera.scad) Implementation. + +[tests/cameras.scad](tests/cameras.scad) Code for this example. + +### Properties +| Function | Description | +|:--- |:--- | +| ```camera_connector(type)``` | The flex connector block for the camera itself | +| ```camera_lens(type)``` | Stack of lens parts, can be round, rectanular or rounded rectangular, with optional tapered aperture | +| ```camera_lens_offset(type)``` | Offset of the lens center from the PCB centre | +| ```camera_pcb(type)``` | The PCB part of the camera | + +### Modules +| Module | Description | +|:--- |:--- | +| ```camera(type)``` | Draw specified PCB camera | + +![cameras](tests/png/cameras.png) + +### Vitamins +| Qty | Module call | BOM entry | +| ---:|:--- |:---| +| 1 | ```camera(rpi_camera_v1)``` | Raspberry Pi camera V1 | +| 1 | ```camera(rpi_camera)``` | Raspberry Pi focusable camera | + + Top --- diff --git a/tests/cameras.scad b/tests/cameras.scad new file mode 100644 index 0000000..631a7fb --- /dev/null +++ b/tests/cameras.scad @@ -0,0 +1,31 @@ +// +// NopSCADlib Copyright Chris Palmer 2020 +// 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 <../core.scad> +use <../utils/layout.scad> + +include <../vitamins/cameras.scad> + +use <../vitamins/pcb.scad> + +module cameras() + layout([for(c = cameras) pcb_length(camera_pcb(c))], 10, false) let(c = cameras[$i]) + camera(c); + +if($preview) + cameras(); diff --git a/tests/png/cameras.png b/tests/png/cameras.png new file mode 100644 index 0000000..1efe34a Binary files /dev/null and b/tests/png/cameras.png differ diff --git a/vitamins/camera.scad b/vitamins/camera.scad new file mode 100644 index 0000000..f86ed80 --- /dev/null +++ b/vitamins/camera.scad @@ -0,0 +1,83 @@ +// +// NopSCADlib Copyright Chris Palmer 2020 +// 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 . +// + +// +//! PCB cameras. +// +include <../utils/core/core.scad> +use + +function camera_pcb(type) = type[2]; //! The PCB part of the camera +function camera_lens_offset(type) = type[3]; //! Offset of the lens center from the PCB centre +function camera_lens(type) = type[4]; //! Stack of lens parts, can be round, rectanular or rounded rectangular, with optional tapered aperture +function camera_connector(type) = type[5]; //! The flex connector block for the camera itself + +module camera(type) { //! Draw specified PCB camera + vitamin(str("camera(", type[0], "): ", type[1])); + pcb = camera_pcb(type); + + not_on_bom() + pcb(pcb); + + translate_z(pcb_thickness(pcb)) { + color(grey(20)) + translate(camera_lens_offset(type)) + for(p = camera_lens(type)) { + size = p[0]; + r = p[1]; + app = p[2]; + if(size.x) + rounded_rectangle(size, r, center = false); + else + translate_z(size.y) + rotate_extrude() + difference() { + square([r, size.z]); + + if(app) + translate([0, size.z]) + hull() { + translate([0, -eps]) + square([app.y, eps * 2]); + + translate([0, -app.z]) + square([app.x, app.z]); + } + } + } + conn = camera_connector(type); + if(conn) { + color(grey(20)) + translate(conn[0]) + rounded_rectangle(conn[1], 0.5, center = false); + + flex = [5, 0.1]; + color("orange") + hull() { + translate_z(flex.y /2) + translate(camera_lens_offset(type) + [0, camera_lens(type)[0][0].y / 2]) + cube([flex.x, eps, flex.y], center = true); + + translate_z(conn[1].z - flex.y) + translate(conn[0] - [0, conn[1].y / 2]) + cube([flex.x, eps, flex.y], center = true); + } + } + } +} diff --git a/vitamins/cameras.scad b/vitamins/cameras.scad new file mode 100644 index 0000000..e394960 --- /dev/null +++ b/vitamins/cameras.scad @@ -0,0 +1,58 @@ +// +// NopSCADlib Copyright Chris Palmer 2020 +// 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 + +rpi_camera_v1_pcb = ["", "", 25, 24, 1, 0, 2.1, 0, "green", false, [[2, -2], [-2, -2], [2, 9.6], [-2, 9.6]], + [ + [12, 3.25, 0, "-flat_flex", true], + [-4.5, -4, 0, "smd_led", LED0603, "red"], + [-5.5, -3, 0, "smd_res", RES0603, "10K"], + ], + []]; + +rpi_camera_v1 = ["rpi_camera_v1", "Raspberry Pi camera V1", rpi_camera_v1_pcb, [0, 9.6 - 12], + [ + [[8, 8, 3], 0], + [[0, 0, 4], 7.5 / 2], + [[0, 0, 5], 5.5 / 2, [1.5/2, 2/2, 0.5]], + ], + [[0, 12 - 1.5 - 2.5], [8, 5, 1]] +]; + +rpi_camera_pcb = ["", "", 36, 36, 1.6, 0, 3.2, 0, "green", false, [[3.5, -3.5], [-3.5, -3.5], [3.5, 3.5], [-3.5, 3.5]], + [ + [18, 4.25, 0, "-flat_flex", true], + [-3.8, -7.8, 0, "smd_led", LED0805, "red"], + ], + []]; + +rpi_camera = ["rpi_camera", "Raspberry Pi focusable camera", rpi_camera_pcb, [0, 0], + [ + [[13, 13, 3], 0], + [[22, 4, 3], 2 - eps], + [[0, 0, 8.5], 7], + [[0, 0, 12], 6], + [[0, 11, 4.3], 14 / 2, [8/2, 11/2, 1]], + ], + [[0, 18 - 1.5 - 2.5], [8, 5, 1]] +]; + +cameras = [rpi_camera_v1, rpi_camera]; + +use