]> git.gag.com Git - hw/altusmetrum/commitdiff
add footprint generator for CDS photocell for greenhouse board
authorBdale Garbee <bdale@gag.com>
Sun, 24 Oct 2021 06:30:19 +0000 (00:30 -0600)
committerBdale Garbee <bdale@gag.com>
Sun, 24 Oct 2021 06:30:19 +0000 (00:30 -0600)
packages/Makefile
packages/PDV-P8103.py [new file with mode: 0755]

index 48b877a16acca63028714e2976333f9c9f674ca8..b03f1654d4f4ec7f3b99ff6b40f14434a1e67864 100644 (file)
@@ -148,7 +148,9 @@ FOOTPRINTS= \
        FA-20H.fp \
        RGZ0048A.fp \
        RSM0032B.fp \
-       RHB0032E.fp
+       RHB0032E.fp \
+       udfn8.fp \
+       PDV-P8103.fp
 
 .5c.fp:
        nickle $*.5c -o $@
diff --git a/packages/PDV-P8103.py b/packages/PDV-P8103.py
new file mode 100755 (executable)
index 0000000..d06d9a7
--- /dev/null
@@ -0,0 +1,83 @@
+#!/usr/bin/python3
+# Copyright 2021 by Bdale Garbee <bdale@gag.com>.  GPLv3
+#
+# Program to emit PCB footprint for Luna CDS Photoconductive Photocell
+#
+
+import math
+
+# dimensions in mm from PDV-P8103.pdf Luna Optoelectronics datasheet
+BodyDiam = 5.08
+HoleDiam = 0.5         # pins are 0.4mm, make hole large enough
+HoleSpacing = 3.40
+FlatSpacing = 4.29
+
+FlatHalfLength = math.sqrt((BodyDiam / 2)**2 - (FlatSpacing / 2)**2)
+ArcStart = 180 * math.atan((FlatSpacing/2)/FlatHalfLength)/math.pi
+
+# we're going to use the 1/100 of a mil fundamental unit form
+def mm2mils100( mm ):
+       return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
+
+print('# author: Bdale Garbee')
+print('# email: bdale@gag.com')
+print('# dist-license: GPL 3')
+print('# use-license: unlimited')
+
+print('Element[0x0 "PDV-P8103" "" "" 0 0 0 0 0 100 0x0]')
+print("(")
+print('   Pin[',\
+       mm2mils100(-HoleSpacing/2), \
+       0, \
+       mm2mils100(2.5*HoleDiam), \
+       mm2mils100(0.5), \
+       mm2mils100(3*HoleDiam), \
+       mm2mils100(HoleDiam), \
+       '"pin1" "1" 0x0001]')
+
+print('   Pin[',\
+       mm2mils100(HoleSpacing/2), \
+       0, \
+       mm2mils100(2.5*HoleDiam), \
+       mm2mils100(0.5), \
+       mm2mils100(3*HoleDiam), \
+       mm2mils100(HoleDiam), \
+       '"pin2" "2" 0x0001]')
+
+print('   ElementArc[',\
+       0, \
+       0, \
+       mm2mils100(BodyDiam/2), \
+       mm2mils100(BodyDiam/2), \
+       ArcStart, \
+       -2 * ArcStart, \
+       1000, \
+       ']')
+
+print('   ElementArc[',\
+       0, \
+       0, \
+       mm2mils100(BodyDiam/2), \
+       mm2mils100(BodyDiam/2), \
+       ArcStart + 180, \
+       -2 * ArcStart, \
+       1000, \
+       ']')
+
+print('   ElementLine[',\
+       mm2mils100(-FlatHalfLength), \
+       mm2mils100(-FlatSpacing/2), \
+       mm2mils100(FlatHalfLength), \
+       mm2mils100(-FlatSpacing/2), \
+       1000, \
+       ']')
+
+print('   ElementLine[',\
+       mm2mils100(-FlatHalfLength), \
+       mm2mils100(FlatSpacing/2), \
+       mm2mils100(FlatHalfLength), \
+       mm2mils100(FlatSpacing/2), \
+       1000, \
+       ']')
+
+print(")")