mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-27 01:03:51 -05:00
Renamed meters to LED_meters and added ammeter version.
This commit is contained in:
parent
192460c0fa
commit
c9d10eeb8b
2
lib.scad
2
lib.scad
@ -40,6 +40,7 @@ include <vitamins/inserts.scad>
|
||||
include <vitamins/kp_pillow_blocks.scad>
|
||||
include <vitamins/ldrs.scad>
|
||||
include <vitamins/leadnuts.scad>
|
||||
include <vitamins/led_meter.scad>
|
||||
include <vitamins/light_strips.scad>
|
||||
include <vitamins/mains_sockets.scad>
|
||||
include <vitamins/modules.scad>
|
||||
@ -63,7 +64,6 @@ include <vitamins/variacs.scad>
|
||||
include <vitamins/zipties.scad>
|
||||
|
||||
use <vitamins/jack.scad>
|
||||
use <vitamins/meter.scad>
|
||||
use <vitamins/fuseholder.scad>
|
||||
use <vitamins/hygrometer.scad>
|
||||
|
||||
|
BIN
libtest.png
BIN
libtest.png
Binary file not shown.
Before Width: | Height: | Size: 787 KiB After Width: | Height: | Size: 788 KiB |
10
libtest.scad
10
libtest.scad
@ -48,7 +48,7 @@ use <tests/LDRs.scad>
|
||||
use <tests/LEDs.scad>
|
||||
use <tests/light_strips.scad>
|
||||
use <tests/linear_bearings.scad>
|
||||
use <tests/meter.scad>
|
||||
use <tests/LED_meters.scad>
|
||||
use <tests/microswitches.scad>
|
||||
use <tests/modules.scad>
|
||||
use <tests/nuts.scad>
|
||||
@ -280,16 +280,16 @@ components_y = toggles_y + 40;
|
||||
translate([x2, leds_y])
|
||||
leds();
|
||||
|
||||
translate([x2 + 40, leds_y])
|
||||
translate([x2 + 35, leds_y])
|
||||
ldrs();
|
||||
|
||||
translate([x2 + 8, carriers_y])
|
||||
carriers();
|
||||
|
||||
translate([x2+ 38, carriers_y])
|
||||
meters();
|
||||
translate([x2 + 20, carriers_y])
|
||||
led_meters();
|
||||
|
||||
translate([x2 + 68, carriers_y])
|
||||
translate([x2 + 70, leds_y])
|
||||
fuseholders();
|
||||
|
||||
translate([x2, spades_y])
|
||||
|
138
readme.md
138
readme.md
@ -21,12 +21,12 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
|
||||
<tr><td> <a href = "#Axials">Axials</a> </td><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Rails">Rails</a> </td><td> <a href = "#Box">Box</a> </td><td> <a href = "#Annotation">Annotation</a> </td><td> <a href = "#BOM">BOM</a> </td></tr>
|
||||
<tr><td> <a href = "#Ball_bearings">Ball_bearings</a> </td><td> <a href = "#KP_pillow_blocks">KP_pillow_blocks</a> </td><td> <a href = "#Ring_terminals">Ring_terminals</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 = "#Batteries">Batteries</a> </td><td> <a href = "#LDRs">LDRs</a> </td><td> <a href = "#Rockers">Rockers</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 = "#Belts">Belts</a> </td><td> <a href = "#LEDs">LEDs</a> </td><td> <a href = "#Rod">Rod</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 = "#Blowers">Blowers</a> </td><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#SCS_bearing_blocks">SCS_bearing_blocks</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 = "#Bulldogs">Bulldogs</a> </td><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#SK_brackets">SK_brackets</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 = "#Buttons">Buttons</a> </td><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#SMDs">SMDs</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 = "#Cable_strips">Cable_strips</a> </td><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#SSRs">SSRs</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 = "#Circlips">Circlips</a> </td><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Screws">Screws</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 = "#Belts">Belts</a> </td><td> <a href = "#LED_meters">LED_meters</a> </td><td> <a href = "#Rod">Rod</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 = "#Blowers">Blowers</a> </td><td> <a href = "#LEDs">LEDs</a> </td><td> <a href = "#SCS_bearing_blocks">SCS_bearing_blocks</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 = "#Bulldogs">Bulldogs</a> </td><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#SK_brackets">SK_brackets</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 = "#Buttons">Buttons</a> </td><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#SMDs">SMDs</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 = "#Cable_strips">Cable_strips</a> </td><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#SSRs">SSRs</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 = "#Circlips">Circlips</a> </td><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Screws">Screws</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 = "#Components">Components</a> </td><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Flat_hinge">Flat_hinge</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#DIP">DIP</a> </td><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
|
||||
@ -71,7 +71,7 @@ Axial components for PCBs.
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```ax_res(type, value, tol = 5, pitch = 0)``` | Through hole axial resistor. If ```pitch``` is zero the minimum is used. If below the minimum the resistor is placed vertical. |
|
||||
| ```wire_link(d, l, h = 1)``` | Draw a wire jumper link. |
|
||||
| ```wire_link(d, l, h = 1, tail = 3)``` | Draw a wire jumper link. |
|
||||
|
||||
![axials](tests/png/axials.png)
|
||||
|
||||
@ -1406,6 +1406,68 @@ Nuts for leadscrews.
|
||||
| 1 | ```leadnut(LSN8x8)``` | Leadscrew nut 8 x 8 RobotDigg |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="LED_meters"></a>
|
||||
## LED_meters
|
||||
LED voltmeter and ammeter modules available from China and a printed bezel that allows the voltmeter to be mounted into a
|
||||
CNC cut panel. The meter is held in the bezel by melting the stakes with a soldering iron set to 200°C. The
|
||||
bezel is fixed in the panel with hot glue.
|
||||
|
||||
The 7 SEGMENT.TTF font from the [docs](docs) directory needs to be installed to get realistic digits.
|
||||
|
||||
|
||||
[vitamins/led_meters.scad](vitamins/led_meters.scad) Object definitions.
|
||||
|
||||
[vitamins/led_meter.scad](vitamins/led_meter.scad) Implementation.
|
||||
|
||||
[tests/LED_meters.scad](tests/LED_meters.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```meter_hole_pitch(type)``` | Lug hole pitch |
|
||||
| ```meter_hole_radius(type)``` | Lug hole radius |
|
||||
| ```meter_lug_offset(type)``` | Lug position, 0 = center, +1 = top |
|
||||
| ```meter_lug_size(type)``` | Lug length and width |
|
||||
| ```meter_offset(type)``` | Display position, 0 = center, +1 = top |
|
||||
| ```meter_pcb_size(type)``` | PCB size excluding lugs |
|
||||
| ```meter_shunt(type)``` | Ampmeter shunt wire |
|
||||
| ```meter_size(type)``` | Size of display |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```meter_bezel_length(type)``` | Printed bezel length |
|
||||
| ```meter_bezel_rad(type)``` | Printed bezel corner radius |
|
||||
| ```meter_bezel_wall(type)``` | Printed bezel wall thickness |
|
||||
| ```meter_bezel_width(type)``` | Printed bezel width |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```meter(type, colour = "red", value = "888", display_colour = false)``` | Draw a meter with optional colour and display value |
|
||||
| ```meter_assembly(type, colour = "red", value = "888", display_colour = false)``` | Meter assembled into the bezel |
|
||||
| ```meter_bezel(type)``` | Generate the STL for the meter bezel |
|
||||
| ```meter_bezel_hole(type, h = 100)``` | Make a hole to fit the meter Bezel |
|
||||
| ```meter_hole_positions(type)``` | Position children over the holes |
|
||||
|
||||
![led_meters](tests/png/led_meters.png)
|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```meter(led_ameter, colour = "blue")``` | LED ammeter blue |
|
||||
| 1 | ```meter(led_meter, colour = "blue")``` | LED voltmeter blue |
|
||||
| 1 | ```meter(led_meter)``` | LED voltmeter red |
|
||||
|
||||
### Printed
|
||||
| Qty | Filename |
|
||||
| ---:|:--- |
|
||||
| 1 | meter_bezel.stl |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
@ -1612,68 +1674,6 @@ UK 13A sockets at the moment.
|
||||
| 1 | ```mains_socket(MKLOGIC)``` | Mains socket 13A, switched |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="Meter"></a>
|
||||
## Meter
|
||||
LED volt meter modules available from China and a printed bezel that allows them to be mounted into a
|
||||
CNC cut panel. The meter is held in the bezel by melting the stakes with a soldering iron set to 200°C. The
|
||||
bezel is fixed in the panel with hot glue.
|
||||
|
||||
The 7 SEGMENT.TTF font from the [docs](docs) directory needs to be installed to get realistic digits.
|
||||
|
||||
|
||||
[vitamins/meter.scad](vitamins/meter.scad) Implementation.
|
||||
|
||||
[tests/meter.scad](tests/meter.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```meter_height(type = led_meter)``` | Height of body excluding PCB |
|
||||
| ```meter_hole_pitch(type = led_meter)``` | Lug hole pitch |
|
||||
| ```meter_hole_radius(type = led_meter)``` | Lug hole radius |
|
||||
| ```meter_length(type = led_meter)``` | Length of body |
|
||||
| ```meter_lug_length(type = led_meter)``` | PCB length including lugs |
|
||||
| ```meter_lug_width(type = led_meter)``` | Lug width |
|
||||
| ```meter_pcb_length(type = led_meter)``` | PCB length excluding lugs |
|
||||
| ```meter_pcb_thickness(type = led_meter)``` | PCB thickness |
|
||||
| ```meter_pcb_width(type = led_meter)``` | PCB width |
|
||||
| ```meter_width(type = led_meter)``` | Width of body |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```meter()``` | Default meter type |
|
||||
| ```meter_bezel_length(type = led_meter)``` | Printed bezel length |
|
||||
| ```meter_bezel_rad(type = led_meter)``` | Printed bezel corner radius |
|
||||
| ```meter_bezel_wall(type = led_meter)``` | Printed bezel wall thickness |
|
||||
| ```meter_bezel_width(type = led_meter)``` | Printed bezel width |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```meter(type = led_meter, colour = "red", value = "888", display_colour = false)``` | Draw a meter with optional colour and display value |
|
||||
| ```meter_assembly(type = led_meter, colour = "red", value = "888", display_colour = false)``` | Meter assembled into the bezel |
|
||||
| ```meter_bezel(type = led_meter)``` | Generate the STL for the meter bezel |
|
||||
| ```meter_bezel_hole(type = led_meter, h = 100)``` | Make a hole to fit the meter Bezel |
|
||||
| ```meter_hole_positions(type = led_meter)``` | Position children over the holes |
|
||||
|
||||
![meter](tests/png/meter.png)
|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```meter(led_meter, colour = "blue")``` | LED meter blue |
|
||||
| 2 | ```meter(led_meter)``` | LED meter red |
|
||||
|
||||
### Printed
|
||||
| Qty | Filename |
|
||||
| ---:|:--- |
|
||||
| 2 | meter_bezel.stl |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
|
@ -17,23 +17,21 @@
|
||||
// If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
include <../utils/layout.scad>
|
||||
|
||||
use <../vitamins/meter.scad>
|
||||
include <../vitamins/led_meters.scad>
|
||||
|
||||
module meters()
|
||||
if($preview) {
|
||||
meter_assembly();
|
||||
module led_meters()
|
||||
layout([for(m = led_meters) meter_bezel_length(m)], 5) let(m = led_meters[$i])
|
||||
if($preview) {
|
||||
hflip()
|
||||
meter(m, colour = "blue", value = "123");
|
||||
|
||||
translate([0, meter_bezel_width() + 5])
|
||||
vflip()
|
||||
meter_assembly();
|
||||
if(!$i)
|
||||
translate([0, meter_bezel_width(m)])
|
||||
meter_assembly(m, value = "123");
|
||||
}
|
||||
else
|
||||
meter_bezel(m);
|
||||
|
||||
translate([0, -meter_bezel_width()])
|
||||
rotate([0, 180, 0])
|
||||
meter(colour = "blue", value = "123");
|
||||
}
|
||||
else
|
||||
meter_bezel();
|
||||
|
||||
|
||||
meters();
|
||||
led_meters();
|
BIN
tests/png/led_meters.png
Normal file
BIN
tests/png/led_meters.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
@ -23,9 +23,8 @@
|
||||
include <../utils/core/core.scad>
|
||||
include <../utils/round.scad>
|
||||
|
||||
module wire_link(d, l, h = 1) { //! Draw a wire jumper link.
|
||||
module wire_link(d, l, h = 1, tail = 3) { //! Draw a wire jumper link.
|
||||
r = d;
|
||||
tail = 3;
|
||||
$fn = 32;
|
||||
|
||||
color("silver") {
|
||||
|
145
vitamins/led_meter.scad
Normal file
145
vitamins/led_meter.scad
Normal file
@ -0,0 +1,145 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! LED voltmeter and ammeter modules available from China and a printed bezel that allows the voltmeter to be mounted into a
|
||||
//! CNC cut panel. The meter is held in the bezel by melting the stakes with a soldering iron set to 200°C. The
|
||||
//! bezel is fixed in the panel with hot glue.
|
||||
//!
|
||||
//! The 7 SEGMENT.TTF font from the [docs](docs) directory needs to be installed to get realistic digits.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
use <axial.scad>
|
||||
|
||||
function meter_size(type) = type[1]; //! Size of display
|
||||
function meter_offset(type) = type[2]; //! Display position, 0 = center, +1 = top
|
||||
function meter_pcb_size(type) = type[3]; //! PCB size excluding lugs
|
||||
function meter_lug_size(type) = type[4]; //! Lug length and width
|
||||
function meter_lug_offset(type) = type[5]; //! Lug position, 0 = center, +1 = top
|
||||
function meter_hole_pitch(type) = type[6]; //! Lug hole pitch
|
||||
function meter_hole_radius(type) = type[7]; //! Lug hole radius
|
||||
function meter_shunt(type) = type[8]; //! Ampmeter shunt wire
|
||||
|
||||
function meter_pos(type) = (meter_pcb_size(type).y - meter_size(type).y) * meter_offset(type) / 2;
|
||||
function meter_lug_pos(type) = (meter_pcb_size(type).y - meter_lug_size(type).y) * meter_lug_offset(type) / 2;
|
||||
|
||||
module meter_hole_positions(type) //! Position children over the holes
|
||||
for(side = [-1, 1])
|
||||
translate([side * meter_hole_pitch(type) / 2, meter_lug_pos(type)])
|
||||
children();
|
||||
|
||||
module meter(type, colour = "red", value = "888", display_colour = false) //! Draw a meter with optional colour and display value
|
||||
{
|
||||
vitamin(str("meter(", type[0], arg(colour, "red", "colour"), "): LED ", meter_shunt(type) ? "am" : "volt", "meter ", colour));
|
||||
|
||||
size = meter_size(type);
|
||||
|
||||
color("grey")
|
||||
translate([0, meter_pos(type), size.z / 2])
|
||||
cube(size, center = true);
|
||||
|
||||
color("green")
|
||||
translate_z(meter_size(type).z)
|
||||
linear_extrude(meter_pcb_size(type).z)
|
||||
difference() {
|
||||
union() {
|
||||
square([meter_pcb_size(type).x, meter_pcb_size(type).y], center = true);
|
||||
|
||||
translate([0, meter_lug_pos(type)])
|
||||
square([meter_lug_size(type).x, meter_lug_size(type).y], center = true);
|
||||
}
|
||||
meter_hole_positions(type)
|
||||
circle(meter_hole_radius(type));
|
||||
}
|
||||
|
||||
color(display_colour ? display_colour : colour)
|
||||
linear_extrude(0.2, center = true)
|
||||
mirror([1, 0, 0])
|
||||
translate([-size.x / 2 + 1, meter_pos(type)])
|
||||
resize([size.x - 2, size.y - 2]) {
|
||||
text(value, font = "7 segment", valign = "center");
|
||||
|
||||
square(eps); // Tiny invisible pixel at the origin so numbers starting with 1 scale correctly.
|
||||
}
|
||||
|
||||
shunt = meter_shunt(type);
|
||||
if(shunt)
|
||||
translate([0, -meter_pcb_size(type).y / 2 + meter_pos(type), size.z])
|
||||
vflip()
|
||||
color("#b87333")
|
||||
wire_link(shunt.y, shunt.x, shunt.z, tail = 2);
|
||||
}
|
||||
|
||||
clearance = 0.1;
|
||||
overlap = 1;
|
||||
flange_t = 1;
|
||||
|
||||
function meter_bezel_wall(type) = (meter_lug_size(type).x - meter_size(type).x) / 2; //! Printed bezel wall thickness
|
||||
function meter_bezel_rad(type) = meter_bezel_wall(type); //! Printed bezel corner radius
|
||||
function meter_bezel_length(type) = meter_size(type).x + 2 * (meter_bezel_wall(type) + overlap); //! Printed bezel length
|
||||
function meter_bezel_width(type) = meter_size(type).y + 2 * (meter_bezel_wall(type) + overlap); //! Printed bezel width
|
||||
|
||||
module meter_bezel_hole(type, h = 100) { //! Make a hole to fit the meter Bezel
|
||||
wall = meter_bezel_wall(type) + clearance;
|
||||
rad = meter_bezel_rad(type) + clearance;
|
||||
l = meter_size(type).x;
|
||||
w = meter_size(type).y;
|
||||
|
||||
extrude_if(h)
|
||||
rounded_square([l + 2 * wall, w + 2 * wall], rad);
|
||||
}
|
||||
|
||||
module meter_bezel(type) { //! Generate the STL for the meter bezel
|
||||
stl("meter_bezel");
|
||||
|
||||
wall = meter_bezel_wall(type);
|
||||
rad = meter_bezel_rad(type);
|
||||
l = meter_size(type).x;
|
||||
w = meter_size(type).y;
|
||||
h = meter_size(type).z;
|
||||
|
||||
union() {
|
||||
linear_extrude(h)
|
||||
difference() {
|
||||
rounded_square([l + 2 * wall, w + 2 * wall], rad);
|
||||
|
||||
square([l + 2 * clearance, w + 2 * clearance], center = true);
|
||||
}
|
||||
|
||||
linear_extrude(flange_t)
|
||||
difference() {
|
||||
rounded_square([l + 2 * wall + 2 * overlap, w + 2 * wall + 2 * overlap], rad + overlap);
|
||||
|
||||
square([l + 2 * clearance, w + 2 * clearance], center = true);
|
||||
}
|
||||
translate([0, -meter_pos(type)])
|
||||
meter_hole_positions(type)
|
||||
cylinder(r = meter_hole_radius(type), h = h + meter_pcb_size(type).z * 2);
|
||||
}
|
||||
}
|
||||
|
||||
module meter_assembly(type, colour = "red", value = "888", display_colour = false) { //! Meter assembled into the bezel
|
||||
hflip()
|
||||
translate_z(-flange_t) {
|
||||
color("dimgrey") meter_bezel(type);
|
||||
|
||||
translate([0, -meter_pos(type)])
|
||||
meter(type, colour, value, display_colour);
|
||||
}
|
||||
}
|
26
vitamins/led_meters.scad
Normal file
26
vitamins/led_meters.scad
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
// display size offset pcb size lug size offset hole pitch and size
|
||||
led_meter = ["led_meter", [22.72, 10.14, 6.3], 0, [22.72, 11.04, 0.96], [30, 4.2], 0, 26, 2.2 / 2, false];
|
||||
led_ameter = ["led_ameter", [22.72, 14.05, 7.3], 1, [27.5, 18.54, 1.2], [35, 6.25], 1, 29, 3.0 / 2, [15.5, 1.5, 7.75]];
|
||||
|
||||
led_meters = [led_meter, led_ameter];
|
||||
|
||||
use <led_meter.scad>
|
@ -1,130 +0,0 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! LED volt meter modules available from China and a printed bezel that allows them to be mounted into a
|
||||
//! CNC cut panel. The meter is held in the bezel by melting the stakes with a soldering iron set to 200°C. The
|
||||
//! bezel is fixed in the panel with hot glue.
|
||||
//!
|
||||
//! The 7 SEGMENT.TTF font from the [docs](docs) directory needs to be installed to get realistic digits.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
|
||||
led_meter = ["led_meter", 22.72, 10.14, 6.3, 22.72, 11.04, 0.96, 30, 4.2, 26, 2.2 / 2];
|
||||
|
||||
function meter() = led_meter; //! Default meter type
|
||||
|
||||
function meter_length(type = led_meter) = type[1]; //! Length of body
|
||||
function meter_width(type = led_meter) = type[2]; //! Width of body
|
||||
function meter_height(type = led_meter) = type[3]; //! Height of body excluding PCB
|
||||
function meter_pcb_length(type = led_meter) = type[4]; //! PCB length excluding lugs
|
||||
function meter_pcb_width(type = led_meter) = type[5]; //! PCB width
|
||||
function meter_pcb_thickness(type = led_meter) = type[6]; //! PCB thickness
|
||||
function meter_lug_length(type = led_meter) = type[7]; //! PCB length including lugs
|
||||
function meter_lug_width(type = led_meter) = type[8]; //! Lug width
|
||||
function meter_hole_pitch(type = led_meter) = type[9]; //! Lug hole pitch
|
||||
function meter_hole_radius(type = led_meter) = type[10]; //! Lug hole radius
|
||||
|
||||
module meter_hole_positions(type = led_meter) //! Position children over the holes
|
||||
for(side = [-1, 1])
|
||||
translate([side * meter_hole_pitch(type) / 2, 0])
|
||||
children();
|
||||
|
||||
module meter(type = led_meter, colour = "red", value = "888", display_colour = false) //! Draw a meter with optional colour and display value
|
||||
{
|
||||
vitamin(str("meter(", type[0], arg(colour, "red", "colour"), "): LED meter ", colour));
|
||||
|
||||
color("grey")
|
||||
translate_z(meter_height(type) / 2)
|
||||
cube([meter_length(type), meter_width(type), meter_height(type)], center = true);
|
||||
|
||||
color("green")
|
||||
translate_z(meter_height(type))
|
||||
linear_extrude(meter_pcb_thickness(type))
|
||||
difference() {
|
||||
union() {
|
||||
square([meter_pcb_length(type), meter_pcb_width(type)], center = true);
|
||||
|
||||
square([meter_lug_length(type), meter_lug_width(type)], center = true);
|
||||
}
|
||||
meter_hole_positions(type)
|
||||
circle(meter_hole_radius(type));
|
||||
}
|
||||
|
||||
color(display_colour ? display_colour : colour)
|
||||
linear_extrude(0.2, center = true)
|
||||
mirror([1,0,0])
|
||||
text(value, font = "7 segment", valign = "center", halign = "center", size = meter_width(type) - 2, spacing = 1.2);
|
||||
}
|
||||
|
||||
clearance = 0.1;
|
||||
overlap = 1;
|
||||
flange_t = 1;
|
||||
|
||||
function meter_bezel_wall(type = led_meter) = (meter_lug_length(type) - meter_length(type)) / 2; //! Printed bezel wall thickness
|
||||
function meter_bezel_rad(type = led_meter) = meter_bezel_wall(type); //! Printed bezel corner radius
|
||||
function meter_bezel_length(type = led_meter) = meter_length(type) + 2 * (meter_bezel_wall(type) + overlap); //! Printed bezel length
|
||||
function meter_bezel_width(type = led_meter) = meter_width(type) + 2 * (meter_bezel_wall(type) + overlap); //! Printed bezel width
|
||||
|
||||
module meter_bezel_hole(type = led_meter, h = 100) { //! Make a hole to fit the meter Bezel
|
||||
wall = meter_bezel_wall(type) + clearance;
|
||||
rad = meter_bezel_rad(type) + clearance;
|
||||
l = meter_length(type);
|
||||
w = meter_width(type);
|
||||
|
||||
extrude_if(h)
|
||||
rounded_square([l + 2 * wall, w + 2 * wall], rad);
|
||||
}
|
||||
|
||||
module meter_bezel(type = led_meter) { //! Generate the STL for the meter bezel
|
||||
stl("meter_bezel");
|
||||
|
||||
wall = meter_bezel_wall(type);
|
||||
rad = meter_bezel_rad(type);
|
||||
l = meter_length(type);
|
||||
w = meter_width(type);
|
||||
h = meter_height(type);
|
||||
|
||||
union() {
|
||||
linear_extrude(h)
|
||||
difference() {
|
||||
rounded_square([l + 2 * wall, w + 2 * wall], rad);
|
||||
|
||||
square([l + 2 * clearance, w + 2 * clearance], center = true);
|
||||
}
|
||||
|
||||
linear_extrude(flange_t)
|
||||
difference() {
|
||||
rounded_square([l + 2 * wall + 2 * overlap, w + 2 * wall + 2 * overlap], rad + overlap);
|
||||
|
||||
square([l + 2 * clearance, w + 2 * clearance], center = true);
|
||||
}
|
||||
meter_hole_positions(type)
|
||||
cylinder(r = meter_hole_radius(type), h = h + meter_pcb_thickness(type) * 2);
|
||||
}
|
||||
}
|
||||
|
||||
module meter_assembly(type = led_meter, colour = "red", value = "888", display_colour = false) { //! Meter assembled into the bezel
|
||||
vflip()
|
||||
translate_z(-flange_t) {
|
||||
color("dimgrey") meter_bezel(type);
|
||||
|
||||
meter(type, colour, value, display_colour);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user