Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c9aad0178e | ||
|
df96551b11 | ||
|
a5a360e0d1 | ||
|
828e5ad36e | ||
|
cedaafed3d | ||
|
0d38d82416 | ||
|
041341b946 | ||
|
70622ba8de | ||
|
4ab0a981ef | ||
|
bb7dd51270 | ||
|
48293b9abd | ||
|
c9d10eeb8b | ||
|
192460c0fa | ||
|
d4402c6713 | ||
|
b9890ca589 |
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 232 KiB |
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 202 KiB |
3
lib.scad
@@ -40,9 +40,11 @@ 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>
|
||||
include <vitamins/panel_meters.scad>
|
||||
include <vitamins/pillars.scad>
|
||||
include <vitamins/pin_headers.scad>
|
||||
include <vitamins/pulleys.scad>
|
||||
@@ -63,7 +65,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
Before Width: | Height: | Size: 787 KiB After Width: | Height: | Size: 794 KiB |
20
libtest.scad
@@ -48,12 +48,13 @@ 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>
|
||||
use <tests/o_ring.scad>
|
||||
use <tests/opengrab.scad>
|
||||
use <tests/panel_meters.scad>
|
||||
use <tests/PCBs.scad>
|
||||
use <tests/pillars.scad>
|
||||
use <tests/PSUs.scad>
|
||||
@@ -280,16 +281,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])
|
||||
@@ -321,7 +322,8 @@ ssrs_y = modules_y + 80;
|
||||
blowers_y = ssrs_y + 60;
|
||||
batteries_y = blowers_y + 100;
|
||||
steppers_y = batteries_y + 70;
|
||||
extrusions_y = steppers_y + 100;
|
||||
panel_meters_y = steppers_y + 70;
|
||||
extrusions_y = panel_meters_y + 80;
|
||||
|
||||
translate([x3, veroboard_y])
|
||||
veroboard_test();
|
||||
@@ -362,9 +364,11 @@ translate([x3, batteries_y])
|
||||
translate([x2, steppers_y]) // interloper
|
||||
stepper_motors();
|
||||
|
||||
translate([x2, extrusions_y]) {
|
||||
translate([x2, panel_meters_y])
|
||||
panel_meters();
|
||||
|
||||
translate([x2, extrusions_y])
|
||||
extrusions();
|
||||
}
|
||||
|
||||
translate([x3, transformers_y])
|
||||
transformers();
|
||||
|
@@ -71,7 +71,7 @@ function pbox_mid_offset(type) = pbox_ridges(type).y + pbox_wall(type) / 2; // O
|
||||
|
||||
function pbox_screw_inset(type) = //! How far the base screws are inset
|
||||
let(foot = pbox_foot(type),
|
||||
r = foot ? foot_diameter(foot) / 2 : washer_radius(pbox_washer(type)),
|
||||
r = foot ? foot_diameter(foot) / 2 : pbox_base(type) ? washer_radius(pbox_washer(type)) : insert_hole_radius(pbox_insert(type)),
|
||||
R = pbox_radius(type)
|
||||
) max(r, R - (R - r) / sqrt(2));
|
||||
|
||||
|
269
readme.md
@@ -21,26 +21,27 @@ 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 = "#SSRs">SSRs</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 = "#Screws">Screws</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 = "#Sealing_strip">Sealing_strip</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 = "#Sheets">Sheets</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 = "#Spades">Spades</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 = "#Spools">Spools</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#PCB_mount">PCB_mount</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#O_ring">O_ring</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td> <a href = "#PSU_shroud">PSU_shroud</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Extrusions">Extrusions</a> </td><td> <a href = "#Opengrab">Opengrab</a> </td><td> <a href = "#Swiss_clips">Swiss_clips</a> </td><td> <a href = "#Printed_box">Printed_box</a> </td><td> <a href = "#Thread">Thread</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#PCB">PCB</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#PCBs">PCBs</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td> <a href = "#SSR_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Geared_steppers">Geared_steppers</a> </td><td> <a href = "#PSUs">PSUs</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Pillars">Pillars</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Pin_headers">Pin_headers</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Hygrometer">Hygrometer</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#IECs">IECs</a> </td><td></td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Inserts">Inserts</a> </td><td></td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></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>
|
||||
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#PCB_mount">PCB_mount</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#O_ring">O_ring</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#PSU_shroud">PSU_shroud</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Extrusions">Extrusions</a> </td><td> <a href = "#Opengrab">Opengrab</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td> <a href = "#Printed_box">Printed_box</a> </td><td> <a href = "#Thread">Thread</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#PCB">PCB</a> </td><td> <a href = "#Swiss_clips">Swiss_clips</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#PCBs">PCBs</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td> <a href = "#SSR_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Geared_steppers">Geared_steppers</a> </td><td> <a href = "#PSUs">PSUs</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Panel_meters">Panel_meters</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Pillars">Pillars</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Hygrometer">Hygrometer</a> </td><td> <a href = "#Pin_headers">Pin_headers</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#IECs">IECs</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Inserts">Inserts</a> </td><td></td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td></td><td></td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
---
|
||||
@@ -70,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. |
|
||||
|
||||

|
||||
|
||||
@@ -1405,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 |
|
||||
|
||||

|
||||
|
||||
### 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>
|
||||
|
||||
---
|
||||
@@ -1611,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 |
|
||||
|
||||

|
||||
|
||||
### 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>
|
||||
|
||||
---
|
||||
@@ -1946,6 +1947,60 @@ A permanent magnet that can be magnatized and de-magnatized electronically.
|
||||
| 1 | ```opengrab()``` | OpenGrab V3 electro permanent magnet |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="Panel_meters"></a>
|
||||
## Panel_meters
|
||||
Panel mounted digital meter modules
|
||||
|
||||
Notes on the DSN_VC288:
|
||||
|
||||
* The tabs aren't modelled because they can be fully retracted if the PCB is removed.
|
||||
* The current connector isn't moddelled as it is awkwardly tall. I remove it and solder wires instead.
|
||||
|
||||
|
||||
[vitamins/panel_meters.scad](vitamins/panel_meters.scad) Object definitions.
|
||||
|
||||
[vitamins/panel_meter.scad](vitamins/panel_meter.scad) Implementation.
|
||||
|
||||
[tests/panel_meters.scad](tests/panel_meters.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```pmeter_aperture(type)``` | Aperture length, width and bevel |
|
||||
| ```pmeter_bevel(type)``` | Bezel bevel inset and start height |
|
||||
| ```pmeter_bezel(type)``` | Bezel size |
|
||||
| ```pmeter_bezel_r(type)``` | Bezel radius |
|
||||
| ```pmeter_pcb(type)``` | Optional PCB for open types |
|
||||
| ```pmeter_pcb_z(type)``` | Distance of PCB from the back |
|
||||
| ```pmeter_size(type)``` | Body size including bezel height |
|
||||
| ```pmeter_tab(type)``` | Tab size |
|
||||
| ```pmeter_tab_z(type)``` | Tab vertical position |
|
||||
| ```pmeter_thickness(type)``` | Wall thickness if not closed |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```pmeter_depth(type)``` | Depth below bezel |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```panel_meter(type)``` | Draw panel mounted LCD meter module |
|
||||
| ```panel_meter_cutout(type, h = 0)``` | Make panel cutout |
|
||||
|
||||

|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```panel_meter(DSN_VC288)``` | DSN-VC288 DC 100V 10A Voltmeter ammeter |
|
||||
| 1 | ```panel_meter(PZEM001)``` | Peacefair PZEM-001 AC digital multi-function meter |
|
||||
| 1 | ```panel_meter(PZEM021)``` | Peacefair PZEM-021 AC digital multi-function meter |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
@@ -1995,6 +2050,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```barrel_jack(cutout = false)``` | Draw barrel power jack |
|
||||
| ```block(size, colour, makes_cutout, cutouts)``` | Draw a coloured cube to represent a random PCB component |
|
||||
| ```buzzer(height, diameter, colour)``` | Draw PCB buzzer with specified height, diameter and colour |
|
||||
| ```chip(length, width, thickness, colour, cutout = false)``` | Draw a coloured cube to represent a chip, or other rectangular component |
|
||||
| ```flat_flex(cutout = false)``` | Draw flat flexistrip connector as used on RPI0 |
|
||||
@@ -2053,6 +2109,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
|
||||
| 1 | ```ax_res(res1_4, 10000)``` | Resistor 10000 Ohms 5% 0.25W |
|
||||
| 1 | ```ax_res(res1_2, 100000)``` | Resistor 100000 Ohms 5% 0.5W |
|
||||
| 1 | ```ax_res(res1_8, 1e+6, tol = 1)``` | Resistor 1e+6 Ohms 1% 0.125W |
|
||||
| 1 | ```smd_led(LED0805, red)``` | SMD LED 0805 red |
|
||||
| 1 | ```square_button(button_6mm)``` | Square button 6mm |
|
||||
| 1 | ```pcb(TMC2130)``` | TMC2130 |
|
||||
| 1 | ```green_terminal(gt_5p08, 2)``` | Terminal block 2 way 0.2" |
|
||||
@@ -2118,6 +2175,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```barrel_jack(cutout = false)``` | Draw barrel power jack |
|
||||
| ```block(size, colour, makes_cutout, cutouts)``` | Draw a coloured cube to represent a random PCB component |
|
||||
| ```buzzer(height, diameter, colour)``` | Draw PCB buzzer with specified height, diameter and colour |
|
||||
| ```chip(length, width, thickness, colour, cutout = false)``` | Draw a coloured cube to represent a chip, or other rectangular component |
|
||||
| ```flat_flex(cutout = false)``` | Draw flat flexistrip connector as used on RPI0 |
|
||||
@@ -2987,6 +3045,46 @@ SK shaft support brackets
|
||||
| 6 | ```washer(M5_washer)``` | Washer M5 x 10mm x 1mm |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="SMDs"></a>
|
||||
## SMDs
|
||||
Surface mount components for PCBs.
|
||||
|
||||
|
||||
[vitamins/smds.scad](vitamins/smds.scad) Object definitions.
|
||||
|
||||
[vitamins/smd.scad](vitamins/smd.scad) Implementation.
|
||||
|
||||
[tests/SMDs.scad](tests/SMDs.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```smd_led_lens(type)``` | Lens length width and height |
|
||||
| ```smd_led_size(type)``` | Body length, width and height |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```smd_100th(x)``` | Convert dimesion to 1/100" notation |
|
||||
| ```smd_led_height(type)``` | Total height |
|
||||
| ```smd_size(size)``` | Convert size to 1/100" notation |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```smd_led(type, colour, cutout)``` | Draw an SMD LED with specified ```colour``` |
|
||||
|
||||

|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```smd_led(LED0805, green)``` | SMD LED 0805 green |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
@@ -5512,10 +5610,11 @@ The module provides `poly_circle()`, `poly_cylinder()` and `poly_ring()` that is
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```drill(r, h = 100)``` | Make a cylinder for drilling holes suitable for CNC routing, set h = 0 for circle |
|
||||
| ```drill(r, h = 100, center = true)``` | Make a cylinder for drilling holes suitable for CNC routing, set h = 0 for circle |
|
||||
| ```poly_circle(r, sides = 0)``` | Make a circle adjusted to print the correct size |
|
||||
| ```poly_cylinder(r, h, center = false, sides = 0)``` | Make a cylinder adjusted to print the correct size |
|
||||
| ```poly_ring(or, ir)``` | Make a 2D ring adjusted to have the correct internal radius |
|
||||
| ```poly_drill(r, h = 100, center = true)``` | Make a cylinder for drilling holes suitable for CNC routing if cnc_bit_r is non zero, otherwise a poly_cylinder. |
|
||||
| ```poly_ring(or, ir, sides = 0)``` | Make a 2D ring adjusted to have the correct internal radius |
|
||||
| ```poly_tube(or, ir, h, center = false)``` | Make a tube adjusted to have the correct internal radius |
|
||||
| ```slot(r, l, h = 100)``` | Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version |
|
||||
|
||||
|
@@ -213,7 +213,7 @@ def parse_bom(file = "openscad.log", name = None):
|
||||
main.assemblies[stack[-1]].add_part(s)
|
||||
else:
|
||||
if 'ERROR:' in line or 'WARNING:' in line:
|
||||
print(line[:-1])
|
||||
raise Exception(line[:-1])
|
||||
return main
|
||||
|
||||
def usage():
|
||||
@@ -221,53 +221,57 @@ def usage():
|
||||
sys.exit(1)
|
||||
|
||||
def boms(target = None, assembly = None):
|
||||
bom_dir = set_config(target, usage) + "bom"
|
||||
if assembly:
|
||||
bom_dir += "/accessories"
|
||||
if not os.path.isdir(bom_dir):
|
||||
try:
|
||||
bom_dir = set_config(target, usage) + "bom"
|
||||
if assembly:
|
||||
bom_dir += "/accessories"
|
||||
if not os.path.isdir(bom_dir):
|
||||
os.makedirs(bom_dir)
|
||||
else:
|
||||
assembly = "main_assembly"
|
||||
if os.path.isdir(bom_dir):
|
||||
shutil.rmtree(bom_dir)
|
||||
sleep(0.1)
|
||||
os.makedirs(bom_dir)
|
||||
else:
|
||||
assembly = "main_assembly"
|
||||
if os.path.isdir(bom_dir):
|
||||
shutil.rmtree(bom_dir)
|
||||
sleep(0.1)
|
||||
os.makedirs(bom_dir)
|
||||
#
|
||||
# Find the scad file that makes the module
|
||||
#
|
||||
scad_file = find_scad_file(assembly)
|
||||
if not scad_file:
|
||||
raise Exception("can't find source for " + assembly)
|
||||
#
|
||||
# make a file to use the module
|
||||
#
|
||||
bom_maker_name = source_dir + "/bom.scad"
|
||||
with open(bom_maker_name, "w") as f:
|
||||
f.write("use <%s>\n" % scad_file)
|
||||
f.write("%s();\n" % assembly);
|
||||
#
|
||||
# Run openscad
|
||||
#
|
||||
openscad.run("-D", "$bom=2", "-D", "$preview=true", "--hardwarnings", "-o", "openscad.echo", "-d", bom_dir + "/bom.deps", bom_maker_name)
|
||||
os.remove(bom_maker_name)
|
||||
print("Generating bom ...", end=" ")
|
||||
#
|
||||
# Find the scad file that makes the module
|
||||
#
|
||||
scad_file = find_scad_file(assembly)
|
||||
if not scad_file:
|
||||
raise Exception("can't find source for " + assembly)
|
||||
#
|
||||
# make a file to use the module
|
||||
#
|
||||
bom_maker_name = source_dir + "/bom.scad"
|
||||
with open(bom_maker_name, "w") as f:
|
||||
f.write("use <%s>\n" % scad_file)
|
||||
f.write("%s();\n" % assembly);
|
||||
#
|
||||
# Run openscad
|
||||
#
|
||||
openscad.run("-D", "$bom=2", "-D", "$preview=true", "--hardwarnings", "-o", "openscad.echo", "-d", bom_dir + "/bom.deps", bom_maker_name)
|
||||
os.remove(bom_maker_name)
|
||||
print("Generating bom ...", end=" ")
|
||||
|
||||
main = parse_bom("openscad.echo", assembly)
|
||||
main = parse_bom("openscad.echo", assembly)
|
||||
|
||||
if assembly == "main_assembly":
|
||||
main.print_bom(True, open(bom_dir + "/bom.txt","wt"))
|
||||
if assembly == "main_assembly":
|
||||
main.print_bom(True, open(bom_dir + "/bom.txt","wt"))
|
||||
|
||||
for ass in main.assemblies:
|
||||
with open(bom_dir + "/" + ass + ".txt", "wt") as f:
|
||||
bom = main.assemblies[ass]
|
||||
print(bom.make_name(ass) + ":", file=f)
|
||||
bom.print_bom(False, f)
|
||||
for ass in main.assemblies:
|
||||
with open(bom_dir + "/" + ass + ".txt", "wt") as f:
|
||||
bom = main.assemblies[ass]
|
||||
print(bom.make_name(ass) + ":", file=f)
|
||||
bom.print_bom(False, f)
|
||||
|
||||
data = [main.assemblies[ass].flat_data() for ass in main.ordered_assemblies]
|
||||
with open(bom_dir + "/bom.json", 'w') as outfile:
|
||||
json.dump(data, outfile, indent = 4)
|
||||
data = [main.assemblies[ass].flat_data() for ass in main.ordered_assemblies]
|
||||
with open(bom_dir + "/bom.json", 'w') as outfile:
|
||||
json.dump(data, outfile, indent = 4)
|
||||
|
||||
print("done")
|
||||
print("done")
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 3: usage()
|
||||
@@ -286,8 +290,4 @@ if __name__ == '__main__':
|
||||
if assembly:
|
||||
if assembly[-9:] != "_assembly": usage()
|
||||
|
||||
try:
|
||||
boms(target, assembly)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
sys.exit(1)
|
||||
boms(target, assembly)
|
||||
|
@@ -30,7 +30,7 @@ def usage():
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 2: usage()
|
||||
if len(sys.argv) > 2: usage()
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
target = sys.argv[1]
|
||||
|
37
tests/LED_meters.scad
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// 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 <../utils/core/core.scad>
|
||||
include <../utils/layout.scad>
|
||||
|
||||
include <../vitamins/led_meters.scad>
|
||||
|
||||
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");
|
||||
|
||||
if(!$i)
|
||||
translate([0, meter_bezel_width(m)])
|
||||
meter_assembly(m, value = "123");
|
||||
}
|
||||
else
|
||||
meter_bezel(m);
|
||||
|
||||
led_meters();
|
@@ -21,6 +21,7 @@ include <../vitamins/microswitches.scad>
|
||||
include <../vitamins/d_connectors.scad>
|
||||
include <../vitamins/leds.scad>
|
||||
include <../vitamins/axials.scad>
|
||||
include <../vitamins/smds.scad>
|
||||
|
||||
use <../vitamins/pcb.scad>
|
||||
|
||||
@@ -58,7 +59,7 @@ test_pcb = ["TestPCB", "Test PCB",
|
||||
[
|
||||
[ 20, -5, 180, "trimpot10"],
|
||||
[ 20, -15, 0, "trimpot10", true],
|
||||
|
||||
[ 10, 2, 0, "smd_led", LED0805, "red"],
|
||||
[ 10, 10, 0, "2p54header", 4, 1],
|
||||
[ 25, 10, 0, "2p54header", 5, 1, undef, "blue" ],
|
||||
[ 10, 20, 0, "2p54boxhdr", 4, 2],
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NopSCADlib Copyright Chris Palmer 2018
|
||||
// NopSCADlib Copyright Chris Palmer 2020
|
||||
// nop.head@gmail.com
|
||||
// hydraraptor.blogspot.com
|
||||
//
|
||||
@@ -17,23 +17,13 @@
|
||||
// If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
use <../utils/layout.scad>
|
||||
|
||||
use <../vitamins/meter.scad>
|
||||
include <../vitamins/smds.scad>
|
||||
|
||||
module meters()
|
||||
if($preview) {
|
||||
meter_assembly();
|
||||
module smds()
|
||||
layout([for(l = smd_leds) smd_led_size(l).x], 1)
|
||||
smd_led(smd_leds[$i], ["green", "blue", "red"][$i % 3]);
|
||||
|
||||
translate([0, meter_bezel_width() + 5])
|
||||
vflip()
|
||||
meter_assembly();
|
||||
|
||||
translate([0, -meter_bezel_width()])
|
||||
rotate([0, 180, 0])
|
||||
meter(colour = "blue", value = "123");
|
||||
}
|
||||
else
|
||||
meter_bezel();
|
||||
|
||||
|
||||
meters();
|
||||
if($preview)
|
||||
smds();
|
29
tests/panel_meters.scad
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
include <../core.scad>
|
||||
use <../utils/layout.scad>
|
||||
|
||||
include <../vitamins/panel_meters.scad>
|
||||
|
||||
module panel_meters()
|
||||
layout([for(p = panel_meters) pmeter_size(p).x], 20)
|
||||
panel_meter(panel_meters[$i]);
|
||||
|
||||
if($preview)
|
||||
panel_meters();
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 72 KiB |
BIN
tests/png/led_meters.png
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
tests/png/panel_meters.png
Normal file
After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 168 KiB |
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |
BIN
tests/png/smds.png
Normal file
After Width: | Height: | Size: 52 KiB |
@@ -36,29 +36,29 @@ module poly_cylinder(r, h, center = false, sides = 0) //! Make a cylinder adjust
|
||||
extrude_if(h, center)
|
||||
poly_circle(r, sides);
|
||||
|
||||
module poly_ring(or, ir) { //! Make a 2D ring adjusted to have the correct internal radius
|
||||
cir = corrected_radius(ir);
|
||||
module poly_ring(or, ir, sides = 0) { //! Make a 2D ring adjusted to have the correct internal radius
|
||||
cir = corrected_radius(ir, sides);
|
||||
filaments = (or - cir) / extrusion_width;
|
||||
if(filaments > 3 + eps)
|
||||
difference() {
|
||||
circle(or);
|
||||
|
||||
poly_circle(ir);
|
||||
poly_circle(ir, sides);
|
||||
}
|
||||
else
|
||||
if(filaments >= 2)
|
||||
difference() {
|
||||
offset(or - cir)
|
||||
poly_circle(ir);
|
||||
poly_circle(ir, sides);
|
||||
|
||||
poly_circle(ir);
|
||||
poly_circle(ir, sides);
|
||||
}
|
||||
else
|
||||
difference() {
|
||||
poly_circle(or);
|
||||
poly_circle(or, sides);
|
||||
|
||||
offset(-squeezed_wall)
|
||||
poly_circle(or);
|
||||
poly_circle(or, sides);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,16 @@ module poly_tube(or, ir, h, center = false) //! Make a tube adjusted to have the
|
||||
extrude_if(h, center)
|
||||
poly_ring(or, ir);
|
||||
|
||||
module drill(r, h = 100) //! Make a cylinder for drilling holes suitable for CNC routing, set h = 0 for circle
|
||||
extrude_if(h)
|
||||
module drill(r, h = 100, center = true) //! Make a cylinder for drilling holes suitable for CNC routing, set h = 0 for circle
|
||||
extrude_if(h, center)
|
||||
circle(r = corrected_radius(r, r2sides(r)));
|
||||
|
||||
module poly_drill(r, h = 100, center = true) //! Make a cylinder for drilling holes suitable for CNC routing if cnc_bit_r is non zero, otherwise a poly_cylinder.
|
||||
if(cnc_bit_r)
|
||||
drill(r, h, center = true);
|
||||
else
|
||||
poly_cylinder(r, h, center);
|
||||
|
||||
//
|
||||
// Horizontal slot
|
||||
//
|
||||
|
@@ -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") {
|
||||
|
@@ -29,7 +29,7 @@ flange_d = 45.5;
|
||||
flange_t = 1.5;
|
||||
flange_d2 = 32;
|
||||
flange_t2 = 2;
|
||||
apperture_d = 24.7;
|
||||
aperture_d = 24.7;
|
||||
hygrometer_hole_r = 21.3;
|
||||
slot_w = 5.5;
|
||||
|
||||
@@ -55,8 +55,8 @@ module hygrometer() { //! Draw a hygrometer
|
||||
rotate_extrude()
|
||||
polygon([
|
||||
[0, 0],
|
||||
[apperture_d / 2, 0],
|
||||
[apperture_d / 2, flange_t],
|
||||
[aperture_d / 2, 0],
|
||||
[aperture_d / 2, flange_t],
|
||||
[flange_d2 / 2, flange_t2],
|
||||
[flange_d / 2, flange_t],
|
||||
[flange_d / 2, 0],
|
||||
@@ -66,21 +66,21 @@ module hygrometer() { //! Draw a hygrometer
|
||||
]);
|
||||
|
||||
color("#94A7AB")
|
||||
cylinder(d = apperture_d, h = eps);
|
||||
cylinder(d = aperture_d, h = eps);
|
||||
|
||||
color("black")
|
||||
linear_extrude(0.2, center = true) {
|
||||
translate([0, 3])
|
||||
text("20_4", font = "7 segment", valign = "bottom", halign = "center", size = apperture_d / 6);
|
||||
text("20_4", font = "7 segment", valign = "bottom", halign = "center", size = aperture_d / 6);
|
||||
|
||||
translate([7, 3])
|
||||
text("C", font = "7 segment", valign = "bottom", halign = "center", size = apperture_d / 8);
|
||||
text("C", font = "7 segment", valign = "bottom", halign = "center", size = aperture_d / 8);
|
||||
|
||||
translate([-1.9, 0.5])
|
||||
text("50", font = "7 segment", valign = "top", halign = "center", size = apperture_d / 2.7);
|
||||
text("50", font = "7 segment", valign = "top", halign = "center", size = aperture_d / 2.7);
|
||||
|
||||
translate([0, -apperture_d / 6])
|
||||
text(" %", font = "Arial", valign = "center", halign = "center", size = apperture_d / 6);
|
||||
translate([0, -aperture_d / 6])
|
||||
text(" %", font = "Arial", valign = "center", halign = "center", size = aperture_d / 6);
|
||||
}
|
||||
|
||||
}
|
||||
|
146
vitamins/led_meter.scad
Normal file
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// 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
@@ -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.6, 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);
|
||||
}
|
||||
}
|
110
vitamins/panel_meter.scad
Normal file
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Panel mounted digital meter modules
|
||||
//!
|
||||
//! Notes on the DSN_VC288:
|
||||
//!
|
||||
//! * The tabs aren't modelled because they can be fully retracted if the PCB is removed.
|
||||
//! * The current connector isn't moddelled as it is awkwardly tall. I remove it and solder wires instead.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
|
||||
use <../utils/dogbones.scad>
|
||||
use <pcb.scad>
|
||||
|
||||
function pmeter_size(type) = type[2]; //! Body size including bezel height
|
||||
function pmeter_bezel(type) = type[3]; //! Bezel size
|
||||
function pmeter_bezel_r(type) = type[4]; //! Bezel radius
|
||||
function pmeter_bevel(type) = type[5]; //! Bezel bevel inset and start height
|
||||
function pmeter_aperture(type) = type[6]; //! Aperture length, width and bevel
|
||||
function pmeter_tab(type) = type[7]; //! Tab size
|
||||
function pmeter_tab_z(type) = type[8]; //! Tab vertical position
|
||||
function pmeter_thickness(type) = type[9]; //! Wall thickness if not closed
|
||||
function pmeter_pcb(type) = type[10]; //! Optional PCB for open types
|
||||
function pmeter_pcb_z(type) = type[11]; //! Distance of PCB from the back
|
||||
|
||||
function pmeter_depth(type) = pmeter_size(type).z - pmeter_bezel(type).z; //! Depth below bezel
|
||||
|
||||
module panel_meter(type) { //! Draw panel mounted LCD meter module
|
||||
vitamin(str("panel_meter(", type[0], "): ", type[1]));
|
||||
size = pmeter_size(type);
|
||||
bezel = pmeter_bezel(type);
|
||||
bevel = pmeter_bevel(type);
|
||||
t = pmeter_thickness(type);
|
||||
r = pmeter_bezel_r(type);
|
||||
h = size.z - bezel.z;
|
||||
app = pmeter_aperture(type);
|
||||
tab = pmeter_tab(type);
|
||||
tab_z = pmeter_tab_z(type);
|
||||
pcb = pmeter_pcb(type);
|
||||
|
||||
color("#94A7AB")
|
||||
cube([app.x, app.y, 3 * eps], center = true);
|
||||
|
||||
color(grey30) union() {
|
||||
difference() {
|
||||
hull() {
|
||||
rounded_rectangle([bezel.x - 2 * bevel.x, bezel.y - 2 * bevel.x, bezel.z], r - bevel.x, center = false);
|
||||
rounded_rectangle([bezel.x, bezel.y, bevel[1]],r, center = false);
|
||||
}
|
||||
hull() {
|
||||
translate_z(bezel.z + eps) {
|
||||
cube([app.x + app.z, app.y + app.z, eps], center = true);
|
||||
|
||||
cube([app.x, app.y, bezel.z * 2], center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
translate_z(-h)
|
||||
linear_extrude(h)
|
||||
difference() {
|
||||
square([size.x, size.y], center = true);
|
||||
|
||||
if(t)
|
||||
square([size.x - 2 * t, size.y - 2 * t], center = true);
|
||||
}
|
||||
|
||||
if(tab)
|
||||
for(end = [-1, 1])
|
||||
translate([end * (size.x / 2 + tab.x / 2), 0, -size.z + tab_z])
|
||||
rotate([0, end * 10, 0])
|
||||
translate_z(tab.z / 2)
|
||||
cube([tab.x, tab.y, tab.z], center = true);
|
||||
|
||||
}
|
||||
if(pcb)
|
||||
vflip()
|
||||
translate_z(h - pcb_thickness(pcb) - pmeter_pcb_z(type))
|
||||
pcb(pcb);
|
||||
}
|
||||
|
||||
module panel_meter_cutout(type, h = 0) { //! Make panel cutout
|
||||
size = pmeter_size(type);
|
||||
tab = pmeter_tab(type);
|
||||
extrude_if(h)
|
||||
offset(0.2) {
|
||||
dogbone_square([size.x, size.y]);
|
||||
|
||||
if(tab)
|
||||
rounded_square([size.x + 2 * tab.x, tab.y + 2 * cnc_bit_r], r = cnc_bit_r, center = true);
|
||||
}
|
||||
}
|
38
vitamins/panel_meters.scad
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Panel mounted digital meter modules
|
||||
//
|
||||
|
||||
PZEM021 = ["PZEM021", "Peacefair PZEM-021 AC digital multi-function meter", [84.6, 44.7, 24.4], [89.6, 49.6, 2.3], 1.5, [1, 1], [51, 30, 5], [1.3, 10, 6], 15.5, 0];
|
||||
PZEM001 = ["PZEM001", "Peacefair PZEM-001 AC digital multi-function meter", [62 , 52.5, 24.4], [67, 57.5, 2.0], 1.5, [1, 1], [36, 36, 0], [1.2, 10, 6], 15.5, 0];
|
||||
|
||||
DSN_VC288PCB = ["", "", 41, 21, 1, 0, 0, 0, "green", false, [],
|
||||
[ [ 5, -3, 0, "jst_xh", 3],
|
||||
|
||||
],
|
||||
[]];
|
||||
|
||||
DSN_VC288 = ["DSN_VC288","DSN-VC288 DC 100V 10A Voltmeter ammeter", [45.3, 26, 17.4], [47.8, 28.8, 2.5], 0, [1, 1.8], [36, 18, 2.5], [], 0, 2,
|
||||
DSN_VC288PCB, 5];
|
||||
|
||||
panel_meters = [DSN_VC288, PZEM021, PZEM001];
|
||||
|
||||
use <panel_meter.scad>
|
@@ -36,6 +36,7 @@ use <d_connector.scad>
|
||||
use <led.scad>
|
||||
use <dip.scad>
|
||||
use <axial.scad>
|
||||
use <smd.scad>
|
||||
|
||||
function pcb_name(type) = type[1]; //! Description
|
||||
function pcb_length(type) = type[2]; //! Length
|
||||
@@ -161,7 +162,7 @@ module molex_usb_Ax2(cutout) { //! Draw Molex USB connector suitable for perf bo
|
||||
l = 17;
|
||||
pin_l = 2.8;
|
||||
clearance = 0.2;
|
||||
tag_l = 4.8;
|
||||
tag_l = 4.4;
|
||||
tag_r = 0.5;
|
||||
tag_w = 1.5;
|
||||
tag_t = 0.3;
|
||||
@@ -840,7 +841,7 @@ module trimpot10(vertical, cutout = false) { //! Draw a ten turn trimpot
|
||||
rotate([vertical ? -90 : 0, 0, 0]) {
|
||||
if(cutout)
|
||||
screw_pos()
|
||||
cylinder(d = screw_d + 1, h = 100);
|
||||
poly_drill(r = (screw_d + 1) / 2, h = 100, center = false);
|
||||
else
|
||||
color("#2CA1FD") {
|
||||
translate([0, -foot_h / 2, foot_h / 2 + h / 2])
|
||||
@@ -866,50 +867,64 @@ module trimpot10(vertical, cutout = false) { //! Draw a ten turn trimpot
|
||||
}
|
||||
}
|
||||
|
||||
module block(size, colour, makes_cutout, cutouts) //! Draw a coloured cube to represent a random PCB component
|
||||
if(cutouts) {
|
||||
if(makes_cutout)
|
||||
translate([-50, 0, size.z / 2 - panel_clearance])
|
||||
cube([100, size.y + 2 * panel_clearance, size.z + 2 * panel_clearance], center = true);
|
||||
}
|
||||
else
|
||||
color(colour)
|
||||
translate_z(size.z / 2)
|
||||
cube(size, center = true);
|
||||
|
||||
module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb component from description
|
||||
function show(comp, part) = (comp[3] == part || comp[3] == str("-",part)) && (!cutouts || angle == undef || angle == comp.z);
|
||||
function param(n, default = 0) = len(comp) > n ? comp[n] : default;
|
||||
rotate(comp.z) {
|
||||
if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6), cutouts, colour = param(7, undef));
|
||||
if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], param(6), cutouts);
|
||||
if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7), param(8, false), cutouts, param(9, undef));
|
||||
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts);
|
||||
if(show(comp, "rj45")) rj45(cutouts);
|
||||
if(show(comp, "usb_A")) usb_Ax1(cutouts);
|
||||
if(show(comp, "usb_Ax2")) usb_Ax2(cutouts);
|
||||
if(show(comp, "usb_uA")) usb_uA(cutouts);
|
||||
if(show(comp, "usb_B")) usb_B(cutouts);
|
||||
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey20));
|
||||
if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9));
|
||||
if(show(comp, "jack")) jack(cutouts);
|
||||
if(show(comp, "barrel_jack")) barrel_jack(cutouts);
|
||||
if(show(comp, "hdmi")) hdmi(hdmi_full, cutouts);
|
||||
if(show(comp, "mini_hdmi")) hdmi(hdmi_mini, cutouts);
|
||||
if(show(comp, "flex")) flex(cutouts);
|
||||
if(show(comp, "flat_flex")) flat_flex(cutouts);
|
||||
if(show(comp, "D_plug")) if(!cutouts) translate_z(d_pcb_offset(comp[4])) d_plug(comp[4], pcb = true);
|
||||
if(show(comp, "molex_hdr")) if(!cutouts) molex_254(comp[4]);
|
||||
if(show(comp, "jst_xh")) if(!cutouts) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef));
|
||||
if(show(comp, "term254")) if(!cutouts) green_terminal(gt_2p54,comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "gterm")) if(!cutouts) green_terminal(comp[4], comp[5], comp[6], param(7,"lime"));
|
||||
if(show(comp, "gterm35")) if(!cutouts) green_terminal(gt_3p5, comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "gterm508")) if(!cutouts) green_terminal(gt_5p08, comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "gterm635")) if(!cutouts) green_terminal(gt_6p35, comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "term35")) if(!cutouts) terminal_35(comp[4], param(5,"blue"));
|
||||
if(show(comp, "transition")) if(!cutouts) idc_transition(2p54header, comp[4], comp[5]);
|
||||
if(show(comp, "block"))
|
||||
color(comp[7]) if(!cutouts) translate_z(comp[6] / 2) cube([comp[4], comp[5], comp[6]], center = true);
|
||||
else if(comp[8]) translate([-50, 0, comp[6] / 2 - panel_clearance]) cube([100, comp[5] + 2 * panel_clearance, comp[6] + 2 * panel_clearance], center = true);
|
||||
if(show(comp, "button_6mm")) square_button(button_6mm);
|
||||
if(show(comp, "microswitch")) translate_z(microswitch_thickness(comp[4])/2) microswitch(comp[4]);
|
||||
if(show(comp, "pcb")) if(!cutouts) translate_z(comp[4]) pcb(comp[5]);
|
||||
if(show(comp, "standoff")) if(!cutouts) standoff(comp[4], comp[5], comp[6], comp[7]);
|
||||
if(show(comp, "uSD")) uSD(comp[4], cutouts);
|
||||
if(show(comp, "trimpot10")) trimpot10(param(4, false), cutouts);
|
||||
if(show(comp, "led")) led(comp[4], comp[5], 2.6);
|
||||
if(show(comp, "pdip")) pdip(comp[4], comp[5], param(6, false), param(7, inch(0.3)));
|
||||
if(show(comp, "ax_res")) ax_res(comp[4], comp[5], param(6, 5), param(7, 0));
|
||||
// Components that have a cutout parameter go in this section
|
||||
if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6), false, cutouts, colour = param(7, undef));
|
||||
if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], param(6), cutouts);
|
||||
if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7), param(8, false), cutouts, param(9, undef));
|
||||
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts);
|
||||
if(show(comp, "rj45")) rj45(cutouts);
|
||||
if(show(comp, "usb_A")) usb_Ax1(cutouts);
|
||||
if(show(comp, "usb_Ax2")) usb_Ax2(cutouts);
|
||||
if(show(comp, "usb_uA")) usb_uA(cutouts);
|
||||
if(show(comp, "usb_B")) usb_B(cutouts);
|
||||
if(show(comp, "jack")) jack(cutouts);
|
||||
if(show(comp, "barrel_jack")) barrel_jack(cutouts);
|
||||
if(show(comp, "hdmi")) hdmi(hdmi_full, cutouts);
|
||||
if(show(comp, "mini_hdmi")) hdmi(hdmi_mini, cutouts);
|
||||
if(show(comp, "flex")) flex(cutouts);
|
||||
if(show(comp, "flat_flex")) flat_flex(cutouts);
|
||||
if(show(comp, "uSD")) uSD(comp[4], cutouts);
|
||||
if(show(comp, "trimpot10")) trimpot10(param(4, false), cutouts);
|
||||
if(show(comp, "molex_usb_Ax2")) molex_usb_Ax2(cutouts);
|
||||
if(show(comp, "smd_led")) smd_led(comp[4], comp[5], cutouts);
|
||||
if(show(comp, "block")) block(size = [comp[4], comp[5], comp[6]], colour = comp[7], makes_cutout = param(8));
|
||||
if(!cutouts) {
|
||||
// Components that don't have a cutout parameter go in this section
|
||||
if(show(comp, "button_6mm")) square_button(button_6mm);
|
||||
if(show(comp, "microswitch")) translate_z(microswitch_thickness(comp[4])/2) microswitch(comp[4]);
|
||||
if(show(comp, "pcb")) translate_z(comp[4]) pcb(comp[5]);
|
||||
if(show(comp, "standoff")) standoff(comp[4], comp[5], comp[6], comp[7]);
|
||||
if(show(comp, "term254")) green_terminal(gt_2p54,comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "gterm")) green_terminal(comp[4], comp[5], comp[6], param(7,"lime"));
|
||||
if(show(comp, "gterm35")) green_terminal(gt_3p5, comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "gterm508")) green_terminal(gt_5p08, comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "gterm635")) green_terminal(gt_6p35, comp[4], comp[5], param(6,"lime"));
|
||||
if(show(comp, "term35")) terminal_35(comp[4], param(5,"blue"));
|
||||
if(show(comp, "transition")) idc_transition(2p54header, comp[4], comp[5]);
|
||||
if(show(comp, "led")) led(comp[4], comp[5], 2.6);
|
||||
if(show(comp, "pdip")) pdip(comp[4], comp[5], param(6, false), param(7, inch(0.3)));
|
||||
if(show(comp, "ax_res")) ax_res(comp[4], comp[5], param(6, 5), param(7, 0));
|
||||
if(show(comp, "D_plug")) translate_z(d_pcb_offset(comp[4])) d_plug(comp[4], pcb = true);
|
||||
if(show(comp, "molex_hdr")) molex_254(comp[4]);
|
||||
if(show(comp, "jst_xh")) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef));
|
||||
if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9));
|
||||
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@ include <microswitches.scad>
|
||||
include <d_connectors.scad>
|
||||
include <leds.scad>
|
||||
include <axials.scad>
|
||||
include <smds.scad>
|
||||
|
||||
//
|
||||
// l w t r h l c b h
|
||||
@@ -348,6 +349,8 @@ MT3608 = ["MT3608", "MT3608 boost converter module", 37, 17, 1.2, 2, 1.5,
|
||||
TP4056 = ["TP4056", "TP4056 Li-lon Battery charger module", 26.2, 17.5, 1.0, 0, 1.0, [2.4, 2.4], "#2140BE", false,
|
||||
[[1.67, 1.8], [1.67, -1.8], [-1.67, 1.8], [-1.67, -1.8], [-1.67, -4.98], [-1.67, 4.98]],
|
||||
[ [ 2, 17.5 / 2, 180, "usb_uA"],
|
||||
[ 7, -2 , 0, "smd_led", LED0805, "red"],
|
||||
[ 11, -2 , 0, "smd_led", LED0805, "blue"],
|
||||
|
||||
]];
|
||||
|
||||
@@ -358,6 +361,8 @@ WD2002SJ = ["WD2002SJ", "WD2002SJ Buck Boost DC-DC converter", 78, 47, 1.6, 0, 3
|
||||
[ -25.5, 3.1, 0, "trimpot10", true],
|
||||
[ 30.5, 3.1, 0, "trimpot10", true],
|
||||
[ 41.5, 3.1, 0, "trimpot10", true],
|
||||
[ -10.4, 1.4, 0, "smd_led", LED0805, "blue"],
|
||||
[ 15.7, 2.7, 0, "smd_led", LED0805, "red"],
|
||||
],
|
||||
[]];
|
||||
|
||||
|
@@ -52,7 +52,7 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu
|
||||
|
||||
if(cutout)
|
||||
dogbone_rectangle([cols * pitch + 2 * panel_clearance, rows * pitch + 2 * panel_clearance, 100], center = false);
|
||||
else
|
||||
else {
|
||||
vitamin(str("pin_header(", type[0], ", ", cols, ", ", rows,
|
||||
arg(smt, false, "smt"), arg(right_angle, false, "right_angle"), "): Pin header ", cols, " x ", rows, right_angle ? " right_angle" : ""));
|
||||
|
||||
@@ -91,6 +91,7 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu
|
||||
square([pitch - chamfer, pitch + eps], center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module box_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! Draw box header
|
||||
@@ -102,7 +103,7 @@ module box_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! D
|
||||
|
||||
if(cutout)
|
||||
dogbone_rectangle([cols * pitch + 2 * panel_clearance, rows * pitch + 2 * panel_clearance, 100], center = false);
|
||||
else
|
||||
else {
|
||||
vitamin(str("box_header(", type[0], ", ", cols, ", ", rows, arg(smt, false, "smt"), "): Box header ", cols, " x ", rows));
|
||||
|
||||
translate_z(smt ? 3.5 - h : 0) {
|
||||
@@ -125,6 +126,7 @@ module box_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! D
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module idc_transition(type, cols = 5, skip = [], cutout = false) { //! Draw IDC transition header
|
||||
|
80
vitamins/smd.scad
Normal file
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Surface mount components for PCBs.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
|
||||
use <../utils/tube.scad>
|
||||
|
||||
function smd_led_size(type) = type[1]; //! Body length, width and height
|
||||
function smd_led_lens(type) = type[2]; //! Lens length width and height
|
||||
function smd_led_height(type) = //! Total height
|
||||
smd_led_size(type).z + smd_led_lens(type).z;
|
||||
|
||||
function smd_100th(x) = //! Convert dimesion to 1/100" notation
|
||||
let(s = str(round(x / inch(0.01))))
|
||||
len(s) < 2 ? str("0", s) : s;
|
||||
|
||||
function smd_size(size) = //! Convert size to 1/100" notation
|
||||
str(smd_100th(size.x), smd_100th(size.y));
|
||||
|
||||
module smd_led(type, colour, cutout) { //! Draw an SMD LED with specified ```colour```
|
||||
size = smd_led_size(type);
|
||||
vitamin(str("smd_led(", type[0], ", ", colour, "): SMD LED ", smd_size(size), " ", colour));
|
||||
|
||||
lens = smd_led_lens(type);
|
||||
r = size.y * 0.32;
|
||||
$fn = 32;
|
||||
|
||||
if(cutout)
|
||||
poly_drill(r = 2.85 / 2, h = 100, center = false); // For lightguide made from transparent PLA filament
|
||||
else {
|
||||
color("white")
|
||||
linear_extrude(size.z)
|
||||
difference() {
|
||||
square([size.x, size.y], center = true);
|
||||
|
||||
for(end = [-1, 1])
|
||||
translate([end * size.x / 2, 0])
|
||||
circle(r);
|
||||
}
|
||||
|
||||
color(gold)
|
||||
linear_extrude(size.z)
|
||||
intersection() {
|
||||
square([size.x, size.y], center = true);
|
||||
|
||||
for(end = [-1, 1])
|
||||
translate([end * size.x / 2, 0])
|
||||
ring(or = r, ir = r / 2);
|
||||
}
|
||||
|
||||
color(colour, 0.9)
|
||||
translate_z(size.z)
|
||||
hull() {
|
||||
cube([lens.x, lens.y, eps], center = true);
|
||||
|
||||
slant = lens.z * tan(15);
|
||||
translate_z(lens.z / 2)
|
||||
cube([lens.x - slant, lens.y - slant, lens.z], center = true);
|
||||
}
|
||||
}
|
||||
}
|
28
vitamins/smds.scad
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Axial components
|
||||
//
|
||||
|
||||
LED0805 = ["LED0805", [2, 1.25, 0.46], [1.4, 1.25, 0.54]];
|
||||
|
||||
smd_leds = [LED0805];
|
||||
|
||||
use <smd.scad>
|