Use the LUN provided in IDENTIFY messages in preference to the CDB.
[SCSI2SD.git] / hardware / bracket / 3.5_hdd_mount.scad
1 //      Copyright (C) 2013 Michael McMaster <michael@codesrc.com>
2 //
3 //      This file is part of SCSI2SD.
4 //
5 //      SCSI2SD is free software: you can redistribute it and/or modify
6 //      it under the terms of the GNU General Public License as published by
7 //      the Free Software Foundation, either version 3 of the License, or
8 //      (at your option) any later version.
9 //
10 //      SCSI2SD is distributed in the hope that it will be useful,
11 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //      GNU General Public License for more details.
14 //
15 //      You should have received a copy of the GNU General Public License
16 //      along with SCSI2SD.  If not, see <http://www.gnu.org/licenses/>.
17
18
19 $fa = 3; // 4-times as many angles per circle.
20 $fs = 0.1; // 0.1mm accuracy
21
22         // A* taken from SFF-8301 Specification for Form Factor of 3.5" Disk Drives
23
24         A3 = 101.6; // width
25         A5 = 3.19; // Distance from side to bottom hole.
26         A6 = 44.45; // Distance from A7 to second bottom hole.
27         A7 = 41.28; // Distance from front to bottom holes.
28         A8 = 28.5; // Distance from front to side holes
29         A9 = 101.60; // Distance between side holes.
30         A10 = 6.35; // Height from base to site holes.
31         A13 = 76.2; // Distance from A7 to third bottom hole.
32         m3HoleRadius=2.667/2; // M3x0.50 minimum hole size (aluminium or softer material)
33         holeBulk=4; // Extra around holes
34         tmp = 10;
35         // NOTE: PCB width (3860mils) must be less than 101.6 -  (2 * wall width)
36         // Max width is about 1.5mm.
37         wallWidth = 1.3;
38         screwWidth = 3;
39         foo = 6;
40         bar = 4;  // PSOC MOUNT
41
42 PCB_DIFF=90.42; // Clearance line of "fat" via is 10mil from edge.
43 PCB_off = (A3 - PCB_DIFF) / 2;
44 // from front = A7 + foo = 47.28
45 // second = 47.28 + A6 = 91.73. Perfect!
46 // Height between board and screw:
47 // screwWidth + 1.6mm pcb only = 3 + 1.6 =4.6. Not a problem!
48 // Width of PCB vs side hole bulk: 101.6 - 97.5360  = 4.064
49 // only 2mm to spare on either side.
50 // TODO Made a NOTCH in the PCB to handle this!
51 // notch: A8 +- holeBulk = 28.5 - 4, 28.5 + 4 = 24 -> 33mm. 3mm in.
52
53
54
55 module hdd_side()
56 {
57         difference()
58         {
59                 union()
60                 {
61                         cube([A8 + A9 + tmp, wallWidth, A10 + holeBulk]);
62
63                         // Bottom mount 1
64                         translate([A7 - (foo / 2), 0, 0])
65                         {
66                                 cube([foo, foo, screwWidth]); 
67                         }
68
69                         // Bottom mount 2
70                         translate([A6 + A7 - (foo / 2), 0, 0])
71                         {
72                                 cube([foo, foo, screwWidth]); 
73                         }
74
75                         // Bottom mount 3
76                         translate([A13 + A7 - (foo / 2), 0, 0])
77                         {
78                                 cube([foo, foo, screwWidth]); 
79                         }
80
81                         // psoc mount 1
82                         translate([A7 - (foo / 2) + foo, 0, 0])
83                         {
84                                 cube([foo, foo + bar, screwWidth]); 
85                         }
86
87                         // psoc mount 2
88                         translate([A6 + A7 - (foo / 2) + foo, 0, 0])
89                         {
90                                 cube([foo, foo + bar, screwWidth]); 
91                         }
92
93                         // Extra bulk behind side holes
94                         translate([A8, 0, A10])
95                         {
96                                 rotate([270, 0, 0])
97                                 {
98                                         cylinder(h=screwWidth, r=holeBulk);
99                                 }
100                         }
101
102                         translate([A8 + A9, 0, A10])
103                         {
104                                 rotate([270, 0, 0])
105                                 {
106                                         cylinder(h=screwWidth, r=holeBulk);
107                                 }
108                         }
109                 }
110         
111                 // Remove excess material from the side
112                 translate([-0.5, -0.5,screwWidth + wallWidth])
113                 {
114                         cube([A8 - tmp + 0.5, wallWidth + 1, A10 + holeBulk]);
115                 }
116                 translate([A8 + tmp, -0.5, screwWidth + wallWidth])
117                 {
118                         cube([A9 - (tmp * 2), wallWidth + 1, A10 + holeBulk]);
119                 }
120
121
122                 // SIDE HOLES
123         
124                 translate([A8, -0.5, A10])
125                 {
126                         rotate([270, 0, 0])
127                         {
128                                 cylinder(h=screwWidth + 1, r=m3HoleRadius);
129                         }
130                 }
131
132                 translate([A8 + A9, -0.5, A10])
133                 {
134                         rotate([270, 0, 0])
135                         {
136                                 cylinder(h=screwWidth + 1, r=m3HoleRadius);
137                         }
138                 }
139
140                 // BOTTOM HOLES
141                 // Bottom hole 1
142                 translate([A7, A5, -0.5])
143                 {
144                         cylinder(h=screwWidth + 1, r = m3HoleRadius); 
145                 }
146
147                 // Bottom hole 2
148                 translate([A6 + A7, A5, -0.5])
149                 {
150                         cylinder(h=screwWidth + 1, r = m3HoleRadius); 
151                 }
152
153                 // Bottom hole 3
154                 translate([A13 + A7, A5, -0.5])
155                 {
156                         cylinder(h=screwWidth + 1, r = m3HoleRadius); 
157                 }
158
159                 // PSOC hole1
160                 translate([A7 + foo, PCB_off, -0.5])
161                 {
162                         cylinder(h=screwWidth + 1, r = m3HoleRadius); 
163                 }
164                 // PSOC hole2
165                 translate([A6 + A7 + foo, PCB_off, -0.5])
166                 {
167                         cylinder(h=screwWidth + 1, r = m3HoleRadius); 
168                 }
169         }
170 }
171
172 union()
173 {
174         hdd_side();
175         translate([0, A3, 0])
176         {
177                 mirror([0, 1, 0])
178                 {
179                         hdd_side();
180                 }
181         }
182
183         cube([wallWidth * 2, A3, wallWidth]);
184
185         translate([A8 + A9 + tmp - wallWidth * 2, 0, 0])
186         {
187                 cube([wallWidth * 2, A3, wallWidth]);
188         }
189
190                 // Bottom hole 1
191                 translate([A7 + foo, foo + bar, 0])
192                 {
193                         cube([wallWidth * 2, A3 - ((foo + bar) * 2), wallWidth]); 
194                 }
195
196                 // Bottom hole 2
197                 translate([A6 + A7 + foo, foo + bar, 0])
198                 {
199                         cube([wallWidth * 2, A3 - ((foo + bar) * 2), wallWidth]); 
200                 }
201
202
203         for (i = [0:3])
204         {
205                 translate([0, (i * (A3 - wallWidth) / 3), 0])
206                 {
207                         cube([A8 + A9 + tmp, wallWidth, wallWidth]);
208                 }
209         }
210 }