From c81465889fed0207c60a2bcea5e4bdab3a18ea50 Mon Sep 17 00:00:00 2001 From: Robert Gawron Date: Thu, 10 Dec 2020 11:03:56 +0100 Subject: [PATCH] Fix front panel height. Add screw hole for debug panel (on top chassis). Rework of screws connecting bottom and top chassis. Add PCB mounting screw. Add PCB support bars. Refactor by splitting models to separate files and submodules. Related to #50. --- Mechanic/MechanicOverview/ChassisBottom.scad | 93 +++++++ Mechanic/MechanicOverview/ChassisTop.scad | 125 ++++++++++ Mechanic/MechanicOverview/GenericChassis.scad | 112 +++++++++ .../MechanicOverview/GenericChassis2D.scad | 33 --- .../MechanicOverview/GenericFrontPanel.scad | 9 + .../MechanicOverview/MechanicOverview.scad | 231 +----------------- 6 files changed, 351 insertions(+), 252 deletions(-) create mode 100644 Mechanic/MechanicOverview/ChassisBottom.scad create mode 100644 Mechanic/MechanicOverview/ChassisTop.scad create mode 100644 Mechanic/MechanicOverview/GenericChassis.scad delete mode 100644 Mechanic/MechanicOverview/GenericChassis2D.scad create mode 100644 Mechanic/MechanicOverview/GenericFrontPanel.scad diff --git a/Mechanic/MechanicOverview/ChassisBottom.scad b/Mechanic/MechanicOverview/ChassisBottom.scad new file mode 100644 index 0000000..41e29b7 --- /dev/null +++ b/Mechanic/MechanicOverview/ChassisBottom.scad @@ -0,0 +1,93 @@ +// This is model of bottom chassis. + +module ChassisBottom_FrontPanel(Height) +{ + translate([-PCB_X/2 - CHASSIS_THICKNESS-COMPONENT_TOLERANCE, + -PCB_Y/2, + Height]) + { + GenericFrontPanel(); + } +} + +module ChassisBottom_SupportAroundPCB() +{ + linear_extrude(height = 2*CHASSIS_THICKNESS+PCB_Z_OFFSET, convexity = 10, twist = 0) + { + square([PCB_X+2*COMPONENT_TOLERANCE, CHASSIS_THICKNESS]); + } +} + +module ChassisBottom_SupportsAroundPCB() +{ + translate([-PCB_X/2 -COMPONENT_TOLERANCE, + -PCB_Y/2-CHASSIS_THICKNESS-COMPONENT_TOLERANCE, + 0]) + { + ChassisBottom_SupportAroundPCB(); + } + + translate([-PCB_X/2 - COMPONENT_TOLERANCE, + PCB_Y/2+COMPONENT_TOLERANCE, + 0]) + { + ChassisBottom_SupportAroundPCB(); + } +} + +module ChassisBottom_PCBMountingHole() +{ + translate([0, + 0, + CHASSIS_THICKNESS]) + { + GenericChassis_InsertNutSocket(PCB_Z_OFFSET, false); + } +} + +module ChassisBottom_PCBBottomHolder() +{ + PCBBottomHolderThickness = 2; + + linear_extrude(height = PCB_Z_OFFSET, convexity = 10, twist = 0) + { + square([PCBBottomHolderThickness, PCB_Y]); + } +} + +module ChassisBottom_PCBBottomHolders() +{ + translate([-PCB_X/2, + -PCB_Y/2, + CHASSIS_THICKNESS]) + { + ChassisBottom_PCBBottomHolder(); + } + + translate([PCB_X/2-1, + -PCB_Y/2, + CHASSIS_THICKNESS]) + { + ChassisBottom_PCBBottomHolder(); + } +} + +module ChassisBottom(Height) +{ + difference() + { + union() + { + GenericChassis(Height); + ChassisBottom_FrontPanel(Height); + ChassisBottom_SupportsAroundPCB(); + ChassisBottom_PCBMountingHole(); + ChassisBottom_PCBBottomHolders(); + + InsertNutSockets(Height, false); + } + + // add mounting for top and bottom chassis + InsertNutSockets(Height, true); + } +} \ No newline at end of file diff --git a/Mechanic/MechanicOverview/ChassisTop.scad b/Mechanic/MechanicOverview/ChassisTop.scad new file mode 100644 index 0000000..d62fa00 --- /dev/null +++ b/Mechanic/MechanicOverview/ChassisTop.scad @@ -0,0 +1,125 @@ +// This is model of top chassis. + +// below values are taken from KiCad model + +SCREW_CONNECTOR_DX = 10 + COMPONENT_TOLERANCE; +SCREW_CONNECTOR_Y = 1 - COMPONENT_TOLERANCE; +SCREW_CONNECTOR_DY = 20.668 + 2*COMPONENT_TOLERANCE; + +AdcPowerSupplyYOffset = PCB_X/2 + - SCREW_CONNECTOR_DX + + CHASSIS_THICKNESS + - COMPONENT_TOLERANCE; + +module ChassisTop_WallsAroundADCAndPowerSupplySocket(Height) +{ + linear_extrude(height = Height, convexity = 10, twist = 0) + { + translate([AdcPowerSupplyYOffset, + -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y - CHASSIS_THICKNESS, + 0]) + { + square([SCREW_CONNECTOR_DX + COMPONENT_TOLERANCE, CHASSIS_THICKNESS]); + } + + translate([AdcPowerSupplyYOffset, + -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y + SCREW_CONNECTOR_DY, + 0]) + { + square([SCREW_CONNECTOR_DX + COMPONENT_TOLERANCE, CHASSIS_THICKNESS]); + } + + translate([AdcPowerSupplyYOffset, + -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y, + 0]) + { + square([CHASSIS_THICKNESS, SCREW_CONNECTOR_DY + CHASSIS_THICKNESS]); + } + } +} + +module ChassisTop_SupportFrontPanel() +{ + translate([-PCB_X/2 -COMPONENT_TOLERANCE, + -PCB_Y/2, + CHASSIS_THICKNESS]) + { + linear_extrude(height = CHASSIS_THICKNESS, convexity = 10, twist = 0) + { + square([CHASSIS_THICKNESS, PCB_Y]); + } + } + +} + +module ChassisTop_DebugPanelMountingScrewSupport() +{ + + DebugPanelSupportSize = 10; + + translate([-PCB_X/2+DEBUG_CONNECTOR_X+DEBUG_CONNECTOR_DX/2, + -PCB_Y/2+DEBUG_CONNECTOR_DY/2+COMPONENT_TOLERANCE, + 0]) + { + difference() + { + union() + { + translate([0,DebugPanelSupportSize/2,0]) + { + linear_extrude(height = CHASSIS_THICKNESS+INSERT_NUT_LENGTH, convexity = 10, twist = 0) + { + square([INSERT_NUT_HOLDER_DIAMETER, DebugPanelSupportSize], center=true); + } + } + GenericChassis_InsertNutSocket(CHASSIS_THICKNESS+INSERT_NUT_LENGTH, false); + } + + // add hole for debug socket screw + linear_extrude(height = CHASSIS_THICKNESS+INSERT_NUT_LENGTH, convexity = 10, twist = 0) + { + circle(r=INSERT_NUT_RADIUS); + } + } + } +} + +module Chassis3DTop(Height) +{ + difference() + { + union() + { + GenericChassis(Height); + ChassisTop_DebugPanelMountingScrewSupport(); + } + + // add hole for ADC and power supply socket + translate([AdcPowerSupplyYOffset, + -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y, + 0]) + { + linear_extrude(height = Height, convexity = 10, twist = 0) + { + square([SCREW_CONNECTOR_DX + CHASSIS_THICKNESS, SCREW_CONNECTOR_DY]); + } + } + + // add hole for flashing and UART sockets + DebugPanel(Height); + + // add hole for front pannel + translate([-PCB_X/2 - CHASSIS_THICKNESS-COMPONENT_TOLERANCE, + -PCB_Y/2, + CHASSIS_THICKNESS]) + { + GenericFrontPanel(); + } + } + + ChassisTop_WallsAroundADCAndPowerSupplySocket(Height); + ChassisTop_SupportFrontPanel(); + + // add nounting screws + InsertNutSockets(Height, false); +} \ No newline at end of file diff --git a/Mechanic/MechanicOverview/GenericChassis.scad b/Mechanic/MechanicOverview/GenericChassis.scad new file mode 100644 index 0000000..2d92676 --- /dev/null +++ b/Mechanic/MechanicOverview/GenericChassis.scad @@ -0,0 +1,112 @@ +module Chassis2DQuarter(Thickness) +{ + CHASSIS_X = PCB_X/2 + COMPONENT_TOLERANCE + Thickness; + CHASSIS_Y = PCB_Y/2 + COMPONENT_TOLERANCE + Thickness; + + polygon(points=[ + [0, 0], + [CHASSIS_X, 0], + [CHASSIS_X, CHASSIS_Y + CHASSIS_CORNER_DIAMETER/2 - Thickness/2], + [CHASSIS_X - CHASSIS_CORNER_RADIUS - CHASSIS_THICKNESS/2, CHASSIS_Y + CHASSIS_CORNER_DIAMETER], + [0, CHASSIS_Y + CHASSIS_CORNER_DIAMETER], + ]); + + translate([CHASSIS_X - CHASSIS_THICKNESS - INSERT_NUT_RADIUS, + CHASSIS_Y + INSERT_NUT_RADIUS, + 0]) + { + circle(r=INSERT_NUT_RADIUS + CHASSIS_THICKNESS); + } +} + +module Chassis2DHalf(Thickness) +{ + Chassis2DQuarter(Thickness); + + rotate([180, 0, 0]) + { + Chassis2DQuarter(Thickness); + } +} + +module GenericChassis2D(Thickness) +{ + Chassis2DHalf(Thickness); + + rotate([0, 180, 0]) + { + Chassis2DHalf(Thickness); + } +} + + + +module GenericChassis_InsertNutSocket(Height, isFull) +{ + linear_extrude(height = Height, convexity = 10, twist = 0) + { + difference() + { + if(!isFull) + { + circle(r=INSERT_NUT_RADIUS + CHASSIS_THICKNESS); + } + + circle(r=INSERT_NUT_RADIUS); + } + } +} + +module InsertNutSockets(Height, isFull) +{ + Thickness = CHASSIS_THICKNESS; + CHASSIS_X = PCB_X/2 + COMPONENT_TOLERANCE + Thickness; + CHASSIS_Y = PCB_Y/2 + COMPONENT_TOLERANCE + Thickness; + + translate([CHASSIS_X - Thickness - INSERT_NUT_RADIUS, + CHASSIS_Y + INSERT_NUT_RADIUS, + 0]) + { + GenericChassis_InsertNutSocket(Height, isFull); + } + + translate([CHASSIS_X - Thickness - INSERT_NUT_RADIUS, + -CHASSIS_Y - INSERT_NUT_RADIUS, + 0]) + { + GenericChassis_InsertNutSocket(Height, isFull); + } + + translate([-CHASSIS_X + Thickness + INSERT_NUT_RADIUS, + CHASSIS_Y + INSERT_NUT_RADIUS, + 0]) + { + GenericChassis_InsertNutSocket(Height, isFull); + } + + translate([-CHASSIS_X + Thickness + INSERT_NUT_RADIUS, + -CHASSIS_Y - INSERT_NUT_RADIUS, + 0]) + { + GenericChassis_InsertNutSocket(Height, isFull); + } +} + +module GenericChassis(Height) +{ + difference() + { + linear_extrude(height = Height, convexity = 10, twist = 0) + { + GenericChassis2D(CHASSIS_THICKNESS); + } + + translate([0, 0, CHASSIS_THICKNESS]) + { + linear_extrude(height = Height - CHASSIS_THICKNESS, convexity = 10, twist = 0) + { + GenericChassis2D(0); + } + } + } +} \ No newline at end of file diff --git a/Mechanic/MechanicOverview/GenericChassis2D.scad b/Mechanic/MechanicOverview/GenericChassis2D.scad deleted file mode 100644 index 3e92130..0000000 --- a/Mechanic/MechanicOverview/GenericChassis2D.scad +++ /dev/null @@ -1,33 +0,0 @@ -module Chassis2DQuarter(Thickness) -{ - CHASSIS_X = PCB_X/2 + COMPONENT_TOLERANCE + Thickness; - CHASSIS_Y = PCB_Y/2 + COMPONENT_TOLERANCE + Thickness; - - polygon(points=[ - [0, 0], - [CHASSIS_X, 0], - [CHASSIS_X, CHASSIS_Y + CHASSIS_CORNER_DIAMETER/2 - Thickness/2], - [CHASSIS_X - CHASSIS_CORNER_RADIUS - CHASSIS_THICKNESS/2, CHASSIS_Y + CHASSIS_CORNER_DIAMETER], - [0, CHASSIS_Y + CHASSIS_CORNER_DIAMETER], - ]); -} - -module Chassis2DHalf(Thickness) -{ - Chassis2DQuarter(Thickness); - - rotate([180, 0, 0]) - { - Chassis2DQuarter(Thickness); - } -} - -module GenericChassis2D(Thickness) -{ - Chassis2DHalf(Thickness); - - rotate([0, 180, 0]) - { - Chassis2DHalf(Thickness); - } -} \ No newline at end of file diff --git a/Mechanic/MechanicOverview/GenericFrontPanel.scad b/Mechanic/MechanicOverview/GenericFrontPanel.scad new file mode 100644 index 0000000..d1cbf82 --- /dev/null +++ b/Mechanic/MechanicOverview/GenericFrontPanel.scad @@ -0,0 +1,9 @@ +// This is model of panel where BNC, LCD and encoder are. + +module GenericFrontPanel() +{ + linear_extrude(height = TOP_CHASSIS_HEIGHT-CHASSIS_THICKNESS, convexity = 10, twist = 0) + { + square([CHASSIS_THICKNESS, PCB_Y]); + } +} \ No newline at end of file diff --git a/Mechanic/MechanicOverview/MechanicOverview.scad b/Mechanic/MechanicOverview/MechanicOverview.scad index 216e410..9e56986 100644 --- a/Mechanic/MechanicOverview/MechanicOverview.scad +++ b/Mechanic/MechanicOverview/MechanicOverview.scad @@ -14,6 +14,8 @@ PCB_Z_OFFSET = 3; // 3mm for PCB cearance between PCB and chassis INSERT_NUT_DIAMETER=3.5; INSERT_NUT_RADIUS=(INSERT_NUT_DIAMETER + COMPONENT_TOLERANCE)/2; INSERT_NUT_LENGTH=3.5; +INSERT_NUT_HOLDER_RADIUS=INSERT_NUT_RADIUS + CHASSIS_THICKNESS; +INSERT_NUT_HOLDER_DIAMETER= 2*INSERT_NUT_HOLDER_RADIUS; CHASSIS_CORNER_RADIUS = INSERT_NUT_RADIUS + CHASSIS_THICKNESS/2; CHASSIS_CORNER_DIAMETER= 2*CHASSIS_CORNER_RADIUS; @@ -23,7 +25,11 @@ DEBUG_CONNECTOR_X = 11 - COMPONENT_TOLERANCE; DEBUG_CONNECTOR_DX = 29 + 2*COMPONENT_TOLERANCE; DEBUG_CONNECTOR_DY = /*18*/20 + CHASSIS_CORNER_DIAMETER - COMPONENT_TOLERANCE; -include ; +include ; +include ; +include ; +include ; + // Increase steps in render to have quality circles //$fs=0.1; //$fn=30; @@ -34,219 +40,6 @@ module PCB() import("PCB.stl"); } - - -module InsertNutSocket(isFull) -{ - difference() - { - circle(r=INSERT_NUT_RADIUS + CHASSIS_THICKNESS); - - if(!isFull) - { - circle(r=INSERT_NUT_RADIUS); - } - } -} - -module InsertNutSockets(Height, isFull) -{ - Thickness = CHASSIS_THICKNESS; - CHASSIS_X = PCB_X/2 + COMPONENT_TOLERANCE + Thickness; - CHASSIS_Y = PCB_Y/2 + COMPONENT_TOLERANCE + Thickness; - - linear_extrude(height = Height, convexity = 10, twist = 0) - { - translate([CHASSIS_X - Thickness - INSERT_NUT_RADIUS, - CHASSIS_Y + INSERT_NUT_RADIUS, - 0]) - { - InsertNutSocket(isFull); - } - - translate([CHASSIS_X - Thickness - INSERT_NUT_RADIUS, - -CHASSIS_Y - INSERT_NUT_RADIUS, - 0]) - { - InsertNutSocket(isFull); - } - - translate([-CHASSIS_X + Thickness + INSERT_NUT_RADIUS, - CHASSIS_Y + INSERT_NUT_RADIUS, - 0]) - { - InsertNutSocket(isFull); - } - - translate([-CHASSIS_X + Thickness + INSERT_NUT_RADIUS, - -CHASSIS_Y - INSERT_NUT_RADIUS, - 0]) - { - InsertNutSocket(isFull); - } - } -} - -module Chassis3DBasic(Height) -{ - difference() - { - linear_extrude(height = Height, convexity = 10, twist = 0) - { - GenericChassis2D(CHASSIS_THICKNESS); - } - - translate([0, 0, CHASSIS_THICKNESS]) - { - linear_extrude(height = Height - CHASSIS_THICKNESS, convexity = 10, twist = 0) - { - GenericChassis2D(0); - } - } - InsertNutSockets(Height, true); - } - - InsertNutSockets(Height, false); -} - -module FrontPanelBasic() -{ - linear_extrude(height = TOP_CHASSIS_HEIGHT, convexity = 10, twist = 0) - { - square([CHASSIS_THICKNESS, PCB_Y]); - } -} - -module Chassis3DTop(Height) -{ - // below values are taken from KiCad model - - SCREW_CONNECTOR_DX = 10 + COMPONENT_TOLERANCE; - SCREW_CONNECTOR_Y = 1 - COMPONENT_TOLERANCE; - SCREW_CONNECTOR_DY = 20.668 + 2*COMPONENT_TOLERANCE; - - difference() - { - union() - { - Chassis3DBasic(Height); - - - // add screw for mounting debug panel - DebugPanelSupportSize = 10; - translate([-PCB_X/2+DEBUG_CONNECTOR_X+DEBUG_CONNECTOR_DX/2, - -PCB_Y/2+DEBUG_CONNECTOR_DY/2+COMPONENT_TOLERANCE, - 0]) - { - linear_extrude(height = CHASSIS_THICKNESS+INSERT_NUT_LENGTH, convexity = 10, twist = 0) - { - translate([0,DebugPanelSupportSize/2,0]) - square([DebugPanelSupportSize, DebugPanelSupportSize], center=true); - InsertNutSocket(false); - } - } - - } - - // add hole for ADC and power supply socket - translate([PCB_Y/2 - COMPONENT_TOLERANCE, - -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y, - 0]) - { - linear_extrude(height = Height, convexity = 10, twist = 0) - { - square([SCREW_CONNECTOR_DX + CHASSIS_THICKNESS, SCREW_CONNECTOR_DY]); - } - } - - // add hole for flashing and UART sockets - DebugPanel(Height); - - // add hole for front pannel - translate([-PCB_X/2 - CHASSIS_THICKNESS-COMPONENT_TOLERANCE, - -PCB_Y/2, - CHASSIS_THICKNESS]) - { - FrontPanelBasic(); - } - } - - // around hole for ADC and power supply socket add eges to hide inside of the device - linear_extrude(height = Height, convexity = 10, twist = 0) - { - translate([PCB_Y/2 - CHASSIS_THICKNESS - COMPONENT_TOLERANCE, - -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y - CHASSIS_THICKNESS, - 0]) - { - square([SCREW_CONNECTOR_DX + COMPONENT_TOLERANCE, CHASSIS_THICKNESS]); - } - - translate([PCB_Y/2 - CHASSIS_THICKNESS - COMPONENT_TOLERANCE, - -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y + SCREW_CONNECTOR_DY, - 0]) - { - square([SCREW_CONNECTOR_DX + COMPONENT_TOLERANCE, CHASSIS_THICKNESS]); - } - - translate([PCB_Y/2 - CHASSIS_THICKNESS - COMPONENT_TOLERANCE, - -SCREW_CONNECTOR_DY - SCREW_CONNECTOR_Y, - 0]) - { - square([CHASSIS_THICKNESS, SCREW_CONNECTOR_DY + CHASSIS_THICKNESS]); - } - } - - // add support bar for front panel - translate([-PCB_X/2 -COMPONENT_TOLERANCE, - -PCB_Y/2, - CHASSIS_THICKNESS]) - { - linear_extrude(height = CHASSIS_THICKNESS, convexity = 10, twist = 0) - { - square([CHASSIS_THICKNESS, PCB_Y]); - } - } - - -} - - -module LongHorizontalPCBSupport() -{ - linear_extrude(height = 2*CHASSIS_THICKNESS+PCB_Z_OFFSET, convexity = 10, twist = 0) - { - square([PCB_X+2*COMPONENT_TOLERANCE, CHASSIS_THICKNESS]); - } -} - -module Chassis3DBottom(Height) -{ - Chassis3DBasic(Height); - - // add front pannel - translate([-PCB_X/2 - CHASSIS_THICKNESS-COMPONENT_TOLERANCE, - -PCB_Y/2, - 2*CHASSIS_THICKNESS]) - { - FrontPanelBasic(); - } - - // add PCB support - translate([-PCB_X/2 -COMPONENT_TOLERANCE, - -PCB_Y/2-CHASSIS_THICKNESS-COMPONENT_TOLERANCE, - 0]) - { - LongHorizontalPCBSupport(); - } - - translate([-PCB_X/2 - COMPONENT_TOLERANCE, - PCB_Y/2+COMPONENT_TOLERANCE, - 0]) - { - LongHorizontalPCBSupport(); - } -} - module DebugPanelBasic(Height) { translate([-PCB_X/2+DEBUG_CONNECTOR_X, @@ -268,11 +61,11 @@ module DebugPanel(Height) { difference() { - Chassis3DBasic(Height); + GenericChassis(Height); difference() { - Chassis3DBasic(Height); + GenericChassis(Height); DebugPanelBasic(Height); } } @@ -303,9 +96,9 @@ module Render_PCB() module Render_BottomChassis() { - color("red") + color("salmon") { - Chassis3DBottom(BOTTOM_CHASSIS_HEIGHT); + ChassisBottom(BOTTOM_CHASSIS_HEIGHT); } } @@ -334,5 +127,5 @@ Render_DebugPanel(); } else{ //Render_PCB(); -Chassis3DTop(TOP_CHASSIS_HEIGHT); +ChassisTop(TOP_CHASSIS_HEIGHT); } \ No newline at end of file