First working version
This commit is contained in:
commit
99d55d9b5e
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.bak
|
||||
*.kicad_pcb-bak
|
||||
*-cache.lib
|
||||
KiCad/output/
|
26
KiCad/OmronG5V.pretty/OMRON-G5V-1.kicad_mod
Normal file
26
KiCad/OmronG5V.pretty/OMRON-G5V-1.kicad_mod
Normal file
@ -0,0 +1,26 @@
|
||||
(module OMRON-G5V-1 (layer F.Cu) (tedit 54CEF90B)
|
||||
(fp_text reference REF** (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.8 0.8) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value OMRON-G5V-1 (at 0 0) (layer F.Fab)
|
||||
(effects (font (size 0.8 0.8) (thickness 0.15)))
|
||||
)
|
||||
(fp_line (start -6.5 -4) (end 6.5 -4) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start 6.5 -4) (end 6.5 4) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start 6.5 4) (end -6.5 4) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start -6.5 4) (end -6.5 -4) (layer F.Fab) (width 0.15))
|
||||
(fp_line (start -7 -4.5) (end 7 -4.5) (layer F.CrtYd) (width 0.15))
|
||||
(fp_line (start 7 -4.5) (end 7 4.5) (layer F.CrtYd) (width 0.15))
|
||||
(fp_line (start 7 4.5) (end -7 4.5) (layer F.CrtYd) (width 0.15))
|
||||
(fp_line (start -7 4.5) (end -7 -4.5) (layer F.CrtYd) (width 0.15))
|
||||
(fp_line (start 6.5 -4) (end -6.5 -4) (layer F.SilkS) (width 0.35))
|
||||
(fp_line (start -6.5 -4) (end -6.5 4) (layer F.SilkS) (width 0.35))
|
||||
(fp_line (start -6.5 4) (end 6.5 4) (layer F.SilkS) (width 0.35))
|
||||
(fp_line (start 6.5 4) (end 6.5 -4) (layer F.SilkS) (width 0.35))
|
||||
(pad 4 thru_hole circle (at -2.159 -2.54) (size 1.7 1.7) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
|
||||
(pad 5 thru_hole circle (at -2.159 2.54) (size 1.7 1.7) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
|
||||
(pad 2 thru_hole circle (at 5.461 -2.54) (size 1.7 1.7) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
|
||||
(pad 2 thru_hole circle (at 5.461 2.54) (size 1.7 1.7) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
|
||||
(pad 3 thru_hole circle (at -5.334 -2.54) (size 1.7 1.7) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
|
||||
(pad 1 thru_hole circle (at -5.334 2.54) (size 1.7 1.7) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
|
||||
)
|
1095
KiCad/PiPower.kicad_pcb
Normal file
1095
KiCad/PiPower.kicad_pcb
Normal file
File diff suppressed because it is too large
Load Diff
361
KiCad/PiPower.net
Normal file
361
KiCad/PiPower.net
Normal file
@ -0,0 +1,361 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source P:/Arduino/PiPower/KiCad/PiPower.sch)
|
||||
(date "18-3-2017 13:11:47")
|
||||
(tool "Eeschema 4.0.5")
|
||||
(sheet (number 1) (name /) (tstamps /)
|
||||
(title_block
|
||||
(title PiPower)
|
||||
(company "Mark van Renswoude")
|
||||
(rev 1)
|
||||
(date 2017-03-05)
|
||||
(source PiPower.sch)
|
||||
(comment (number 1) (value ""))
|
||||
(comment (number 2) (value ""))
|
||||
(comment (number 3) (value ""))
|
||||
(comment (number 4) (value "")))))
|
||||
(components
|
||||
(comp (ref IC1)
|
||||
(value ATTiny85)
|
||||
(footprint Housings_DIP:DIP-8_W7.62mm_Socket)
|
||||
(libsource (lib atmel) (part ATTINY45-P))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BC3ABE))
|
||||
(comp (ref R1)
|
||||
(value 150)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BC46F5))
|
||||
(comp (ref P2)
|
||||
(value GPIO)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
|
||||
(libsource (lib conn) (part CONN_01X02))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BC9E67))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BC419B))
|
||||
(comp (ref P1)
|
||||
(value Out)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
|
||||
(libsource (lib conn) (part CONN_01X02))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BCAB40))
|
||||
(comp (ref P3)
|
||||
(value In)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
|
||||
(libsource (lib conn) (part CONN_01X02))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BCB107))
|
||||
(comp (ref P4)
|
||||
(value SW)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
|
||||
(libsource (lib conn) (part CONN_01X02))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58BCBF9C))
|
||||
(comp (ref Q1)
|
||||
(value BC547)
|
||||
(footprint TO_SOT_Packages_THT:TO-92_Inline_Narrow_Oval)
|
||||
(libsource (lib transistors) (part BC547))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C05D7C))
|
||||
(comp (ref R2)
|
||||
(value 1K)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C07326))
|
||||
(comp (ref RL1)
|
||||
(value "Songle SRD-05VDC")
|
||||
(footprint Relays_ThroughHole:Relay_SANYOU_SRD_Series_Form_C)
|
||||
(libsource (lib PiPower-cache) (part FINDER-40.51))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C04AF6))
|
||||
(comp (ref R4)
|
||||
(value 10K)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C0E76C))
|
||||
(comp (ref R3)
|
||||
(value 10K)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C0F69C))
|
||||
(comp (ref D2)
|
||||
(value D)
|
||||
(footprint Diodes_ThroughHole:D_T-1_P5.08mm_Horizontal)
|
||||
(libsource (lib device) (part D))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C1C921))
|
||||
(comp (ref R5)
|
||||
(value 33)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C1D8B7))
|
||||
(comp (ref P6)
|
||||
(value FanCtrl)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x01_Pitch2.54mm)
|
||||
(libsource (lib conn) (part CONN_01X01))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C5AEE2))
|
||||
(comp (ref Q2)
|
||||
(value BC547)
|
||||
(footprint TO_SOT_Packages_THT:TO-92_Inline_Narrow_Oval)
|
||||
(libsource (lib transistors) (part BC547))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C5B17E))
|
||||
(comp (ref K1)
|
||||
(value G5V-1)
|
||||
(footprint OmronG5V:OMRON-G5V-1)
|
||||
(libsource (lib OmronG5V) (part G5V-1))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C5C232))
|
||||
(comp (ref D3)
|
||||
(value D)
|
||||
(footprint Diodes_ThroughHole:D_T-1_P5.08mm_Horizontal)
|
||||
(libsource (lib device) (part D))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C5CB60))
|
||||
(comp (ref R6)
|
||||
(value 33)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C5CFB1))
|
||||
(comp (ref P5)
|
||||
(value Fan)
|
||||
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
|
||||
(libsource (lib conn) (part CONN_01X02))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58C5F893))
|
||||
(comp (ref R7)
|
||||
(value 1K)
|
||||
(footprint Resistors_SMD:R_0603_HandSoldering)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 58CD4537)))
|
||||
(libparts
|
||||
(libpart (lib atmel) (part ATTINY25-P)
|
||||
(aliases
|
||||
(alias ATTINY45-P)
|
||||
(alias ATTINY85-P))
|
||||
(description "PDIP8, 2k Flash, 128B SRAM, 128B EEPROM, Debug Wire")
|
||||
(docs http://www.atmel.com/images/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf)
|
||||
(fields
|
||||
(field (name Reference) IC)
|
||||
(field (name Value) ATTINY25-P)
|
||||
(field (name Footprint) DIP8))
|
||||
(pins
|
||||
(pin (num 1) (name "PB5(~RESET~/dW/ADC0/PCINT5)") (type BiDi))
|
||||
(pin (num 2) (name "PB3(XTAL1/CLKI/OC1B/ADC3/PCINT3)") (type BiDi))
|
||||
(pin (num 3) (name "PB4(XTAL2/CLKO/OC1B/ADC2/PCINT4)") (type BiDi))
|
||||
(pin (num 4) (name GND) (type power_in))
|
||||
(pin (num 5) (name "PB0(MOSI/DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0)") (type BiDi))
|
||||
(pin (num 6) (name "PB1(MISO/DO/AIN1/OC0B/OC1A/PCINT1)") (type BiDi))
|
||||
(pin (num 7) (name "PB2(SCK/USCK/SCL/T0/INT0/ADC1/PCINT2)") (type BiDi))
|
||||
(pin (num 8) (name VCC) (type power_in))))
|
||||
(libpart (lib transistors) (part BC547)
|
||||
(aliases
|
||||
(alias BC546)
|
||||
(alias BC548)
|
||||
(alias BC549)
|
||||
(alias BC550))
|
||||
(description "45V Vce, 0.1A Ic, NPN, Small Signal Transistor, TO-92")
|
||||
(docs http://www.fairchildsemi.com/ds/BC/BC547.pdf)
|
||||
(footprints
|
||||
(fp TO-92*))
|
||||
(fields
|
||||
(field (name Reference) Q)
|
||||
(field (name Value) BC547)
|
||||
(field (name Footprint) TO-92))
|
||||
(pins
|
||||
(pin (num 1) (name C) (type passive))
|
||||
(pin (num 2) (name B) (type input))
|
||||
(pin (num 3) (name E) (type passive))))
|
||||
(libpart (lib conn) (part CONN_01X01)
|
||||
(description "Connector, single row, 01x01")
|
||||
(footprints
|
||||
(fp Pin_Header_Straight_1X01)
|
||||
(fp Pin_Header_Angled_1X01)
|
||||
(fp Socket_Strip_Straight_1X01)
|
||||
(fp Socket_Strip_Angled_1X01))
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_01X01))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))))
|
||||
(libpart (lib conn) (part CONN_01X02)
|
||||
(description "Connector, single row, 01x02")
|
||||
(footprints
|
||||
(fp Pin_Header_Straight_1X02)
|
||||
(fp Pin_Header_Angled_1X02)
|
||||
(fp Socket_Strip_Straight_1X02)
|
||||
(fp Socket_Strip_Angled_1X02))
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_01X02))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))))
|
||||
(libpart (lib device) (part D)
|
||||
(description Diode)
|
||||
(footprints
|
||||
(fp Diode_*)
|
||||
(fp D-*)
|
||||
(fp *SingleDiode)
|
||||
(fp *_Diode_*)
|
||||
(fp *SingleDiode*)
|
||||
(fp D_*))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) D))
|
||||
(pins
|
||||
(pin (num 1) (name K) (type passive))
|
||||
(pin (num 2) (name A) (type passive))))
|
||||
(libpart (lib PiPower-cache) (part FINDER-40.51)
|
||||
(aliases
|
||||
(alias FINDER-36.11.4001)
|
||||
(alias FINDER-40.31)
|
||||
(alias RM50-xx11))
|
||||
(fields
|
||||
(field (name Reference) RL)
|
||||
(field (name Value) FINDER-40.51))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))
|
||||
(pin (num 3) (name ~) (type passive))
|
||||
(pin (num 4) (name ~) (type passive))
|
||||
(pin (num 5) (name ~) (type passive))))
|
||||
(libpart (lib OmronG5V) (part G5V-1)
|
||||
(footprints
|
||||
(fp G5V-1))
|
||||
(fields
|
||||
(field (name Reference) K)
|
||||
(field (name Value) G5V-1)
|
||||
(field (name Footprint) G5V-1))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type unspc))
|
||||
(pin (num 2) (name ~) (type unspc))
|
||||
(pin (num 5) (name ~) (type unspc))
|
||||
(pin (num 6) (name ~) (type unspc))
|
||||
(pin (num 9) (name ~) (type unspc))
|
||||
(pin (num 10) (name ~) (type unspc))))
|
||||
(libpart (lib device) (part LED)
|
||||
(description "LED generic")
|
||||
(footprints
|
||||
(fp LED*))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED))
|
||||
(pins
|
||||
(pin (num 1) (name K) (type passive))
|
||||
(pin (num 2) (name A) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistor)
|
||||
(footprints
|
||||
(fp R_*)
|
||||
(fp Resistor_*))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\device.lib"))
|
||||
(library (logical transistors)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\transistors.lib"))
|
||||
(library (logical conn)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\conn.lib"))
|
||||
(library (logical atmel)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\atmel.lib"))
|
||||
(library (logical OmronG5V)
|
||||
(uri P:\KiCad\Libraries\OmronG5V.lib))
|
||||
(library (logical PiPower-cache)
|
||||
(uri P:\Arduino\PiPower\KiCad\PiPower-cache.lib)))
|
||||
(nets
|
||||
(net (code 1) (name "Net-(IC1-Pad3)")
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref IC1) (pin 3))
|
||||
(node (ref P2) (pin 1)))
|
||||
(net (code 2) (name "Net-(P6-Pad1)")
|
||||
(node (ref R7) (pin 1))
|
||||
(node (ref P6) (pin 1)))
|
||||
(net (code 3) (name "Net-(Q2-Pad2)")
|
||||
(node (ref R7) (pin 2))
|
||||
(node (ref Q2) (pin 2)))
|
||||
(net (code 4) (name +5V)
|
||||
(node (ref RL1) (pin 1))
|
||||
(node (ref R6) (pin 2))
|
||||
(node (ref IC1) (pin 8))
|
||||
(node (ref K1) (pin 5))
|
||||
(node (ref R5) (pin 2))
|
||||
(node (ref P3) (pin 1))
|
||||
(node (ref P4) (pin 1)))
|
||||
(net (code 5) (name GND)
|
||||
(node (ref Q1) (pin 3))
|
||||
(node (ref P3) (pin 2))
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref IC1) (pin 4))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref P5) (pin 2))
|
||||
(node (ref R4) (pin 1))
|
||||
(node (ref Q2) (pin 3)))
|
||||
(net (code 6) (name "Net-(IC1-Pad5)")
|
||||
(node (ref P4) (pin 2))
|
||||
(node (ref R4) (pin 2))
|
||||
(node (ref IC1) (pin 5)))
|
||||
(net (code 7) (name "Net-(K1-Pad10)")
|
||||
(node (ref P5) (pin 1))
|
||||
(node (ref K1) (pin 10)))
|
||||
(net (code 8) (name "Net-(K1-Pad6)")
|
||||
(node (ref K1) (pin 6)))
|
||||
(net (code 9) (name "Net-(K1-Pad1)")
|
||||
(node (ref K1) (pin 1)))
|
||||
(net (code 10) (name "Net-(D3-Pad2)")
|
||||
(node (ref D3) (pin 2))
|
||||
(node (ref Q2) (pin 1))
|
||||
(node (ref K1) (pin 9)))
|
||||
(net (code 11) (name "Net-(D3-Pad1)")
|
||||
(node (ref D3) (pin 1))
|
||||
(node (ref R6) (pin 1))
|
||||
(node (ref K1) (pin 2)))
|
||||
(net (code 12) (name "Net-(IC1-Pad2)")
|
||||
(node (ref IC1) (pin 2))
|
||||
(node (ref P2) (pin 2)))
|
||||
(net (code 13) (name "Net-(IC1-Pad6)")
|
||||
(node (ref IC1) (pin 6))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 14) (name "Net-(D1-Pad1)")
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref R1) (pin 2)))
|
||||
(net (code 15) (name "Net-(P1-Pad1)")
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref RL1) (pin 3)))
|
||||
(net (code 16) (name "Net-(D2-Pad2)")
|
||||
(node (ref RL1) (pin 2))
|
||||
(node (ref Q1) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 17) (name "Net-(RL1-Pad4)")
|
||||
(node (ref RL1) (pin 4)))
|
||||
(net (code 18) (name "Net-(D2-Pad1)")
|
||||
(node (ref R5) (pin 1))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref RL1) (pin 5)))
|
||||
(net (code 19) (name "Net-(IC1-Pad1)")
|
||||
(node (ref IC1) (pin 1)))
|
||||
(net (code 20) (name "Net-(IC1-Pad7)")
|
||||
(node (ref IC1) (pin 7))
|
||||
(node (ref R2) (pin 1)))
|
||||
(net (code 21) (name "Net-(Q1-Pad2)")
|
||||
(node (ref Q1) (pin 2))
|
||||
(node (ref R2) (pin 2)))))
|
72
KiCad/PiPower.pro
Normal file
72
KiCad/PiPower.pro
Normal file
@ -0,0 +1,72 @@
|
||||
update=14-3-2017 21:48:10
|
||||
version=1
|
||||
last_client=kicad
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
UseCmpFile=1
|
||||
PadDrill=0.600000000000
|
||||
PadDrillOvalY=0.600000000000
|
||||
PadSizeH=1.500000000000
|
||||
PadSizeV=1.500000000000
|
||||
PcbTextSizeV=1.500000000000
|
||||
PcbTextSizeH=1.500000000000
|
||||
PcbTextThickness=0.300000000000
|
||||
ModuleTextSizeV=1.000000000000
|
||||
ModuleTextSizeH=1.000000000000
|
||||
ModuleTextSizeThickness=0.150000000000
|
||||
SolderMaskClearance=0.000000000000
|
||||
SolderMaskMinWidth=0.000000000000
|
||||
DrawSegmentWidth=0.200000000000
|
||||
BoardOutlineThickness=0.100000000000
|
||||
ModuleOutlineThickness=0.150000000000
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[general]
|
||||
version=1
|
||||
[schematic_editor]
|
||||
version=1
|
||||
PageLayoutDescrFile=
|
||||
PlotDirectoryName=
|
||||
SubpartIdSeparator=0
|
||||
SubpartFirstId=65
|
||||
NetFmtName=
|
||||
SpiceForceRefPrefix=0
|
||||
SpiceUseNetNumbers=0
|
||||
LabSize=60
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=microcontrollers
|
||||
LibName13=dsp
|
||||
LibName14=microchip
|
||||
LibName15=analog_switches
|
||||
LibName16=motorola
|
||||
LibName17=texas
|
||||
LibName18=intel
|
||||
LibName19=audio
|
||||
LibName20=interface
|
||||
LibName21=digital-audio
|
||||
LibName22=philips
|
||||
LibName23=display
|
||||
LibName24=cypress
|
||||
LibName25=siliconi
|
||||
LibName26=opto
|
||||
LibName27=atmel
|
||||
LibName28=contrib
|
||||
LibName29=valves
|
||||
LibName30=C:/Program Files/KiCad/share/kicad/library/switches
|
||||
LibName31=P:/KiCad/Libraries/OmronG5V
|
583
KiCad/PiPower.sch
Normal file
583
KiCad/PiPower.sch
Normal file
@ -0,0 +1,583 @@
|
||||
EESchema Schematic File Version 2
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:switches
|
||||
LIBS:OmronG5V
|
||||
LIBS:PiPower-cache
|
||||
EELAYER 25 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title "PiPower"
|
||||
Date "2017-03-05"
|
||||
Rev "1"
|
||||
Comp "Mark van Renswoude"
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L ATTINY45-P IC1
|
||||
U 1 1 58BC3ABE
|
||||
P 6350 3700
|
||||
F 0 "IC1" H 5200 4100 50 0000 C CNN
|
||||
F 1 "ATTiny85" H 7350 3300 50 0000 C CNN
|
||||
F 2 "Housings_DIP:DIP-8_W7.62mm_Socket" H 6350 3300 50 0001 C CIN
|
||||
F 3 "" H 6350 3700 50 0000 C CNN
|
||||
1 6350 3700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L +5V #PWR01
|
||||
U 1 1 58BC3C63
|
||||
P 7950 3000
|
||||
F 0 "#PWR01" H 7950 2850 50 0001 C CNN
|
||||
F 1 "+5V" H 7950 3140 50 0000 C CNN
|
||||
F 2 "" H 7950 3000 50 0000 C CNN
|
||||
F 3 "" H 7950 3000 50 0000 C CNN
|
||||
1 7950 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 58BC3C79
|
||||
P 7950 4150
|
||||
F 0 "#PWR02" H 7950 3900 50 0001 C CNN
|
||||
F 1 "GND" H 7950 4000 50 0000 C CNN
|
||||
F 2 "" H 7950 4150 50 0000 C CNN
|
||||
F 3 "" H 7950 4150 50 0000 C CNN
|
||||
1 7950 4150
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
7700 3950 7950 3950
|
||||
Wire Wire Line
|
||||
7950 3950 7950 4150
|
||||
Wire Wire Line
|
||||
7950 3450 7700 3450
|
||||
Wire Wire Line
|
||||
7950 3000 7950 3450
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 58BC46F5
|
||||
P 4650 3550
|
||||
F 0 "R1" V 4550 3550 50 0000 C CNN
|
||||
F 1 "150" V 4650 3550 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 4580 3550 50 0001 C CNN
|
||||
F 3 "" H 4650 3550 50 0000 C CNN
|
||||
1 4650 3550
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
3350 3950 3350 4400
|
||||
Wire Wire Line
|
||||
2950 4400 3250 4400
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 58BC5554
|
||||
P 3750 3100
|
||||
F 0 "#PWR03" H 3750 2850 50 0001 C CNN
|
||||
F 1 "GND" H 3750 2950 50 0000 C CNN
|
||||
F 2 "" H 3750 3100 50 0000 C CNN
|
||||
F 3 "" H 3750 3100 50 0000 C CNN
|
||||
1 3750 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
5000 3750 4850 3750
|
||||
Wire Wire Line
|
||||
4850 3750 4850 4300
|
||||
Wire Wire Line
|
||||
5000 3850 4950 3850
|
||||
Wire Wire Line
|
||||
5000 3550 4800 3550
|
||||
Wire Wire Line
|
||||
4500 3550 4500 3000
|
||||
Wire Wire Line
|
||||
4500 3000 4200 3000
|
||||
Wire Wire Line
|
||||
3900 3000 3750 3000
|
||||
Wire Wire Line
|
||||
3750 3000 3750 3100
|
||||
Wire Wire Line
|
||||
6300 3000 7950 3000
|
||||
Wire Wire Line
|
||||
5000 3000 6200 3000
|
||||
Wire Wire Line
|
||||
5000 3000 5000 3450
|
||||
$Comp
|
||||
L CONN_01X02 P2
|
||||
U 1 1 58BC9E67
|
||||
P 4900 4500
|
||||
F 0 "P2" H 4900 4650 50 0000 C CNN
|
||||
F 1 "GPIO" V 5000 4500 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 4900 4500 50 0001 C CNN
|
||||
F 3 "" H 4900 4500 50 0000 C CNN
|
||||
1 4900 4500
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 58BC419B
|
||||
P 4050 3000
|
||||
F 0 "D1" H 4050 3100 50 0000 C CNN
|
||||
F 1 "LED" H 4050 2850 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 4050 3000 50 0001 C CNN
|
||||
F 3 "" H 4050 3000 50 0000 C CNN
|
||||
1 4050 3000
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_01X02 P1
|
||||
U 1 1 58BCAB40
|
||||
P 3300 4600
|
||||
F 0 "P1" H 3300 4750 50 0000 C CNN
|
||||
F 1 "Out" V 3400 4600 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 3300 4600 50 0001 C CNN
|
||||
F 3 "" H 3300 4600 50 0000 C CNN
|
||||
1 3300 4600
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_01X02 P3
|
||||
U 1 1 58BCB107
|
||||
P 6150 4800
|
||||
F 0 "P3" H 6150 4950 50 0000 C CNN
|
||||
F 1 "In" V 6250 4800 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 6150 4800 50 0001 C CNN
|
||||
F 3 "" H 6150 4800 50 0000 C CNN
|
||||
1 6150 4800
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6250 4500 6250 4600
|
||||
Wire Wire Line
|
||||
6250 4600 6200 4600
|
||||
Wire Wire Line
|
||||
6050 4500 6050 4600
|
||||
Wire Wire Line
|
||||
6050 4600 6100 4600
|
||||
$Comp
|
||||
L CONN_01X02 P4
|
||||
U 1 1 58BCBF9C
|
||||
P 6250 3200
|
||||
F 0 "P4" H 6250 3350 50 0000 C CNN
|
||||
F 1 "SW" V 6350 3200 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 6250 3200 50 0001 C CNN
|
||||
F 3 "" H 6250 3200 50 0000 C CNN
|
||||
1 6250 3200
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L BC547 Q1
|
||||
U 1 1 58C05D7C
|
||||
P 4150 3650
|
||||
F 0 "Q1" H 4350 3725 50 0000 L CNN
|
||||
F 1 "BC547" H 4350 3650 50 0000 L CNN
|
||||
F 2 "TO_SOT_Packages_THT:TO-92_Inline_Narrow_Oval" H 4350 3575 50 0001 L CIN
|
||||
F 3 "" H 4150 3650 50 0000 L CNN
|
||||
1 4150 3650
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 58C07326
|
||||
P 4650 3650
|
||||
F 0 "R2" V 4730 3650 50 0000 C CNN
|
||||
F 1 "1K" V 4650 3650 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 4580 3650 50 0001 C CNN
|
||||
F 3 "" H 4650 3650 50 0000 C CNN
|
||||
1 4650 3650
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
5000 3650 4800 3650
|
||||
Wire Wire Line
|
||||
4500 3650 4350 3650
|
||||
$Comp
|
||||
L GND #PWR04
|
||||
U 1 1 58C075E3
|
||||
P 4050 3850
|
||||
F 0 "#PWR04" H 4050 3600 50 0001 C CNN
|
||||
F 1 "GND" H 4050 3700 50 0000 C CNN
|
||||
F 2 "" H 4050 3850 50 0000 C CNN
|
||||
F 3 "" H 4050 3850 50 0000 C CNN
|
||||
1 4050 3850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
3350 3450 4050 3450
|
||||
$Comp
|
||||
L FINDER-40.51 RL1
|
||||
U 1 1 58C04AF6
|
||||
P 3050 3650
|
||||
F 0 "RL1" V 3500 3600 50 0000 L CNN
|
||||
F 1 "Songle SRD-05VDC" V 2550 3300 50 0000 L CNN
|
||||
F 2 "Relays_ThroughHole:Relay_SANYOU_SRD_Series_Form_C" H 3050 3650 50 0001 C CNN
|
||||
F 3 "" H 3050 3650 50 0000 C CNN
|
||||
1 3050 3650
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2550 3450 2750 3450
|
||||
NoConn ~ 5000 3950
|
||||
NoConn ~ 3350 3750
|
||||
$Comp
|
||||
L +5V #PWR05
|
||||
U 1 1 58C0C2EB
|
||||
P 2250 3450
|
||||
F 0 "#PWR05" H 2250 3300 50 0001 C CNN
|
||||
F 1 "+5V" H 2250 3590 50 0000 C CNN
|
||||
F 2 "" H 2250 3450 50 0000 C CNN
|
||||
F 3 "" H 2250 3450 50 0000 C CNN
|
||||
1 2250 3450
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 58C0C314
|
||||
P 2950 4400
|
||||
F 0 "#PWR06" H 2950 4150 50 0001 C CNN
|
||||
F 1 "GND" H 2950 4250 50 0000 C CNN
|
||||
F 2 "" H 2950 4400 50 0000 C CNN
|
||||
F 3 "" H 2950 4400 50 0000 C CNN
|
||||
1 2950 4400
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L +5V #PWR07
|
||||
U 1 1 58C0C6A9
|
||||
P 6250 4500
|
||||
F 0 "#PWR07" H 6250 4350 50 0001 C CNN
|
||||
F 1 "+5V" H 6250 4640 50 0000 C CNN
|
||||
F 2 "" H 6250 4500 50 0000 C CNN
|
||||
F 3 "" H 6250 4500 50 0000 C CNN
|
||||
1 6250 4500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 58C0C6D2
|
||||
P 6050 4500
|
||||
F 0 "#PWR08" H 6050 4250 50 0001 C CNN
|
||||
F 1 "GND" H 6050 4350 50 0000 C CNN
|
||||
F 2 "" H 6050 4500 50 0000 C CNN
|
||||
F 3 "" H 6050 4500 50 0000 C CNN
|
||||
1 6050 4500
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L PWR_FLAG #FLG09
|
||||
U 1 1 58C0D1D1
|
||||
P 7100 4700
|
||||
F 0 "#FLG09" H 7100 4795 50 0001 C CNN
|
||||
F 1 "PWR_FLAG" H 7100 4880 50 0000 C CNN
|
||||
F 2 "" H 7100 4700 50 0000 C CNN
|
||||
F 3 "" H 7100 4700 50 0000 C CNN
|
||||
1 7100 4700
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L PWR_FLAG #FLG010
|
||||
U 1 1 58C0D61C
|
||||
P 7400 4600
|
||||
F 0 "#FLG010" H 7400 4695 50 0001 C CNN
|
||||
F 1 "PWR_FLAG" H 7400 4780 50 0000 C CNN
|
||||
F 2 "" H 7400 4600 50 0000 C CNN
|
||||
F 3 "" H 7400 4600 50 0000 C CNN
|
||||
1 7400 4600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L +5V #PWR011
|
||||
U 1 1 58C0D645
|
||||
P 7100 4600
|
||||
F 0 "#PWR011" H 7100 4450 50 0001 C CNN
|
||||
F 1 "+5V" H 7100 4740 50 0000 C CNN
|
||||
F 2 "" H 7100 4600 50 0000 C CNN
|
||||
F 3 "" H 7100 4600 50 0000 C CNN
|
||||
1 7100 4600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR012
|
||||
U 1 1 58C0D7B8
|
||||
P 7400 4700
|
||||
F 0 "#PWR012" H 7400 4450 50 0001 C CNN
|
||||
F 1 "GND" H 7400 4550 50 0000 C CNN
|
||||
F 2 "" H 7400 4700 50 0000 C CNN
|
||||
F 3 "" H 7400 4700 50 0000 C CNN
|
||||
1 7400 4700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
7400 4600 7400 4700
|
||||
Wire Wire Line
|
||||
7100 4600 7100 4700
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 58C0E291
|
||||
P 5850 3100
|
||||
F 0 "#PWR013" H 5850 2850 50 0001 C CNN
|
||||
F 1 "GND" H 5850 2950 50 0000 C CNN
|
||||
F 2 "" H 5850 3100 50 0000 C CNN
|
||||
F 3 "" H 5850 3100 50 0000 C CNN
|
||||
1 5850 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R4
|
||||
U 1 1 58C0E76C
|
||||
P 5600 3100
|
||||
F 0 "R4" V 5680 3100 50 0000 C CNN
|
||||
F 1 "10K" V 5600 3100 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 5530 3100 50 0001 C CNN
|
||||
F 3 "" H 5600 3100 50 0000 C CNN
|
||||
1 5600 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
5850 3100 5750 3100
|
||||
Wire Wire Line
|
||||
5450 3100 5350 3100
|
||||
Wire Wire Line
|
||||
5350 3100 5350 3000
|
||||
Connection ~ 5350 3000
|
||||
$Comp
|
||||
L GND #PWR014
|
||||
U 1 1 58C0F5DA
|
||||
P 5350 4350
|
||||
F 0 "#PWR014" H 5350 4100 50 0001 C CNN
|
||||
F 1 "GND" H 5350 4200 50 0000 C CNN
|
||||
F 2 "" H 5350 4350 50 0000 C CNN
|
||||
F 3 "" H 5350 4350 50 0000 C CNN
|
||||
1 5350 4350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 58C0F69C
|
||||
P 5200 4200
|
||||
F 0 "R3" V 5280 4200 50 0000 C CNN
|
||||
F 1 "10K" V 5200 4200 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 5130 4200 50 0001 C CNN
|
||||
F 3 "" H 5200 4200 50 0000 C CNN
|
||||
1 5200 4200
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
5350 4350 5350 4200
|
||||
Wire Wire Line
|
||||
5050 4200 4950 4200
|
||||
Connection ~ 4950 4200
|
||||
$Comp
|
||||
L D D2
|
||||
U 1 1 58C1C921
|
||||
P 3050 3000
|
||||
F 0 "D2" H 3050 3100 50 0000 C CNN
|
||||
F 1 "D" H 3050 2900 50 0000 C CNN
|
||||
F 2 "Diodes_ThroughHole:D_T-1_P5.08mm_Horizontal" H 3050 3000 50 0001 C CNN
|
||||
F 3 "" H 3050 3000 50 0000 C CNN
|
||||
1 3050 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2900 3000 2650 3000
|
||||
Wire Wire Line
|
||||
2650 3000 2650 3450
|
||||
Connection ~ 2650 3450
|
||||
Wire Wire Line
|
||||
3200 3000 3450 3000
|
||||
Wire Wire Line
|
||||
3450 3000 3450 3450
|
||||
Connection ~ 3450 3450
|
||||
$Comp
|
||||
L R R5
|
||||
U 1 1 58C1D8B7
|
||||
P 2400 3450
|
||||
F 0 "R5" V 2480 3450 50 0000 C CNN
|
||||
F 1 "33" V 2400 3450 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 2330 3450 50 0001 C CNN
|
||||
F 3 "" H 2400 3450 50 0000 C CNN
|
||||
1 2400 3450
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2250 3450 2250 3850
|
||||
Wire Wire Line
|
||||
2250 3850 2750 3850
|
||||
Text Notes 6900 4350 0 20 ~ 0
|
||||
These are here just to satisfy KiCad's ERC
|
||||
Wire Notes Line
|
||||
6850 4250 6850 4950
|
||||
Wire Notes Line
|
||||
6850 4950 7650 4950
|
||||
Wire Notes Line
|
||||
7650 4950 7650 4250
|
||||
Wire Notes Line
|
||||
7650 4250 6850 4250
|
||||
Text Notes 3700 2800 0 20 ~ 0
|
||||
Note: I know this is not the correct way around, \nbut since the footprint is a pin header this'll match \nup pin 2 to ground like the other pin headers
|
||||
Wire Wire Line
|
||||
4950 3850 4950 4300
|
||||
$Comp
|
||||
L CONN_01X01 P6
|
||||
U 1 1 58C5AEE2
|
||||
P 5400 5850
|
||||
F 0 "P6" H 5400 5950 50 0000 C CNN
|
||||
F 1 "FanCtrl" V 5500 5850 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x01_Pitch2.54mm" H 5400 5850 50 0001 C CNN
|
||||
F 3 "" H 5400 5850 50 0000 C CNN
|
||||
1 5400 5850
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L BC547 Q2
|
||||
U 1 1 58C5B17E
|
||||
P 4900 5650
|
||||
F 0 "Q2" H 5100 5725 50 0000 L CNN
|
||||
F 1 "BC547" H 5100 5650 50 0000 L CNN
|
||||
F 2 "TO_SOT_Packages_THT:TO-92_Inline_Narrow_Oval" H 5100 5575 50 0001 L CIN
|
||||
F 3 "" H 4900 5650 50 0000 L CNN
|
||||
1 4900 5650
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR015
|
||||
U 1 1 58C5B84A
|
||||
P 4800 6200
|
||||
F 0 "#PWR015" H 4800 5950 50 0001 C CNN
|
||||
F 1 "GND" H 4800 6050 50 0000 C CNN
|
||||
F 2 "" H 4800 6200 50 0000 C CNN
|
||||
F 3 "" H 4800 6200 50 0000 C CNN
|
||||
1 4800 6200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L G5V-1 K1
|
||||
U 1 1 58C5C232
|
||||
P 4000 5650
|
||||
F 0 "K1" V 4400 5600 50 0000 L CNN
|
||||
F 1 "G5V-1" V 4000 5550 50 0000 L CNN
|
||||
F 2 "OmronG5V:OMRON-G5V-1" H 4000 5650 50 0001 C CNN
|
||||
F 3 "" H 4000 5650 60 0001 C CNN
|
||||
1 4000 5650
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L D D3
|
||||
U 1 1 58C5CB60
|
||||
P 4000 5100
|
||||
F 0 "D3" H 4000 5200 50 0000 C CNN
|
||||
F 1 "D" H 4000 5000 50 0000 C CNN
|
||||
F 2 "Diodes_ThroughHole:D_T-1_P5.08mm_Horizontal" H 4000 5100 50 0001 C CNN
|
||||
F 3 "" H 4000 5100 50 0000 C CNN
|
||||
1 4000 5100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R6
|
||||
U 1 1 58C5CFB1
|
||||
P 3450 5450
|
||||
F 0 "R6" V 3530 5450 50 0000 C CNN
|
||||
F 1 "33" V 3450 5450 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 3380 5450 50 0001 C CNN
|
||||
F 3 "" H 3450 5450 50 0000 C CNN
|
||||
1 3450 5450
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
3700 5450 3600 5450
|
||||
Wire Wire Line
|
||||
3850 5100 3650 5100
|
||||
Wire Wire Line
|
||||
3650 5100 3650 5450
|
||||
Connection ~ 3650 5450
|
||||
Wire Wire Line
|
||||
4150 5100 4400 5100
|
||||
Wire Wire Line
|
||||
4400 5100 4400 5450
|
||||
Wire Wire Line
|
||||
4300 5450 4800 5450
|
||||
Connection ~ 4400 5450
|
||||
Wire Wire Line
|
||||
3200 5400 3200 5750
|
||||
Wire Wire Line
|
||||
3200 5450 3300 5450
|
||||
Wire Wire Line
|
||||
3200 5750 3700 5750
|
||||
Connection ~ 3200 5450
|
||||
Wire Wire Line
|
||||
4800 5850 4800 6200
|
||||
$Comp
|
||||
L CONN_01X02 P5
|
||||
U 1 1 58C5F893
|
||||
P 4550 5900
|
||||
F 0 "P5" H 4550 6050 50 0000 C CNN
|
||||
F 1 "Fan" V 4650 5900 50 0000 C CNN
|
||||
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 4550 5900 50 0001 C CNN
|
||||
F 3 "" H 4550 5900 50 0000 C CNN
|
||||
1 4550 5900
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4600 6100 4800 6100
|
||||
Connection ~ 4800 6100
|
||||
Wire Wire Line
|
||||
4500 6100 4300 6100
|
||||
Wire Wire Line
|
||||
4300 6100 4300 5950
|
||||
$Comp
|
||||
L +5V #PWR016
|
||||
U 1 1 58C61908
|
||||
P 3200 5400
|
||||
F 0 "#PWR016" H 3200 5250 50 0001 C CNN
|
||||
F 1 "+5V" H 3200 5540 50 0000 C CNN
|
||||
F 2 "" H 3200 5400 50 0000 C CNN
|
||||
F 3 "" H 3200 5400 50 0000 C CNN
|
||||
1 3200 5400
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
NoConn ~ 3700 5950
|
||||
NoConn ~ 4300 5750
|
||||
$Comp
|
||||
L R R7
|
||||
U 1 1 58CD4537
|
||||
P 5250 5650
|
||||
F 0 "R7" V 5330 5650 50 0000 C CNN
|
||||
F 1 "1K" V 5250 5650 50 0000 C CNN
|
||||
F 2 "Resistors_SMD:R_0603_HandSoldering" V 5180 5650 50 0001 C CNN
|
||||
F 3 "" H 5250 5650 50 0000 C CNN
|
||||
1 5250 5650
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$EndSCHEMATC
|
289
KiCad/V_Relay.lib
Normal file
289
KiCad/V_Relay.lib
Normal file
@ -0,0 +1,289 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: 28/02/2012-23:01:42
|
||||
#
|
||||
# DIL_REED
|
||||
#
|
||||
DEF DIL_REED K 0 20 Y Y 1 L N
|
||||
F0 "K" -325 500 50 H V L C
|
||||
F1 "DIL_REED" -325 400 50 H V L C
|
||||
F2 "DIL_REED14" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
DIL_REED14
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 7 100 -300 200 U 50 50 1 0 U
|
||||
X ~ 14 300 300 200 D 50 50 1 0 U
|
||||
X ~ 1 100 300 200 D 50 50 1 0 U
|
||||
X ~ 2 -200 -300 200 U 50 50 1 0 U
|
||||
X ~ 6 -200 300 250 D 50 50 1 0 U
|
||||
X ~ 8 300 -300 200 U 50 50 1 0 U
|
||||
P 2 0 0 8 130 50 200 -100 N
|
||||
P 2 0 0 8 200 100 200 50 N
|
||||
P 2 0 0 8 100 100 300 100 N
|
||||
P 2 0 0 8 100 -100 300 -100 N
|
||||
S -350 48 -50 -102 0 0 8 N
|
||||
C 205 25 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# DIL_REED_DIODE
|
||||
#
|
||||
DEF DIL_REED_DIODE K 0 20 Y Y 1 L N
|
||||
F0 "K" -400 500 50 H V L C
|
||||
F1 "DIL_REED_DIODE" -400 400 50 H V L C
|
||||
F2 "DIL_REED14" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
DIL_REED14
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 7 200 -300 200 U 50 50 1 0 U
|
||||
X ~ 14 400 300 200 D 50 50 1 0 U
|
||||
X ~ 1 200 300 200 D 50 50 1 0 U
|
||||
X ~ 2 -100 -300 200 U 50 50 1 0 U
|
||||
X ~ 6 -100 300 250 D 50 50 1 0 U
|
||||
X ~ 8 400 -300 200 U 50 50 1 0 U
|
||||
P 2 0 0 8 230 50 300 -100 N
|
||||
P 2 0 0 8 300 100 300 50 N
|
||||
P 2 0 0 8 -350 100 -350 0 N
|
||||
P 2 0 0 8 -350 -50 -350 -150 N
|
||||
P 4 0 0 8 -400 0 -300 0 -350 -50 -400 0 N
|
||||
P 2 0 0 8 -400 -50 -300 -50 N
|
||||
P 2 0 0 8 -350 100 -100 100 N
|
||||
P 2 0 0 8 -350 -150 -100 -150 N
|
||||
P 2 0 0 8 200 100 400 100 N
|
||||
P 2 0 0 8 200 -100 400 -100 N
|
||||
S -250 48 50 -102 0 0 8 N
|
||||
C 305 25 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# DPDT
|
||||
#
|
||||
DEF DPDT K 0 20 Y Y 1 L N
|
||||
F0 "K" -500 475 50 H V L C
|
||||
F1 "DPDT" -500 375 50 H V L C
|
||||
F2 "??" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
??
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 4 0 -250 200 U 50 50 1 0 U
|
||||
X ~ 3 -100 300 200 D 50 50 1 0 U
|
||||
X ~ 5 50 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -350 -250 200 U 50 50 1 0 U
|
||||
X ~ 2 -350 300 200 D 50 50 1 0 U
|
||||
X ~ 4 400 -250 200 U 50 50 1 0 U
|
||||
X ~ 3 300 300 200 D 50 50 1 0 U
|
||||
X ~ 5 450 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 -70 100 0 -50 N
|
||||
P 2 0 0 8 330 100 400 -50 N
|
||||
S -500 100 -200 -50 0 0 8 N
|
||||
C -95 75 25 0 0 8 N
|
||||
C 55 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
C 455 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# G2E
|
||||
#
|
||||
DEF G2E K 0 20 Y Y 1 L N
|
||||
F0 "K" -350 475 50 H V L C
|
||||
F1 "G2E" -350 375 50 H V L C
|
||||
F2 "G2E" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
G2E
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 3 100 -250 200 U 50 50 1 0 U
|
||||
X ~ 1 100 300 200 D 50 50 1 0 U
|
||||
X ~ 6 300 300 200 D 50 50 1 0 U
|
||||
X ~ 2 -200 -250 200 U 50 50 1 0 U
|
||||
X ~ 5 -200 300 200 D 50 50 1 0 U
|
||||
X ~ 4 300 -250 200 U 50 50 1 0 U
|
||||
P 2 0 0 8 130 100 208 -48 N
|
||||
P 2 0 0 8 100 -50 300 -50 N
|
||||
S -350 100 -50 -50 0 0 8 N
|
||||
C 105 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# G5A-234P
|
||||
#
|
||||
DEF G5A-234P K 0 20 Y Y 1 L N
|
||||
F0 "K" -500 475 50 H V L C
|
||||
F1 "G5A-234P" -500 375 50 H V L C
|
||||
F2 "G5A-234P" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
G5A-234P
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 3 0 -250 200 U 50 50 1 0 U
|
||||
X ~ 5 -100 300 200 D 50 50 1 0 U
|
||||
X ~ 6 50 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -350 -250 200 U 50 50 1 0 U
|
||||
X ~ 12 -350 300 200 D 50 50 1 0 U
|
||||
X ~ 10 400 -250 200 U 50 50 1 0 U
|
||||
X ~ 8 300 300 200 D 50 50 1 0 U
|
||||
X ~ 7 450 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 -70 100 0 -50 N
|
||||
P 2 0 0 8 330 100 400 -50 N
|
||||
S -500 100 -200 -50 0 0 8 N
|
||||
C -95 75 25 0 0 8 N
|
||||
C 55 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
C 455 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# G5AK-234P
|
||||
#
|
||||
DEF G5AK-234P K 0 20 Y Y 1 L N
|
||||
F0 "K" -500 475 50 H V L C
|
||||
F1 "G5AK-234P" -500 375 50 H V L C
|
||||
F2 "G5AK-234P" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
G5AK-234P
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 2 0 -250 200 U 50 50 1 0 U
|
||||
X ~ 5 -100 300 200 D 50 50 1 0 U
|
||||
X ~ 6 50 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -350 -250 200 U 50 50 1 0 U
|
||||
X ~ 12 -350 300 200 D 50 50 1 0 U
|
||||
X ~ 11 400 -250 200 U 50 50 1 0 U
|
||||
X ~ 8 300 300 200 D 50 50 1 0 U
|
||||
X ~ 7 450 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 -70 100 0 -50 N
|
||||
P 2 0 0 8 330 100 400 -50 N
|
||||
S -500 100 -200 -50 0 0 8 N
|
||||
C -95 75 25 0 0 8 N
|
||||
C 55 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
C 455 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# G5V-1
|
||||
#
|
||||
DEF G5V-1 K 0 20 Y Y 1 L N
|
||||
F0 "K" -350 500 50 H V L C
|
||||
F1 "G5V-1" -350 400 50 H V L C
|
||||
F2 "G5V-1" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
G5V-1
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 5 100 -300 200 U 50 50 1 0 U
|
||||
X ~ 1 100 300 200 D 50 50 1 0 U
|
||||
X ~ 10 300 300 200 D 50 50 1 0 U
|
||||
X ~ 2 -200 -300 200 U 50 50 1 0 U
|
||||
X ~ 9 -200 300 200 D 50 50 1 0 U
|
||||
X ~ 6 300 -300 200 U 50 50 1 0 U
|
||||
P 2 0 0 8 200 -100 150 100 N
|
||||
P 2 0 0 8 100 -100 300 -100 N
|
||||
S -350 100 -50 -100 0 0 8 N
|
||||
C 105 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# G5V-2
|
||||
#
|
||||
DEF G5V-2 K 0 20 Y Y 1 L N
|
||||
F0 "K" -500 475 50 H V L C
|
||||
F1 "G5V-2" -500 375 50 H V L C
|
||||
F2 "G5V-2" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
G5V-2
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 4 0 -250 200 U 50 50 1 0 U
|
||||
X ~ 6 -100 300 200 D 50 50 1 0 U
|
||||
X ~ 8 50 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -350 -250 200 U 50 50 1 0 U
|
||||
X ~ 16 -350 300 200 D 50 50 1 0 U
|
||||
X ~ 13 400 -250 200 U 50 50 1 0 U
|
||||
X ~ 11 300 300 200 D 50 50 1 0 U
|
||||
X ~ 9 450 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 -70 100 0 -50 N
|
||||
P 2 0 0 8 330 100 400 -50 N
|
||||
S -500 100 -200 -50 0 0 8 N
|
||||
C -95 75 25 0 0 8 N
|
||||
C 55 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
C 455 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# G6A-274P
|
||||
#
|
||||
DEF G6A-274P K 0 20 Y Y 1 L N
|
||||
F0 "K" -500 475 50 H V L C
|
||||
F1 "G6A-274P" -500 375 50 H V L C
|
||||
F2 "G5V-2" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
G5V-2
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 4 0 -250 200 U 50 50 1 0 U
|
||||
X ~ 6 -100 300 200 D 50 50 1 0 U
|
||||
X ~ 8 50 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -350 -250 200 U 50 50 1 0 U
|
||||
X ~ 16 -350 300 200 D 50 50 1 0 U
|
||||
X ~ 13 400 -250 200 U 50 50 1 0 U
|
||||
X ~ 11 300 300 200 D 50 50 1 0 U
|
||||
X ~ 9 450 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 -70 100 0 -50 N
|
||||
P 2 0 0 8 330 100 400 -50 N
|
||||
S -500 100 -200 -50 0 0 8 N
|
||||
C -95 75 25 0 0 8 N
|
||||
C 55 75 25 0 0 8 N
|
||||
C 305 75 25 0 0 8 N
|
||||
C 455 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SPDT
|
||||
#
|
||||
DEF SPDT K 0 20 Y Y 1 L N
|
||||
F0 "K" -300 475 50 H V L C
|
||||
F1 "SPDT" -300 375 50 H V L C
|
||||
F2 "??" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
??
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 4 200 -250 200 U 50 50 1 0 U
|
||||
X ~ 3 100 300 200 D 50 50 1 0 U
|
||||
X ~ 5 250 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -150 -250 200 U 50 50 1 0 U
|
||||
X ~ 2 -150 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 130 100 200 -50 N
|
||||
S -300 100 0 -50 0 0 8 N
|
||||
C 105 75 25 0 0 8 N
|
||||
C 255 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SPST
|
||||
#
|
||||
DEF SPST K 0 20 Y Y 1 L N
|
||||
F0 "K" -300 475 50 H V L C
|
||||
F1 "SPST" -300 375 50 H V L C
|
||||
F2 "??" 0 0 50 H I C C
|
||||
$FPLIST
|
||||
??
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
X ~ 4 200 -250 200 U 50 50 1 0 U
|
||||
X ~ 5 250 300 200 D 50 50 1 0 U
|
||||
X ~ 1 -150 -250 200 U 50 50 1 0 U
|
||||
X ~ 2 -150 300 200 D 50 50 1 0 U
|
||||
P 2 0 0 8 130 100 200 -50 N
|
||||
S -300 100 0 -50 0 0 8 N
|
||||
C 255 75 25 0 0 8 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
3
KiCad/fp-lib-table
Normal file
3
KiCad/fp-lib-table
Normal file
@ -0,0 +1,3 @@
|
||||
(fp_lib_table
|
||||
(lib (name OmronG5V)(type KiCad)(uri P:\KiCad\Libraries\OmronG5V.pretty)(options "")(descr ""))
|
||||
)
|
39
Pi/PiPower.py
Normal file
39
Pi/PiPower.py
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# PiPower
|
||||
# Copyright 2017 (c) Mark van Renswoude
|
||||
#
|
||||
# Yet another power supply for the Raspberry Pi.
|
||||
# Designed to run on an ATTiny85 with a self-locking button.
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
import os
|
||||
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(15, GPIO.OUT)
|
||||
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
|
||||
|
||||
hasShutdown = False
|
||||
|
||||
|
||||
def shutdownSignal(channel):
|
||||
print "PiPower: shutting down"
|
||||
os.system('shutdown -h now')
|
||||
hasShutdown = true
|
||||
|
||||
|
||||
GPIO.add_event_detect(18, GPIO.RISING, callback=shutdownSignal, bouncetime=300)
|
||||
GPIO.output(15, GPIO.HIGH)
|
||||
|
||||
|
||||
try:
|
||||
print "PiPower: waiting for signal"
|
||||
|
||||
while not hasShutdown:
|
||||
time.sleep(1)
|
||||
|
||||
print "PiPower: exiting"
|
||||
GPIO.cleanup()
|
||||
except KeyboardInterrupt:
|
||||
GPIO.cleanup()
|
36
Pi/notes.txt
Normal file
36
Pi/notes.txt
Normal file
@ -0,0 +1,36 @@
|
||||
WARNING!
|
||||
The PiPower board is outputting 5V, which can kill your Pi according
|
||||
to the specs.
|
||||
|
||||
Either add a logic level converter chip or a simple resistor based
|
||||
voltage divider:
|
||||
|
||||
|
||||
2.2k 3.3k
|
||||
PiPower signal ---~~~--+--~~~--- GND
|
||||
|
|
||||
|
|
||||
GPIO
|
||||
|
||||
Source: https://www.raspberrypi.org/forums/viewtopic.php?f=45&t=22841
|
||||
|
||||
|
||||
|
||||
To install as a service, save pipower.service to /lib/systemd/system/ and execute:
|
||||
|
||||
sudo chmod 644 /lib/systemd/system/pipower.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable pipower.service
|
||||
sudo systemctl start pipower.service
|
||||
|
||||
|
||||
|
||||
Please check /boot/config.txt for a line defining enable_uart.
|
||||
If this is set to 0, change it to 1! If not defined, add it just
|
||||
to be sure:
|
||||
|
||||
enable_uart=1
|
||||
|
||||
I have encountered this default of 0 in RetroPie, but I've seen
|
||||
reports for a standard installation as well:
|
||||
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=141195
|
17
Pi/pipower.service
Normal file
17
Pi/pipower.service
Normal file
@ -0,0 +1,17 @@
|
||||
# PiPower
|
||||
# Copyright 2017 (c) Mark van Renswoude
|
||||
#
|
||||
# Yet another power supply for the Raspberry Pi.
|
||||
# Designed to run on an ATTiny85 with a self-locking button.
|
||||
|
||||
[Unit]
|
||||
Description=PiPower
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python /home/pi/pipower.py
|
||||
Restart=on-abort
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
442
PiPower.ino
Normal file
442
PiPower.ino
Normal file
@ -0,0 +1,442 @@
|
||||
/*
|
||||
* PiPower
|
||||
* Copyright 2017 (c) Mark van Renswoude
|
||||
*
|
||||
* Yet another power supply for the Raspberry Pi.
|
||||
* Designed to run on an ATTiny85 with a self-locking button.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Known "bug": if you turn the power button back on while it's shutting
|
||||
* down, it may not power cycle the Pi as it'll only turn the relay off
|
||||
* for the length of the button debounce time. Since there is a simple
|
||||
* workaround (turn the button off, wait a few seconds and turn it back
|
||||
* on again) I didn't bother to add the logic for this situation.
|
||||
*/
|
||||
#include <avr/sleep.h>
|
||||
|
||||
|
||||
/*
|
||||
* Configuration
|
||||
*/
|
||||
// The button needs to be on a pin that supports interrupts
|
||||
const uint8_t PinButton = 0;
|
||||
const uint8_t PinButtonInterrupt = PCINT0;
|
||||
|
||||
// The LED needs to be on a pin that supports PWM
|
||||
const uint8_t PinLED = 1;
|
||||
|
||||
// These just need digital I/O
|
||||
const uint8_t PinRelay = 2;
|
||||
const uint8_t PinShutdown = 3;
|
||||
const uint8_t PinPiState = 4;
|
||||
|
||||
|
||||
// The debounce time used to filter button noise
|
||||
const unsigned long ButtonDebounceTime = 300;
|
||||
|
||||
// How long to wait for a signal from the Pi before alerting the user
|
||||
const unsigned long BootProblemTime = 5000;
|
||||
|
||||
// How long to wait after the Pi signal turns off to turn off the power, to prevent false positives during a reboot
|
||||
const unsigned long PowerOffTime = 5000;
|
||||
|
||||
|
||||
// How long the LED stays on or off during blinking
|
||||
const unsigned long LEDBlinkTime = 750;
|
||||
|
||||
// How long it takes to fade from on to off or back
|
||||
const unsigned long LEDFadeTime = 750;
|
||||
|
||||
|
||||
|
||||
enum LEDState
|
||||
{
|
||||
Off,
|
||||
On,
|
||||
Blinking,
|
||||
Fading
|
||||
};
|
||||
|
||||
struct ButtonState
|
||||
{
|
||||
bool pressed;
|
||||
bool debouncing;
|
||||
};
|
||||
|
||||
typedef void (* StateHandler) ();
|
||||
|
||||
|
||||
// Forward declarations
|
||||
void gotoStateIdle();
|
||||
void gotoStateBoot();
|
||||
void gotoStateBootProblem();
|
||||
void gotoStateShutdown();
|
||||
|
||||
ButtonState getButtonState();
|
||||
void checkPiShutdown();
|
||||
inline void checkLEDAnimation();
|
||||
|
||||
inline LEDState getLEDState();
|
||||
void setLEDState(LEDState newState);
|
||||
void setRelayState(uint8_t newState);
|
||||
void setShutdownState(uint8_t newState);
|
||||
|
||||
|
||||
// State variables
|
||||
StateHandler currentState;
|
||||
unsigned long currentTime;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(PinLED, OUTPUT);
|
||||
pinMode(PinRelay, OUTPUT);
|
||||
pinMode(PinShutdown, OUTPUT);
|
||||
pinMode(PinPiState, INPUT);
|
||||
|
||||
digitalWrite(PinLED, LOW);
|
||||
digitalWrite(PinRelay, LOW);
|
||||
digitalWrite(PinShutdown, LOW);
|
||||
|
||||
gotoStateIdle();
|
||||
|
||||
// Blink two times to indicate we've got power
|
||||
digitalWrite(PinLED, HIGH); delay(250); digitalWrite(PinLED, LOW); delay(250);
|
||||
digitalWrite(PinLED, HIGH); delay(250); digitalWrite(PinLED, LOW); delay(250);
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
currentTime = millis();
|
||||
currentState();
|
||||
|
||||
checkLEDAnimation();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Idle
|
||||
*
|
||||
* Power button is not pressed, no power going to the Pi.
|
||||
*
|
||||
* LED: Off
|
||||
* Relay: Off
|
||||
* Shutdown signal: Off
|
||||
*/
|
||||
void stateIdle()
|
||||
{
|
||||
ButtonState buttonState = getButtonState();
|
||||
|
||||
if (buttonState.pressed)
|
||||
{
|
||||
gotoStateBoot();
|
||||
}
|
||||
else if (!buttonState.debouncing)
|
||||
{
|
||||
// Go into sleep mode until the button interrupt wakes us up again
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
|
||||
void gotoStateIdle()
|
||||
{
|
||||
setLEDState(Off);
|
||||
setRelayState(LOW);
|
||||
setShutdownState(LOW);
|
||||
|
||||
currentState = stateIdle;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Boot
|
||||
*
|
||||
* Power going to the Pi, waiting for confirmation.
|
||||
*
|
||||
* LED: On
|
||||
* Relay: On
|
||||
* Shutdown signal: Off
|
||||
*/
|
||||
unsigned long bootStart;
|
||||
|
||||
void stateBoot()
|
||||
{
|
||||
if (digitalRead(PinPiState) == HIGH)
|
||||
gotoStateOn();
|
||||
else if (currentTime - bootStart >= BootProblemTime)
|
||||
gotoStateBootProblem();
|
||||
}
|
||||
|
||||
void gotoStateBoot()
|
||||
{
|
||||
setLEDState(On);
|
||||
setRelayState(HIGH);
|
||||
setShutdownState(LOW);
|
||||
|
||||
bootStart = currentTime;
|
||||
currentState = stateBoot;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Boot problem
|
||||
*
|
||||
* No confirmation of a succesful boot within the timeout,
|
||||
* alert the user.
|
||||
*
|
||||
* LED: Blinking
|
||||
* Relay: On
|
||||
* Shutdown signal: Off
|
||||
*/
|
||||
void stateBootProblem()
|
||||
{
|
||||
if (digitalRead(PinPiState) == HIGH)
|
||||
gotoStateOn();
|
||||
else
|
||||
{
|
||||
ButtonState buttonState = getButtonState();
|
||||
if (!buttonState.pressed)
|
||||
gotoStateIdle();
|
||||
}
|
||||
}
|
||||
|
||||
void gotoStateBootProblem()
|
||||
{
|
||||
setLEDState(Blinking);
|
||||
setRelayState(HIGH);
|
||||
setShutdownState(LOW);
|
||||
|
||||
currentState = stateBootProblem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* On
|
||||
*
|
||||
* Pi is running.
|
||||
*
|
||||
* LED: On
|
||||
* Relay: On
|
||||
* Shutdown signal: Off
|
||||
*/
|
||||
void stateOn()
|
||||
{
|
||||
ButtonState buttonState = getButtonState();
|
||||
if (!buttonState.pressed)
|
||||
gotoStateShutdown();
|
||||
|
||||
checkPiShutdown();
|
||||
}
|
||||
|
||||
void gotoStateOn()
|
||||
{
|
||||
setLEDState(On);
|
||||
setRelayState(HIGH);
|
||||
setShutdownState(LOW);
|
||||
|
||||
currentState = stateOn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Shutdown
|
||||
*
|
||||
* Signal to the Pi that a shutdown is requested.
|
||||
*
|
||||
* LED: Fading
|
||||
* Relay: On
|
||||
* Shutdown signal: On
|
||||
*/
|
||||
void stateShutdown()
|
||||
{
|
||||
checkPiShutdown();
|
||||
}
|
||||
|
||||
void gotoStateShutdown()
|
||||
{
|
||||
setLEDState(Fading);
|
||||
setRelayState(HIGH);
|
||||
setShutdownState(HIGH);
|
||||
|
||||
currentState = stateShutdown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Helpers
|
||||
*/
|
||||
// https://bigdanzblog.wordpress.com/2014/08/10/attiny85-wake-from-sleep-on-pin-state-change-code-example/
|
||||
void sleep()
|
||||
{
|
||||
GIMSK |= _BV(PCIE); // Enable Pin Change Interrupts
|
||||
PCMSK |= _BV(PinButtonInterrupt); // Use button as interrupt pin
|
||||
ADCSRA &= ~_BV(ADEN); // ADC off
|
||||
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Replaces above statement
|
||||
|
||||
sleep_enable(); // Sets the Sleep Enable bit in the MCUCR Register (SE BIT)
|
||||
sei(); // Enable interrupts
|
||||
sleep_cpu(); // Sleep
|
||||
|
||||
cli(); // Disable interrupts
|
||||
PCMSK &= ~_BV(PinButtonInterrupt); // Turn off button as interrupt pin
|
||||
sleep_disable(); // Clear SE bit
|
||||
ADCSRA |= _BV(ADEN); // ADC on
|
||||
|
||||
sei(); // Enable interrupts
|
||||
}
|
||||
|
||||
ISR(PCINT0_vect)
|
||||
{
|
||||
// This is called when the interrupt occurs, but I don't need to do anything in it
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t debouncedButtonState = LOW;
|
||||
uint8_t lastButtonState = LOW;
|
||||
unsigned long lastButtonChange = 0;
|
||||
|
||||
ButtonState getButtonState()
|
||||
{
|
||||
ButtonState state;
|
||||
uint8_t currentButtonState = digitalRead(PinButton);
|
||||
|
||||
if (currentButtonState != lastButtonState)
|
||||
{
|
||||
lastButtonState = currentButtonState;
|
||||
lastButtonChange = currentTime;
|
||||
}
|
||||
|
||||
if (currentTime - lastButtonChange >= ButtonDebounceTime)
|
||||
{
|
||||
if (currentButtonState != debouncedButtonState)
|
||||
debouncedButtonState = currentButtonState;
|
||||
|
||||
state.debouncing = false;
|
||||
}
|
||||
else
|
||||
state.debouncing = true;
|
||||
|
||||
state.pressed = (debouncedButtonState == HIGH);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
bool shutdownDetected = false;
|
||||
unsigned long shutdownStart;
|
||||
|
||||
void checkPiShutdown()
|
||||
{
|
||||
if (digitalRead(PinPiState) == LOW)
|
||||
{
|
||||
if (shutdownDetected)
|
||||
{
|
||||
if (currentTime - shutdownStart >= PowerOffTime)
|
||||
gotoStateIdle();
|
||||
}
|
||||
else
|
||||
{
|
||||
shutdownStart = currentTime;
|
||||
shutdownDetected = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
shutdownDetected = false;
|
||||
}
|
||||
|
||||
|
||||
LEDState ledState = Off;
|
||||
unsigned long ledLastAnimation;
|
||||
bool ledAnimationOn;
|
||||
|
||||
inline LEDState getLEDState()
|
||||
{
|
||||
return ledState;
|
||||
}
|
||||
|
||||
void setLEDState(LEDState newState)
|
||||
{
|
||||
if (newState == ledState)
|
||||
return;
|
||||
|
||||
switch(newState)
|
||||
{
|
||||
case Off:
|
||||
digitalWrite(PinLED, LOW);
|
||||
break;
|
||||
|
||||
case On:
|
||||
digitalWrite(PinLED, HIGH);
|
||||
break;
|
||||
|
||||
default:
|
||||
ledLastAnimation = currentTime;
|
||||
ledAnimationOn = true;
|
||||
break;
|
||||
}
|
||||
ledState = newState;
|
||||
}
|
||||
|
||||
|
||||
inline void checkLEDAnimation()
|
||||
{
|
||||
switch(getLEDState())
|
||||
{
|
||||
case Blinking:
|
||||
if (currentTime - ledLastAnimation >= LEDBlinkTime)
|
||||
{
|
||||
ledAnimationOn = !ledAnimationOn;
|
||||
ledLastAnimation = currentTime;
|
||||
}
|
||||
|
||||
digitalWrite(PinLED, ledAnimationOn ? HIGH : LOW);
|
||||
break;
|
||||
|
||||
case Fading:
|
||||
unsigned long elapsedTime = currentTime - ledLastAnimation;
|
||||
while (elapsedTime >= LEDFadeTime)
|
||||
{
|
||||
ledAnimationOn = !ledAnimationOn;
|
||||
ledLastAnimation = currentTime;
|
||||
|
||||
elapsedTime -= LEDFadeTime;
|
||||
}
|
||||
|
||||
byte currentStep = (byte)((elapsedTime * 255) / LEDFadeTime);
|
||||
if (!ledAnimationOn)
|
||||
currentStep = 255 - currentStep;
|
||||
|
||||
analogWrite(PinLED, currentStep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t relayState = LOW;
|
||||
|
||||
void setRelayState(uint8_t newState)
|
||||
{
|
||||
if (newState == relayState)
|
||||
return;
|
||||
|
||||
digitalWrite(PinRelay, newState);
|
||||
relayState = newState;
|
||||
}
|
||||
|
||||
|
||||
uint8_t shutdownState = LOW;
|
||||
|
||||
void setShutdownState(uint8_t newState)
|
||||
{
|
||||
if (newState == shutdownState)
|
||||
return;
|
||||
|
||||
digitalWrite(PinShutdown, newState);
|
||||
shutdownState = newState;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user