Modelled DSP5005 power supply module as a panel_meter.

Panel_meters can now have inner apertures and buttons.
This commit is contained in:
Chris Palmer 2020-05-02 20:42:26 +01:00
parent baa737c4d8
commit 0ec7aabcfb
10 changed files with 118 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 KiB

After

Width:  |  Height:  |  Size: 293 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 174 KiB

View File

@ -1970,10 +1970,18 @@ Notes on the DSN_VC288:
| Function | Description |
|:--- |:--- |
| ```pmeter_aperture(type)``` | Aperture length, width and bevel |
| ```pmeter_bevel(type)``` | Bezel bevel inset and start height |
| ```pmeter_bevel(type)``` | Bezel bevel inset and start height or a radius |
| ```pmeter_bezel(type)``` | Bezel size |
| ```pmeter_bezel_r(type)``` | Bezel radius |
| ```pmeter_button_colour(type)``` | Button colour |
| ```pmeter_button_pos(type)``` | Button position |
| ```pmeter_button_r(type)``` | Button radius |
| ```pmeter_button_size(type)``` | Button size |
| ```pmeter_buttons(type)``` | List of buttons |
| ```pmeter_inner_ap(type)``` | Inner aperture |
| ```pmeter_inner_ap_o(type)``` | Inner aperture offset |
| ```pmeter_pcb(type)``` | Optional PCB for open types |
| ```pmeter_pcb_h(type)``` | Component height from the front |
| ```pmeter_pcb_z(type)``` | Distance of PCB from the back |
| ```pmeter_size(type)``` | Body size including bezel height |
| ```pmeter_tab(type)``` | Tab size |
@ -1989,6 +1997,7 @@ Notes on the DSN_VC288:
| Module | Description |
|:--- |:--- |
| ```panel_meter(type)``` | Draw panel mounted LCD meter module |
| ```panel_meter_button(type)``` | Draw panel meter button |
| ```panel_meter_cutout(type, h = 0)``` | Make panel cutout |
![panel_meters](tests/png/panel_meters.png)
@ -1999,6 +2008,7 @@ Notes on the DSN_VC288:
| 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 |
| 1 | ```panel_meter(DSP5005)``` | Ruideng DSP5005 Power supply module |
<a href="#top">Top</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -28,21 +28,42 @@
include <../utils/core/core.scad>
use <../utils/dogbones.scad>
use <../utils/rounded_cylinder.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_bevel(type) = type[5]; //! Bezel bevel inset and start height or a radius
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_inner_ap(type) = type[10]; //! Inner aperture
function pmeter_inner_ap_o(type) = type[11]; //! Inner aperture offset
function pmeter_pcb(type) = type[12]; //! Optional PCB for open types
function pmeter_pcb_z(type) = type[13]; //! Distance of PCB from the back
function pmeter_pcb_h(type) = type[14]; //! Component height from the front
function pmeter_buttons(type) = type[15]; //! List of buttons
function pmeter_button_pos(type) = type[0]; //! Button position
function pmeter_button_size(type) = type[1]; //! Button size
function pmeter_button_r(type) = type[2]; //! Button radius
function pmeter_button_colour(type) = type[3]; //! Button colour
function pmeter_depth(type) = pmeter_size(type).z - pmeter_bezel(type).z; //! Depth below bezel
module panel_meter_button(type) { //! Draw panel meter button
size = pmeter_button_size(type);
r = pmeter_button_r(type);
color(pmeter_button_colour(type))
translate(pmeter_button_pos(type))
if(size.x)
rounded_rectangle(pmeter_button_size(type), r, center = false);
else
cylinder(r = r, h = size.z);
}
module panel_meter(type) { //! Draw panel mounted LCD meter module
vitamin(str("panel_meter(", type[0], "): ", type[1]));
size = pmeter_size(type);
@ -51,29 +72,52 @@ module panel_meter(type) { //! Draw panel mounted LCD meter module
t = pmeter_thickness(type);
r = pmeter_bezel_r(type);
h = size.z - bezel.z;
app = pmeter_aperture(type);
ap = pmeter_aperture(type);
tab = pmeter_tab(type);
tab_z = pmeter_tab_z(type);
pcb = pmeter_pcb(type);
ap2 = pmeter_inner_ap(type);
pcb_h = pmeter_pcb_h(type) - bezel.z;
buttons = pmeter_buttons(type);
color("#94A7AB")
cube([app.x, app.y, 3 * eps], center = true);
cube([ap.x, ap.y, 3 * eps], center = true);
module corner(x, y)
translate([x * (bezel.x / 2 - bevel), y * (bezel.y / 2 - bevel)])
rounded_cylinder(r = r, r2 = bevel, h = bezel.z);
color(grey30) union() {
//
// Bezel and aperture
//
difference() {
if(is_list(bevel))
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);
rounded_rectangle([bezel.x, bezel.y, bevel[1]], r, center = false);
}
else
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);
}
}
corner(-1, -1);
corner(-1, 1);
corner( 1, -1);
corner( 1, 1);
}
hull() {
r = max(0, -ap.z);
if(ap.z > 0)
translate_z(bezel.z + eps)
cube([ap.x + ap.z, ap.y + ap.z, eps], center = true);
translate_z(bezel.z + eps)
rounded_rectangle([ap.x, ap.y, bezel.z * 2], r, center = true);
}
}
//
// Body
//
translate_z(-h)
linear_extrude(h)
difference() {
@ -82,7 +126,9 @@ module panel_meter(type) { //! Draw panel mounted LCD meter module
if(t)
square([size.x - 2 * t, size.y - 2 * t], center = true);
}
//
// tabs
//
if(tab)
for(end = [-1, 1])
translate([end * (size.x / 2 + tab.x / 2), 0, -size.z + tab_z])
@ -91,10 +137,27 @@ module panel_meter(type) { //! Draw panel mounted LCD meter module
cube([tab.x, tab.y, tab.z], center = true);
}
if(ap2)
color("grey")
linear_extrude(ap2.z)
difference() {
square([ap.x, ap.y], center = true);
translate(pmeter_inner_ap_o(type))
square([ap2.x, ap2.y], center = true);
}
if(pcb)
vflip()
translate_z(h - pcb_thickness(pcb) - pmeter_pcb_z(type))
pcb(pcb);
if(pcb_h > 0)
%translate_z(-pcb_h / 2 - eps)
cube([size.x - 2 * t - eps, size.y - 2 * t - eps, pcb_h], center = true);
if(buttons)
for(b = buttons)
panel_meter_button(b);
}
module panel_meter_cutout(type, h = 0) { //! Make panel cutout

View File

@ -20,19 +20,32 @@
//
//! Panel mounted digital meter modules
//
// body size bezel size, radius, bevel aperture tab tab_z t
// inner aperture offset pcb pcb z h
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];
PZEM001 = ["PZEM001", "Peacefair PZEM-001 AC digital multi-function meter", [62 , 52.5, 24.4], [67, 57.5, 2.0], 2.0, [1, 1], [61, 46,-3], [1.2, 10, 6], 15.5, 0,
[36, 36, 1.9], [0, 0], false, 0, 0, [
[[25, 8, 0], [0, 0, 2], 4, grey90],
[[25, -8, 0], [0, 0, 2], 4, grey90],
DSN_VC288PCB = ["", "", 41, 21, 1, 0, 0, 0, "green", false, [],
[ [ 5, -3, 0, "jst_xh", 3],
]];
],
[]];
DSP5004PCB = ["", "", 68, 36, 1.6, 0, 0, 0, "green", false, [], [], []];
DSP5005 = ["DSP5005", "Ruideng DSP5005 Power supply module", [71.6, 39.8, 25.0], [79, 43.0, 2.3], 2.0, 1, [67, 32,-1], [2.0, 12, 9], 13.5, 1.5,
[28, 27, 0.7], [-4.5, 0], DSP5004PCB, 10, 36, [
[[ 22, 4, 2], [ 0, 0, 11], 6, "silver"],
[[ 22, 4, 5], [ 0, 0, 6], 6.5, "silver"],
[[ 22, -9, 0], [ 8, 6, 1], 2.99, "yellow"],
[[-25, -9, 0], [ 6.5, 4.5, 1], 0.5, "yellow"],
[[-25, 0, 0], [ 6.5, 4.5, 1], 0.5, "yellow"],
[[-25, 9, 0], [ 6.5, 4.5, 1], 0.5, "yellow"],
]];
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];
[], 0, DSN_VC288PCB, 5];
panel_meters = [DSN_VC288, PZEM021, PZEM001];
panel_meters = [DSN_VC288, PZEM021, PZEM001, DSP5005];
use <panel_meter.scad>