Camera connector position and size separated.

Camera_lens() module added.
This commit is contained in:
Chris Palmer 2020-07-04 09:55:38 +01:00
parent 92d7e18b16
commit 235f7b86e3
4 changed files with 44 additions and 37 deletions

View File

@ -447,7 +447,8 @@ PCB cameras.
### Properties ### Properties
| Function | Description | | Function | Description |
|:--- |:--- | |:--- |:--- |
| ```camera_connector(type)``` | The flex connector block for the camera itself | | ```camera_connector_pos(type)``` | The flex connector block for the camera itself's position |
| ```camera_connector_size(type)``` | The flex connector block for the camera itself's size |
| ```camera_lens(type)``` | Stack of lens parts, can be round, rectanular or rounded rectangular, with optional tapered aperture | | ```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_lens_offset(type)``` | Offset of the lens center from the PCB centre |
| ```camera_pcb(type)``` | The PCB part of the camera | | ```camera_pcb(type)``` | The PCB part of the camera |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -26,29 +26,23 @@ use <pcb.scad>
function camera_pcb(type) = type[2]; //! The PCB part of the camera 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_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_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 function camera_connector_pos(type) = type[5]; //! The flex connector block for the camera itself's position
function camera_connector_size(type)= type[6]; //! The flex connector block for the camera itself's size
module camera(type) { //! Draw specified PCB camera module camera_lens(type, offset = 0)
vitamin(str("camera(", type[0], "): ", type[1]));
pcb = camera_pcb(type);
not_on_bom()
pcb(pcb);
translate_z(pcb_thickness(pcb)) {
color(grey(20)) color(grey(20))
translate(camera_lens_offset(type)) translate(camera_lens_offset(type))
for(p = camera_lens(type)) { for(p = camera_lens(type)) {
size = p[0]; size = p[0];
r = p[1]; r = p[1] + offset;
app = p[2]; app = p[2];
if(size.x) if(size.x)
rounded_rectangle(size, r, center = false); rounded_rectangle(size + [2 * offset, 2 * offset, round_to_layer(offset)], r, center = false);
else else
translate_z(size.y) translate_z(size.y)
rotate_extrude() rotate_extrude()
difference() { difference() {
square([r, size.z]); square([r, size.z + round_to_layer(offset)]);
if(app) if(app)
translate([0, size.z]) translate([0, size.z])
@ -61,11 +55,23 @@ module camera(type) { //! Draw specified PCB camera
} }
} }
} }
conn = camera_connector(type);
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)) {
camera_lens(type);
conn = camera_connector_size(type);
if(conn) { if(conn) {
pos = camera_connector_pos(type);
color(grey(20)) color(grey(20))
translate(conn[0]) translate(pos)
rounded_rectangle(conn[1], 0.5, center = false); rounded_rectangle(conn, 0.5, center = false);
flex = [5, 0.1]; flex = [5, 0.1];
color("orange") color("orange")
@ -74,8 +80,8 @@ module camera(type) { //! Draw specified PCB camera
translate(camera_lens_offset(type) + [0, camera_lens(type)[0][0].y / 2]) translate(camera_lens_offset(type) + [0, camera_lens(type)[0][0].y / 2])
cube([flex.x, eps, flex.y], center = true); cube([flex.x, eps, flex.y], center = true);
translate_z(conn[1].z - flex.y) translate_z(conn.z - flex.y)
translate(conn[0] - [0, conn[1].y / 2]) translate(pos - [0, conn.y / 2])
cube([flex.x, eps, flex.y], center = true); cube([flex.x, eps, flex.y], center = true);
} }
} }

View File

@ -22,7 +22,7 @@ rpi_camera_v1_pcb = ["", "", 25, 24, 1, 0, 2.1, 0, "green", false, [[2, -2], [-
[ [
[12, 3.25, 0, "-flat_flex", true], [12, 3.25, 0, "-flat_flex", true],
[-4.5, -5, 0, "smd_led", LED0603, "red"], [-4.5, -5, 0, "smd_led", LED0603, "red"],
[-5.5, -4, 0, "smd_res", RES0603, "10K"], [-5.5, -4, 0, "smd_res", RES0603, "1K2"],
], ],
[]]; []];
@ -32,7 +32,7 @@ rpi_camera_v1 = ["rpi_camera_v1", "Raspberry Pi camera V1", rpi_camera_v1_pcb, [
[[0, 0, 4], 7.5 / 2], [[0, 0, 4], 7.5 / 2],
[[0, 0, 5], 5.5 / 2, [1.5/2, 2/2, 0.5]], [[0, 0, 5], 5.5 / 2, [1.5/2, 2/2, 0.5]],
], ],
[[0, 12 - 1.5 - 2.5], [8, 5, 1]] [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]], 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]],
@ -50,7 +50,7 @@ rpi_camera = ["rpi_camera", "Raspberry Pi focusable camera", rpi_camera_pcb, [0,
[[0, 0, 12], 6], [[0, 0, 12], 6],
[[0, 11, 4.3], 14 / 2, [8/2, 11/2, 1]], [[0, 11, 4.3], 14 / 2, [8/2, 11/2, 1]],
], ],
[[0, 18 - 1.5 - 2.5], [8, 5, 1]] [0, 18 - 1.5 - 2.5], [8, 5, 1.6]
]; ];
cameras = [rpi_camera_v1, rpi_camera]; cameras = [rpi_camera_v1, rpi_camera];