led_pillar

Documentation: http://frombelow.net/projects/led_pillar/
Clone: git clone https://git.frombelow.net/led_pillar.git
Log | Files | Refs | Submodules | README | LICENSE

case.scad (10229B)


      1 // Dimensions of the power supply (+ 1 mm on each side)
      2 power_supply_width = 97 + 1;
      3 power_supply_depth = 159 + 1;
      4 power_supply_height = 30 + 1;
      5 
      6 // Mount for Raspberry Pi Zero W
      7 mcu_compartment_depth = 60;
      8 knob_distance_width = 58;
      9 knob_distance_depth = 23;
     10 knob_diameter_bottom = 3;
     11 knob_diameter_top = 1;
     12 knob_height = 10;
     13 
     14 // Dimensions of power switch (+ 1 mm)
     15 power_switch_width = 18 + 1;
     16 power_switch_height = 12 + 1;
     17 
     18 // Diameters of cables ( + 2 mm)
     19 diameter_power_cable = 6 + 2;
     20 diameter_data_cable = 5 + 2;
     21 diameter_cord_grip_screw = 5 + 2;
     22 
     23 // Thickness of walls, guide rails, etc.
     24 wall_thickness = 2;
     25 
     26 // Interiour width must be big enough for power supply plus guide rails for
     27 // lid.
     28 inner_frame_width = power_supply_width + 2 * wall_thickness;
     29 inner_frame_depth = power_supply_depth + mcu_compartment_depth;
     30 // No wall on top, because we will place the lid there.
     31 inner_frame_height = power_supply_height + 2 * wall_thickness;
     32 
     33 // Create walls around empty box of given size. The top is left open.
     34 // Front does not have full height in order to leave room for the lid.
     35 module Frame(width, depth, height, wall_thickness) {
     36     // Add walls to inner frame
     37     outer_frame_width = width + 2 * wall_thickness;
     38     outer_frame_depth = depth + 2 * wall_thickness;
     39     outer_frame_height = height + 1 * wall_thickness;
     40     // Construct frame
     41     difference() {
     42         cube([outer_frame_width, outer_frame_depth, outer_frame_height]);
     43         translate([wall_thickness, wall_thickness, wall_thickness])
     44             cube([width, depth, height]);
     45         translate([wall_thickness, 0, outer_frame_height - wall_thickness * 2 ])
     46             cube([width, wall_thickness, wall_thickness * 2]);
     47     }
     48 }
     49 
     50 // Guide rails for lid and supporting structures.
     51 module Guide_Rails(width, depth, height, wall_thickness) {
     52     // Left top
     53     translate([wall_thickness, 0, height])
     54         cube([wall_thickness, depth + wall_thickness, wall_thickness]);
     55     // Left bottom
     56     translate([wall_thickness, 0, height - 2 * wall_thickness])
     57         cube([wall_thickness, depth + wall_thickness, wall_thickness]);
     58     // Right top
     59     translate([width, 0, height])
     60         cube([wall_thickness, depth + wall_thickness, wall_thickness]);
     61     // Right bottom
     62     translate([width, 0, height - 2 * wall_thickness])
     63         cube([wall_thickness, depth + wall_thickness, wall_thickness]);
     64     // Back top
     65     translate([wall_thickness, depth, height])
     66         cube([width, wall_thickness, wall_thickness]);
     67     // Back bottom
     68     translate([wall_thickness, depth, height - 2 * wall_thickness])
     69         cube([width, wall_thickness, wall_thickness]);
     70     // Support structure back
     71     translate([width/3, depth, wall_thickness])
     72         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     73     translate([width/3*2, depth, wall_thickness])
     74         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     75     // Support structure left side
     76     translate([wall_thickness, depth-depth/4, wall_thickness])
     77         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     78     translate([wall_thickness, depth-depth/4 * 2, wall_thickness])
     79         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     80     translate([wall_thickness, depth-depth/4 * 3, wall_thickness])
     81         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     82     // Support structure right side
     83     translate([width, depth-depth/4, wall_thickness])
     84         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     85     translate([width, depth-depth/4 * 2, wall_thickness])
     86         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     87     translate([width, depth-depth/4 * 3, wall_thickness])
     88         cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
     89     // Fixation of power supply
     90     translate([wall_thickness, 
     91                     depth - (wall_thickness + power_supply_depth),
     92                     wall_thickness])
     93         cube([width, wall_thickness, wall_thickness]);
     94 }
     95 
     96 module Frame_with_Rails(width, depth, height, wall_thickness) {
     97     union () {
     98         Frame(width=width, depth=depth, height=height, wall_thickness=wall_thickness);
     99         Guide_Rails(width=width, depth=depth, height=height, wall_thickness=wall_thickness);
    100     }
    101 }
    102 
    103 // Holes for cords and power switch
    104 module  Frame_with_Rails_and_Holes(width, depth, height, wall_thickness) {
    105     difference() {
    106         Frame_with_Rails(width=width, depth=depth, height=height,
    107                                       wall_thickness=wall_thickness);
    108         // Hole for power switch
    109         translate([width/3 , 0, height /3])
    110             cube([power_switch_width, wall_thickness, power_switch_height]);
    111         // Hole for power cable
    112         translate([0 , depth/11, height /4])
    113             rotate([0, 90, 0]) cylinder(d=diameter_power_cable, h=wall_thickness+1,
    114                                                      center=false);
    115         // Hole for data cable
    116         translate([0 , depth/5.5, height /4])
    117             rotate([0, 90, 0]) cylinder(d=diameter_data_cable, h=wall_thickness+1,
    118                                                      center=false);
    119     }
    120 }
    121 
    122 module  Frame_with_Air_Vents(width, depth, height, wall_thickness) {
    123     difference() {
    124         Frame_with_Rails_and_Holes(width=width, depth=depth, height=height,
    125                                       wall_thickness=wall_thickness);
    126         // Left side vents
    127         for(vent_depth = [depth/40*11+wall_thickness: depth/40: depth-wall_thickness*2])
    128             translate([0, vent_depth, 2*wall_thickness])
    129                 cube([wall_thickness*2, depth/80, height/3*2]);
    130         // Right side vents
    131         for(vent_depth = [depth/40*11+wall_thickness: depth/40: depth-wall_thickness*2])
    132             translate([width, vent_depth, 2*wall_thickness])
    133                 cube([wall_thickness*2, depth/80, height/3*2]);
    134         // Back side vents
    135         for(vent_width = [wall_thickness*3: width/20: width-wall_thickness*2])
    136             translate([vent_width, depth, 2*wall_thickness])
    137                 cube([width/50, wall_thickness*2, height/3*2]);
    138     }
    139 }
    140 // Support structure for cord grip for power supply
    141 module Cord_Grip_for_Power_Supply(width, depth, height, wall_thickness,
    142                                                                 diameter_power_cable,
    143                                                                 diameter_cord_grip_screw) {
    144 // Cord grip for power supply
    145     translate([wall_thickness,
    146                     depth/10 + diameter_power_cable/2 +  wall_thickness,
    147                     wall_thickness])
    148         difference () {
    149             cube([width/5, wall_thickness, height-2*wall_thickness]);
    150                 translate([width/7,
    151                                wall_thickness,
    152                                height/2])
    153                     rotate([90, 0, 0]) cylinder(d=diameter_cord_grip_screw,
    154                                                              h=wall_thickness+2,
    155                                                              center=true); 
    156         }
    157     
    158 }
    159  
    160 // Mount for Raspberry Pi Zero W
    161 module MCU_Mount(width, depth, knob_distance_width, knob_distance_depth,
    162                  mcu_compartment_depth, knob_diameter_bottom,
    163                  knob_diameter_top, knob_height, wall_thickness) {
    164     translate([knob_distance_width*.68,
    165                (mcu_compartment_depth-wall_thickness-knob_distance_depth)/1.5,
    166                       wall_thickness]) {
    167          cylinder(h=knob_height, r1=knob_diameter_bottom/2,
    168                   r2=knob_diameter_top/2);
    169          translate([knob_distance_width, 0, 0])
    170               cylinder(h=knob_height, r1=knob_diameter_bottom/2,
    171                        r2=knob_diameter_top/2);
    172          translate([0, knob_distance_depth, 0])
    173               cylinder(h=knob_height, r1=knob_diameter_bottom/2,
    174                        r2=knob_diameter_top/2);
    175          translate([knob_distance_width, knob_distance_depth, 0])
    176               cylinder(h=knob_height, r1=knob_diameter_bottom/2,
    177                        r2=knob_diameter_top/2);
    178     }
    179 }
    180 
    181 
    182 // Initials and year
    183 module Signature(width, wall_thickness) {
    184 translate([width+wall_thickness*2, wall_thickness*2, wall_thickness*2]) rotate([90, 0, 90]) linear_extrude(1) text(text="gb 2020", size=5, font="Arial Black");
    185 }
    186 
    187 
    188 // Complete Box
    189 module Box(){
    190     Frame_with_Air_Vents(width=inner_frame_width, 
    191                                                      depth=inner_frame_depth,
    192                                                      height=inner_frame_height,
    193                                                      wall_thickness=wall_thickness);
    194     
    195     Cord_Grip_for_Power_Supply(width=inner_frame_width, 
    196                                                       depth=inner_frame_depth,
    197                                                       height=inner_frame_height,
    198                                                       wall_thickness=wall_thickness,
    199                                                       diameter_power_cable=diameter_power_cable,
    200                                                       diameter_cord_grip_screw=diameter_cord_grip_screw);
    201     
    202     MCU_Mount(width=inner_frame_width, depth=inner_frame_depth,
    203               knob_distance_width=knob_distance_width,
    204               knob_distance_depth=knob_distance_depth,
    205               mcu_compartment_depth=mcu_compartment_depth,
    206               knob_diameter_bottom=knob_diameter_bottom,
    207               knob_diameter_top=knob_diameter_top,
    208               knob_height=knob_height,
    209               wall_thickness=wall_thickness);
    210     
    211     Signature(width=inner_frame_width, wall_thickness=wall_thickness);
    212 }
    213 
    214 // Lid for the box
    215 // (rails leave 0.5 mm on each side)
    216 module Lid(){
    217 translate([wall_thickness+0.5, 0, inner_frame_height-wall_thickness])
    218      cube([inner_frame_width-1, inner_frame_depth+wall_thickness-1.5, wall_thickness]);
    219 translate([wall_thickness*2, 0, inner_frame_height])
    220      cube([inner_frame_width-2*wall_thickness,
    221                inner_frame_depth-1,
    222                wall_thickness]);
    223 }
    224 
    225 
    226 module Render_All() {
    227     Box();
    228     translate([0, 0, 40])
    229         Lid();
    230 }
    231 
    232 
    233 // projection(cut=true) translate([0, 0, -3])
    234 // Box();
    235 // Lid();
    236 Render_All();