Implemented getSensors

Changed to Adafruit PWM Servo library for PCA9685
Finalized PCB design for manufacturing
This commit is contained in:
Mark van Renswoude 2018-11-25 22:38:49 +01:00
parent b635fce45d
commit 3348cbd48a
17 changed files with 259 additions and 314 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ node_modules
src/secret.h src/secret.h
/kicad/Stairs.kicad_pcb-bak /kicad/Stairs.kicad_pcb-bak
/kicad/Stairs.bak /kicad/Stairs.bak
kicad/output/*

View File

@ -27,7 +27,7 @@
(36 B.SilkS user) (36 B.SilkS user)
(37 F.SilkS user) (37 F.SilkS user)
(38 B.Mask user hide) (38 B.Mask user hide)
(39 F.Mask user hide) (39 F.Mask user)
(40 Dwgs.User user hide) (40 Dwgs.User user hide)
(41 Cmts.User user hide) (41 Cmts.User user hide)
(42 Eco1.User user hide) (42 Eco1.User user hide)
@ -97,7 +97,7 @@
(mirror false) (mirror false)
(drillshape 0) (drillshape 0)
(scaleselection 1) (scaleselection 1)
(outputdirectory "")) (outputdirectory "output"))
) )
(net 0 "") (net 0 "")
@ -1341,60 +1341,6 @@
) )
) )
(module Housings_SOIC:SO-8_5.3x6.2mm_Pitch1.27mm (layer F.Cu) (tedit 59920130) (tstamp 5BF92C7C)
(at 131.572 66.548)
(descr "8-Lead Plastic Small Outline, 5.3x6.2mm Body (http://www.ti.com.cn/cn/lit/ds/symlink/tl7705a.pdf)")
(tags "SOIC 1.27")
(path /5B8AD72A)
(attr smd)
(fp_text reference U2 (at 0 -4.13) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value MAX485 (at 0 4.13) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -2.75 -2.55) (end -4.5 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end 2.75 3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end 2.75 -3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end -2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 3.205) (end 2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 -3.205) (end 2.75 -2.455) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end -2.75 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -4.83 3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -4.83 -3.35) (end 4.83 -3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start 4.83 -3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -4.83 -3.35) (end -4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.65 -2.1) (end -1.65 -3.1) (layer F.Fab) (width 0.15))
(fp_line (start -2.65 3.1) (end -2.65 -2.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 3.1) (end -2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 -3.1) (end 2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start -1.65 -3.1) (end 2.65 -3.1) (layer F.Fab) (width 0.15))
(fp_text user %R (at 0 0) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(pad 8 smd rect (at 3.7 -1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 2 +5V))
(pad 7 smd rect (at 3.7 -0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 7 "Net-(P1-Pad1)"))
(pad 6 smd rect (at 3.7 0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 6 "Net-(P1-Pad2)"))
(pad 5 smd rect (at 3.7 1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 1 GND))
(pad 4 smd rect (at -3.7 1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 21 "Net-(U1-Pad31)"))
(pad 3 smd rect (at -3.7 0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 23 "Net-(U1-Pad32)"))
(pad 2 smd rect (at -3.7 -0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 23 "Net-(U1-Pad32)"))
(pad 1 smd rect (at -3.7 -1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask)
(net 22 "Net-(U1-Pad30)"))
(model ${KISYS3DMOD}/Package_SO.3dshapes/SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.35x2.35mm.step
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
(module Crystals:Crystal_HC49-U_Vertical (layer B.Cu) (tedit 58CD2E9C) (tstamp 5BF92C93) (module Crystals:Crystal_HC49-U_Vertical (layer B.Cu) (tedit 58CD2E9C) (tstamp 5BF92C93)
(at 144.272 64.516 180) (at 144.272 64.516 180)
(descr "Crystal THT HC-49/U http://5hertz.com/pdfs/04404_D.pdf") (descr "Crystal THT HC-49/U http://5hertz.com/pdfs/04404_D.pdf")
@ -1527,6 +1473,60 @@
(pad 1 np_thru_hole circle (at 0 0) (size 3.2 3.2) (drill 3.2) (layers *.Cu *.Mask)) (pad 1 np_thru_hole circle (at 0 0) (size 3.2 3.2) (drill 3.2) (layers *.Cu *.Mask))
) )
(module MAX485-SO8:SO-8 (layer F.Cu) (tedit 5BFB111F) (tstamp 5BFB20E7)
(at 131.572 66.548)
(descr "8-Lead Plastic Small Outline, 5.3x6.2mm Body (http://www.ti.com.cn/cn/lit/ds/symlink/tl7705a.pdf)")
(tags "SOIC 1.27")
(path /5B8AD72A)
(attr smd)
(fp_text reference U2 (at 0 -4.13) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value MAX485 (at 0 4.13) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -2.75 -2.55) (end -3.7 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end 2.75 3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end 2.75 -3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end -2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 3.205) (end 2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 -3.205) (end 2.75 -2.455) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end -2.75 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -3.9 3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -3.9 -3.35) (end 3.9 -3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start 3.9 -3.35) (end 3.9 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -3.9 -3.35) (end -3.9 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.65 -2.1) (end -1.65 -3.1) (layer F.Fab) (width 0.15))
(fp_line (start -2.65 3.1) (end -2.65 -2.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 3.1) (end -2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 -3.1) (end 2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start -1.65 -3.1) (end 2.65 -3.1) (layer F.Fab) (width 0.15))
(fp_text user %R (at 0 0) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(pad 8 smd rect (at 3.2 -1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 2 +5V))
(pad 7 smd rect (at 3.2 -0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 7 "Net-(P1-Pad1)"))
(pad 6 smd rect (at 3.2 0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 6 "Net-(P1-Pad2)"))
(pad 5 smd rect (at 3.2 1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 1 GND))
(pad 4 smd rect (at -3.2 1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 21 "Net-(U1-Pad31)"))
(pad 3 smd rect (at -3.2 0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 23 "Net-(U1-Pad32)"))
(pad 2 smd rect (at -3.2 -0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 23 "Net-(U1-Pad32)"))
(pad 1 smd rect (at -3.2 -1.9) (size 1 0.55) (layers F.Cu F.Paste F.Mask)
(net 22 "Net-(U1-Pad30)"))
(model ${KISYS3DMOD}/Housings_SOIC.3dshapes/SO-8_5.3x6.2mm_Pitch1.27mm.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
(gr_text GND (at 118.745 58.42 270) (layer F.SilkS) (tstamp 5BFAC0C2) (gr_text GND (at 118.745 58.42 270) (layer F.SilkS) (tstamp 5BFAC0C2)
(effects (font (size 0.75 0.75) (thickness 0.1))) (effects (font (size 0.75 0.75) (thickness 0.1)))
) )
@ -1611,10 +1611,6 @@
(via (at 137.414 68.834) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 2)) (via (at 137.414 68.834) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 2))
(segment (start 137.414 72.644) (end 138.176 73.406) (width 0.5) (layer B.Cu) (net 2)) (segment (start 137.414 72.644) (end 138.176 73.406) (width 0.5) (layer B.Cu) (net 2))
(segment (start 137.414 68.834) (end 137.414 72.644) (width 0.5) (layer B.Cu) (net 2)) (segment (start 137.414 68.834) (end 137.414 72.644) (width 0.5) (layer B.Cu) (net 2))
(segment (start 137.414 68.268315) (end 137.414 68.834) (width 0.5) (layer F.Cu) (net 2))
(segment (start 137.414 65.41) (end 137.414 68.268315) (width 0.5) (layer F.Cu) (net 2))
(segment (start 136.647 64.643) (end 137.414 65.41) (width 0.5) (layer F.Cu) (net 2))
(segment (start 135.272 64.643) (end 136.647 64.643) (width 0.5) (layer F.Cu) (net 2))
(segment (start 150.368 56.518) (end 150.368 58.293) (width 0.5) (layer F.Cu) (net 2)) (segment (start 150.368 56.518) (end 150.368 58.293) (width 0.5) (layer F.Cu) (net 2))
(segment (start 146.558 56.412) (end 150.262 56.412) (width 0.5) (layer F.Cu) (net 2)) (segment (start 146.558 56.412) (end 150.262 56.412) (width 0.5) (layer F.Cu) (net 2))
(segment (start 150.262 56.412) (end 150.368 56.518) (width 0.5) (layer F.Cu) (net 2)) (segment (start 150.262 56.412) (end 150.368 56.518) (width 0.5) (layer F.Cu) (net 2))
@ -1632,8 +1628,6 @@
(segment (start 133.858 53.305573) (end 132.141405 51.588978) (width 0.5) (layer F.Cu) (net 2)) (segment (start 133.858 53.305573) (end 132.141405 51.588978) (width 0.5) (layer F.Cu) (net 2))
(segment (start 133.858 54.436944) (end 133.858 53.305573) (width 0.5) (layer F.Cu) (net 2)) (segment (start 133.858 54.436944) (end 133.858 53.305573) (width 0.5) (layer F.Cu) (net 2))
(segment (start 136.949732 57.528676) (end 133.858 54.436944) (width 0.5) (layer F.Cu) (net 2)) (segment (start 136.949732 57.528676) (end 133.858 54.436944) (width 0.5) (layer F.Cu) (net 2))
(segment (start 135.272 62.34) (end 137.922 59.69) (width 0.5) (layer F.Cu) (net 2))
(segment (start 135.272 64.643) (end 135.272 62.34) (width 0.5) (layer F.Cu) (net 2))
(segment (start 140.728 56.884) (end 140.716 56.896) (width 0.25) (layer B.Cu) (net 2)) (segment (start 140.728 56.884) (end 140.716 56.896) (width 0.25) (layer B.Cu) (net 2))
(segment (start 119.92 38.1) (end 119.38 38.64) (width 0.5) (layer F.Cu) (net 2)) (segment (start 119.92 38.1) (end 119.38 38.64) (width 0.5) (layer F.Cu) (net 2))
(segment (start 121.92 38.1) (end 119.92 38.1) (width 0.5) (layer F.Cu) (net 2)) (segment (start 121.92 38.1) (end 119.92 38.1) (width 0.5) (layer F.Cu) (net 2))
@ -1665,6 +1659,12 @@
(segment (start 140.462 53.34) (end 140.462 54.864) (width 0.25) (layer B.Cu) (net 2)) (segment (start 140.462 53.34) (end 140.462 54.864) (width 0.25) (layer B.Cu) (net 2))
(segment (start 140.45 56.63) (end 140.716 56.896) (width 0.25) (layer B.Cu) (net 2)) (segment (start 140.45 56.63) (end 140.716 56.896) (width 0.25) (layer B.Cu) (net 2))
(segment (start 140.45 54.864) (end 140.45 56.63) (width 0.25) (layer B.Cu) (net 2)) (segment (start 140.45 54.864) (end 140.45 56.63) (width 0.25) (layer B.Cu) (net 2))
(segment (start 135.272 64.643) (end 135.272 62.34) (width 0.5) (layer F.Cu) (net 2))
(segment (start 135.272 62.34) (end 137.922 59.69) (width 0.5) (layer F.Cu) (net 2))
(segment (start 136.647 64.643) (end 137.414 65.41) (width 0.5) (layer F.Cu) (net 2))
(segment (start 137.414 65.41) (end 137.414 68.268315) (width 0.5) (layer F.Cu) (net 2))
(segment (start 137.414 68.268315) (end 137.414 68.834) (width 0.5) (layer F.Cu) (net 2))
(segment (start 134.772 64.643) (end 136.647 64.643) (width 0.5) (layer F.Cu) (net 2))
(via (at 143.256 79.20736) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 3)) (via (at 143.256 79.20736) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 3))
(segment (start 152.4 81.026) (end 143.256 81.026) (width 3) (layer F.Cu) (net 3)) (segment (start 152.4 81.026) (end 143.256 81.026) (width 3) (layer F.Cu) (net 3))
(segment (start 143.256 81.026) (end 121.92 81.026) (width 3) (layer F.Cu) (net 3)) (segment (start 143.256 81.026) (end 121.92 81.026) (width 3) (layer F.Cu) (net 3))
@ -1687,20 +1687,20 @@
(segment (start 144.272 62.588202) (end 144.272 64.516) (width 0.5) (layer F.Cu) (net 5)) (segment (start 144.272 62.588202) (end 144.272 64.516) (width 0.5) (layer F.Cu) (net 5))
(segment (start 138.081103 56.397305) (end 144.272 62.588202) (width 0.5) (layer F.Cu) (net 5)) (segment (start 138.081103 56.397305) (end 144.272 62.588202) (width 0.5) (layer F.Cu) (net 5))
(segment (start 144.272 64.516) (end 144.272 68.096) (width 0.5) (layer B.Cu) (net 5)) (segment (start 144.272 64.516) (end 144.272 68.096) (width 0.5) (layer B.Cu) (net 5))
(segment (start 133.897 67.183) (end 133.096 67.984) (width 0.5) (layer F.Cu) (net 6))
(segment (start 135.272 67.183) (end 133.897 67.183) (width 0.5) (layer F.Cu) (net 6))
(via (at 133.096 68.834) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 6)) (via (at 133.096 68.834) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 6))
(segment (start 133.096 67.984) (end 133.096 68.834) (width 0.5) (layer F.Cu) (net 6))
(via (at 133.096 73.406) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 6)) (via (at 133.096 73.406) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 6))
(segment (start 133.096 68.834) (end 133.096 73.406) (width 0.5) (layer B.Cu) (net 6)) (segment (start 133.096 68.834) (end 133.096 73.406) (width 0.5) (layer B.Cu) (net 6))
(segment (start 133.096 73.406) (end 133.096 75.946) (width 0.5) (layer F.Cu) (net 6)) (segment (start 133.096 73.406) (end 133.096 75.946) (width 0.5) (layer F.Cu) (net 6))
(segment (start 152.4 75.946) (end 133.096 75.946) (width 1) (layer F.Cu) (net 6)) (segment (start 152.4 75.946) (end 133.096 75.946) (width 1) (layer F.Cu) (net 6))
(segment (start 133.096 75.946) (end 121.92 75.946) (width 1) (layer F.Cu) (net 6)) (segment (start 133.096 75.946) (end 121.92 75.946) (width 1) (layer F.Cu) (net 6))
(segment (start 131.826 67.984) (end 131.826 70.866) (width 0.5) (layer F.Cu) (net 7)) (segment (start 133.096 67.984) (end 133.096 68.834) (width 0.5) (layer F.Cu) (net 6))
(segment (start 133.897 65.913) (end 131.826 67.984) (width 0.5) (layer F.Cu) (net 7)) (segment (start 134.772 67.183) (end 133.897 67.183) (width 0.5) (layer F.Cu) (net 6))
(segment (start 135.272 65.913) (end 133.897 65.913) (width 0.5) (layer F.Cu) (net 7)) (segment (start 133.897 67.183) (end 133.096 67.984) (width 0.5) (layer F.Cu) (net 6))
(segment (start 121.92 70.866) (end 131.826 70.866) (width 1) (layer F.Cu) (net 7)) (segment (start 121.92 70.866) (end 131.826 70.866) (width 1) (layer F.Cu) (net 7))
(segment (start 131.826 70.866) (end 152.4 70.866) (width 1) (layer F.Cu) (net 7)) (segment (start 131.826 70.866) (end 152.4 70.866) (width 1) (layer F.Cu) (net 7))
(segment (start 131.826 67.984) (end 131.826 70.866) (width 0.5) (layer F.Cu) (net 7))
(segment (start 134.772 65.913) (end 133.897 65.913) (width 0.5) (layer F.Cu) (net 7))
(segment (start 133.897 65.913) (end 131.826 67.984) (width 0.5) (layer F.Cu) (net 7))
(segment (start 127.452 57.311) (end 127.452 56.661) (width 0.25) (layer B.Cu) (net 8)) (segment (start 127.452 57.311) (end 127.452 56.661) (width 0.25) (layer B.Cu) (net 8))
(segment (start 127.452 56.661) (end 127.452 56.011) (width 0.25) (layer B.Cu) (net 8)) (segment (start 127.452 56.661) (end 127.452 56.011) (width 0.25) (layer B.Cu) (net 8))
(segment (start 127.452 55.361) (end 127.452 54.711) (width 0.25) (layer B.Cu) (net 8)) (segment (start 127.452 55.361) (end 127.452 54.711) (width 0.25) (layer B.Cu) (net 8))
@ -1776,22 +1776,22 @@
(segment (start 125.509686 47.22) (end 125.476 47.22) (width 0.5) (layer F.Cu) (net 20)) (segment (start 125.509686 47.22) (end 125.476 47.22) (width 0.5) (layer F.Cu) (net 20))
(segment (start 130.373639 52.083953) (end 125.509686 47.22) (width 0.5) (layer F.Cu) (net 20)) (segment (start 130.373639 52.083953) (end 125.509686 47.22) (width 0.5) (layer F.Cu) (net 20))
(via (at 128.778 62.992) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 21)) (via (at 128.778 62.992) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 21))
(segment (start 127.872 68.453) (end 128.997 68.453) (width 0.25) (layer F.Cu) (net 21))
(segment (start 128.997 68.453) (end 129.54 67.91) (width 0.25) (layer F.Cu) (net 21))
(segment (start 129.54 67.91) (end 129.54 67.621685) (width 0.25) (layer F.Cu) (net 21))
(segment (start 129.54 67.056) (end 129.54 67.621685) (width 0.25) (layer F.Cu) (net 21))
(segment (start 128.778 66.294) (end 129.54 67.056) (width 0.25) (layer B.Cu) (net 21)) (segment (start 128.778 66.294) (end 129.54 67.056) (width 0.25) (layer B.Cu) (net 21))
(segment (start 128.778 62.992) (end 128.778 66.294) (width 0.25) (layer B.Cu) (net 21)) (segment (start 128.778 62.992) (end 128.778 66.294) (width 0.25) (layer B.Cu) (net 21))
(via (at 129.54 67.056) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 21)) (via (at 129.54 67.056) (size 0.8) (drill 0.4) (layers F.Cu B.Cu) (net 21))
(segment (start 128.778 62.518427) (end 128.778 62.992) (width 0.25) (layer F.Cu) (net 21)) (segment (start 128.778 62.518427) (end 128.778 62.992) (width 0.25) (layer F.Cu) (net 21))
(segment (start 131.50501 59.791417) (end 128.778 62.518427) (width 0.25) (layer F.Cu) (net 21)) (segment (start 131.50501 59.791417) (end 128.778 62.518427) (width 0.25) (layer F.Cu) (net 21))
(segment (start 129.54 67.621685) (end 129.54 67.056) (width 0.25) (layer F.Cu) (net 21))
(segment (start 129.54 67.91) (end 129.54 67.621685) (width 0.25) (layer F.Cu) (net 21))
(segment (start 128.372 68.453) (end 128.997 68.453) (width 0.25) (layer F.Cu) (net 21))
(segment (start 128.997 68.453) (end 129.54 67.91) (width 0.25) (layer F.Cu) (net 21))
(segment (start 127.872 62.293056) (end 130.939324 59.225732) (width 0.25) (layer F.Cu) (net 22)) (segment (start 127.872 62.293056) (end 130.939324 59.225732) (width 0.25) (layer F.Cu) (net 22))
(segment (start 127.872 64.643) (end 127.872 62.293056) (width 0.25) (layer F.Cu) (net 22)) (segment (start 127.872 64.643) (end 127.872 62.293056) (width 0.25) (layer F.Cu) (net 22))
(segment (start 129.54 62.887798) (end 132.070695 60.357103) (width 0.25) (layer F.Cu) (net 23)) (segment (start 129.54 62.887798) (end 132.070695 60.357103) (width 0.25) (layer F.Cu) (net 23))
(segment (start 129.159 65.913) (end 129.54 65.532) (width 0.25) (layer F.Cu) (net 23)) (segment (start 129.159 65.913) (end 129.54 65.532) (width 0.25) (layer F.Cu) (net 23))
(segment (start 127.872 65.913) (end 129.159 65.913) (width 0.25) (layer F.Cu) (net 23)) (segment (start 127.872 65.913) (end 129.159 65.913) (width 0.25) (layer F.Cu) (net 23))
(segment (start 129.54 65.532) (end 129.54 62.887798) (width 0.25) (layer F.Cu) (net 23)) (segment (start 129.54 65.532) (end 129.54 62.887798) (width 0.25) (layer F.Cu) (net 23))
(segment (start 127.872 67.183) (end 127.872 65.913) (width 0.25) (layer F.Cu) (net 23)) (segment (start 128.372 67.183) (end 128.372 65.913) (width 0.25) (layer F.Cu) (net 23))
(segment (start 125.476 41.148) (end 128.524 38.1) (width 0.25) (layer B.Cu) (net 24)) (segment (start 125.476 41.148) (end 128.524 38.1) (width 0.25) (layer B.Cu) (net 24))
(segment (start 125.476 51.585) (end 125.476 41.148) (width 0.25) (layer B.Cu) (net 24)) (segment (start 125.476 51.585) (end 125.476 41.148) (width 0.25) (layer B.Cu) (net 24))
(segment (start 127.452 52.761) (end 126.652 52.761) (width 0.25) (layer B.Cu) (net 24)) (segment (start 127.452 52.761) (end 126.652 52.761) (width 0.25) (layer B.Cu) (net 24))
@ -1835,7 +1835,7 @@
(segment (start 139.7 48.09) (end 140.97 46.82) (width 0.25) (layer B.Cu) (net 29)) (segment (start 139.7 48.09) (end 140.97 46.82) (width 0.25) (layer B.Cu) (net 29))
(segment (start 139.7 53.09) (end 139.7 48.09) (width 0.25) (layer B.Cu) (net 29)) (segment (start 139.7 53.09) (end 139.7 48.09) (width 0.25) (layer B.Cu) (net 29))
(zone (net 1) (net_name GND) (layer F.Cu) (tstamp 5BFAF2BC) (hatch edge 0.508) (zone (net 1) (net_name GND) (layer F.Cu) (tstamp 5BFB26CB) (hatch edge 0.508)
(connect_pads (clearance 0.508)) (connect_pads (clearance 0.508))
(min_thickness 0.254) (min_thickness 0.254)
(fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508))
@ -1849,21 +1849,21 @@
(xy 127.847543 58.180939) (xy 127.953511 58.251745) (xy 128.024319 58.357716) (xy 128.413228 58.746625) (xy 128.519197 58.817432) (xy 127.847543 58.180939) (xy 127.953511 58.251745) (xy 128.024319 58.357716) (xy 128.413228 58.746625) (xy 128.519197 58.817432)
(xy 128.590004 58.923401) (xy 128.978913 59.31231) (xy 129.084883 59.383117) (xy 129.15569 59.489087) (xy 129.378429 59.711826) (xy 128.590004 58.923401) (xy 128.978913 59.31231) (xy 129.084883 59.383117) (xy 129.15569 59.489087) (xy 129.378429 59.711826)
(xy 127.387528 61.702727) (xy 127.324072 61.745127) (xy 127.156097 61.996519) (xy 127.148651 62.033955) (xy 127.097112 62.293056) (xy 127.387528 61.702727) (xy 127.324072 61.745127) (xy 127.156097 61.996519) (xy 127.148651 62.033955) (xy 127.097112 62.293056)
(xy 127.112001 62.367908) (xy 127.112 63.72056) (xy 126.997 63.72056) (xy 126.749235 63.769843) (xy 126.539191 63.910191) (xy 127.112001 62.367908) (xy 127.112 64.717851) (xy 127.156096 64.939536) (xy 127.258264 65.092441) (xy 127.273843 65.170765)
(xy 126.398843 64.120235) (xy 126.34956 64.368) (xy 126.34956 64.918) (xy 126.398843 65.165765) (xy 126.473837 65.278) (xy 127.347166 65.2805) (xy 127.273843 65.390235) (xy 127.25968 65.461439) (xy 127.156096 65.616463) (xy 127.097111 65.913)
(xy 126.398843 65.390235) (xy 126.34956 65.638) (xy 126.34956 66.188) (xy 126.398843 66.435765) (xy 126.473837 66.548) (xy 127.156096 66.209537) (xy 127.25968 66.364561) (xy 127.273843 66.435765) (xy 127.348837 66.548) (xy 127.273843 66.660235)
(xy 126.398843 66.660235) (xy 126.34956 66.908) (xy 126.34956 67.458) (xy 126.398843 67.705765) (xy 126.473837 67.818) (xy 127.22456 66.908) (xy 127.22456 67.458) (xy 127.273843 67.705765) (xy 127.348837 67.818) (xy 127.273843 67.930235)
(xy 126.398843 67.930235) (xy 126.34956 68.178) (xy 126.34956 68.728) (xy 126.398843 68.975765) (xy 126.539191 69.185809) (xy 127.22456 68.178) (xy 127.22456 68.728) (xy 127.273843 68.975765) (xy 127.414191 69.185809) (xy 127.624235 69.326157)
(xy 126.749235 69.326157) (xy 126.997 69.37544) (xy 128.747 69.37544) (xy 128.994765 69.326157) (xy 129.203223 69.186869) (xy 127.872 69.37544) (xy 128.872 69.37544) (xy 129.119765 69.326157) (xy 129.329809 69.185809) (xy 129.379472 69.111484)
(xy 129.293537 69.168904) (xy 129.544929 69.000929) (xy 129.587331 68.93747) (xy 130.024473 68.500329) (xy 130.087929 68.457929) (xy 129.544929 69.000929) (xy 129.587331 68.93747) (xy 130.024473 68.500329) (xy 130.087929 68.457929) (xy 130.255904 68.206537)
(xy 130.255904 68.206537) (xy 130.3 67.984852) (xy 130.3 67.984847) (xy 130.314888 67.91) (xy 130.3 67.835153) (xy 130.3 67.984852) (xy 130.3 67.984847) (xy 130.314888 67.91) (xy 130.3 67.835153) (xy 130.3 67.759711)
(xy 130.3 67.759711) (xy 130.417431 67.64228) (xy 130.575 67.261874) (xy 130.575 66.850126) (xy 130.417431 66.46972) (xy 130.417431 67.64228) (xy 130.575 67.261874) (xy 130.575 66.850126) (xy 130.417431 66.46972) (xy 130.12628 66.178569)
(xy 130.12628 66.178569) (xy 130.014524 66.132278) (xy 130.024473 66.122329) (xy 130.087929 66.079929) (xy 130.255904 65.828537) (xy 130.014524 66.132278) (xy 130.024473 66.122329) (xy 130.087929 66.079929) (xy 130.255904 65.828537) (xy 130.3 65.606852)
(xy 130.3 65.606852) (xy 130.3 65.606848) (xy 130.314888 65.532001) (xy 130.3 65.457154) (xy 130.3 63.202599) (xy 130.3 65.606848) (xy 130.314888 65.532001) (xy 130.3 65.457154) (xy 130.3 63.202599) (xy 131.747464 61.755135)
(xy 131.747464 61.755135) (xy 131.947229 61.7154) (xy 132.157273 61.575052) (xy 133.096 60.636325) (xy 134.034727 61.575052) (xy 131.947229 61.7154) (xy 132.157273 61.575052) (xy 133.096 60.636325) (xy 134.034727 61.575052) (xy 134.244771 61.7154)
(xy 134.244771 61.7154) (xy 134.492536 61.764683) (xy 134.607287 61.741858) (xy 134.584578 61.775844) (xy 134.584576 61.775846) (xy 134.492536 61.764683) (xy 134.607287 61.741858) (xy 134.584578 61.775844) (xy 134.584576 61.775846) (xy 134.438348 61.994691)
(xy 134.438348 61.994691) (xy 134.369663 62.34) (xy 134.387001 62.427165) (xy 134.387 63.722549) (xy 134.149235 63.769843) (xy 134.369663 62.34) (xy 134.387001 62.427165) (xy 134.387 63.72056) (xy 134.272 63.72056) (xy 134.024235 63.769843)
(xy 133.939191 63.910191) (xy 133.798843 64.120235) (xy 133.74956 64.368) (xy 133.74956 64.918) (xy 133.772901 65.035347) (xy 133.814191 63.910191) (xy 133.673843 64.120235) (xy 133.62456 64.368) (xy 133.62456 64.918) (xy 133.652659 65.059264)
(xy 133.55169 65.079348) (xy 133.44388 65.151385) (xy 133.332845 65.225576) (xy 133.332844 65.225577) (xy 133.258951 65.274951) (xy 133.55169 65.079348) (xy 133.44388 65.151385) (xy 133.332845 65.225576) (xy 133.332844 65.225577) (xy 133.258951 65.274951)
(xy 133.209577 65.348844) (xy 131.261847 67.296575) (xy 131.187951 67.345951) (xy 130.992348 67.638691) (xy 130.941 67.896836) (xy 133.209577 65.348844) (xy 131.261847 67.296575) (xy 131.187951 67.345951) (xy 130.992348 67.638691) (xy 130.941 67.896836)
(xy 130.941 67.896839) (xy 130.923663 67.984) (xy 130.941 68.071161) (xy 130.941001 69.731) (xy 124.06744 69.731) (xy 130.941 67.896839) (xy 130.923663 67.984) (xy 130.941 68.071161) (xy 130.941001 69.731) (xy 124.06744 69.731)
@ -1963,11 +1963,16 @@
) )
(filled_polygon (filled_polygon
(pts (pts
(xy 135.399 68.326) (xy 135.419 68.326) (xy 135.419 68.58) (xy 135.399 68.58) (xy 135.399 69.20425) (xy 136.529 65.776579) (xy 136.529001 68.181146) (xy 136.529 68.181151) (xy 136.529 68.265993) (xy 136.379 68.628126)
(xy 135.55775 69.363) (xy 136.273309 69.363) (xy 136.477764 69.278312) (xy 136.536569 69.42028) (xy 136.82772 69.711431) (xy 136.379 69.039874) (xy 136.536569 69.42028) (xy 136.82772 69.711431) (xy 136.874964 69.731) (xy 133.635036 69.731)
(xy 136.874964 69.731) (xy 133.635036 69.731) (xy 133.68228 69.711431) (xy 133.973431 69.42028) (xy 134.03723 69.266255) (xy 133.68228 69.711431) (xy 133.973431 69.42028) (xy 134.018909 69.310485) (xy 134.145691 69.363) (xy 134.48625 69.363)
(xy 134.037302 69.266327) (xy 134.270691 69.363) (xy 134.98625 69.363) (xy 135.145 69.20425) (xy 135.145 68.58) (xy 134.645 69.20425) (xy 134.645 68.58) (xy 134.899 68.58) (xy 134.899 69.20425) (xy 135.05775 69.363)
(xy 135.125 68.58) (xy 135.125 68.326) (xy 135.145 68.326) (xy 135.145 68.306) (xy 135.399 68.306) (xy 135.398309 69.363) (xy 135.631698 69.266327) (xy 135.810327 69.087699) (xy 135.907 68.85431) (xy 135.907 68.73875)
(xy 135.74825 68.58) (xy 134.899 68.58) (xy 134.645 68.58) (xy 134.625 68.58) (xy 134.625 68.326)
(xy 134.645 68.326) (xy 134.645 68.306) (xy 134.899 68.306) (xy 134.899 68.326) (xy 135.74825 68.326)
(xy 135.907 68.16725) (xy 135.907 68.05169) (xy 135.810327 67.818301) (xy 135.801117 67.809091) (xy 135.870157 67.705765)
(xy 135.91944 67.458) (xy 135.91944 66.908) (xy 135.870157 66.660235) (xy 135.795163 66.548) (xy 135.870157 66.435765)
(xy 135.91944 66.188) (xy 135.91944 65.638) (xy 135.89756 65.528) (xy 136.280422 65.528)
) )
) )
(filled_polygon (filled_polygon
@ -2157,7 +2162,7 @@
) )
) )
) )
(zone (net 1) (net_name GND) (layer B.Cu) (tstamp 5BFAF2B9) (hatch edge 0.508) (zone (net 1) (net_name GND) (layer B.Cu) (tstamp 5BFB26C8) (hatch edge 0.508)
(connect_pads (clearance 0.508)) (connect_pads (clearance 0.508))
(min_thickness 0.254) (min_thickness 0.254)
(fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508))

View File

@ -1,7 +1,7 @@
(export (version D) (export (version D)
(design (design
(source P:\Electronics\Stairs\kicad\Stairs.sch) (source P:\Electronics\Stairs\kicad\Stairs.sch)
(date "25-11-2018 19:41:52") (date "25-11-2018 22:16:46")
(tool "Eeschema (5.0.1)-3") (tool "Eeschema (5.0.1)-3")
(sheet (number 1) (name /) (tstamps /) (sheet (number 1) (name /) (tstamps /)
(title_block (title_block
@ -24,7 +24,7 @@
(tstamp 5B8AD5C2)) (tstamp 5B8AD5C2))
(comp (ref U2) (comp (ref U2)
(value MAX485) (value MAX485)
(footprint Housings_SOIC:SO-8_5.3x6.2mm_Pitch1.27mm) (footprint MAX485-SO8:SO-8)
(datasheet "Maxim Integrated") (datasheet "Maxim Integrated")
(fields (fields
(field (name Field4) None) (field (name Field4) None)

View File

@ -31,7 +31,7 @@ U 1 1 5B8AD72A
P 4700 6150 P 4700 6150
F 0 "U2" H 4700 6617 50 0000 C CNN F 0 "U2" H 4700 6617 50 0000 C CNN
F 1 "MAX485" H 4700 6526 50 0000 C CNN F 1 "MAX485" H 4700 6526 50 0000 C CNN
F 2 "Housings_SOIC:SO-8_5.3x6.2mm_Pitch1.27mm" H 4700 6150 60 0001 C CNN F 2 "MAX485-SO8:SO-8" H 4700 6150 60 0001 C CNN
F 3 "Maxim Integrated" H 4700 6150 50 0001 L BNN F 3 "Maxim Integrated" H 4700 6150 50 0001 L BNN
F 4 "None" H 4700 6150 50 0001 L BNN "Field4" F 4 "None" H 4700 6150 50 0001 L BNN "Field4"
F 5 "Unavailable" H 4700 6150 50 0001 L BNN "Field5" F 5 "Unavailable" H 4700 6150 50 0001 L BNN "Field5"

View File

@ -2,4 +2,5 @@
(lib (name AMS1117-5.0)(type Legacy)(uri ${KIPRJMOD}/libs/AMS1117-5.0.mod)(options "")(descr "")) (lib (name AMS1117-5.0)(type Legacy)(uri ${KIPRJMOD}/libs/AMS1117-5.0.mod)(options "")(descr ""))
(lib (name MAX485)(type Legacy)(uri ${KIPRJMOD}/libs/MAX485.mod)(options "")(descr "")) (lib (name MAX485)(type Legacy)(uri ${KIPRJMOD}/libs/MAX485.mod)(options "")(descr ""))
(lib (name SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_)(type Legacy)(uri ${KIPRJMOD}/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.mod)(options "")(descr "")) (lib (name SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_)(type Legacy)(uri ${KIPRJMOD}/libs/SMD-BUTTON_4P-5.2X5.2X1.5MM-SKQGAKE010_.mod)(options "")(descr ""))
(lib (name MAX485-SO8)(type KiCad)(uri ${KIPRJMOD}/libs/MAX485-SO8.pretty)(options "")(descr ""))
) )

View File

@ -0,0 +1,43 @@
(module SO-8 (layer F.Cu) (tedit 5BFB111F)
(descr "8-Lead Plastic Small Outline, 5.3x6.2mm Body (http://www.ti.com.cn/cn/lit/ds/symlink/tl7705a.pdf)")
(tags "SOIC 1.27")
(attr smd)
(fp_text reference REF** (at 0 -4.13) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value SO-8 (at 0 4.13) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -2.75 -2.55) (end -3.7 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end 2.75 3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end 2.75 -3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end -2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 3.205) (end 2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 -3.205) (end 2.75 -2.455) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end -2.75 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -3.9 3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -3.9 -3.35) (end 3.9 -3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start 3.9 -3.35) (end 3.9 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -3.9 -3.35) (end -3.9 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.65 -2.1) (end -1.65 -3.1) (layer F.Fab) (width 0.15))
(fp_line (start -2.65 3.1) (end -2.65 -2.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 3.1) (end -2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 -3.1) (end 2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start -1.65 -3.1) (end 2.65 -3.1) (layer F.Fab) (width 0.15))
(fp_text user %R (at 0 0) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(pad 8 smd rect (at 3.2 -1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 7 smd rect (at 3.2 -0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 6 smd rect (at 3.2 0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 5 smd rect (at 3.2 1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 4 smd rect (at -3.2 1.905) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 3 smd rect (at -3.2 0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 2 smd rect (at -3.2 -0.635) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(pad 1 smd rect (at -3.2 -1.9) (size 1 0.55) (layers F.Cu F.Paste F.Mask))
(model ${KISYS3DMOD}/Housings_SOIC.3dshapes/SO-8_5.3x6.2mm_Pitch1.27mm.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)

View File

@ -0,0 +1,43 @@
(module Housings_SOIC:SO-8_5.3x6.2mm_Pitch1.27mm (layer F.Cu) (tedit 59920130)
(descr "8-Lead Plastic Small Outline, 5.3x6.2mm Body (http://www.ti.com.cn/cn/lit/ds/symlink/tl7705a.pdf)")
(tags "SOIC 1.27")
(attr smd)
(fp_text reference REF** (at 0 -4.13) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value SO-8_5.3x6.2mm_Pitch1.27mm (at 0 4.13) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -2.75 -2.55) (end -4.5 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end 2.75 3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end 2.75 -3.205) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 3.205) (end -2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 3.205) (end 2.75 2.455) (layer F.SilkS) (width 0.15))
(fp_line (start 2.75 -3.205) (end 2.75 -2.455) (layer F.SilkS) (width 0.15))
(fp_line (start -2.75 -3.205) (end -2.75 -2.55) (layer F.SilkS) (width 0.15))
(fp_line (start -4.83 3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -4.83 -3.35) (end 4.83 -3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start 4.83 -3.35) (end 4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -4.83 -3.35) (end -4.83 3.35) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.65 -2.1) (end -1.65 -3.1) (layer F.Fab) (width 0.15))
(fp_line (start -2.65 3.1) (end -2.65 -2.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 3.1) (end -2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start 2.65 -3.1) (end 2.65 3.1) (layer F.Fab) (width 0.15))
(fp_line (start -1.65 -3.1) (end 2.65 -3.1) (layer F.Fab) (width 0.15))
(fp_text user %R (at 0 0) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(pad 8 smd rect (at 3.7 -1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 7 smd rect (at 3.7 -0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 6 smd rect (at 3.7 0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 5 smd rect (at 3.7 1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 4 smd rect (at -3.7 1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 3 smd rect (at -3.7 0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 2 smd rect (at -3.7 -0.635) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(pad 1 smd rect (at -3.7 -1.905) (size 1.75 0.55) (layers F.Cu F.Paste F.Mask))
(model ${KISYS3DMOD}/Housings_SOIC.3dshapes/SO-8_5.3x6.2mm_Pitch1.27mm.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)

View File

@ -113,6 +113,16 @@ void loop ()
void sendCommMessage(const byte* data, size_t len) void sendCommMessage(const byte* data, size_t len)
{ {
Serial.print("Raw out: ");
byte* ptr = data;
for (size_t i = 0; i < len; i++, ptr++)
{
Serial.print(*ptr, HEX);
Serial.print(' ');
}
Serial.println("");
digitalWrite(PinRS485WriteEnable, HIGH); digitalWrite(PinRS485WriteEnable, HIGH);
comm.sendMsg(data, len); comm.sendMsg(data, len);
digitalWrite(PinRS485WriteEnable, LOW); digitalWrite(PinRS485WriteEnable, LOW);
@ -188,12 +198,13 @@ void handlesetPWMCommand(SerialCommands* sender)
{ {
if (inLink) return; if (inLink) return;
int moduleIndex = atoi(sender->Next());
int flags = atoi(sender->Next()); int flags = atoi(sender->Next());
int value1 = atoi(sender->Next()); int value1 = atoi(sender->Next());
int value2 = atoi(sender->Next()); int value2 = atoi(sender->Next());
sender->GetSerial()->println("> Ping"); sender->GetSerial()->println("> SetPWM");
const byte msg[] = { CommandSetPWM, (uint8_t)flags, (uint16_t)value1, (uint16_t)value2 }; const byte msg[] = { CommandSetPWM, moduleIndex, flags, lowByte(value1), highByte(value1), lowByte(value2), highByte(value2) };
sendCommMessage(msg, sizeof(msg)); sendCommMessage(msg, sizeof(msg));
} }
@ -215,6 +226,15 @@ void handleCommMessage()
uint8_t* data = comm.getData(); uint8_t* data = comm.getData();
uint8_t length = comm.getLength(); uint8_t length = comm.getLength();
Serial.print("Raw in: ");
byte* ptr = data;
for (size_t i = 0; i < length; i++, ptr++)
{
Serial.print(*ptr, HEX);
Serial.print(' ');
}
Serial.println("");
if (length == 0) if (length == 0)
return; return;
@ -239,16 +259,16 @@ void handleCommMessage()
case ResponseGetSensors: case ResponseGetSensors:
Serial.println("< Get sensors response, module index = " + String(*data)); data++; length--; Serial.println("< Get sensors response, module index = " + String(*data)); data++; length--;
if (length > 0) if (length >= 2)
{ {
Serial.println(" Sensor 1 value: " + String(*data)); data++; length--; Serial.println(" Sensor 1 value: " + String(*reinterpret_cast<uint16_t*>(data))); data+=2; length-=2;
} }
else else
Serial.println(" Sensor 1 value: <missing>"); Serial.println(" Sensor 1 value: <missing>");
if (length > 0) if (length >= 2)
{ {
Serial.println(" Sensor 2 value: " + String(*data)); data++; length--; Serial.println(" Sensor 2 value: " + String(*reinterpret_cast<uint16_t*>(data))); data+=2; length-=2;
} }
else else
Serial.println(" Sensor 2 value: <missing>"); Serial.println(" Sensor 2 value: <missing>");

View File

@ -21,3 +21,4 @@ upload_protocol = usbtiny
lib_deps = lib_deps =
Adafruit GFX Library Adafruit GFX Library
Adafruit PWM Servo Driver Library

View File

@ -18,17 +18,30 @@ const uint32_t CommBaudRate = 76800;
// Arduino pin number connected to the MAX485's Receiver and Driver Output Enable pins // Arduino pin number connected to the MAX485's Receiver and Driver Output Enable pins
const uint8_t CommWriteEnablePin = 2; const uint8_t CommWriteEnablePin = 2;
// How long the display should stay on once it's idle and showing the
// current step numbers.
const uint32_t DisplayIdleTimeout = 5000;
// How long since the last packet before the communication icon shows // How long since the last packet before the communication icon shows
// as 'off'. Note that if a module is not configured for sensors and // as 'off'. Note that if a module is not configured for sensors and
// the light doesn't change either there will be no communication, // the light doesn't change either there will be no communication,
// so no need to panic immediately. // so no need to panic immediately.
const uint32_t CommIdleTimeout = 1000; const uint32_t CommIdleTimeout = 1000;
// Arduino pin number connected to the push button.
// How long the display should stay on once it's idle and showing the
// current step numbers.
const uint32_t DisplayIdleTimeout = 5000;
// I2C address of the PCA9685 PWM driver
const uint8_t PWMDriverAddress = 0x40;
// Frequency of the PCA9685 PWM driver
const uint16_t PWMDriverFrequency = 1600;
// Arduino analog pin number connected to the sensors
const uint8_t PinSensor1 = 1;
const uint8_t PinSensor2 = 2;
// Arduino digital pin number connected to the push button.
const uint8_t PinButton = 8; const uint8_t PinButton = 8;
// Debounce time for the push button. Since it is not used for fast operations, this can be relatively high. // Debounce time for the push button. Since it is not used for fast operations, this can be relatively high.

View File

@ -23,6 +23,8 @@ void Display::init()
void Display::update() void Display::update()
{ {
// TODO invalidate when comm state changes
switch (state) switch (state)
{ {
case State::WaitingForComm: case State::WaitingForComm:

View File

@ -5,6 +5,7 @@
* https://git.x2software.net/pub/Stairs * https://git.x2software.net/pub/Stairs
*/ */
#include "global.h" #include "global.h"
#include "config.h"
int serialRead() int serialRead()
@ -26,6 +27,6 @@ size_t serialWrite(const byte what)
Settings settings; Settings settings;
Display display; Display display;
RS485 comm(serialRead, serialAvailable, serialWrite, 20); RS485 comm(serialRead, serialAvailable, serialWrite, 20);
PCA9685 pwmDriver; Adafruit_PWMServoDriver pwmDriver(PWMDriverAddress);
State state = State::WaitingForComm; State state = State::WaitingForComm;
uint32_t currentTime; uint32_t currentTime;

View File

@ -8,7 +8,7 @@
#define __global #define __global
#include "lib/RS485_non_blocking.h" #include "lib/RS485_non_blocking.h"
#include "lib/PCA9685.h" #include "Adafruit_PWMServoDriver.h"
#include "settings.h" #include "settings.h"
#include "display.h" #include "display.h"
#include "state.h" #include "state.h"
@ -16,7 +16,7 @@
extern Settings settings; extern Settings settings;
extern Display display; extern Display display;
extern RS485 comm; extern RS485 comm;
extern PCA9685 pwmDriver; extern Adafruit_PWMServoDriver pwmDriver;
extern State state; extern State state;
extern uint32_t currentTime; extern uint32_t currentTime;

View File

@ -1,127 +0,0 @@
/*
* PCA9685 library for Arduino
* Copyright 2017 (c) Mark van Renswoude
*/
#include <stdint.h>
#include "./PCA9685.h"
#include <Wire.h>
#include <Arduino.h>
void PCA9685::setAddress(uint8_t address)
{
this->mAddress = address;
}
uint8_t PCA9685::read(uint8_t registerAddress)
{
uint8_t result = 0;
Wire.beginTransmission(this->mAddress);
Wire.write(registerAddress);
Wire.endTransmission();
Wire.requestFrom(this->mAddress, (uint8_t)1);
if (Wire.available())
result = Wire.read();
return result;
}
void PCA9685::write(uint8_t registerAddress, uint8_t value)
{
Wire.beginTransmission(this->mAddress);
Wire.write(registerAddress);
Wire.write(value);
Wire.endTransmission();
}
inline void PCA9685::write(uint8_t data)
{
Wire.write(data);
}
static const float prescaleValue = 25000000 / 4096;
void PCA9685::setPWMFrequency(float frequency)
{
// Credit to the Adafruit PWM Servo Driver library for these calculations
// https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library/
uint8_t prescale = floor(prescaleValue / (frequency * 0.9) - 0.5);
// Sleep while changing the frequency
uint8_t oldMode = this->read(PCA9685::RegisterMode1) & !PCA9685::Mode1Sleep;
uint8_t newMode = (oldMode & !PCA9685::Mode1Restart) | PCA9685::Mode1Sleep;
this->write(PCA9685::RegisterMode1, newMode);
this->write(PCA9685::RegisterPrescale, prescale);
this->write(PCA9685::RegisterMode1, oldMode);
// According to the datasheet:
// It takes 500 us max. for the oscillator to be up and running once
// SLEEP bit has been set to logic 0
//
// The Adafruit library uses 5 milliseconds, so I'll stick to that as well.
delay(5);
// Restart and turn on auto-increment (required for SetPWM)
this->write(PCA9685::RegisterMode1, oldMode | PCA9685::Mode1Restart | PCA9685::Mode1AI | PCA9685::Mode1AllCall);
}
void PCA9685::setPWM(uint8_t pin, uint16_t value)
{
if (value < 0) value = 0;
if (value > 4095) value = 4095;
if (value == 4095)
this->setPWM(pin, 4096, 0);
else if (value == 0)
this->setPWM(pin, 0, 4096);
else
this->setPWM(pin, 0, value);
}
void PCA9685::setPWM(uint8_t pin, uint16_t on, uint16_t off)
{
Wire.beginTransmission(this->mAddress);
this->write(PCA9685::RegisterLED0OnL + (4 * pin));
this->write(on);
this->write(on >> 8);
this->write(off);
this->write(off >> 8);
Wire.endTransmission();
}
void PCA9685::setAll(uint16_t value)
{
if (value < 0) value = 0;
if (value > 4095) value = 4095;
if (value == 4095)
this->setAll(4096, 0);
else if (value == 0)
this->setAll(0, 4096);
else
this->setAll(0, value);
}
void PCA9685::setAll(uint16_t on, uint16_t off)
{
Wire.beginTransmission(this->mAddress);
this->write(PCA9685::RegisterAllLEDOnL);
this->write(on);
this->write(on >> 8);
this->write(off);
this->write(off >> 8);
Wire.endTransmission();
}

View File

@ -1,48 +0,0 @@
/*
* PCA9685 library for Arduino
* Copyright 2017 (c) Mark van Renswoude
*/
#ifndef __PCA9685
#define __PCA9685
#include <stdint.h>
class PCA9685
{
private:
uint8_t mAddress;
protected:
uint8_t read(uint8_t registerAddress);
void write(uint8_t registerAddress, uint8_t value);
inline void write(uint8_t data);
public:
static const uint16_t Off = 0;
static const uint16_t On = 4095;
static const uint8_t RegisterMode1 = 0x0;
static const uint8_t RegisterPrescale = 0xFE;
static const uint8_t RegisterLED0OnL = 0x6;
static const uint8_t RegisterAllLEDOnL = 0xFA;
static const uint8_t Mode1Restart = 0x80;
static const uint8_t Mode1AI = 0x20;
static const uint8_t Mode1Sleep = 0x10;
static const uint8_t Mode1AllCall = 0x01;
// Call this if you already initialized the I2C library
void setAddress(uint8_t address);
void setPWMFrequency(float frequency);
void setPWM(uint8_t pin, uint16_t value);
void setPWM(uint8_t pin, uint16_t on, uint16_t off);
void setAll(uint16_t value);
void setAll(uint16_t on, uint16_t off);
};
#endif

View File

@ -19,7 +19,9 @@ void setup()
// Set up I2C devices: the SSD1306 OLED display and PCA9685 LED PWM driver // Set up I2C devices: the SSD1306 OLED display and PCA9685 LED PWM driver
Wire.begin(); Wire.begin();
display.init(); display.init();
pwmDriver.setAddress(0x40);
pwmDriver.begin();
pwmDriver.setPWMFreq(PWMDriverFrequency);
// At 16 Mhz we pick a baud rate with a very acceptable 0.2% error rate // At 16 Mhz we pick a baud rate with a very acceptable 0.2% error rate
// Source: http://www.robotroom.com/Asynchronous-Serial-Communication-2.html // Source: http://www.robotroom.com/Asynchronous-Serial-Communication-2.html
@ -47,9 +49,6 @@ void handleGetSensors(uint8_t* data, uint8_t length);
void checkButtonPress(); void checkButtonPress();
uint32_t test = 0;
int testState = LOW;
void loop() void loop()
{ {
currentTime = millis(); currentTime = millis();
@ -59,13 +58,6 @@ void loop()
checkButtonPress(); checkButtonPress();
display.update(); display.update();
if (currentTime - test >= 500)
{
testState = testState == LOW ? HIGH : LOW;
test = currentTime;
digitalWrite(5, testState);
}
} }
@ -187,18 +179,18 @@ void handleSetPWM(uint8_t* data, uint8_t length)
uint16_t value1 = *(reinterpret_cast<uint16_t*>(data)); data += 2; uint16_t value1 = *(reinterpret_cast<uint16_t*>(data)); data += 2;
uint16_t value2 = *(reinterpret_cast<uint16_t*>(data)); data += 2; uint16_t value2 = *(reinterpret_cast<uint16_t*>(data)); data += 2;
pwmDriver.setPWM(0, value1); pwmDriver.setPin(0, value1);
pwmDriver.setPWM(1, value2); pwmDriver.setPin(1, value2);
if (flags & SetPWMFlagModuleLEDs) if ((flags & SetPWMFlagModuleLEDs) == SetPWMFlagModuleLEDs)
{ {
pwmDriver.setPWM(2, value1); pwmDriver.setPin(2, value1);
pwmDriver.setPWM(3, value2); pwmDriver.setPin(3, value2);
} }
else else
{ {
pwmDriver.setPWM(2, 0); pwmDriver.setPin(2, 0);
pwmDriver.setPWM(3, 0); pwmDriver.setPin(3, 0);
} }
const uint8_t msg[] = { ResponseSetPWM, settings.getModuleIndex() }; const uint8_t msg[] = { ResponseSetPWM, settings.getModuleIndex() };
@ -208,12 +200,10 @@ void handleSetPWM(uint8_t* data, uint8_t length)
void handleGetSensors(uint8_t* data, uint8_t length) void handleGetSensors(uint8_t* data, uint8_t length)
{ {
// TODO get sensor values uint16_t value1 = analogRead(PinSensor1);
uint16_t value2 = analogRead(PinSensor2);
uint8_t sensor1 = 0; const uint8_t msg[] = { ResponseGetSensors, settings.getModuleIndex(), lowByte(value1), highByte(value1), lowByte(value2), highByte(value2) };
uint8_t sensor2 = 0;
const uint8_t msg[] = { ResponseSetPWM, settings.getModuleIndex(), sensor1, sensor2 };
sendCommMessage(msg, sizeof(msg)); sendCommMessage(msg, sizeof(msg));
} }

View File

@ -145,8 +145,8 @@ const uint8_t SetPWMFlagModuleLEDs = 0x01;
* Response: * Response:
* [0] ResponseGetSensors * [0] ResponseGetSensors
* [1] Module index * [1] Module index
* [2] Analog (0-255) or digital (0, 255) value for sensor 1 * [2,3] Analog (0-1023) or digital (0, 1023) value for sensor 1 (uint16_t)
* [3] Analog (0-255) or digital (0, 255) value for sensor 2 * [4,5] Analog (0-1024) or digital (0, 1023) value for sensor 2 (uint16_t)
*/ */
const uint8_t BaseGetSensors = 0x30; const uint8_t BaseGetSensors = 0x30;
const uint8_t CommandGetSensors = BaseGetSensors | MaskModuleCommand; const uint8_t CommandGetSensors = BaseGetSensors | MaskModuleCommand;