diff --git a/libtest.png b/libtest.png
index d35b357..a171850 100644
Binary files a/libtest.png and b/libtest.png differ
diff --git a/readme.md b/readme.md
index 1e5ad9e..aa54f4c 100644
--- a/readme.md
+++ b/readme.md
@@ -17,29 +17,29 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
## Table of Contents
---
@@ -570,6 +570,50 @@ D-connectors. Can be any number of ways, male or female, solder buckets, PCB mou
| 6 | ```d_pillar()``` | D-type connector pillar |
+Top
+
+---
+
+## DIP
+Dual inline IC packages and sockets
+
+
+[vitamins/dip.scad](vitamins/dip.scad) Implementation.
+
+[tests/DIP.scad](tests/DIP.scad) Code for this example.
+
+### Properties
+| Function | Description |
+|:--- |:--- |
+| ```pdip_pin_W(type)``` | Pin shoulder width |
+| ```pdip_pin_h(type)``` | Pin height |
+| ```pdip_pin_n(type)``` | Pin neck |
+| ```pdip_pin_s(type)``` | Height above seating plane |
+| ```pdip_pin_t(type)``` | Pin thickness |
+| ```pdip_pin_w(type)``` | Pin width |
+
+### Modules
+| Module | Description |
+|:--- |:--- |
+| ```dip(n, part, size, w, pitch, pin)``` | Draw DIP package |
+| ```pdip(pins, part, socketed, w = inch(0.3)``` | Draw standard 0.1" PDIP IC package |
+| ```pdip_pin(type, l, end)``` | Draw a pin |
+
+
+
+### Vitamins
+| Qty | Module call | BOM entry |
+| ---:|:--- |:---|
+| 1 | ```dil_socket(14, 7.62)``` | DIL socket 28 x 0.3" |
+| 1 | ```pdip(14, 74HC00)``` | IC 74HC00 PDIP14 |
+| 1 | ```pdip(20, 74HC245)``` | IC 74HC245 PDIP20 |
+| 1 | ```pdip(28, ATMEGA328)``` | IC ATMEGA328 PDIP28 |
+| 1 | ```pdip(8, NE555)``` | IC NE555 PDIP8 |
+| 1 | ```pdip(6, OPTO)``` | IC OPTO PDIP6 |
+| 1 | ```pdip(16, ULN2003)``` | IC ULN2003 PDIP16 |
+| 1 | ```pdip(18, ULN2803)``` | IC ULN2803 PDIP18 |
+
+
Top
---
@@ -1939,7 +1983,10 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| ---:|:--- |:---|
| 1 | ```box_header(2p54header, 4, 2, smt = 0)``` | Box header 4 x 2 |
| 1 | ```d_plug(DCONN9, pcb = true)``` | D-type 9 way PCB mount plug |
+| 1 | ```dil_socket(12, 15.24)``` | DIL socket 24 x 0.6" |
| 1 | ```hdmi(hdmi_full)``` | HDMI socket |
+| 1 | ```pdip(24, 27C32, w = 15.24)``` | IC 27C32 PDIP24 |
+| 1 | ```pdip(8, NE555)``` | IC NE555 PDIP8 |
| 1 | ```idc_transition(2p54header, 5)``` | IDC transition header 5 x 2 |
| 1 | ```led(LED10mm, "yellow")``` | LED 10 mm yellow |
| 1 | ```led(LED3mm)``` | LED 3 mm red |
diff --git a/tests/DIP.scad b/tests/DIP.scad
new file mode 100644
index 0000000..516b70d
--- /dev/null
+++ b/tests/DIP.scad
@@ -0,0 +1,32 @@
+//
+// NopSCADlib Copyright Chris Palmer 2020
+// nop.head@gmail.com
+// hydraraptor.blogspot.com
+//
+// This file is part of NopSCADlib.
+//
+// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software Foundation, either version 3 of
+// the License, or (at your option) any later version.
+//
+// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along with NopSCADlib.
+// If not, see .
+//
+include <../core.scad>
+include <../vitamins/dip.scad>
+
+use <../utils/layout.scad>
+
+dips = [[6, "OPTO"], [8, "NE555"], [14, "74HC00"], [16, "ULN2003"], [18, "ULN2803"], [20, "74HC245"], [28, "ATMEGA328"]];
+
+module dips()
+ for(i = [0 : len(dips) - 1]) let(dip = dips[i])
+ translate([i * inch(0.5), 0])
+ pdip(dip[0], dip[1], dip[0] > 20);
+
+if($preview)
+ dips();
diff --git a/tests/PCB.scad b/tests/PCB.scad
index 0d73171..bf70ecf 100644
--- a/tests/PCB.scad
+++ b/tests/PCB.scad
@@ -106,6 +106,8 @@ test_pcb = ["TestPCB", "Test PCB",
[ 50, 170, 0, "button_6mm"],
[ 50, 185, 0, "microswitch", small_microswitch],
[ 52, 200, 0, "pcb", 11, TMC2130 ],
+ [ 80, 200, 0, "pdip", 24, "27C32", true, inch(0.6) ],
+ [ 80, 170, 0, "pdip", 8, "NE555" ],
[ 52, 206, 0, "2p54socket", 8, 1 ],
[ 52, 194, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ],
[ 50, 220, 0, "standoff", 5, 4.5, 12.5, 2.54],
diff --git a/tests/png/dip.png b/tests/png/dip.png
new file mode 100644
index 0000000..d231a61
Binary files /dev/null and b/tests/png/dip.png differ
diff --git a/tests/png/pcb.png b/tests/png/pcb.png
index c520624..8b5591a 100644
Binary files a/tests/png/pcb.png and b/tests/png/pcb.png differ
diff --git a/tests/png/pcbs.png b/tests/png/pcbs.png
index e46d911..0daf9d1 100644
Binary files a/tests/png/pcbs.png and b/tests/png/pcbs.png differ
diff --git a/vitamins/dip.scad b/vitamins/dip.scad
new file mode 100644
index 0000000..26b48de
--- /dev/null
+++ b/vitamins/dip.scad
@@ -0,0 +1,181 @@
+//
+// NopSCADlib Copyright Chris Palmer 2020
+// nop.head@gmail.com
+// hydraraptor.blogspot.com
+//
+// This file is part of NopSCADlib.
+//
+// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software Foundation, either version 3 of
+// the License, or (at your option) any later version.
+//
+// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along with NopSCADlib.
+// If not, see .
+//
+
+//
+//! Dual inline IC packages and sockets
+//
+include <../utils/core/core.scad>
+
+pdip_pin = [0.25, 2.54, 0.5, 3.0, 1.524, 1];
+
+function pdip_pin_t(type) = type[0]; //! Pin thickness
+function pdip_pin_s(type) = type[1]; //! Height above seating plane
+function pdip_pin_w(type) = type[2]; //! Pin width
+function pdip_pin_h(type) = type[3]; //! Pin height
+function pdip_pin_W(type) = type[4]; //! Pin shoulder width
+function pdip_pin_n(type) = type[5]; //! Pin neck
+
+module pdip_pin(type, l, end) { //! Draw a pin
+ w = pdip_pin_w(type);
+ t = pdip_pin_t(type);
+ h = pdip_pin_h(type);
+ W = pdip_pin_W(type);
+ s = pdip_pin_s(type);
+ n = pdip_pin_n(type);
+ slope = (W - n);
+ r = t;
+ x0 = end < 0 ? -w / 2 : -W / 2;
+ n0 = end < 0 ? -w / 2 : -n / 2;
+ W1 = end != 0 ? W / 2 + w / 2 : W;
+ n1 = end != 0 ? n / 2 + w / 2 : n;
+ color("silver") {
+ translate([x0, -r - t / 2 - l, s - t / 2])
+ cube([W1, l, t]);
+
+ translate([x0, -r - t / 2, s - r - t / 2])
+ rotate([90, 0, 90])
+ rotate_extrude(angle = 90, $fn = 32)
+ translate([r, 0])
+ square([t, W1]);
+
+ translate_z(-h)
+ rotate([90, 0, 0])
+ linear_extrude(t, center = true) {
+
+ translate([-w / 2, 0])
+ square([w, h]);
+
+ hull() {
+ translate([x0, h + slope])
+ square([W1, s - t / 2 - r - slope]);
+
+ translate([n0, h])
+ square([n1, eps]);
+ }
+
+ }
+ }
+}
+
+module dil_pin_positions(rows, w, pitch)
+ for(i = [0 : rows - 1], $side = [-1, 1], $x = i * pitch - (rows - 1) * pitch / 2)
+ translate([0, $x])
+ rotate($side * 90)
+ translate([0, w / 2])
+ children();
+
+module dil_socket(rows, w, pitch = inch(0.1)) {
+ vitamin(str("dil_socket(", rows, ", ", w, arg(pitch, inch(0.1), "pitch"), "): DIL socket ", rows * 2, " x ", w / inch(1), "\""));
+
+ h = 4;
+ h2 = 6;
+ t = 0.8;
+ length = rows * pitch;
+ width = w + pitch;
+ hole = [0.8, 0.5];
+ pin_l = 3;
+
+ color(grey20) {
+ linear_extrude(h)
+ difference() {
+ square([width, length], center = true);
+
+ square([w - pitch, length - 2 * pitch], center = true);
+
+ dil_pin_positions(rows, w, pitch)
+ square(hole, center = true);
+
+ translate([0, rows * pitch / 2])
+ circle(d = 1.5);
+ }
+ rotate([90, 0, 0])
+ linear_extrude(length, center = true)
+ for(side = [-1, 1])
+ hull() {
+ t2 = pitch / 2 - hole.y / 2;
+ translate([side * (width / 2 - t / 2) - t / 2, 0])
+ square([t, h2]);
+
+ translate([side * (width / 2 - t2 / 2) - t2 / 2, 0])
+ square([t2, h]);
+ }
+ }
+ color("silver")
+ dil_pin_positions(rows, w, pitch)
+ translate_z(-pin_l / 2)
+ cube([0.5, 0.25, pin_l], center = true);
+
+ translate_z(h)
+ children();
+}
+
+module dip(n, part, size, w, pitch, pin) { //! Draw DIP package
+ D = [3, 0.6];
+
+ translate_z(pdip_pin_s(pin)) {
+ color(grey20) {
+ rotate([90, 0, 0])
+ linear_extrude(size.x, center = true)
+ difference() {
+ hull() {
+ square([size.y, pdip_pin_t(pin)], center = true);
+
+ square([size.y - 1, size.z], center = true);
+ }
+ square([D.x + 1, size.z + 1], center = true);
+ }
+
+ translate_z(-D.y / 2)
+ cube([D.x + 1 + eps, size.x, size.z - D.y], center = true);
+
+ linear_extrude(size.z / 2)
+ difference() {
+ square([D.x + 1 + eps, size.x], center = true);
+
+ translate([0, size.x / 2])
+ circle(d = D.x);
+ }
+ }
+
+ color("white")
+ translate([0, -D.x / 4, size.z / 2])
+ rotate(-90)
+ linear_extrude(eps)
+ resize([(size.x - D.x / 2) * 0.75, size.y / 3])
+ text(part, halign = "center", valign = "center");
+ }
+
+ l = size.x / 2 - pdip_pin_W(pin) / 2;
+ dil_pin_positions(n, w, pitch)
+ pdip_pin(pin, w / 2, $side * (abs($x) > l ? sign($x) : 0));
+}
+
+module pdip(pins, part, socketed, w = inch(0.3), pitch = inch(0.1)) { //! Draw standard 0.1" PDIP IC package
+ vitamin(str("pdip(", pins, ", ", part, arg(w, inch(0.3), "w"), arg(pitch, inch(0.1), "pitch"),"): IC ", part, " PDIP", pins));
+ n = ceil(pins / 2);
+ k = in([4, 8], n) ? n - 1 : n;
+ length = k * pitch + pitch / 2;
+ width = w - pitch / 2;
+ height = 3;
+ if(socketed)
+ dil_socket(n, w, pitch)
+ dip(n, part, [length, width, height], w, pitch, pdip_pin);
+ else
+ dip(n, part, [length, width, height], w, pitch, pdip_pin);
+}
diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad
index f25b9d6..7408103 100644
--- a/vitamins/pcb.scad
+++ b/vitamins/pcb.scad
@@ -34,6 +34,7 @@ use <../utils/thread.scad>
use <../utils/tube.scad>
use
use
+use
function pcb_name(type) = type[1]; //! Description
function pcb_length(type) = type[2]; //! Length
@@ -823,6 +824,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "uSD")) uSD(comp[4], cutouts);
if(show(comp, "trimpot10")) trimpot10(param(4, false), cutouts);
if(show(comp, "led")) led(comp[4], comp[5], 2.6);
+ if(show(comp, "pdip")) pdip(comp[4], comp[5], param(6, false), param(7, inch(0.3)));
}
}
diff --git a/vitamins/pcbs.scad b/vitamins/pcbs.scad
index b8c5833..23211f6 100644
--- a/vitamins/pcbs.scad
+++ b/vitamins/pcbs.scad
@@ -244,8 +244,9 @@ ArduinoUno3 = ["ArduinoUno3", "Arduino Uno R3", 68.58, 53.34, 1.6, 0, 3.3, 0, "#
[64.91, 27.89, 0, "2p54header", 2, 3],
[18.796, -7.00, 0, "2p54header", 3, 2],
[ 6.5, -3.5, 0, "button_6mm"],
- [4.7625, 7.62, 180, "barrel_jack"],
- [1.5875, 37.7825,180,"usb_B"],
+ [4.7625, 7.62, 180,"barrel_jack"],
+ [1.5875, 37.78, 180,"usb_B"],
+ [46.99, 17, 270,"pdip", 28, "ATMEGA328", true],
],
[],[],
inch([
@@ -328,7 +329,8 @@ PI_IO = ["PI_IO", "PI_IO V2", 35.56, 25.4, 1.6, 0, 0, 0, "green", tru
ZC_A0591 = ["ZC_A0591", "ZC-A0591 ULN2003 driver PCB", 35, 32, 1.6, 0, 2.5, 0, "green", false, [[2.25, 3.25], [-2.25, 3.25], [2.25, -3.25], [-2.25, -3.25] ],
[ [ 12.25, 8.3, -90, "jst_xh", 5],
[ -6.5, 10, 0, "2p54header", 1, 4],
- [-14, -4.5, 0, "2p54header", 4, 1],
+ [ 20.4, -4.5, 0, "2p54header", 4, 1],
+ [ 20.4, 11, 180, "pdip", 16, "ULN2803AN", true],
[ 5.5, 6, 0, "led", LED3mm, [1,1,1, 0.5]],
[ 5.5, 10.5, 0, "led", LED3mm, [1,1,1, 0.5]],
[ 5.5, 15, 0, "led", LED3mm, [1,1,1, 0.5]],