diff --git a/README.md b/README.md index c4fa3aa..e47009c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # OpenSCAD Arduino Mounting library -The library has a variety of modules for creating Arduinos and Arduino mounts. Here is a basic description of the included modules. It includes all official boards through the Due. For examples see the included example SCAD. +The library has a variety of modules for creating Arduinos and Arduino mounts. Here is a basic description of the included modules. It includes all official boards through the Due, plus the MKR WIFI 1010. For examples see the included example SCAD. -![openscadarduinomounting](https://cloud.githubusercontent.com/assets/492003/9833469/f1cbe2dc-5965-11e5-8357-0297916c8885.jpg) +![openscadarduinomounting](example.jpg) -##Dependencies +## Dependencies Using the [library location instructions](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries), checkout the `pin_connectors` library in the `libraries` folder, e.g on OSX this is done as follows: @@ -27,19 +27,19 @@ platform. ## Arduino Mounting Library Functions ### arduino(boardType) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 *This module creates an Arduino board with USB connector, power supply and headers.* ### bumper(boardType, mountingHoles) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 **mountingHoles** - (OPTIONAL) True or false for external mounting holes for bumper. *Create a simple bumper style encloser for a particular board* -### enclosure(boardType, wall, offset, heightExtension, cornerRadius, mountType) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +### enclosure(boardType, wall, offset, heightExtension, cornerRadius, mountType, standOffHeight) +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 **wall** - Thickness of enclosure walls. Default is 3. @@ -51,10 +51,12 @@ platform. **mountType** - TAPHOLE, PIN - How the standoffs attach to the board either using tap holes for screws or pins. +**standOffHeight** - The spacing between the enclosure bottom and the board. MKR_WIFI_1010 needs abot 10mm. + *Creates a box enclosure with a snap-on lid for a particular board* ### enclosureLid(boardType, wall, offset, cornerRadius, ventHoles) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 **wall** - Thickness of enclosure walls. Default is 3. @@ -68,7 +70,7 @@ platform. ### standoffs(boardType, height, topRadius, bottomRadius, holeRadius, mountType) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 **height** - height of standoffs @@ -78,12 +80,12 @@ platform. **holeRadius** - Radius of tap hole in the standoff. -**mountType** - TAPHOLE, PIN +**mountType** - TAPHOLE, PIN, NOTCH recommended for FDM printing for small holes like on NANO and MKR_WIFI_1010 *This creates standoffs for mounting holes. These are simple cylinders that can be tapered. For custom standoffs use the holePlacement() module.* ### boardShape( boardType, offset, height ) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 **offset** - creates the shape offset from actual board size. Negative values create an inset shape. @@ -92,7 +94,7 @@ platform. *This creates the shape of the PCB with no holes. The default create a basic Uno PCB.* ### boundingBox(boardType, offset, height, cornerRadius, include) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 **offset** - creates the shape offset from actual board size. Negative values create an inset shape. @@ -105,19 +107,36 @@ platform. *This creates a box whos dimensions are the extremes of the board.* ### holePlacement(boardType) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 *This is used for placing holes and is the basis of the standoff module. holePlacement takes a child element and places it at each of the mounting hole centers for a given board.* ### components(boardType, component, extension, offset) -**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET +**boardType** - UNO, LEONARDO, DUEMILANOVE, DIECIMILA, DUE, MEGA, MEGA 2560, ETHERNET, NANO, MKR_WIFI_1010 -**component** - ALL, HEADER\_F, HEADER\_M, USB, POWER, RJ45 +**component** - ALL, HEADER\_F, HEADER\_M, USB, POWER, RJ45, HEADER\_BI **extension** - Extention off the board in direction of connector. The default is the standard dimension of the connector, but can be set to an arbitrary value. **offset** - Offsets the connector cube in the other two dimensions. *Creates the components( headers, power and usb jacks) for a given board. Also used for creating punchout, by using the extension and offset values.* + +## Examples + +This creates a simple standoff for an Arduino MKR WIFI 1010. +``` + standoffs(MKR_WIFI_1010, height = 10, mountType=NOTCH); + difference() { + boardShape(MKR_WIFI_1010, offset = 3); + translate([0,0,-0.005]) scale(1.01) boardShape(MKR_WIFI_1010); + } + +``` + +The notches might be difficult to clip in, use pliers to carefully apply force without damaging the board. +If the print is perfect, there should be a notable 'click', and the board should fit on without tension, +movable by a few microns. +![FDM printed standoff](mkr_wifi_1010.webp) diff --git a/arduino.scad b/arduino.scad index a122d1b..457c5f0 100644 --- a/arduino.scad +++ b/arduino.scad @@ -30,7 +30,7 @@ module arduino(boardType = UNO) { color("SteelBlue") boardShape( boardType ); translate([0,0,-pcbHeight * 0.5]) holePlacement(boardType = boardType) - color("SteelBlue") cylinder(r = mountingHoleRadius, h = pcbHeight * 2, $fn=32); + color("SteelBlue") cylinder(r = mountingHoleRadius[boardType], h = pcbHeight * 2, $fn=32); } //Add all components to board components( boardType = boardType, component = ALL ); @@ -60,7 +60,7 @@ module bumper( boardType = UNO, mountingHoles = false ) { //Board mounting holes holePlacement(boardType=boardType) - cylinder(r = mountingHoleRadius + 1.5, h = bumperBaseHeight, $fn = 32); + cylinder(r = mountingHoleRadius[boardType] + 1.5, h = bumperBaseHeight, $fn = 32); //Bumper mounting holes (exterior) if( mountingHoles ) { @@ -88,10 +88,20 @@ module bumper( boardType = UNO, mountingHoles = false ) { } translate([0,0,-0.5]) holePlacement(boardType=boardType) - cylinder(r = mountingHoleRadius, h = bumperHeight, $fn = 32); + cylinder(r = mountingHoleRadius[boardType], h = bumperHeight, $fn = 32); translate([0, 0, bumperBaseHeight]) { - components(boardType = boardType, component = ALL, offset = 1); + components(boardType = boardType, component = USB, offset = 1); } + translate([0, 0, bumperBaseHeight]) { + components(boardType = boardType, component = I2C, offset = 1); + } + translate([0, 0, bumperBaseHeight]) { + components(boardType = boardType, component = POWER, offset = 1); + } + translate([0, 0, bumperBaseHeight]) { + components(boardType = boardType, component = RJ45, offset = 1); + } + // Cooling opening? translate([4,(dimensions[1] - dimensions[1] * 0.4)/2,-1]) cube([dimensions[0] -8,dimensions[1] * 0.4,bumperBaseHeight + 2]); } @@ -103,8 +113,8 @@ INTERIORMOUNTINGHOLES = 1; EXTERIORMOUNTINGHOLES = 2; //Create a board enclosure -module enclosure(boardType = UNO, wall = 3, offset = 3, heightExtension = 10, cornerRadius = 3, mountType = TAPHOLE) { - standOffHeight = 5; +module enclosure(boardType = UNO, wall = 3, offset = 3, heightExtension = 10, cornerRadius = 3, mountType = TAPHOLE, standOffHeight = 5) { + dimensions = boardDimensions(boardType); boardDim = boardDimensions(boardType); @@ -200,7 +210,7 @@ module boardShape( boardType = UNO, offset = 0, height = pcbHeight ) { //Create a bounding box around the board //Offset - will increase the size of the box on each side, -//Height - overides the boardHeight and offset in the z direction +//Height - overrides the boardHeight and offset in the z direction BOARD = 0; //Includes all components and PCB PCB = 1; //Just the PCB @@ -236,16 +246,18 @@ module boundingBox(boardType = UNO, offset = 0, height = 0, cornerRadius = 0, in //Creates standoffs for different boards TAPHOLE = 0; PIN = 1; +NOTCH = 2; // Recommended for small radius (< 1.5mm) on FDM printers. -module standoffs( - boardType = UNO, - height = 10, - topRadius = mountingHoleRadius + 1, - bottomRadius = mountingHoleRadius + 2, - holeRadius = mountingHoleRadius, +module standoffs( + boardType = UNO, + height = 10, mountType = TAPHOLE ) { + topRadius = mountingHoleRadius[boardType] + 1; + bottomRadius = mountingHoleRadius[boardType] + 2; + holeRadius = mountingHoleRadius[boardType]; + holePlacement(boardType = boardType) union() { difference() { @@ -255,10 +267,17 @@ module standoffs( } } if( mountType == PIN ) { - translate([0, 0, height - 1]) + translate([0, 0, height -1]) pintack( h=pcbHeight + 3, r = holeRadius, lh=3, lt=1, bh=1, br=topRadius ); } - } + if( mountType == NOTCH ) { + $fn = 16; + translate([0, 0, height]) { + cylinder(r= holeRadius *0.9 , h=pcbHeight+0.1); + translate([0, 0, pcbHeight+0.1]) cylinder(r1 = holeRadius + 0.15, r2 = holeRadius * 0.7, h=0.8); + } + } + } } //This is used for placing the mounting holes and for making standoffs @@ -282,6 +301,22 @@ HEADER_M = 1; USB = 2; POWER = 3; RJ45 = 4; +HEADER_BI = 5; +I2C = 6; + +module header(dimensions, headerType ) { + // zb : height of plastic part of the header: 2.54 for male + // zg : height of pin below the board. + zb = headerType==HEADER_M?2.54:dimensions[2]; + zg = headerType==HEADER_BI?dimensions[2]:0.8+pcbHeight; + + color("black") cube( [dimensions[0],dimensions[1],zb] ); + for (m = [0:dimensions[0]/2.54 -1]) { + for (n = [0:dimensions[1]/2.54 -1]) { + translate([0.95 + m*2.54, 0.95 + n*2.54, -zg-0.01]) color("yellow") cube([0.64, 0.64,dimensions[2] + zg] ); + } + } +} module components( boardType = UNO, component = ALL, extension = 0, offset = 0 ) { translate([0, 0, pcbHeight]) { @@ -297,10 +332,14 @@ module components( boardType = UNO, component = ALL, extension = 0, offset = 0 ) + ((components[boardType][i][2] * [1,1,1]) * components[boardType][i][2]) * extension + ([1,1,1] - components[boardType][i][2]) * offset * 2; - translate( position ) color( components[boardType][i][4] ) - cube( dimensions ); + translate( position ) + if(components[boardType][i][3] == HEADER_M || components[boardType][i][3] == HEADER_F || components[boardType][i][3] == HEADER_BI) { + header(dimensions, components[boardType][i][3]); + } else { + color( components[boardType][i][4] ) cube( dimensions ); + } } - } + } } } @@ -412,12 +451,14 @@ YUN = 8; INTELGALILEO = 9; TRE = 10; ETHERNET = 11; +NANO = 12; +MKR_WIFI_1010 = 13; +MKR_WIFI_1000 = 14; /********************************** MEASUREMENTS **********************************/ pcbHeight = 1.7; headerWidth = 2.54; headerHeight = 9; -mountingHoleRadius = 3.2 / 2; ngWidth = 53.34; leonardoDepth = 68.58 + 1.1; //PCB depth plus offset of USB jack (1.1) @@ -462,6 +503,21 @@ megaHoles = [ [ 50.8, 96.52 ] ]; +// Original nano holes +nanoHoles = [ + [ 1.27, 1.27 ], + [ 1.27, 41.91 ], + [ 16.51, 41.91 ], + [ 16.51, 1.27 ] + ]; + +mkrHoles = [ + [ 2.2, 2.2], + [ 22.8, 2.2], + [ 2.2, 59.3], + [ 22.8, 59.3] + ]; + boardHoles = [ ngHoles, //NG ngHoles, //Diecimila @@ -474,7 +530,28 @@ boardHoles = [ 0, //Yun 0, //Intel Galileo 0, //Tre - unoHoles //Ethernet + unoHoles, //Ethernet + nanoHoles, //Nano + mkrHoles, //MKR WIFI 1010 + mkrHoles //MKR WIFI 1000 + ]; + +mountingHoleRadius = [ + 1.6, //NG + 1.6, //Diecimila + 1.6, //Duemilanove + 1.6, //Uno + 1.6, //Leonardo + 1.6, //Mega + 1.6, //Mega 2560 + 1.6, //Due + 1.6, //Yun + 1.6, //Intel Galileo + 1.6, //Tre + 1.6, //Ethernet + 0.92, //Nano + 1.2, //MKR WIFI 1010 + 1.2 //MKR WIFI 1000 ]; /********************************** BOARD SHAPES **********************************/ @@ -502,7 +579,21 @@ megaBoardShape = [ [ 0.0, 96.52 ] ]; -boardShapes = [ + nanoBoardShape = [ + [ 0.0, 0.0 ], + [ 17.78, 0.0 ], + [ 17.78, 43.18 ], + [ 0.0, 43.18] + ]; + + mkr_wifi_BoardShape = [ + [ 0.0, 0.0 ], + [ 25.0, 0.0 ], + [ 25.0, 61.5 ], + [ 0.0, 61.5] + ]; + +boardShapes = [ ngBoardShape, //NG ngBoardShape, //Diecimila ngBoardShape, //Duemilanove @@ -514,12 +605,15 @@ boardShapes = [ 0, //Yun 0, //Intel Galileo 0, //Tre - ngBoardShape //Ethernet - ]; + ngBoardShape, //Ethernet + nanoBoardShape, //Nano + mkr_wifi_BoardShape, //MKR WIFI 1010 + mkr_wifi_BoardShape //MKR WIFI 1000 + ]; /*********************************** COMPONENTS ***********************************/ -//Component data. +//Component data. //[position, dimensions, direction(which way would a cable attach), type(header, usb, etc.), color] ngComponents = [ [[1.27, 17.526, 0], [headerWidth, headerWidth * 10, headerHeight], [0, 0, 1], HEADER_F, "Black" ], @@ -584,7 +678,24 @@ dueComponents = [ [[27.365, -1.1, 0], [7.5, 5.9, 3], [0, -1, 0], USB, "LightGray" ], [[40.7, -1.8, 0], [9.0, 13.2, 10.9], [0, -1, 0], POWER, "Black" ] ]; - + +nanoComponents = [ + [[0, 2.54, 0], [headerWidth, headerWidth * 15, headerHeight], [0, 0, 1], HEADER_M, "Black"], + [[15.24, 2.54, 0], [headerWidth, headerWidth * 15, headerHeight], [0, 0, 1], HEADER_M, "Black"], + [[4.9, -1.1, 0], [8, 9, 3], [0, -1, 0], USB, "LightGray" ], + ]; + +mkr_wifi_1000Components = [ + [[1, 20.5, 0], [headerWidth, headerWidth * 14, headerHeight], [0, 0, 1], HEADER_BI, "Black"], + [[21.46, 20.5, 0], [headerWidth, headerWidth * 14, headerHeight], [0, 0, 1], HEADER_BI, "Black"], + [[9.5, -1.1, 0], [8, 6, 3], [0, -1, 0], USB, "LightGray" ], + [[19, 11.25, 0], [6.0, 8, 5.25], [1, 0, 0], POWER, "White" ] + ]; + +function cat(L1, L2) = [for(L=[L1, L2], a=L) a]; + +mkr_wifi_1010Components = cat(mkr_wifi_1000Components, [[[0.6, 5.9, 0], [4.3, 8, 3], [-1, 0, 0], I2C, "White"]]); + components = [ ngComponents, //NG ngComponents, //Diecimila @@ -597,7 +708,10 @@ components = [ 0, //Yun 0, //Intel Galileo 0, //Tre - etherComponents //Ethernet + etherComponents, //Ethernet + nanoComponents, //Nano + mkr_wifi_1010Components, //MKR WIFI 1010 + mkr_wifi_1000Components //MKR WIFI 1000 ]; /****************************** NON-BOARD PARAMETERS ******************************/ diff --git a/example.jpg b/example.jpg new file mode 100644 index 0000000..b25a533 Binary files /dev/null and b/example.jpg differ diff --git a/examples.scad b/examples.scad index 97290f6..137af0d 100644 --- a/examples.scad +++ b/examples.scad @@ -31,3 +31,27 @@ translate([0, 0, -75]) { translate([0, 0, 75]) { enclosureLid(); } + +translate([-140,0,0]) { + translate([0,0,2.2]) arduino(NANO); + translate([0,100, 0]) bumper(NANO, mountingHoles = true); + translate([0,0,-75]) enclosure(NANO); + translate([0,0,75]) enclosureLid(NANO); + + translate([0,100,-75]) { + standoffs(NANO, mountType=NOTCH); + boardShape(NANO, offset = 3); + } +} + +translate([-200,0,0]) { + translate([0,0,2.2]) arduino(MKR_WIFI_1010); + translate([0,100, 0]) bumper(MKR_WIFI_1010, mountingHoles = true); + translate([0,0,-75]) enclosure(MKR_WIFI_1010, standOffHeight=10); + translate([0,0,75]) enclosureLid(MKR_WIFI_1010); + + translate([0,100,-75]) { + standoffs(MKR_WIFI_1010, mountType=NOTCH); + boardShape(MKR_WIFI_1010, offset = 3); + } +} diff --git a/mkr_wifi_1010.webp b/mkr_wifi_1010.webp new file mode 100644 index 0000000..566550e Binary files /dev/null and b/mkr_wifi_1010.webp differ