diff --git a/README.md b/README.md index e8de565..9024b7c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ # Wifi-Relay -Switch a relay with mqtt via wifi. \ No newline at end of file +This schematic and code can be used to build up a relay, which can be switched over wifi by sending on/off commands to a MQTT channel. + +## Cicurit / Board + +The cicurit is build upon a ESP-01 (ESP8266) module which GPIO2 pin switches the relay. To program the ESP-01 one may solder a pin socket on the board and put the ESP-01 in, instead of soldering it directly onto the board ;-) + +## Source + +The code is quite simple. It connects to a MQTT broker and subscribes to a channel //relay to recieve the on/off command. The current state of the relay is then published to the channel //relay/state. + +Enjoy. + diff --git a/cicurit/wifi_relais.kicad_pcb b/cicurit/wifi_relais.kicad_pcb new file mode 100644 index 0000000..4902ef4 --- /dev/null +++ b/cicurit/wifi_relais.kicad_pcb @@ -0,0 +1,652 @@ +(kicad_pcb (version 20171130) (host pcbnew 5.1.8+dfsg1-1) + + (general + (thickness 1.6) + (drawings 10) + (tracks 68) + (zones 0) + (modules 9) + (nets 16) + ) + + (page A4) + (layers + (0 F.Cu signal) + (31 B.Cu signal) + (33 F.Adhes user hide) + (35 F.Paste user hide) + (37 F.SilkS user) + (38 B.Mask user hide) + (39 F.Mask user hide) + (40 Dwgs.User user hide) + (41 Cmts.User user hide) + (42 Eco1.User user hide) + (43 Eco2.User user hide) + (44 Edge.Cuts user) + (45 Margin user hide) + (46 B.CrtYd user hide) + (47 F.CrtYd user hide) + (49 F.Fab user hide) + ) + + (setup + (last_trace_width 0.6) + (trace_clearance 0.2) + (zone_clearance 0.508) + (zone_45_only no) + (trace_min 0.2) + (via_size 0.8) + (via_drill 0.4) + (via_min_size 0.4) + (via_min_drill 0.3) + (uvia_size 0.3) + (uvia_drill 0.1) + (uvias_allowed no) + (uvia_min_size 0.2) + (uvia_min_drill 0.1) + (edge_width 0.05) + (segment_width 0.2) + (pcb_text_width 0.3) + (pcb_text_size 1.5 1.5) + (mod_edge_width 0.12) + (mod_text_size 1 1) + (mod_text_width 0.15) + (pad_size 1.524 1.524) + (pad_drill 0.762) + (pad_to_mask_clearance 0) + (aux_axis_origin 0 0) + (visible_elements FEFFFFFF) + (pcbplotparams + (layerselection 0x010fc_ffffffff) + (usegerberextensions false) + (usegerberattributes true) + (usegerberadvancedattributes true) + (creategerberjobfile true) + (excludeedgelayer true) + (linewidth 0.100000) + (plotframeref false) + (viasonmask false) + (mode 1) + (useauxorigin false) + (hpglpennumber 1) + (hpglpenspeed 20) + (hpglpendiameter 15.000000) + (psnegative false) + (psa4output false) + (plotreference true) + (plotvalue true) + (plotinvisibletext false) + (padsonsilk false) + (subtractmaskfromsilk false) + (outputformat 1) + (mirror false) + (drillshape 1) + (scaleselection 1) + (outputdirectory "")) + ) + + (net 0 "") + (net 1 "Net-(D1-Pad2)") + (net 2 "Net-(J1-Pad5)") + (net 3 "Net-(J1-Pad4)") + (net 4 "Net-(J1-Pad3)") + (net 5 /3,3V) + (net 6 "Net-(Q1-Pad1)") + (net 7 "Net-(Q1-Pad2)") + (net 8 "Net-(Q2-Pad2)") + (net 9 "Net-(R1-Pad1)") + (net 10 "Net-(U1-Pad7)") + (net 11 "Net-(U1-Pad5)") + (net 12 "Net-(U1-Pad4)") + (net 13 "Net-(U1-Pad3)") + (net 14 /5V) + (net 15 /GND) + + (net_class Default "This is the default net class." + (clearance 0.2) + (trace_width 0.6) + (via_dia 0.8) + (via_drill 0.4) + (uvia_dia 0.3) + (uvia_drill 0.1) + (add_net /3,3V) + (add_net /5V) + (add_net /GND) + (add_net "Net-(D1-Pad2)") + (add_net "Net-(Q1-Pad1)") + (add_net "Net-(Q1-Pad2)") + (add_net "Net-(Q2-Pad2)") + (add_net "Net-(R1-Pad1)") + (add_net "Net-(U1-Pad3)") + (add_net "Net-(U1-Pad4)") + (add_net "Net-(U1-Pad5)") + (add_net "Net-(U1-Pad7)") + ) + + (net_class Breit "" + (clearance 0.2) + (trace_width 1.8) + (via_dia 0.8) + (via_drill 0.4) + (uvia_dia 0.3) + (uvia_drill 0.1) + (add_net "Net-(J1-Pad3)") + (add_net "Net-(J1-Pad4)") + (add_net "Net-(J1-Pad5)") + ) + + (module RF_Module:ESP-01 (layer F.Cu) (tedit 5F88BF57) (tstamp 5FCBF804) + (at 121.256 59.449) + (descr "Wi-Fi Module") + (tags "Wi-Fi Module") + (path /5FCB393A) + (fp_text reference U1 (at -0.057 8.938) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value ESP-01 (at -0.07 -1.37) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start -7.69 -13.57) (end 7.55 -13.57) (layer Dwgs.User) (width 0.12)) + (fp_line (start 7.55 -13.57) (end 7.55 11.83) (layer Dwgs.User) (width 0.12)) + (fp_line (start 7.55 11.83) (end -7.69 11.83) (layer Dwgs.User) (width 0.12)) + (fp_line (start -7.69 11.83) (end -7.69 -13.57) (layer Dwgs.User) (width 0.12)) + (fp_line (start 6.28 -12.3) (end 2.47 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.47 -12.3) (end 2.47 -7.22) (layer Dwgs.User) (width 0.12)) + (fp_line (start 2.47 -7.22) (end 1.2 -7.22) (layer Dwgs.User) (width 0.12)) + (fp_line (start 1.2 -7.22) (end 1.2 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start 1.2 -12.3) (end -0.07 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start -0.07 -12.3) (end -0.07 -7.22) (layer Dwgs.User) (width 0.12)) + (fp_line (start -0.07 -7.22) (end -1.34 -7.22) (layer Dwgs.User) (width 0.12)) + (fp_line (start -1.34 -7.22) (end -1.34 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start -1.34 -12.3) (end -2.61 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.61 -12.3) (end -2.61 -7.22) (layer Dwgs.User) (width 0.12)) + (fp_line (start -2.61 -7.22) (end -3.88 -7.22) (layer Dwgs.User) (width 0.12)) + (fp_line (start -3.88 -7.22) (end -3.88 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start -3.88 -12.3) (end -5.15 -12.3) (layer Dwgs.User) (width 0.12)) + (fp_line (start -5.15 -12.3) (end -5.15 -5.315) (layer Dwgs.User) (width 0.12)) + (fp_line (start -5.15 -5.315) (end 2.47 -5.315) (layer Dwgs.User) (width 0.12)) + (pad 8 thru_hole circle (at 3.81 10.16) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 5 /3,3V)) + (pad 7 thru_hole circle (at 1.27 10.16) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 10 "Net-(U1-Pad7)")) + (pad 6 thru_hole circle (at -1.27 10.16) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 5 /3,3V)) + (pad 5 thru_hole circle (at -3.81 10.16) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 11 "Net-(U1-Pad5)")) + (pad 4 thru_hole rect (at 3.81 7.62) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 12 "Net-(U1-Pad4)")) + (pad 3 thru_hole circle (at 1.27 7.62) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 13 "Net-(U1-Pad3)")) + (pad 2 thru_hole circle (at -1.27 7.62) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 9 "Net-(R1-Pad1)")) + (pad 1 thru_hole rect (at -3.81 7.62) (size 1.524 1.524) (drill 0.762) (layers B.Cu B.Mask) + (net 15 /GND)) + ) + + (module Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal (layer F.Cu) (tedit 5AE5139B) (tstamp 5FCB1B7B) + (at 125.616 50.024 180) + (descr "Resistor, Axial_DIN0207 series, Axial, Horizontal, pin pitch=10.16mm, 0.25W = 1/4W, length*diameter=6.3*2.5mm^2, http://cdn-reichelt.de/documents/datenblatt/B400/1_4W%23YAG.pdf") + (tags "Resistor Axial_DIN0207 series Axial Horizontal pin pitch 10.16mm 0.25W = 1/4W length 6.3mm diameter 2.5mm") + (path /5FCAC893) + (fp_text reference R2 (at 5.202 -0.081) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value 470 (at 5.08 2.37) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 11.21 -1.5) (end -1.05 -1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start 11.21 1.5) (end 11.21 -1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.05 1.5) (end 11.21 1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.05 -1.5) (end -1.05 1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start 9.12 0) (end 8.35 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.04 0) (end 1.81 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 8.35 -1.37) (end 1.81 -1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 8.35 1.37) (end 8.35 -1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.81 1.37) (end 8.35 1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.81 -1.37) (end 1.81 1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 10.16 0) (end 8.23 0) (layer F.Fab) (width 0.1)) + (fp_line (start 0 0) (end 1.93 0) (layer F.Fab) (width 0.1)) + (fp_line (start 8.23 -1.25) (end 1.93 -1.25) (layer F.Fab) (width 0.1)) + (fp_line (start 8.23 1.25) (end 8.23 -1.25) (layer F.Fab) (width 0.1)) + (fp_line (start 1.93 1.25) (end 8.23 1.25) (layer F.Fab) (width 0.1)) + (fp_line (start 1.93 -1.25) (end 1.93 1.25) (layer F.Fab) (width 0.1)) + (fp_text user %R (at 5.08 0) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 2 thru_hole oval (at 10.16 0 180) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) + (net 8 "Net-(Q2-Pad2)")) + (pad 1 thru_hole circle (at 0 0 180) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) + (net 6 "Net-(Q1-Pad1)")) + (model ${KISYS3DMOD}/Resistor_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal (layer F.Cu) (tedit 5AE5139B) (tstamp 5FCBE191) + (at 115.404 59.46) + (descr "Resistor, Axial_DIN0207 series, Axial, Horizontal, pin pitch=10.16mm, 0.25W = 1/4W, length*diameter=6.3*2.5mm^2, http://cdn-reichelt.de/documents/datenblatt/B400/1_4W%23YAG.pdf") + (tags "Resistor Axial_DIN0207 series Axial Horizontal pin pitch 10.16mm 0.25W = 1/4W length 6.3mm diameter 2.5mm") + (path /5FCABFFC) + (fp_text reference R1 (at 5.069 -0.039) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value 470 (at 5.08 2.37) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 11.21 -1.5) (end -1.05 -1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start 11.21 1.5) (end 11.21 -1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.05 1.5) (end 11.21 1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.05 -1.5) (end -1.05 1.5) (layer F.CrtYd) (width 0.05)) + (fp_line (start 9.12 0) (end 8.35 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.04 0) (end 1.81 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 8.35 -1.37) (end 1.81 -1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 8.35 1.37) (end 8.35 -1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.81 1.37) (end 8.35 1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.81 -1.37) (end 1.81 1.37) (layer F.SilkS) (width 0.12)) + (fp_line (start 10.16 0) (end 8.23 0) (layer F.Fab) (width 0.1)) + (fp_line (start 0 0) (end 1.93 0) (layer F.Fab) (width 0.1)) + (fp_line (start 8.23 -1.25) (end 1.93 -1.25) (layer F.Fab) (width 0.1)) + (fp_line (start 8.23 1.25) (end 8.23 -1.25) (layer F.Fab) (width 0.1)) + (fp_line (start 1.93 1.25) (end 8.23 1.25) (layer F.Fab) (width 0.1)) + (fp_line (start 1.93 -1.25) (end 1.93 1.25) (layer F.Fab) (width 0.1)) + (fp_text user %R (at 5.08 0) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 2 thru_hole oval (at 10.16 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) + (net 7 "Net-(Q1-Pad2)")) + (pad 1 thru_hole circle (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) + (net 9 "Net-(R1-Pad1)")) + (model ${KISYS3DMOD}/Resistor_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module Package_TO_SOT_THT:TO-92_Inline (layer F.Cu) (tedit 5A1DD157) (tstamp 5FCB23FA) + (at 117.105 54.318) + (descr "TO-92 leads in-line, narrow, oval pads, drill 0.75mm (see NXP sot054_po.pdf)") + (tags "to-92 sc-43 sc-43a sot54 PA33 transistor") + (path /5FCA14AE) + (fp_text reference Q2 (at 1.377 2.601) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value BC546 (at 1.27 2.79) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 4 2.01) (end -1.46 2.01) (layer F.CrtYd) (width 0.05)) + (fp_line (start 4 2.01) (end 4 -2.73) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.46 -2.73) (end -1.46 2.01) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.46 -2.73) (end 4 -2.73) (layer F.CrtYd) (width 0.05)) + (fp_line (start -0.5 1.75) (end 3 1.75) (layer F.Fab) (width 0.1)) + (fp_line (start -0.53 1.85) (end 3.07 1.85) (layer F.SilkS) (width 0.12)) + (fp_arc (start 1.27 0) (end 1.27 -2.6) (angle 135) (layer F.SilkS) (width 0.12)) + (fp_arc (start 1.27 0) (end 1.27 -2.48) (angle -135) (layer F.Fab) (width 0.1)) + (fp_arc (start 1.27 0) (end 1.27 -2.6) (angle -135) (layer F.SilkS) (width 0.12)) + (fp_arc (start 1.27 0) (end 1.27 -2.48) (angle 135) (layer F.Fab) (width 0.1)) + (fp_text user %R (at 1.27 0) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 1 thru_hole rect (at 0 0) (size 1.05 1.5) (drill 0.75) (layers *.Cu *.Mask) + (net 1 "Net-(D1-Pad2)")) + (pad 3 thru_hole oval (at 2.54 0) (size 1.05 1.5) (drill 0.75) (layers *.Cu *.Mask) + (net 15 /GND)) + (pad 2 thru_hole oval (at 1.27 0) (size 1.05 1.5) (drill 0.75) (layers *.Cu *.Mask) + (net 8 "Net-(Q2-Pad2)")) + (model ${KISYS3DMOD}/Package_TO_SOT_THT.3dshapes/TO-92_Inline.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module Package_TO_SOT_THT:TO-92_Inline (layer F.Cu) (tedit 5A1DD157) (tstamp 5FCB2334) + (at 122.654 54.318) + (descr "TO-92 leads in-line, narrow, oval pads, drill 0.75mm (see NXP sot054_po.pdf)") + (tags "to-92 sc-43 sc-43a sot54 PA33 transistor") + (path /5FCA0DDC) + (fp_text reference Q1 (at 1.405 2.65) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value BC327 (at 1.27 2.79) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 4 2.01) (end -1.46 2.01) (layer F.CrtYd) (width 0.05)) + (fp_line (start 4 2.01) (end 4 -2.73) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.46 -2.73) (end -1.46 2.01) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.46 -2.73) (end 4 -2.73) (layer F.CrtYd) (width 0.05)) + (fp_line (start -0.5 1.75) (end 3 1.75) (layer F.Fab) (width 0.1)) + (fp_line (start -0.53 1.85) (end 3.07 1.85) (layer F.SilkS) (width 0.12)) + (fp_arc (start 1.27 0) (end 1.27 -2.6) (angle 135) (layer F.SilkS) (width 0.12)) + (fp_arc (start 1.27 0) (end 1.27 -2.48) (angle -135) (layer F.Fab) (width 0.1)) + (fp_arc (start 1.27 0) (end 1.27 -2.6) (angle -135) (layer F.SilkS) (width 0.12)) + (fp_arc (start 1.27 0) (end 1.27 -2.48) (angle 135) (layer F.Fab) (width 0.1)) + (fp_text user %R (at 1.27 0) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 1 thru_hole rect (at 0 0) (size 1.05 1.5) (drill 0.75) (layers *.Cu *.Mask) + (net 6 "Net-(Q1-Pad1)")) + (pad 3 thru_hole oval (at 2.54 0) (size 1.05 1.5) (drill 0.75) (layers *.Cu *.Mask) + (net 5 /3,3V)) + (pad 2 thru_hole oval (at 1.27 0) (size 1.05 1.5) (drill 0.75) (layers *.Cu *.Mask) + (net 7 "Net-(Q1-Pad2)")) + (model ${KISYS3DMOD}/Package_TO_SOT_THT.3dshapes/TO-92_Inline.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module Relay_THT:Relay_SPDT_Finder_36.11 (layer F.Cu) (tedit 5D3F5A07) (tstamp 5FCBE74A) + (at 108.953 80.164) + (descr "FINDER 36.11, SPDT relay, 10A, https://gfinder.findernet.com/public/attachments/36/EN/S36EN.pdf") + (tags "spdt relay") + (path /5FCAA0D9) + (fp_text reference K1 (at 8.791 -4.02) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value FINDER-36.11 (at 8 -9.6) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 8.5 1.5) (end 3.5 1.5) (layer F.SilkS) (width 0.12)) + (fp_line (start 8.5 -1.5) (end 8.5 1.5) (layer F.SilkS) (width 0.12)) + (fp_line (start 3.5 -1.5) (end 8.5 -1.5) (layer F.SilkS) (width 0.12)) + (fp_line (start 3.5 1.5) (end 3.5 -1.5) (layer F.SilkS) (width 0.12)) + (fp_line (start 8.5 1.5) (end 3.5 -1.5) (layer F.SilkS) (width 0.12)) + (fp_line (start 6 1.5) (end 6 6) (layer F.SilkS) (width 0.12)) + (fp_line (start 6 -6) (end 6 -1.5) (layer F.SilkS) (width 0.12)) + (fp_line (start 2.6 0) (end 2.6 3.7) (layer F.SilkS) (width 0.12)) + (fp_line (start 9.5 0) (end 9.5 3.7) (layer F.SilkS) (width 0.12)) + (fp_line (start 9.5 3.7) (end 2.6 3.7) (layer F.SilkS) (width 0.12)) + (fp_line (start 11 0) (end 15.5 -2.7) (layer F.SilkS) (width 0.12)) + (fp_line (start 9.5 0) (end 11 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 6 -6) (end 3.7 -6) (layer F.SilkS) (width 0.12)) + (fp_line (start 2.6 0) (end 1.7 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 3.7 6) (end 6 6) (layer F.SilkS) (width 0.12)) + (fp_line (start 14.2 -4.3) (end 14.2 -2) (layer F.SilkS) (width 0.12)) + (fp_line (start 14.2 4.3) (end 14.2 2) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.75 7.85) (end 17.85 7.85) (layer F.CrtYd) (width 0.05)) + (fp_line (start 17.85 -7.85) (end 17.85 7.85) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.75 7.85) (end -1.75 -7.85) (layer F.CrtYd) (width 0.05)) + (fp_line (start 17.85 -7.85) (end -1.75 -7.85) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.4 7.6) (end -1.4 -7.6) (layer F.Fab) (width 0.1)) + (fp_line (start 17.6 7.6) (end -1.4 7.6) (layer F.Fab) (width 0.1)) + (fp_line (start 17.6 -7.6) (end 17.6 7.6) (layer F.Fab) (width 0.1)) + (fp_line (start -1.4 -7.6) (end 17.6 -7.6) (layer F.Fab) (width 0.1)) + (fp_line (start 17.7 7.7) (end -1.5 7.7) (layer F.SilkS) (width 0.12)) + (fp_line (start 17.7 -7.7) (end 17.7 7.7) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.5 -7.7) (end 17.7 -7.7) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.5 -7.7) (end -1.5 -1.2) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.5 1.2) (end -1.5 7.7) (layer F.SilkS) (width 0.12)) + (fp_text user %R (at 7.1 0.025) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 11 thru_hole circle (at 0 0) (size 3 3) (drill 1.3) (layers *.Cu *.Mask) + (net 3 "Net-(J1-Pad4)")) + (pad A2 thru_hole circle (at 2 -6) (size 3 3) (drill 1.3) (layers *.Cu *.Mask) + (net 1 "Net-(D1-Pad2)")) + (pad 12 thru_hole circle (at 14.2 -6) (size 3 3) (drill 1.3) (layers *.Cu *.Mask) + (net 2 "Net-(J1-Pad5)")) + (pad 14 thru_hole circle (at 14.2 6) (size 3 3) (drill 1.3) (layers *.Cu *.Mask) + (net 4 "Net-(J1-Pad3)")) + (pad A1 thru_hole circle (at 2 6) (size 3 3) (drill 1.3) (layers *.Cu *.Mask) + (net 14 /5V)) + (model ${KISYS3DMOD}/Relay_THT.3dshapes/Relay_SPDT_Finder_36.11.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module Connector_PinSocket_2.54mm:PinSocket_1x03_P2.54mm_Vertical (layer F.Cu) (tedit 5A19A429) (tstamp 5FCB1F6A) + (at 112.03 55.156 180) + (descr "Through hole straight socket strip, 1x03, 2.54mm pitch, single row (from Kicad 4.0.7), script generated") + (tags "Through hole socket strip THT 1x03 2.54mm single row") + (path /5FCA9C46) + (fp_text reference J2 (at -1.881 -0.026) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value "Stecker LDO 5V-3,3V" (at 0 7.85) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start -1.8 6.85) (end -1.8 -1.8) (layer F.CrtYd) (width 0.05)) + (fp_line (start 1.75 6.85) (end -1.8 6.85) (layer F.CrtYd) (width 0.05)) + (fp_line (start 1.75 -1.8) (end 1.75 6.85) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.8 -1.8) (end 1.75 -1.8) (layer F.CrtYd) (width 0.05)) + (fp_line (start 0 -1.33) (end 1.33 -1.33) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.33 -1.33) (end 1.33 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.33 1.27) (end 1.33 6.41) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.33 6.41) (end 1.33 6.41) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.33 1.27) (end -1.33 6.41) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.33 1.27) (end 1.33 1.27) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.27 6.35) (end -1.27 -1.27) (layer F.Fab) (width 0.1)) + (fp_line (start 1.27 6.35) (end -1.27 6.35) (layer F.Fab) (width 0.1)) + (fp_line (start 1.27 -0.635) (end 1.27 6.35) (layer F.Fab) (width 0.1)) + (fp_line (start 0.635 -1.27) (end 1.27 -0.635) (layer F.Fab) (width 0.1)) + (fp_line (start -1.27 -1.27) (end 0.635 -1.27) (layer F.Fab) (width 0.1)) + (fp_text user %R (at 0 2.54 90) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 3 thru_hole oval (at 0 5.08 180) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) + (net 15 /GND)) + (pad 2 thru_hole oval (at 0 2.54 180) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) + (net 5 /3,3V)) + (pad 1 thru_hole rect (at 0 0 180) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) + (net 14 /5V)) + (model ${KISYS3DMOD}/Connector_PinSocket_2.54mm.3dshapes/PinSocket_1x03_P2.54mm_Vertical.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module TerminalBlock_TE-Connectivity:TerminalBlock_TE_282834-5_1x05_P2.54mm_Horizontal (layer F.Cu) (tedit 5B1EC513) (tstamp 5FCB1AEA) + (at 110.077 59.004 270) + (descr "Terminal Block TE 282834-5, 5 pins, pitch 2.54mm, size 13.16x6.5mm^2, drill diamater 1.1mm, pad diameter 2.1mm, see http://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Customer+Drawing%7F282834%7FC1%7Fpdf%7FEnglish%7FENG_CD_282834_C1.pdf, script-generated using https://github.com/pointhi/kicad-footprint-generator/scripts/TerminalBlock_TE-Connectivity") + (tags "THT Terminal Block TE 282834-5 pitch 2.54mm size 13.16x6.5mm^2 drill 1.1mm pad 2.1mm") + (path /5FCA6822) + (fp_text reference J1 (at 5.111 -4.458 90) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value Schraubanschluss (at 5.08 4.37 90) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 12.16 -3.75) (end -2 -3.75) (layer F.CrtYd) (width 0.05)) + (fp_line (start 12.16 3.75) (end 12.16 -3.75) (layer F.CrtYd) (width 0.05)) + (fp_line (start -2 3.75) (end 12.16 3.75) (layer F.CrtYd) (width 0.05)) + (fp_line (start -2 -3.75) (end -2 3.75) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.86 3.61) (end -1.46 3.61) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.86 2.97) (end -1.86 3.61) (layer F.SilkS) (width 0.12)) + (fp_line (start 10.861 -0.835) (end 9.326 0.7) (layer F.Fab) (width 0.1)) + (fp_line (start 10.995 -0.7) (end 9.46 0.835) (layer F.Fab) (width 0.1)) + (fp_line (start 8.321 -0.835) (end 6.786 0.7) (layer F.Fab) (width 0.1)) + (fp_line (start 8.455 -0.7) (end 6.92 0.835) (layer F.Fab) (width 0.1)) + (fp_line (start 5.781 -0.835) (end 4.246 0.7) (layer F.Fab) (width 0.1)) + (fp_line (start 5.915 -0.7) (end 4.38 0.835) (layer F.Fab) (width 0.1)) + (fp_line (start 3.241 -0.835) (end 1.706 0.7) (layer F.Fab) (width 0.1)) + (fp_line (start 3.375 -0.7) (end 1.84 0.835) (layer F.Fab) (width 0.1)) + (fp_line (start 0.701 -0.835) (end -0.835 0.7) (layer F.Fab) (width 0.1)) + (fp_line (start 0.835 -0.7) (end -0.701 0.835) (layer F.Fab) (width 0.1)) + (fp_line (start 11.78 -3.37) (end 11.78 3.37) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.62 -3.37) (end -1.62 3.37) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.62 3.37) (end 11.78 3.37) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.62 -3.37) (end 11.78 -3.37) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.62 -2.25) (end 11.78 -2.25) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.5 -2.25) (end 11.66 -2.25) (layer F.Fab) (width 0.1)) + (fp_line (start -1.62 2.85) (end 11.78 2.85) (layer F.SilkS) (width 0.12)) + (fp_line (start -1.5 2.85) (end 11.66 2.85) (layer F.Fab) (width 0.1)) + (fp_line (start -1.5 2.85) (end -1.5 -3.25) (layer F.Fab) (width 0.1)) + (fp_line (start -1.1 3.25) (end -1.5 2.85) (layer F.Fab) (width 0.1)) + (fp_line (start 11.66 3.25) (end -1.1 3.25) (layer F.Fab) (width 0.1)) + (fp_line (start 11.66 -3.25) (end 11.66 3.25) (layer F.Fab) (width 0.1)) + (fp_line (start -1.5 -3.25) (end 11.66 -3.25) (layer F.Fab) (width 0.1)) + (fp_circle (center 10.16 0) (end 11.26 0) (layer F.Fab) (width 0.1)) + (fp_circle (center 7.62 0) (end 8.72 0) (layer F.Fab) (width 0.1)) + (fp_circle (center 5.08 0) (end 6.18 0) (layer F.Fab) (width 0.1)) + (fp_circle (center 2.54 0) (end 3.64 0) (layer F.Fab) (width 0.1)) + (fp_circle (center 0 0) (end 1.1 0) (layer F.Fab) (width 0.1)) + (fp_text user %R (at 5.08 2 90) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (pad 5 thru_hole circle (at 10.16 0 270) (size 2.1 2.1) (drill 1.1) (layers *.Cu *.Mask) + (net 2 "Net-(J1-Pad5)")) + (pad 4 thru_hole circle (at 7.62 0 270) (size 2.1 2.1) (drill 1.1) (layers *.Cu *.Mask) + (net 3 "Net-(J1-Pad4)")) + (pad 3 thru_hole circle (at 5.08 0 270) (size 2.1 2.1) (drill 1.1) (layers *.Cu *.Mask) + (net 4 "Net-(J1-Pad3)")) + (pad 2 thru_hole circle (at 2.54 0 270) (size 2.1 2.1) (drill 1.1) (layers *.Cu *.Mask) + (net 15 /GND)) + (pad 1 thru_hole rect (at 0 0 270) (size 2.1 2.1) (drill 1.1) (layers *.Cu *.Mask) + (net 14 /5V)) + (model ${KISYS3DMOD}/TerminalBlock_TE-Connectivity.3dshapes/TerminalBlock_TE_282834-5_1x05_P2.54mm_Horizontal.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (module Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal (layer F.Cu) (tedit 5AE50CD5) (tstamp 5FCBE4EC) + (at 117.746 63.611) + (descr "Diode, DO-35_SOD27 series, Axial, Horizontal, pin pitch=7.62mm, , length*diameter=4*2mm^2, , http://www.diodes.com/_files/packages/DO-35.pdf") + (tags "Diode DO-35_SOD27 series Axial Horizontal pin pitch 7.62mm length 4mm diameter 2mm") + (path /5FCA5316) + (fp_text reference D1 (at 3.907 -0.012) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text value 1N4148 (at 3.81 2.12) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_line (start 8.67 -1.25) (end -1.05 -1.25) (layer F.CrtYd) (width 0.05)) + (fp_line (start 8.67 1.25) (end 8.67 -1.25) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.05 1.25) (end 8.67 1.25) (layer F.CrtYd) (width 0.05)) + (fp_line (start -1.05 -1.25) (end -1.05 1.25) (layer F.CrtYd) (width 0.05)) + (fp_line (start 2.29 -1.12) (end 2.29 1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 2.53 -1.12) (end 2.53 1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 2.41 -1.12) (end 2.41 1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 6.58 0) (end 5.93 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.04 0) (end 1.69 0) (layer F.SilkS) (width 0.12)) + (fp_line (start 5.93 -1.12) (end 1.69 -1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 5.93 1.12) (end 5.93 -1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.69 1.12) (end 5.93 1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 1.69 -1.12) (end 1.69 1.12) (layer F.SilkS) (width 0.12)) + (fp_line (start 2.31 -1) (end 2.31 1) (layer F.Fab) (width 0.1)) + (fp_line (start 2.51 -1) (end 2.51 1) (layer F.Fab) (width 0.1)) + (fp_line (start 2.41 -1) (end 2.41 1) (layer F.Fab) (width 0.1)) + (fp_line (start 7.62 0) (end 5.81 0) (layer F.Fab) (width 0.1)) + (fp_line (start 0 0) (end 1.81 0) (layer F.Fab) (width 0.1)) + (fp_line (start 5.81 -1) (end 1.81 -1) (layer F.Fab) (width 0.1)) + (fp_line (start 5.81 1) (end 5.81 -1) (layer F.Fab) (width 0.1)) + (fp_line (start 1.81 1) (end 5.81 1) (layer F.Fab) (width 0.1)) + (fp_line (start 1.81 -1) (end 1.81 1) (layer F.Fab) (width 0.1)) + (fp_text user K (at 0 -1.8) (layer F.Fab) + (effects (font (size 1 1) (thickness 0.15))) + ) + (fp_text user %R (at 4.11 0 270) (layer F.Fab) + (effects (font (size 0.8 0.8) (thickness 0.12))) + ) + (pad 2 thru_hole oval (at 7.62 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) + (net 1 "Net-(D1-Pad2)")) + (pad 1 thru_hole rect (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) + (net 14 /5V)) + (model ${KISYS3DMOD}/Diode_THT.3dshapes/D_DO-35_SOD27_P7.62mm_Horizontal.wrl + (at (xyz 0 0 0)) + (scale (xyz 1 1 1)) + (rotate (xyz 0 0 0)) + ) + ) + + (gr_text 2020-12 (at 120.421 50.071) (layer B.Cu) + (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) + ) + (gr_text Evil.2000 (at 108.094 50.177 -90) (layer B.Cu) + (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) + ) + (gr_text Design: (at 110.04 54.069 -90) (layer B.Cu) + (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) + ) + (gr_text "ESP-01 Wifi Relay" (at 119.274 47.382) (layer B.Cu) + (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) + ) + (gr_text "4:C 5:NC =>" (at 107.976 51.81 -90) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (gr_text "1:5V 2:GND 3:NO" (at 115.44 47.105 180) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.15))) + ) + (gr_line (start 127 45.72) (end 127 88.9) (layer Edge.Cuts) (width 0.1)) + (gr_line (start 106.68 45.72) (end 127 45.72) (layer Edge.Cuts) (width 0.1)) + (gr_line (start 106.68 88.9) (end 106.68 45.72) (layer Edge.Cuts) (width 0.1)) + (gr_line (start 127 88.9) (end 106.68 88.9) (layer Edge.Cuts) (width 0.1)) + + (segment (start 117.105 54.318) (end 117.105 55.668) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 125.366 63.611) (end 125.366 62.211) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 125.366 62.211) (end 123.648 62.211) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 123.648 62.211) (end 117.105 55.668) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 112.953001 76.164001) (end 110.953 74.164) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 124.113001 76.164001) (end 112.953001 76.164001) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 126.328001 73.949001) (end 124.113001 76.164001) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 126.328001 64.573001) (end 126.328001 73.949001) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 125.366 63.611) (end 126.328001 64.573001) (width 0.6) (layer B.Cu) (net 1)) + (segment (start 115.077 74.164) (end 123.153 74.164) (width 1.8) (layer B.Cu) (net 2)) + (segment (start 110.077 69.164) (end 115.077 74.164) (width 1.8) (layer B.Cu) (net 2)) + (segment (start 107.926999 79.137999) (end 108.953 80.164) (width 1.8) (layer F.Cu) (net 3)) + (segment (start 107.926999 67.289077) (end 107.926999 79.137999) (width 1.8) (layer F.Cu) (net 3)) + (segment (start 108.592076 66.624) (end 107.926999 67.289077) (width 1.8) (layer F.Cu) (net 3)) + (segment (start 110.077 66.624) (end 108.592076 66.624) (width 1.8) (layer F.Cu) (net 3)) + (segment (start 115.583999 78.594999) (end 123.153 86.164) (width 1.8) (layer F.Cu) (net 4)) + (segment (start 115.583999 68.106075) (end 115.583999 78.594999) (width 1.8) (layer F.Cu) (net 4)) + (segment (start 111.561924 64.084) (end 115.583999 68.106075) (width 1.8) (layer F.Cu) (net 4)) + (segment (start 110.077 64.084) (end 111.561924 64.084) (width 1.8) (layer F.Cu) (net 4)) + (segment (start 112.03 52.616) (end 115.6647 52.616) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 115.6647 52.616) (end 116.0167 52.968) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 116.0167 52.968) (end 125.194 52.968) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 125.194 54.318) (end 125.194 52.968) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 116.0167 52.968) (end 116.0167 57.2132) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 121.248001 68.346999) (end 119.986 69.609) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 123.803999 68.346999) (end 121.248001 68.346999) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 125.066 69.609) (end 123.803999 68.346999) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 121.248001 62.444501) (end 121.248001 68.346999) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 116.0167 57.2132) (end 121.248001 62.444501) (width 0.6) (layer B.Cu) (net 5)) + (segment (start 122.654 54.318) (end 122.654 52.968) (width 0.6) (layer F.Cu) (net 6)) + (segment (start 122.654 52.968) (end 122.672 52.968) (width 0.6) (layer F.Cu) (net 6)) + (segment (start 122.672 52.968) (end 125.616 50.024) (width 0.6) (layer F.Cu) (net 6)) + (segment (start 125.564 59.46) (end 125.564 58.06) (width 0.6) (layer F.Cu) (net 7)) + (segment (start 123.924 54.318) (end 123.924 56.42) (width 0.6) (layer F.Cu) (net 7)) + (segment (start 123.924 56.42) (end 125.564 58.06) (width 0.6) (layer F.Cu) (net 7)) + (segment (start 118.375 54.318) (end 118.375 52.968) (width 0.6) (layer F.Cu) (net 8)) + (segment (start 115.456 50.024) (end 115.456 51.424) (width 0.6) (layer F.Cu) (net 8)) + (segment (start 118.375 52.968) (end 117 52.968) (width 0.6) (layer F.Cu) (net 8)) + (segment (start 117 52.968) (end 115.456 51.424) (width 0.6) (layer F.Cu) (net 8)) + (segment (start 115.404 59.46) (end 115.9075 59.46) (width 0.6) (layer F.Cu) (net 9)) + (segment (start 119.986 62.91063) (end 119.986 67.069) (width 0.6) (layer B.Cu) (net 9)) + (segment (start 116.53537 59.46) (end 119.986 62.91063) (width 0.6) (layer B.Cu) (net 9)) + (segment (start 115.404 59.46) (end 116.53537 59.46) (width 0.6) (layer B.Cu) (net 9)) + (segment (start 110.4895 59.004) (end 110.4244 59.004) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.4244 59.004) (end 108.5172 60.9112) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 108.5172 60.9112) (end 108.5172 75.1596) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 108.5172 75.1596) (end 110.9581 77.6005) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.9581 77.6005) (end 110.9581 86.6289) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.9581 86.6289) (end 110.889 86.698) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.4895 59.004) (end 110.902 59.004) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.077 59.004) (end 110.4895 59.004) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 111.727 59.004) (end 116.334 63.611) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 116.334 63.611) (end 117.746 63.611) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 112.03 55.156) (end 112.03 56.606) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.902 59.004) (end 110.902 57.734) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.902 57.734) (end 112.03 56.606) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 110.902 59.004) (end 111.727 59.004) (width 0.6) (layer B.Cu) (net 14)) + (segment (start 116.3587 55.61) (end 116.4166 55.668) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 116.4166 55.668) (end 119.645 55.668) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 112.03 50.076) (end 114.0839 52.1299) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 114.0839 52.1299) (end 114.0839 53.3353) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 114.0839 53.3353) (end 116.3587 55.61) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 110.077 61.544) (end 110.4247 61.544) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 110.4247 61.544) (end 116.3587 55.61) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 119.645 54.318) (end 119.645 55.668) (width 0.6) (layer F.Cu) (net 15)) + (segment (start 117.637 66.999) (end 116.275 66.999) (width 0.6) (layer B.Cu) (net 15)) + (segment (start 110.077 61.544) (end 110.82 61.544) (width 0.6) (layer B.Cu) (net 15)) + (segment (start 110.82 61.544) (end 116.275 66.999) (width 0.6) (layer B.Cu) (net 15)) + +) diff --git a/cicurit/wifi_relais.sch b/cicurit/wifi_relais.sch new file mode 100644 index 0000000..cd956ff --- /dev/null +++ b/cicurit/wifi_relais.sch @@ -0,0 +1,210 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Transistor_BJT:BC327 Q1 +U 1 1 5FCA0DDC +P 3750 3550 +F 0 "Q1" H 3941 3596 50 0000 L CNN +F 1 "BC327" H 3941 3505 50 0000 L CNN +F 2 "Package_TO_SOT_THT:TO-92_Inline" H 3950 3475 50 0001 L CIN +F 3 "http://www.onsemi.com/pub_link/Collateral/BC327-D.PDF" H 3750 3550 50 0001 L CNN + 1 3750 3550 + 1 0 0 1 +$EndComp +$Comp +L Transistor_BJT:BC546 Q2 +U 1 1 5FCA14AE +P 4850 4050 +F 0 "Q2" H 5041 4096 50 0000 L CNN +F 1 "BC546" H 5041 4005 50 0000 L CNN +F 2 "Package_TO_SOT_THT:TO-92_Inline" H 5050 3975 50 0001 L CIN +F 3 "https://www.onsemi.com/pub/Collateral/BC550-D.pdf" H 4850 4050 50 0001 L CNN + 1 4850 4050 + 1 0 0 -1 +$EndComp +$Comp +L Diode:1N4148 D1 +U 1 1 5FCA5316 +P 4950 3000 +F 0 "D1" V 4904 3080 50 0000 L CNN +F 1 "1N4148" V 4995 3080 50 0000 L CNN +F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 4950 2825 50 0001 C CNN +F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 4950 3000 50 0001 C CNN + 1 4950 3000 + 0 1 1 0 +$EndComp +$Comp +L Connector:Conn_01x03_Female J2 +U 1 1 5FCA9C46 +P 2500 2300 +F 0 "J2" V 2438 2112 50 0000 R CNN +F 1 "Stecker LDO 5V-3,3V" V 2347 2112 50 0000 R CNN +F 2 "Connector_PinSocket_2.54mm:PinSocket_1x03_P2.54mm_Vertical" H 2500 2300 50 0001 C CNN +F 3 "~" H 2500 2300 50 0001 C CNN + 1 2500 2300 + 0 -1 -1 0 +$EndComp +$Comp +L Device:R R1 +U 1 1 5FCABFFC +P 3200 3550 +F 0 "R1" V 3407 3550 50 0000 C CNN +F 1 "470" V 3316 3550 50 0000 C CNN +F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3130 3550 50 0001 C CNN +F 3 "~" H 3200 3550 50 0001 C CNN + 1 3200 3550 + 0 -1 -1 0 +$EndComp +$Comp +L Device:R R2 +U 1 1 5FCAC893 +P 4300 4050 +F 0 "R2" V 4507 4050 50 0000 C CNN +F 1 "470" V 4416 4050 50 0000 C CNN +F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 4230 4050 50 0001 C CNN +F 3 "~" H 4300 4050 50 0001 C CNN + 1 4300 4050 + 0 -1 -1 0 +$EndComp +$Comp +L RF_Module:ESP-01 U1 +U 1 1 5FCB393A +P 1600 3800 +F 0 "U1" H 1543 4417 50 0000 C CNN +F 1 "ESP-01" H 1543 4326 50 0000 C CNN +F 2 "RF_Module:ESP-01" H 1600 3550 50 0001 C CNN +F 3 "http://wiki.ai-thinker.com/_media/esp8266/docs/a017ps01a2_esp-01s_product_specification_v1.2.pdf" H 1250 3650 50 0001 C CNN + 1 1600 3800 + -1 0 0 -1 +$EndComp +Text Label 1900 2600 0 50 ~ 0 +5V +$Comp +L Connector:Screw_Terminal_01x05 J1 +U 1 1 5FCA6822 +P 1700 2800 +F 0 "J1" H 1618 3217 50 0000 C CNN +F 1 "Schraubanschluss" H 1618 3126 50 0000 C CNN +F 2 "TerminalBlock_TE-Connectivity:TerminalBlock_TE_282834-5_1x05_P2.54mm_Horizontal" H 1700 2800 50 0001 C CNN +F 3 "~" H 1700 2800 50 0001 C CNN + 1 1700 2800 + -1 0 0 -1 +$EndComp +Text Label 1900 2700 0 50 ~ 0 +GND +Wire Wire Line + 2600 3450 2200 3450 +Wire Wire Line + 2200 3950 2500 3950 +Wire Wire Line + 5800 2600 5800 2700 +Wire Wire Line + 4950 2600 4950 2850 +Connection ~ 4950 2600 +Wire Wire Line + 4950 2600 5800 2600 +Wire Wire Line + 4950 3150 4950 3400 +Wire Wire Line + 5800 3300 5800 3400 +Wire Wire Line + 5800 3400 4950 3400 +Connection ~ 4950 3400 +Wire Wire Line + 4950 3400 4950 3850 +Text Label 2500 3200 2 50 ~ 0 +3,3V +Wire Wire Line + 2200 3550 3050 3550 +Wire Wire Line + 3850 3350 3850 3200 +Wire Wire Line + 3850 4050 4150 4050 +Wire Wire Line + 4450 4050 4650 4050 +Wire Wire Line + 2600 3450 2600 4400 +Wire Wire Line + 2600 4400 4950 4400 +Wire Wire Line + 4950 4400 4950 4250 +Wire Wire Line + 3350 3550 3550 3550 +Wire Wire Line + 3850 3750 3850 4050 +Wire Wire Line + 1900 2800 4500 2800 +Wire Wire Line + 4500 2800 4500 2400 +Wire Wire Line + 4500 2400 6300 2400 +Wire Wire Line + 6300 2400 6300 2700 +Wire Wire Line + 1900 2900 4500 2900 +Wire Wire Line + 4500 2900 4500 3600 +Wire Wire Line + 4500 3600 6200 3600 +Wire Wire Line + 6200 3600 6200 3300 +Wire Wire Line + 1900 3000 4600 3000 +Wire Wire Line + 4600 3000 4600 2500 +Wire Wire Line + 4600 2500 6100 2500 +Wire Wire Line + 6100 2500 6100 2700 +$Comp +L Relay:FINDER-36.11 K1 +U 1 1 5FCAA0D9 +P 6000 3000 +F 0 "K1" H 6430 3046 50 0000 L CNN +F 1 "FINDER-36.11" H 6430 2955 50 0000 L CNN +F 2 "Relay_THT:Relay_SPDT_Finder_36.11" H 7270 2970 50 0001 C CNN +F 3 "https://gfinder.findernet.com/public/attachments/36/EN/S36EN.pdf" H 6000 3000 50 0001 C CNN + 1 6000 3000 + 1 0 0 -1 +$EndComp +Wire Wire Line + 1900 2600 2400 2600 +Wire Wire Line + 2400 2500 2400 2600 +Connection ~ 2400 2600 +Wire Wire Line + 2400 2600 4950 2600 +Wire Wire Line + 2500 2500 2500 3200 +Wire Wire Line + 2200 4150 2500 4150 +Wire Wire Line + 2500 4150 2500 3950 +Connection ~ 2500 3950 +Wire Wire Line + 2600 3450 2600 2700 +Connection ~ 2600 3450 +Wire Wire Line + 1900 2700 2600 2700 +Connection ~ 2600 2700 +Wire Wire Line + 2600 2700 2600 2500 +Wire Wire Line + 3850 3200 2500 3200 +Connection ~ 2500 3200 +Wire Wire Line + 2500 3200 2500 3950 +$EndSCHEMATC diff --git a/cicurit/wifi_relais_bottom.png b/cicurit/wifi_relais_bottom.png new file mode 100644 index 0000000..a408a8c Binary files /dev/null and b/cicurit/wifi_relais_bottom.png differ diff --git a/cicurit/wifi_relais_top.png b/cicurit/wifi_relais_top.png new file mode 100644 index 0000000..a59a574 Binary files /dev/null and b/cicurit/wifi_relais_top.png differ diff --git a/src/relais.cpp b/src/relais.cpp new file mode 100644 index 0000000..efbb226 --- /dev/null +++ b/src/relais.cpp @@ -0,0 +1,169 @@ +#include +#include + +// Name and password of the WLAN access point. +#define SSID "YourWiFiSSIDhere" // Carmageddon +#define PASSWORD "OhAndYourWiFiPasswordHere;-)" + +#define MQTT_BROKER "192.168.0.25" +#define MQTT_PORT 1883 + +// Relais status flag +uint8_t relais_status = 0; + +// Variable for the MQTT Topic where the on/off command arrvies +char mqtt_topic[64]; +// Variable for the MQTT topic where the current relais state is published to +char mqtt_topic_state[64]; + +WiFiClient espClient; +PubSubClient mqtt(espClient); + +void Serialprint(const char *input...) { + va_list args; + va_start(args, input); + for (const char *i = input; *i != 0; ++i) { + if (*i != '%') { + Serial.print(*i); + continue; + } + switch (*(++i)) { + case '%': + Serial.print('%'); + break; + case 's': + Serial.print(va_arg(args, char*)); + break; + case 'd': + Serial.print(va_arg(args, int), DEC); + break; + case 'b': + Serial.print(va_arg(args, int), BIN); + break; + case 'o': + Serial.print(va_arg(args, int), OCT); + break; + case 'x': + Serial.print(va_arg(args, int), HEX); + break; + case 'f': + Serial.print(va_arg(args, double), 2); + break; + } + } + va_end(args); +} + +void publish_relais_state() { + char payload[7]; + if(relais_status==0) { + sprintf(payload,"%s","off"); + } else { + sprintf(payload,"%s","on"); + } + mqtt.publish(mqtt_topic_state,(byte*) payload,strlen(payload),true); + //mqtt.publish(mqtt_topic,payload,NULL,true); +} + +void onWiFiEvent(WiFiEvent_t event) { + switch (event) { + case WIFI_EVENT_STAMODE_CONNECTED: + Serial.println("WiFi connection established."); + break; + case WIFI_EVENT_STAMODE_DISCONNECTED: + Serial.println("WiFi disconnected."); + break; + case WIFI_EVENT_STAMODE_GOT_IP: + Serialprint("WiFi IP recieved: %s\r\n", WiFi.localIP().toString().c_str()); + break; + case WIFI_EVENT_STAMODE_DHCP_TIMEOUT: + Serial.println("WiFi DHCP timeout."); + break; + default: + break; + } +} + +/** + * This callback is registered an run when data for a subscribed topic arrives. + * In this case, the payload can only be "on" and "off" which switches the relais + * to the corresponding state. + * (Maybe this can be tuned a bit: directly use payload by casting it from byte to char.) + */ +void mqtt_data_arrived(char *topic, byte *payload, unsigned int length) { + char buf[32]; + snprintf(buf, length + 1, "%s", payload); + Serial.println(buf); + if (strcmp(buf, "on") == 0) { + // LOW (0V) level for "ON", because schematic inverts the signal + digitalWrite(2,LOW); + relais_status=1; + publish_relais_state(); + } else if (strcmp(buf, "off") == 0) { + // HIGH (3,3V) level for "OFF", because schematic inverts the signal + digitalWrite(2,HIGH); + relais_status=0; + publish_relais_state(); + } +} + +/** + * Connect to the MQTT broker if not already connected. + * When connecting, register the last will topic, QoS, retained flag and last will also. + * This is done to tell any subscriber that the relay is off when it diconnects from the broker. + */ +void mqtt_connect() { + if (!mqtt.connected()) { + //Serialprint("MQTT connecting to: %s\r\n",MQTT_BROKER); + if (!mqtt.connect(WiFi.hostname().c_str(), mqtt_topic_state, 0, true, "off")) { + // connect using Hostname as Client-ID, last will, will QoS and will retianed flag + // Leave the function if the connection could not be established (broker down). + return; + } + } + mqtt.subscribe(mqtt_topic); +} + +void setup() { + pinMode(2,OUTPUT); + digitalWrite(2,HIGH); + + + // put your setup code here, to run once: + Serial.begin(9600); + + WiFi.onEvent(onWiFiEvent, WIFI_EVENT_STAMODE_CONNECTED); + WiFi.onEvent(onWiFiEvent, WIFI_EVENT_STAMODE_DISCONNECTED); + WiFi.onEvent(onWiFiEvent, WIFI_EVENT_STAMODE_GOT_IP); + WiFi.onEvent(onWiFiEvent, WIFI_EVENT_STAMODE_DHCP_TIMEOUT); + + // Connect to Wifi + WiFi.mode(WIFI_STA); + WiFi.begin(SSID, PASSWORD); + if (WiFi.waitForConnectResult(60000) < 0) { + ESP.reset(); + } + + mqtt.setServer(MQTT_BROKER, MQTT_PORT); + + // Set the topic for recieving the commands and the topic for publishing the + // relay state (on or off) to the hostname of the ESP (ESP-1A2B3C). + sprintf(mqtt_topic, "/%s/relay", WiFi.hostname().c_str()); + sprintf(mqtt_topic_state, "/%s/relay/state", WiFi.hostname().c_str()); + + // Register the MQTT callback function which recieves the data from the topic + mqtt.setCallback(mqtt_data_arrived); + + // Now, connect to the MQTT broker. + mqtt_connect(); + + publish_relais_state(); +} + +void loop() { + if (!mqtt.loop()) { + // loop() returns false if connection was closed + // try to reconnect + mqtt_connect(); + } +}