power supply: loosen power socket mount
[clinton/3d-models.git] / etc / meanwell_supply_cover.scad
CommitLineData
0db640fc
CE
1// Power Supply Cover
2// Copyright (c) 2014 "gregington"
3// CC BY-SA 3.0, http://www.thingiverse.com/thing:216951
4
0e0a29ec
CE
5// Customized by Clinton Ebadi <clinton@unknownlamer.org> for the
6// SE-600 power supply. Copyright (c) 2016.
0db640fc 7
0e0a29ec
CE
8// TODO:
9
10// - powerSocket, powerSwitch, screwHoles, ... might be cleaner if
11// placement were done separately. Should be possible to add
12// modules for placing parts (lying flat, centered on the origin)
13// on each surface of the psu cover, fine tuning positions using
14// translate().
15//
16// - add powerpole mount option
17
18// new todo: - recheck dimensions -- screw holes are fixed offset from
19// cover_depth... cover_depth needs to be rechecked/recalculated as
20// wall + clearance needed for power socket + screw y offset
21
22// or: optimal case depth is buffer + screw hole distance from edge of
23// case + whatever space is needed inside the case + back wall
24// thickness
25
26
27// case depth = back wall thickness + cavity size + mounting hole offset + extra behind mounting hole
28
29// cavity size is usually just enough for the plug or terminals + some extra
30
31WALL = 2;
32
33PSU_CLEARANCE = 1;
34PSU_WIDTH = 127 + PSU_CLEARANCE;
35PSU_HEIGHT = 63.5 + PSU_CLEARANCE;
0db640fc
CE
36PSU_DEPTH = 200;
37
38COVER_WIDTH = PSU_WIDTH + (2 * WALL);
39COVER_HEIGHT = PSU_HEIGHT + (2 * WALL);
4a311aa1 40
0e0a29ec 41COVER_DEPTH = 11 + 6 + 2*(25.4+2) + WALL; // ac
4a311aa1 42//COVER_DEPTH = 11 + 6 + 30 + WALL; // dc
0db640fc 43
0e0a29ec 44//COVER_SUPPORT_WIDTH = 20; // ??
0db640fc 45
0e0a29ec
CE
46VENT_HEIGHT = PSU_HEIGHT - PSU_CLEARANCE - WALL - 1;
47VENT_WIDTH = 2;
48VENT_DISTANCE = 5; // was 4
49
50CABLE_SLOT_WIDTH = 18;
51CABLE_SLOT_HEIGHT = 50;
0db640fc 52CABLE_SLOT_Y_OFFSET = 40;
0db640fc 53
0e0a29ec
CE
54//CABLE_SLOT_VENT_DISTANCE = 2; // ???
55
56POWER_SOCKET_OFFSET = WALL*2 + 43/2;
0db640fc
CE
57POWER_SWITCH_OFFSET = 20;
58
59SCREW_HOLE_HEIGHT = 12;
0e0a29ec
CE
60SCREW_HOLE_WIDTH = 3;
61SCREW_HOLE_Z_OFFSET = 30; // offset from top of PSU
62SCREW_HOLE_GAP = 20; // distance between screw holes
63SCREW_HOLE_Y_OFFSET = COVER_DEPTH - 6; // offset from back of case
0db640fc
CE
64
65
66module cover() {
67 difference() {
0e0a29ec
CE
68 minkowski () {
69 cube([COVER_WIDTH, COVER_DEPTH, COVER_HEIGHT]);
70// sphere (d=1);
71 }
72 translate([WALL, WALL, WALL]) {
73# cube([PSU_WIDTH, PSU_DEPTH, PSU_HEIGHT]);
74 }
0db640fc
CE
75 }
76}
77
0e0a29ec
CE
78module vents(offset = 0, limit = COVER_WIDTH - WALL) {
79 for (x = [ WALL + VENT_DISTANCE + offset : VENT_DISTANCE : limit ]) {
0db640fc
CE
80 translate([x, WALL, (COVER_HEIGHT - VENT_HEIGHT) / 2]) {
81 rotate([0, -90, 90]) {
0e0a29ec 82 slot(VENT_WIDTH, VENT_HEIGHT, 2 * WALL);
0db640fc
CE
83 }
84 }
85 }
86
87}
88
0e0a29ec 89module slot(width, height, depth, center = false) {
0db640fc
CE
90 translate([width / 2, 0, 0]) {
91 union() {
92 cube([height - width, width, depth]);
93 translate([0, width / 2, 0]) {
94 cylinder(h = depth, r = width / 2);
95 }
96 translate([height - width, width / 2, 0]) {
97 cylinder(h = depth, r = width / 2);
98 }
99 }
100 }
101}
102
0e0a29ec
CE
103module cslot(width, height, depth) {
104 translate ([-height/2, -width/2, -depth/2])
105 slot (width, height, depth);
106}
107
108
109// defaults for https://www.digikey.com/product-detail/en/1-1609112-2/CCM1916-ND/2292077
110//module powerSocket(width = 27, height = 38, screw_distance = 35, side=0) {
111module powerSocket(width = 1.06*25.4, height = 1.56*25.4, screw_distance = 1.42*25.4, side=0) {
112 translate([WALL*(side ? 2 : 1) + 2 + (side ? PSU_WIDTH : 0), POWER_SOCKET_OFFSET, (COVER_HEIGHT/2+height)/2]) {
0db640fc 113 rotate([0, 90, 0]) {
0e0a29ec
CE
114 translate([0,screw_distance/2,-5]) { rotate ([0, 0, 90]) cslot (3, 5, 22); }
115 translate([0,-screw_distance/2,-5]) { rotate ([0, 0, 90]) cslot (3, 5, 22); }
0db640fc
CE
116 translate([0,0,-5.5 - 1.5])
117 minkowski() {
c8e2242a
CE
118 #cube([height-8,width-8,11], center=true);
119 cylinder(r=4.5,h=0.1);
0db640fc
CE
120 }
121 }
122 }
123}
124
125module powerSwitch() {
126 translate([COVER_WIDTH / 2, POWER_SWITCH_OFFSET, COVER_HEIGHT + 2]) {
127 rotate([0, 0, -90]) {
128 cube([14.8,20.8,2], center=true);
129 translate([0,0,-7-1]) cube([13,19.8,14], center=true);
130 }
131 }
132}
133
134module cableSlot() {
0e0a29ec 135 translate([(PSU_WIDTH - CABLE_SLOT_HEIGHT) / 2, WALL, (COVER_HEIGHT - VENT_HEIGHT) / 2]) {
0db640fc
CE
136 rotate([90, 0, 0]) {
137 slot(CABLE_SLOT_WIDTH, CABLE_SLOT_HEIGHT, WALL * 2);
138 }
139 }
140}
141
0e0a29ec
CE
142module cableSlotOutline() {
143 border = 4;
144 translate([(PSU_WIDTH - CABLE_SLOT_HEIGHT - border) / 2, WALL, (COVER_HEIGHT - VENT_HEIGHT - border) / 2]) {
145 rotate([90, 0, 0]) {
146 slot(CABLE_SLOT_WIDTH + border, CABLE_SLOT_HEIGHT + border, WALL * 2);
0db640fc
CE
147 }
148 }
0e0a29ec 149}
0db640fc 150
0e0a29ec
CE
151module screwHoles() {
152 translate ([-2.5, SCREW_HOLE_Y_OFFSET + WALL - SCREW_HOLE_HEIGHT, -SCREW_HOLE_WIDTH/2 + WALL + + PSU_CLEARANCE/2 + SCREW_HOLE_Z_OFFSET]) {
0db640fc 153 rotate([90, 0, 90]) {
0e0a29ec
CE
154 #slot(SCREW_HOLE_WIDTH, SCREW_HOLE_HEIGHT, COVER_WIDTH + 5);
155 translate ([0, SCREW_HOLE_GAP, 0])
156 slot(SCREW_HOLE_WIDTH, SCREW_HOLE_HEIGHT, COVER_WIDTH + 5);
0db640fc
CE
157 }
158 }
159}
160
0e0a29ec
CE
161module ac_cover () {
162 translate([0, COVER_HEIGHT, 0]) rotate([90, 0, 0]) {
163 difference() {
164 cover();
165 vents(offset = PSU_WIDTH/2 );
166 powerSocket(side=1);
167 screwHoles();
168 }
169 }
0db640fc
CE
170}
171
0e0a29ec
CE
172module dc_cover () {
173 translate([0, COVER_HEIGHT, 0]) rotate([90, 0, 0]) {
174 difference() {
175 cover();
176 difference () {
177 vents(limit = PSU_WIDTH);
178 cableSlotOutline();
179 }
180 cableSlot();
181 screwHoles();
182 }
183 }
184}
185
186$fs = 0.5;
187
188intersection () {
189// translate ([115, -10, -1]) #cube ([50, 100, 100]);
190 ac_cover ();
191
192}
193//translate ([200,0,0]) dc_cover ();
194
195// power socket mockups
196
197/* difference () { */
198/* cube ([5,45,50]); */
199/* #translate ([0, 0, -10]) powerSocket (); */
200/* } */
201
202/* translate ([100, 0, 0]) */
203/* difference () { */
204/* cube ([5, 40,50]); */
205/* translate ([0, -30, -20]) #screwHoles(); */
206/* } */