Added LDR models
This commit is contained in:
parent
c68f879d13
commit
f85a7e85be
1
lib.scad
1
lib.scad
|
@ -60,6 +60,7 @@ include <vitamins/ball_bearings.scad>
|
|||
include <vitamins/light_strips.scad>
|
||||
include <vitamins/spools.scad>
|
||||
include <vitamins/mains_sockets.scad>
|
||||
include <vitamins/ldrs.scad>
|
||||
|
||||
use <vitamins/jack.scad>
|
||||
use <vitamins/meter.scad>
|
||||
|
|
BIN
libtest.png
BIN
libtest.png
Binary file not shown.
Before Width: | Height: | Size: 703 KiB After Width: | Height: | Size: 703 KiB |
|
@ -40,6 +40,7 @@ use <tests/inserts.scad>
|
|||
use <tests/jack.scad>
|
||||
use <tests/leadnuts.scad>
|
||||
use <tests/leds.scad>
|
||||
use <tests/ldrs.scad>
|
||||
use <tests/light_strips.scad>
|
||||
use <tests/linear_bearings.scad>
|
||||
use <tests/meter.scad>
|
||||
|
@ -252,6 +253,9 @@ components_y = toggles_y + 40;
|
|||
translate([x2, leds_y])
|
||||
leds();
|
||||
|
||||
translate([x2 + 40, leds_y])
|
||||
ldrs();
|
||||
|
||||
translate([x2 + 8, carriers_y])
|
||||
carriers();
|
||||
|
||||
|
|
62
readme.md
62
readme.md
|
@ -35,16 +35,17 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
|
|||
<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 = "#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 = "#Socket_box">Socket_box</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 = "#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 = "#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>
|
||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Ldrs">Ldrs</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 = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Nuts">Nuts</a> </td><td></td><td></td><td></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
---
|
||||
|
@ -951,6 +952,47 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r
|
|||
| 1 | ```jack_4mm_shielded("brown", 3, "sienna")``` | 4mm shielded jack socket brown |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="Ldrs"></a>
|
||||
## Ldrs
|
||||
Light dependent resistors.
|
||||
|
||||
Larger ones seem to have both a higher dark resistance and a lower bright light resistance.
|
||||
|
||||
|
||||
[vitamins/ldrs.scad](vitamins/ldrs.scad) Object definitions.
|
||||
|
||||
[vitamins/ldr.scad](vitamins/ldr.scad) Implementation.
|
||||
|
||||
[tests/ldrs.scad](tests/ldrs.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```ldr_active(type)``` | The active width |
|
||||
| ```ldr_description(type)``` | Description |
|
||||
| ```ldr_diameter(type)``` | The diameter of the round bit |
|
||||
| ```ldr_lead_d(type)``` | The lead diameter |
|
||||
| ```ldr_pitch(type)``` | Pitch between the leads |
|
||||
| ```ldr_thickness(type)``` | Thickness |
|
||||
| ```ldr_width(type)``` | Across the flats |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```LDR(type, lead_length = 3)``` | Draw an LDR, can specify the lead length |
|
||||
|
||||
![ldrs](tests/png/ldrs.png)
|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```ldr(large_ldr)``` | Light dependent resistor |
|
||||
| 1 | ```ldr(small_ldr)``` | Light dependent resistor |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
|
|
|
@ -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/>.
|
||||
//
|
||||
include <../vitamins/ldrs.scad>
|
||||
|
||||
use <../utils/layout.scad>
|
||||
|
||||
module ldrs()
|
||||
layout([for(l = ldrs) ldr_diameter(l)], 5)
|
||||
LDR(ldrs[$i]);
|
||||
|
||||
ldrs();
|
|
@ -108,7 +108,7 @@ module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to tak
|
|||
}
|
||||
}
|
||||
|
||||
module insert_lug(insert, wall, side, counter_bore = 0) {
|
||||
module insert_lug(insert, wall, side, counter_bore = 0) { //! Make a flying insert lug, see [ssr_shroud](#Ssr_shroud)
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Light dependent resistors.
|
||||
//!
|
||||
//! Larger ones seem to have both a higher dark resistance and a lower bright light resistance.
|
||||
//
|
||||
include <../core.scad>
|
||||
|
||||
function ldr_description(type) = type[1]; //! Description
|
||||
function ldr_diameter(type) = type[2]; //! The diameter of the round bit
|
||||
function ldr_width(type) = type[3]; //! Across the flats
|
||||
function ldr_thickness(type) = type[4]; //! Thickness
|
||||
function ldr_pitch(type) = type[5]; //! Pitch between the leads
|
||||
function ldr_active(type) = type[6]; //! The active width
|
||||
function ldr_lead_d(type) = type[7]; //! The lead diameter
|
||||
|
||||
module LDR(type, lead_length = 3) { //! Draw an LDR, can specify the lead length
|
||||
vitamin(str("ldr(", type[0], "): Light dependent resistor: ", ldr_description(type)));
|
||||
|
||||
module shape()
|
||||
intersection() {
|
||||
circle(d = ldr_diameter(type));
|
||||
|
||||
square([100, ldr_width(type)], center = true);
|
||||
}
|
||||
|
||||
function serpentine_t() = let(w = ldr_width(type), n = floor(w / 0.5) + 0.5) w / (n * 2);
|
||||
|
||||
module serpentine() {
|
||||
w = ldr_width(type);
|
||||
|
||||
t = serpentine_t();
|
||||
pitch = 2 * t;
|
||||
l = ldr_active(type);
|
||||
lines = ceil(w / pitch);
|
||||
|
||||
for(i = [0 : lines - 1])
|
||||
translate([0, i * pitch - w / 2 + t / 2]) {
|
||||
square([l - 3 * t, t], center = true);
|
||||
|
||||
end = i % 2 ? 1 : -1;
|
||||
$fn = 16;
|
||||
translate([end * (l / 2 - 1.5 * t), t])
|
||||
rotate(-end * 90)
|
||||
difference() {
|
||||
semi_circle(1.5 * t);
|
||||
|
||||
semi_circle(t / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t = ldr_thickness(type);
|
||||
|
||||
color("white")
|
||||
linear_extrude(height = t - 0.4)
|
||||
shape();
|
||||
|
||||
color("orange")
|
||||
translate_z(t - 0.4)
|
||||
linear_extrude(height = 0.1)
|
||||
shape();
|
||||
|
||||
color([0.9, 0.9, 0.9])
|
||||
translate_z(t - 0.3)
|
||||
linear_extrude(height = 0.1)
|
||||
difference() {
|
||||
offset(-serpentine_t())
|
||||
shape();
|
||||
|
||||
serpentine();
|
||||
}
|
||||
|
||||
color("silver")
|
||||
for(side = [-1, 1])
|
||||
translate([side * ldr_pitch(type) / 2, 0]) {
|
||||
translate_z(-lead_length)
|
||||
cylinder(d = ldr_lead_d(type), h = lead_length, $fn = 16);
|
||||
|
||||
translate_z(t - 0.3)
|
||||
cylinder(d = 1.5 * ldr_lead_d(type), h = 0.2, $fn = 16);
|
||||
}
|
||||
color([1, 1, 1, 0.25])
|
||||
translate_z(t - 0.3 + eps)
|
||||
linear_extrude(height = 0.3)
|
||||
shape();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
// Light dependent resistors.
|
||||
//
|
||||
small_ldr = ["small_ldr", "small", 5, 4.2, 1.8, 3.2, 2.5, 0.4];
|
||||
large_ldr = ["large_ldr", "large", 9.2, 7.9, 1.8, 6.8, 4.5, 0.5];
|
||||
|
||||
ldrs = [small_ldr, large_ldr];
|
||||
|
||||
use <ldr.scad>
|
Loading…
Reference in New Issue