From 47335617dc6804dd2b948e7ab691e36f17e7bce3 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 20 Apr 2024 21:35:51 +0200 Subject: Initial commit --- .gitignore | 15 + CMakeLists.txt | 5 + Makefile | 52 + README.md | 8 + dependencies.lock | 15 + docs/kicad/ShelSP.kicad_pcb | 2 + docs/kicad/ShelSP.kicad_pro | 475 ++++++++ docs/kicad/ShelSP.kicad_sch | 2843 +++++++++++++++++++++++++++++++++++++++++++ main/CMakeLists.txt | 24 + main/Kconfig.projbuild | 22 + main/http.c | 40 + main/http.h | 6 + main/idf_component.yml | 17 + main/main.c | 47 + main/net.c | 239 ++++ main/net.h | 9 + main/routes/relay.c | 130 ++ main/routes/routes.h | 66 + main/routes/settings.c | 246 ++++ main/routes/shelly.c | 44 + main/routes/status.c | 43 + main/utils.c | 12 + main/utils.h | 6 + sdkconfig.ci | 0 24 files changed, 4366 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 Makefile create mode 100644 README.md create mode 100644 dependencies.lock create mode 100644 docs/kicad/ShelSP.kicad_pcb create mode 100644 docs/kicad/ShelSP.kicad_pro create mode 100644 docs/kicad/ShelSP.kicad_sch create mode 100644 main/CMakeLists.txt create mode 100644 main/Kconfig.projbuild create mode 100644 main/http.c create mode 100644 main/http.h create mode 100644 main/idf_component.yml create mode 100644 main/main.c create mode 100644 main/net.c create mode 100644 main/net.h create mode 100644 main/routes/relay.c create mode 100644 main/routes/routes.h create mode 100644 main/routes/settings.c create mode 100644 main/routes/shelly.c create mode 100644 main/routes/status.c create mode 100644 main/utils.c create mode 100644 main/utils.h create mode 100644 sdkconfig.ci diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad546bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# esp-idf +build/ +managed_components/ +sdkconfig +sdkconfig.old + +# KiCad +out/ +ShelSP-backups/ +fp-info-cache + +*.kicad_prl +*.zip +*.gbr +*.gbrjob diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..15f5b22 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ + +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(ShelSP) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..428ed16 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ + +PORT ?= /dev/ttyUSB0 +BUILD_DIR := build + +NULL := /dev/null + +IDF_PY := idf.py -p $(PORT) + +.PHONY: default +default: build + +.PHONY: build +build: + @${IDF_PY} build + +.PHONY: target-esp32 +target-esp32: clean-build + idf.py set-target esp32 + +.PHONY: target-linux +target-linux: clean-build + idf.py --preview set-target linux + +.PHONY: flash +flash: + @${IDF_PY} flash + +.PHONY: menuconfig +menuconfig: + @${IDF_PY} menuconfig + +.PHONY: monitor +monitor: + @${IDF_PY} monitor + +.PHONY: picocom +picocom: + picocom $(PORT) -b 115200 --lower-rts --lower-dtr --noreset + +.PHONY: clean +clean: clean-build + +.PHONY: clean-all +clean-all: clean-build clean-sdkconfig + +.PHONY: clean-build +clean-build: + -rm -rf $(BUILD_DIR) + +.PHONY: clean-sdkconfig +clean-sdkconfig: + -rm -f sdkconfig sdkconfig.old diff --git a/README.md b/README.md new file mode 100644 index 0000000..f683471 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# ShelSP + +**S**mart +**h** +**e**lectronic +**l**ink +**S**ystems +**P**latform diff --git a/dependencies.lock b/dependencies.lock new file mode 100644 index 0000000..ecacb53 --- /dev/null +++ b/dependencies.lock @@ -0,0 +1,15 @@ +dependencies: + espressif/mdns: + component_hash: 9ff9c578fc3a5ea3c68e807233e47f2ce6b2492a92d7a9356ae5c29ab45f0fde + source: + service_url: https://api.components.espressif.com/ + type: service + version: 1.3.0 + idf: + component_hash: null + source: + type: idf + version: 5.2.1 +manifest_hash: f1a572a6b8b65aece61b0a0f76d62584e1a3d1245f1ab9b4ca2e98bd39ba616e +target: esp32 +version: 1.0.0 diff --git a/docs/kicad/ShelSP.kicad_pcb b/docs/kicad/ShelSP.kicad_pcb new file mode 100644 index 0000000..2b8ba10 --- /dev/null +++ b/docs/kicad/ShelSP.kicad_pcb @@ -0,0 +1,2 @@ +(kicad_pcb (version 20221018) (generator pcbnew) +) \ No newline at end of file diff --git a/docs/kicad/ShelSP.kicad_pro b/docs/kicad/ShelSP.kicad_pro new file mode 100644 index 0000000..75d7fe9 --- /dev/null +++ b/docs/kicad/ShelSP.kicad_pro @@ -0,0 +1,475 @@ +{ + "board": { + "3dviewports": [], + "design_settings": { + "defaults": { + "board_outline_line_width": 0.049999999999999996, + "copper_line_width": 0.19999999999999998, + "copper_text_italic": false, + "copper_text_size_h": 1.5, + "copper_text_size_v": 1.5, + "copper_text_thickness": 0.3, + "copper_text_upright": false, + "courtyard_line_width": 0.049999999999999996, + "dimension_precision": 4, + "dimension_units": 3, + "dimensions": { + "arrow_length": 1270000, + "extension_offset": 500000, + "keep_text_aligned": true, + "suppress_zeroes": false, + "text_position": 0, + "units_format": 1 + }, + "fab_line_width": 0.09999999999999999, + "fab_text_italic": false, + "fab_text_size_h": 1.0, + "fab_text_size_v": 1.0, + "fab_text_thickness": 0.15, + "fab_text_upright": false, + "other_line_width": 0.09999999999999999, + "other_text_italic": false, + "other_text_size_h": 1.0, + "other_text_size_v": 1.0, + "other_text_thickness": 0.15, + "other_text_upright": false, + "pads": { + "drill": 0.762, + "height": 1.524, + "width": 1.524 + }, + "silk_line_width": 0.09999999999999999, + "silk_text_italic": false, + "silk_text_size_h": 1.0, + "silk_text_size_v": 1.0, + "silk_text_thickness": 0.09999999999999999, + "silk_text_upright": false, + "zones": { + "min_clearance": 0.5 + } + }, + "diff_pair_dimensions": [], + "drc_exclusions": [], + "meta": { + "version": 2 + }, + "rule_severities": { + "annular_width": "error", + "clearance": "error", + "connection_width": "warning", + "copper_edge_clearance": "error", + "copper_sliver": "warning", + "courtyards_overlap": "error", + "diff_pair_gap_out_of_range": "error", + "diff_pair_uncoupled_length_too_long": "error", + "drill_out_of_range": "error", + "duplicate_footprints": "warning", + "extra_footprint": "warning", + "footprint": "error", + "footprint_type_mismatch": "ignore", + "hole_clearance": "error", + "hole_near_hole": "error", + "invalid_outline": "error", + "isolated_copper": "warning", + "item_on_disabled_layer": "error", + "items_not_allowed": "error", + "length_out_of_range": "error", + "lib_footprint_issues": "warning", + "lib_footprint_mismatch": "warning", + "malformed_courtyard": "error", + "microvia_drill_out_of_range": "error", + "missing_courtyard": "ignore", + "missing_footprint": "warning", + "net_conflict": "warning", + "npth_inside_courtyard": "ignore", + "padstack": "warning", + "pth_inside_courtyard": "ignore", + "shorting_items": "error", + "silk_edge_clearance": "warning", + "silk_over_copper": "warning", + "silk_overlap": "warning", + "skew_out_of_range": "error", + "solder_mask_bridge": "error", + "starved_thermal": "error", + "text_height": "warning", + "text_thickness": "warning", + "through_hole_pad_without_hole": "error", + "too_many_vias": "error", + "track_dangling": "warning", + "track_width": "error", + "tracks_crossing": "error", + "unconnected_items": "error", + "unresolved_variable": "error", + "via_dangling": "warning", + "zones_intersect": "error" + }, + "rules": { + "max_error": 0.005, + "min_clearance": 0.0, + "min_connection": 0.0, + "min_copper_edge_clearance": 0.5, + "min_hole_clearance": 0.25, + "min_hole_to_hole": 0.25, + "min_microvia_diameter": 0.19999999999999998, + "min_microvia_drill": 0.09999999999999999, + "min_resolved_spokes": 2, + "min_silk_clearance": 0.0, + "min_text_height": 0.7999999999999999, + "min_text_thickness": 0.08, + "min_through_hole_diameter": 0.3, + "min_track_width": 0.0, + "min_via_annular_width": 0.09999999999999999, + "min_via_diameter": 0.5, + "solder_mask_to_copper_clearance": 0.0, + "use_height_for_length_calcs": true + }, + "teardrop_options": [ + { + "td_allow_use_two_tracks": true, + "td_curve_segcount": 5, + "td_on_pad_in_zone": false, + "td_onpadsmd": true, + "td_onroundshapesonly": false, + "td_ontrackend": false, + "td_onviapad": true + } + ], + "teardrop_parameters": [ + { + "td_curve_segcount": 0, + "td_height_ratio": 1.0, + "td_length_ratio": 0.5, + "td_maxheight": 2.0, + "td_maxlen": 1.0, + "td_target_name": "td_round_shape", + "td_width_to_size_filter_ratio": 0.9 + }, + { + "td_curve_segcount": 0, + "td_height_ratio": 1.0, + "td_length_ratio": 0.5, + "td_maxheight": 2.0, + "td_maxlen": 1.0, + "td_target_name": "td_rect_shape", + "td_width_to_size_filter_ratio": 0.9 + }, + { + "td_curve_segcount": 0, + "td_height_ratio": 1.0, + "td_length_ratio": 0.5, + "td_maxheight": 2.0, + "td_maxlen": 1.0, + "td_target_name": "td_track_end", + "td_width_to_size_filter_ratio": 0.9 + } + ], + "track_widths": [], + "via_dimensions": [], + "zones_allow_external_fillets": false + }, + "layer_presets": [], + "viewports": [] + }, + "boards": [], + "cvpcb": { + "equivalence_files": [] + }, + "erc": { + "erc_exclusions": [], + "meta": { + "version": 0 + }, + "pin_map": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 2 + ], + [ + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2 + ], + [ + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 2, + 1, + 2, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 2 + ], + [ + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2 + ], + [ + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2 + ], + [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ] + ], + "rule_severities": { + "bus_definition_conflict": "error", + "bus_entry_needed": "error", + "bus_to_bus_conflict": "error", + "bus_to_net_conflict": "error", + "conflicting_netclasses": "error", + "different_unit_footprint": "error", + "different_unit_net": "error", + "duplicate_reference": "error", + "duplicate_sheet_names": "error", + "endpoint_off_grid": "warning", + "extra_units": "error", + "global_label_dangling": "warning", + "hier_label_mismatch": "error", + "label_dangling": "error", + "lib_symbol_issues": "warning", + "missing_bidi_pin": "warning", + "missing_input_pin": "warning", + "missing_power_pin": "error", + "missing_unit": "warning", + "multiple_net_names": "warning", + "net_not_bus_member": "warning", + "no_connect_connected": "warning", + "no_connect_dangling": "warning", + "pin_not_connected": "error", + "pin_not_driven": "error", + "pin_to_pin": "warning", + "power_pin_not_driven": "error", + "similar_labels": "warning", + "simulation_model_issue": "ignore", + "unannotated": "error", + "unit_value_mismatch": "error", + "unresolved_variable": "error", + "wire_dangling": "error" + } + }, + "libraries": { + "pinned_footprint_libs": [], + "pinned_symbol_libs": [] + }, + "meta": { + "filename": "ShelSP.kicad_pro", + "version": 1 + }, + "net_settings": { + "classes": [ + { + "bus_width": 12, + "clearance": 0.2, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.2, + "line_style": 0, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "Default", + "pcb_color": "rgba(0, 0, 0, 0.000)", + "schematic_color": "rgba(0, 0, 0, 0.000)", + "track_width": 0.2, + "via_diameter": 0.6, + "via_drill": 0.3, + "wire_width": 6 + } + ], + "meta": { + "version": 3 + }, + "net_colors": null, + "netclass_assignments": null, + "netclass_patterns": [] + }, + "pcbnew": { + "last_paths": { + "gencad": "", + "idf": "", + "netlist": "", + "specctra_dsn": "", + "step": "", + "vrml": "" + }, + "page_layout_descr_file": "" + }, + "schematic": { + "annotate_start_num": 0, + "drawing": { + "dashed_lines_dash_length_ratio": 12.0, + "dashed_lines_gap_length_ratio": 3.0, + "default_line_thickness": 6.0, + "default_text_size": 50.0, + "field_names": [], + "intersheets_ref_own_page": false, + "intersheets_ref_prefix": "", + "intersheets_ref_short": false, + "intersheets_ref_show": false, + "intersheets_ref_suffix": "", + "junction_size_choice": 3, + "label_size_ratio": 0.375, + "pin_symbol_size": 25.0, + "text_offset_ratio": 0.15 + }, + "legacy_lib_dir": "", + "legacy_lib_list": [], + "meta": { + "version": 1 + }, + "net_format_name": "", + "page_layout_descr_file": "", + "plot_directory": "", + "spice_current_sheet_as_root": false, + "spice_external_command": "spice \"%I\"", + "spice_model_current_sheet_as_root": true, + "spice_save_all_currents": false, + "spice_save_all_voltages": false, + "subpart_first_id": 65, + "subpart_id_separator": 0 + }, + "sheets": [ + [ + "5a1571d2-9eab-4efc-8681-53811a5db50d", + "" + ] + ], + "text_variables": {} +} diff --git a/docs/kicad/ShelSP.kicad_sch b/docs/kicad/ShelSP.kicad_sch new file mode 100644 index 0000000..bd980b1 --- /dev/null +++ b/docs/kicad/ShelSP.kicad_sch @@ -0,0 +1,2843 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 5a1571d2-9eab-4efc-8681-53811a5db50d) + + (paper "A4") + + (lib_symbols + (symbol "Connector:USB_C_Receptacle_USB2.0_14P" (pin_names (offset 1.016)) (in_bom yes) (on_board yes) + (property "Reference" "J" (at 0 22.225 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "USB_C_Receptacle_USB2.0_14P" (at 0 19.685 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 3.81 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "https://www.usb.org/sites/default/files/documents/usb_type-c.zip" (at 3.81 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "usb universal serial bus type-C USB2.0" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "USB 2.0-only 14P Type-C Receptacle connector" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "USB*C*Receptacle*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "USB_C_Receptacle_USB2.0_14P_0_0" + (rectangle (start -0.254 -17.78) (end 0.254 -16.764) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 -4.826) (end 9.144 -5.334) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 -2.286) (end 9.144 -2.794) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 0.254) (end 9.144 -0.254) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 2.794) (end 9.144 2.286) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 7.874) (end 9.144 7.366) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 10.414) (end 9.144 9.906) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (rectangle (start 10.16 15.494) (end 9.144 14.986) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "USB_C_Receptacle_USB2.0_14P_0_1" + (rectangle (start -10.16 17.78) (end 10.16 -17.78) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + (arc (start -8.89 -3.81) (mid -6.985 -5.7067) (end -5.08 -3.81) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (arc (start -7.62 -3.81) (mid -6.985 -4.4423) (end -6.35 -3.81) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (arc (start -7.62 -3.81) (mid -6.985 -4.4423) (end -6.35 -3.81) + (stroke (width 0.254) (type default)) + (fill (type outline)) + ) + (rectangle (start -7.62 -3.81) (end -6.35 3.81) + (stroke (width 0.254) (type default)) + (fill (type outline)) + ) + (arc (start -6.35 3.81) (mid -6.985 4.4423) (end -7.62 3.81) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (arc (start -6.35 3.81) (mid -6.985 4.4423) (end -7.62 3.81) + (stroke (width 0.254) (type default)) + (fill (type outline)) + ) + (arc (start -5.08 3.81) (mid -6.985 5.7067) (end -8.89 3.81) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (circle (center -2.54 1.143) (radius 0.635) + (stroke (width 0.254) (type default)) + (fill (type outline)) + ) + (circle (center 0 -5.842) (radius 1.27) + (stroke (width 0) (type default)) + (fill (type outline)) + ) + (polyline + (pts + (xy -8.89 -3.81) + (xy -8.89 3.81) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -5.08 3.81) + (xy -5.08 -3.81) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 -5.842) + (xy 0 4.318) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 -3.302) + (xy -2.54 -0.762) + (xy -2.54 0.508) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 -2.032) + (xy 2.54 0.508) + (xy 2.54 1.778) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -1.27 4.318) + (xy 0 6.858) + (xy 1.27 4.318) + (xy -1.27 4.318) + ) + (stroke (width 0.254) (type default)) + (fill (type outline)) + ) + (rectangle (start 1.905 1.778) (end 3.175 3.048) + (stroke (width 0.254) (type default)) + (fill (type outline)) + ) + ) + (symbol "USB_C_Receptacle_USB2.0_14P_1_1" + (pin passive line (at 0 -22.86 90) (length 5.08) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "A1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -22.86 90) (length 5.08) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "A12" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 15.24 15.24 180) (length 5.08) + (name "VBUS" (effects (font (size 1.27 1.27)))) + (number "A4" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 10.16 180) (length 5.08) + (name "CC1" (effects (font (size 1.27 1.27)))) + (number "A5" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -2.54 180) (length 5.08) + (name "D+" (effects (font (size 1.27 1.27)))) + (number "A6" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 2.54 180) (length 5.08) + (name "D-" (effects (font (size 1.27 1.27)))) + (number "A7" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 15.24 15.24 180) (length 5.08) hide + (name "VBUS" (effects (font (size 1.27 1.27)))) + (number "A9" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -22.86 90) (length 5.08) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "B1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -22.86 90) (length 5.08) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "B12" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 15.24 15.24 180) (length 5.08) hide + (name "VBUS" (effects (font (size 1.27 1.27)))) + (number "B4" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 7.62 180) (length 5.08) + (name "CC2" (effects (font (size 1.27 1.27)))) + (number "B5" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -5.08 180) (length 5.08) + (name "D+" (effects (font (size 1.27 1.27)))) + (number "B6" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 0 180) (length 5.08) + (name "D-" (effects (font (size 1.27 1.27)))) + (number "B7" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 15.24 15.24 180) (length 5.08) hide + (name "VBUS" (effects (font (size 1.27 1.27)))) + (number "B9" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at -7.62 -22.86 90) (length 5.08) + (name "SHIELD" (effects (font (size 1.27 1.27)))) + (number "S1" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:C" (pin_numbers hide) (pin_names (offset 0.254)) (in_bom yes) (on_board yes) + (property "Reference" "C" (at 0.635 2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "C" (at 0.635 -2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 0.9652 -3.81 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "cap capacitor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Unpolarized capacitor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "C_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "C_0_1" + (polyline + (pts + (xy -2.032 -0.762) + (xy 2.032 -0.762) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.032 0.762) + (xy 2.032 0.762) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + ) + (symbol "C_1_1" + (pin passive line (at 0 3.81 270) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:R_US" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (at 2.54 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R_US" (at -2.54 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 1.016 -0.254 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor, US symbol" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_US_0_1" + (polyline + (pts + (xy 0 -2.286) + (xy 0 -2.54) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 2.286) + (xy 0 2.54) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 -0.762) + (xy 1.016 -1.143) + (xy 0 -1.524) + (xy -1.016 -1.905) + (xy 0 -2.286) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 0.762) + (xy 1.016 0.381) + (xy 0 0) + (xy -1.016 -0.381) + (xy 0 -0.762) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 2.286) + (xy 1.016 1.905) + (xy 0 1.524) + (xy -1.016 1.143) + (xy 0 0.762) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "R_US_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Interface_USB:CP2102N-Axx-xQFN24" (in_bom yes) (on_board yes) + (property "Reference" "U" (at -8.89 26.67 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "CP2102N-Axx-xQFN24" (at 13.97 26.67 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "Package_DFN_QFN:QFN-24-1EP_4x4mm_P0.5mm_EP2.6x2.6mm" (at 31.75 -26.67 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "https://www.silabs.com/documents/public/data-sheets/cp2102n-datasheet.pdf" (at 1.27 -19.05 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "USB UART bridge" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "USB to UART master bridge, QFN-24" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "QFN*4x4mm*P0.5mm*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "CP2102N-Axx-xQFN24_0_1" + (rectangle (start -10.16 25.4) (end 10.16 -25.4) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + ) + (symbol "CP2102N-Axx-xQFN24_1_1" + (pin bidirectional line (at 12.7 5.08 180) (length 2.54) + (name "~{RI}/CLK" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin no_connect line (at -10.16 -22.86 0) (length 2.54) hide + (name "NC" (effects (font (size 1.27 1.27)))) + (number "10" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 12.7 -15.24 180) (length 2.54) + (name "~{WAKEUP}/GPIO.3" (effects (font (size 1.27 1.27)))) + (number "11" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 12.7 -12.7 180) (length 2.54) + (name "RS485/GPIO.2" (effects (font (size 1.27 1.27)))) + (number "12" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 12.7 -10.16 180) (length 2.54) + (name "~{RXT}/GPIO.1" (effects (font (size 1.27 1.27)))) + (number "13" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 12.7 -7.62 180) (length 2.54) + (name "~{TXT}/GPIO.0" (effects (font (size 1.27 1.27)))) + (number "14" (effects (font (size 1.27 1.27)))) + ) + (pin output line (at 12.7 -2.54 180) (length 2.54) + (name "~{SUSPEND}" (effects (font (size 1.27 1.27)))) + (number "15" (effects (font (size 1.27 1.27)))) + ) + (pin no_connect line (at 10.16 -22.86 180) (length 2.54) hide + (name "NC" (effects (font (size 1.27 1.27)))) + (number "16" (effects (font (size 1.27 1.27)))) + ) + (pin output line (at 12.7 0 180) (length 2.54) + (name "SUSPEND" (effects (font (size 1.27 1.27)))) + (number "17" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at 12.7 15.24 180) (length 2.54) + (name "~{CTS}" (effects (font (size 1.27 1.27)))) + (number "18" (effects (font (size 1.27 1.27)))) + ) + (pin output line (at 12.7 17.78 180) (length 2.54) + (name "~{RTS}" (effects (font (size 1.27 1.27)))) + (number "19" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at 0 -27.94 90) (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at 12.7 20.32 180) (length 2.54) + (name "RXD" (effects (font (size 1.27 1.27)))) + (number "20" (effects (font (size 1.27 1.27)))) + ) + (pin output line (at 12.7 22.86 180) (length 2.54) + (name "TXD" (effects (font (size 1.27 1.27)))) + (number "21" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at 12.7 12.7 180) (length 2.54) + (name "~{DSR}" (effects (font (size 1.27 1.27)))) + (number "22" (effects (font (size 1.27 1.27)))) + ) + (pin output line (at 12.7 10.16 180) (length 2.54) + (name "~{DTR}" (effects (font (size 1.27 1.27)))) + (number "23" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at 12.7 7.62 180) (length 2.54) + (name "~{DCD}" (effects (font (size 1.27 1.27)))) + (number "24" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -27.94 90) (length 2.54) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "25" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -12.7 5.08 0) (length 2.54) + (name "D+" (effects (font (size 1.27 1.27)))) + (number "3" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -12.7 7.62 0) (length 2.54) + (name "D-" (effects (font (size 1.27 1.27)))) + (number "4" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at 2.54 27.94 270) (length 2.54) + (name "VIO" (effects (font (size 1.27 1.27)))) + (number "5" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at 0 27.94 270) (length 2.54) + (name "VDD" (effects (font (size 1.27 1.27)))) + (number "6" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at -2.54 27.94 270) (length 2.54) + (name "VREGIN" (effects (font (size 1.27 1.27)))) + (number "7" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at -12.7 10.16 0) (length 2.54) + (name "VBUS" (effects (font (size 1.27 1.27)))) + (number "8" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at -12.7 22.86 0) (length 2.54) + (name "~{RST}" (effects (font (size 1.27 1.27)))) + (number "9" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Logic_LevelTranslator:TXB0104PW" (in_bom yes) (on_board yes) + (property "Reference" "U" (at -6.35 16.51 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "TXB0104PW" (at 3.81 16.51 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "Package_SO:TSSOP-14_4.4x5mm_P0.65mm" (at 0 -19.05 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "http://www.ti.com/lit/ds/symlink/txb0104.pdf" (at 2.794 2.413 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "Level-Shifter CMOS-TTL-Translation" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "4-Bit Bidirectional Voltage-Level Translator, Auto Direction Sensing and ±15-kV ESD Protection, 1.2 - 3.6V APort, 1.65 - 5.5V BPort, TSSOP-14" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "TSSOP*14*5mm*P0.65mm*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "TXB0104PW_0_1" + (rectangle (start -7.62 -15.24) (end -7.62 -12.7) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (rectangle (start -7.62 15.24) (end 7.62 -15.24) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + (polyline + (pts + (xy -2.286 -7.747) + (xy -2.286 -6.731) + (xy -0.508 -6.731) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.286 -2.667) + (xy -2.286 -1.651) + (xy -0.508 -1.651) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.286 2.413) + (xy -2.286 3.429) + (xy -0.508 3.429) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.286 7.493) + (xy -2.286 8.509) + (xy -0.508 8.509) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 3.048 -7.747) + (xy 3.048 -8.763) + (xy 1.27 -8.763) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 3.048 -2.667) + (xy 3.048 -3.683) + (xy 1.27 -3.683) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 3.048 2.413) + (xy 3.048 1.397) + (xy 1.27 1.397) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 3.048 7.493) + (xy 3.048 6.477) + (xy 1.27 6.477) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 -8.763) + (xy -2.286 -8.763) + (xy -2.286 -7.747) + (xy -4.064 -7.747) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 -8.763) + (xy 1.27 -7.747) + (xy 1.27 -9.779) + (xy -0.508 -8.763) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 -3.683) + (xy -2.286 -3.683) + (xy -2.286 -2.667) + (xy -4.064 -2.667) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 -3.683) + (xy 1.27 -2.667) + (xy 1.27 -4.699) + (xy -0.508 -3.683) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 1.397) + (xy -2.286 1.397) + (xy -2.286 2.413) + (xy -4.064 2.413) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 1.397) + (xy 1.27 2.413) + (xy 1.27 0.381) + (xy -0.508 1.397) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 6.477) + (xy -2.286 6.477) + (xy -2.286 7.493) + (xy -4.318 7.493) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.508 6.477) + (xy 1.27 7.493) + (xy 1.27 5.461) + (xy -0.508 6.477) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 -6.731) + (xy -0.508 -7.747) + (xy -0.508 -5.715) + (xy 1.27 -6.731) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 -6.731) + (xy 3.048 -6.731) + (xy 3.048 -7.747) + (xy 4.318 -7.747) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 -1.651) + (xy -0.508 -2.667) + (xy -0.508 -0.635) + (xy 1.27 -1.651) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 -1.651) + (xy 3.048 -1.651) + (xy 3.048 -2.667) + (xy 4.318 -2.667) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 3.429) + (xy -0.508 2.413) + (xy -0.508 4.445) + (xy 1.27 3.429) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 3.429) + (xy 3.048 3.429) + (xy 3.048 2.413) + (xy 4.318 2.413) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 8.509) + (xy -0.508 7.493) + (xy -0.508 9.525) + (xy 1.27 8.509) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.27 8.509) + (xy 3.048 8.509) + (xy 3.048 7.493) + (xy 4.318 7.493) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "TXB0104PW_1_1" + (pin power_in line (at -2.54 17.78 270) (length 2.54) + (name "VCCA" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 10.16 -7.62 180) (length 2.54) + (name "B4" (effects (font (size 1.27 1.27)))) + (number "10" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 10.16 -2.54 180) (length 2.54) + (name "B3" (effects (font (size 1.27 1.27)))) + (number "11" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 10.16 2.54 180) (length 2.54) + (name "B2" (effects (font (size 1.27 1.27)))) + (number "12" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 10.16 7.62 180) (length 2.54) + (name "B1" (effects (font (size 1.27 1.27)))) + (number "13" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at 2.54 17.78 270) (length 2.54) + (name "VCCB" (effects (font (size 1.27 1.27)))) + (number "14" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -10.16 7.62 0) (length 2.54) + (name "A1" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -10.16 2.54 0) (length 2.54) + (name "A2" (effects (font (size 1.27 1.27)))) + (number "3" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -10.16 -2.54 0) (length 2.54) + (name "A3" (effects (font (size 1.27 1.27)))) + (number "4" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -10.16 -7.62 0) (length 2.54) + (name "A4" (effects (font (size 1.27 1.27)))) + (number "5" (effects (font (size 1.27 1.27)))) + ) + (pin no_connect line (at -7.62 -12.7 0) (length 2.54) hide + (name "NC" (effects (font (size 1.27 1.27)))) + (number "6" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at 0 -17.78 90) (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "7" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at -10.16 12.7 0) (length 2.54) + (name "OE" (effects (font (size 1.27 1.27)))) + (number "8" (effects (font (size 1.27 1.27)))) + ) + (pin no_connect line (at 7.62 -12.7 180) (length 2.54) hide + (name "NC" (effects (font (size 1.27 1.27)))) + (number "9" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Power_Protection:SP0503BAHT" (pin_names hide) (in_bom yes) (on_board yes) + (property "Reference" "D" (at 5.715 2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "SP0503BAHT" (at 5.715 0.635 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "Package_TO_SOT_SMD:SOT-143" (at 5.715 -1.27 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (property "Datasheet" "http://www.littelfuse.com/~/media/files/littelfuse/technical%20resources/documents/data%20sheets/sp05xxba.pdf" (at 3.175 3.175 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "usb esd protection suppression transient" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "TVS Diode Array, 5.5V Standoff, 3 Channels, SOT-143 package" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "SOT?143*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "SP0503BAHT_0_0" + (pin passive line (at 0 -5.08 90) (length 2.54) + (name "A" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + ) + (symbol "SP0503BAHT_0_1" + (rectangle (start -4.445 2.54) (end 4.445 -2.54) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + (circle (center 0 -1.27) (radius 0.254) + (stroke (width 0) (type default)) + (fill (type outline)) + ) + (polyline + (pts + (xy -2.54 2.54) + (xy -2.54 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 -1.27) + (xy 0 -2.54) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 -1.27) + (xy 0 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0 2.54) + (xy 0 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0.635 1.27) + (xy 0.762 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 2.54 2.54) + (xy 2.54 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0.635 1.27) + (xy -0.762 1.27) + (xy -0.762 1.016) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -3.302 1.016) + (xy -3.302 1.27) + (xy -1.905 1.27) + (xy -1.778 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.54 1.27) + (xy -2.54 -1.27) + (xy 2.54 -1.27) + (xy 2.54 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.54 1.27) + (xy -1.905 0) + (xy -3.175 0) + (xy -2.54 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0.635 0) + (xy -0.635 0) + (xy 0 1.27) + (xy 0.635 0) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.778 1.016) + (xy 1.778 1.27) + (xy 3.175 1.27) + (xy 3.302 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 2.54 1.27) + (xy 1.905 0) + (xy 3.175 0) + (xy 2.54 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "SP0503BAHT_1_1" + (pin passive line (at -2.54 5.08 270) (length 2.54) + (name "K" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 5.08 270) (length 2.54) + (name "K" (effects (font (size 1.27 1.27)))) + (number "3" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 2.54 5.08 270) (length 2.54) + (name "K" (effects (font (size 1.27 1.27)))) + (number "4" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "RF_Module:ESP32-WROOM-32" (in_bom yes) (on_board yes) + (property "Reference" "U" (at -12.7 34.29 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "ESP32-WROOM-32" (at 1.27 34.29 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "RF_Module:ESP32-WROOM-32" (at 0 -38.1 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf" (at -7.62 1.27 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "RF Radio BT ESP ESP32 Espressif onboard PCB antenna" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "RF Module, ESP32-D0WDQ6 SoC, Wi-Fi 802.11b/g/n, Bluetooth, BLE, 32-bit, 2.7-3.6V, onboard antenna, SMD" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "ESP32?WROOM?32*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "ESP32-WROOM-32_0_1" + (rectangle (start -12.7 33.02) (end 12.7 -33.02) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + ) + (symbol "ESP32-WROOM-32_1_1" + (pin power_in line (at 0 -35.56 90) (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -12.7 180) (length 2.54) + (name "IO25" (effects (font (size 1.27 1.27)))) + (number "10" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -15.24 180) (length 2.54) + (name "IO26" (effects (font (size 1.27 1.27)))) + (number "11" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -17.78 180) (length 2.54) + (name "IO27" (effects (font (size 1.27 1.27)))) + (number "12" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 10.16 180) (length 2.54) + (name "IO14" (effects (font (size 1.27 1.27)))) + (number "13" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 15.24 180) (length 2.54) + (name "IO12" (effects (font (size 1.27 1.27)))) + (number "14" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -35.56 90) (length 2.54) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "15" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 12.7 180) (length 2.54) + (name "IO13" (effects (font (size 1.27 1.27)))) + (number "16" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -15.24 -5.08 0) (length 2.54) + (name "SHD/SD2" (effects (font (size 1.27 1.27)))) + (number "17" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -15.24 -7.62 0) (length 2.54) + (name "SWP/SD3" (effects (font (size 1.27 1.27)))) + (number "18" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -15.24 -12.7 0) (length 2.54) + (name "SCS/CMD" (effects (font (size 1.27 1.27)))) + (number "19" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at 0 35.56 270) (length 2.54) + (name "VDD" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -15.24 -10.16 0) (length 2.54) + (name "SCK/CLK" (effects (font (size 1.27 1.27)))) + (number "20" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -15.24 0 0) (length 2.54) + (name "SDO/SD0" (effects (font (size 1.27 1.27)))) + (number "21" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at -15.24 -2.54 0) (length 2.54) + (name "SDI/SD1" (effects (font (size 1.27 1.27)))) + (number "22" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 7.62 180) (length 2.54) + (name "IO15" (effects (font (size 1.27 1.27)))) + (number "23" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 25.4 180) (length 2.54) + (name "IO2" (effects (font (size 1.27 1.27)))) + (number "24" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 30.48 180) (length 2.54) + (name "IO0" (effects (font (size 1.27 1.27)))) + (number "25" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 20.32 180) (length 2.54) + (name "IO4" (effects (font (size 1.27 1.27)))) + (number "26" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 5.08 180) (length 2.54) + (name "IO16" (effects (font (size 1.27 1.27)))) + (number "27" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 2.54 180) (length 2.54) + (name "IO17" (effects (font (size 1.27 1.27)))) + (number "28" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 17.78 180) (length 2.54) + (name "IO5" (effects (font (size 1.27 1.27)))) + (number "29" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at -15.24 30.48 0) (length 2.54) + (name "EN" (effects (font (size 1.27 1.27)))) + (number "3" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 0 180) (length 2.54) + (name "IO18" (effects (font (size 1.27 1.27)))) + (number "30" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -2.54 180) (length 2.54) + (name "IO19" (effects (font (size 1.27 1.27)))) + (number "31" (effects (font (size 1.27 1.27)))) + ) + (pin no_connect line (at -12.7 -27.94 0) (length 2.54) hide + (name "NC" (effects (font (size 1.27 1.27)))) + (number "32" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -5.08 180) (length 2.54) + (name "IO21" (effects (font (size 1.27 1.27)))) + (number "33" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 22.86 180) (length 2.54) + (name "RXD0/IO3" (effects (font (size 1.27 1.27)))) + (number "34" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 27.94 180) (length 2.54) + (name "TXD0/IO1" (effects (font (size 1.27 1.27)))) + (number "35" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -7.62 180) (length 2.54) + (name "IO22" (effects (font (size 1.27 1.27)))) + (number "36" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -10.16 180) (length 2.54) + (name "IO23" (effects (font (size 1.27 1.27)))) + (number "37" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -35.56 90) (length 2.54) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "38" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -35.56 90) (length 2.54) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "39" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at -15.24 25.4 0) (length 2.54) + (name "SENSOR_VP" (effects (font (size 1.27 1.27)))) + (number "4" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at -15.24 22.86 0) (length 2.54) + (name "SENSOR_VN" (effects (font (size 1.27 1.27)))) + (number "5" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at 15.24 -25.4 180) (length 2.54) + (name "IO34" (effects (font (size 1.27 1.27)))) + (number "6" (effects (font (size 1.27 1.27)))) + ) + (pin input line (at 15.24 -27.94 180) (length 2.54) + (name "IO35" (effects (font (size 1.27 1.27)))) + (number "7" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -20.32 180) (length 2.54) + (name "IO32" (effects (font (size 1.27 1.27)))) + (number "8" (effects (font (size 1.27 1.27)))) + ) + (pin bidirectional line (at 15.24 -22.86 180) (length 2.54) + (name "IO33" (effects (font (size 1.27 1.27)))) + (number "9" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Regulator_Linear:AMS1117-3.3" (in_bom yes) (on_board yes) + (property "Reference" "U" (at -3.81 3.175 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "AMS1117-3.3" (at 0 3.175 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "Package_TO_SOT_SMD:SOT-223-3_TabPin2" (at 0 5.08 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "http://www.advanced-monolithic.com/pdf/ds1117.pdf" (at 2.54 -6.35 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "linear regulator ldo fixed positive" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "1A Low Dropout regulator, positive, 3.3V fixed output, SOT-223" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "SOT?223*TabPin2*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "AMS1117-3.3_0_1" + (rectangle (start -5.08 -5.08) (end 5.08 1.905) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + ) + (symbol "AMS1117-3.3_1_1" + (pin power_in line (at 0 -7.62 90) (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin power_out line (at 7.62 0 180) (length 2.54) + (name "VO" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line (at -7.62 0 0) (length 2.54) + (name "VI" (effects (font (size 1.27 1.27)))) + (number "3" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Relay:Relay_SPDT" (in_bom yes) (on_board yes) + (property "Reference" "K" (at 11.43 3.81 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "Relay_SPDT" (at 11.43 1.27 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 11.43 -1.27 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "Single Pole Relay SPDT" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Monostable Relay SPDT, EN50005" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "Relay?SPDT*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "Relay_SPDT_0_0" + (polyline + (pts + (xy 7.62 5.08) + (xy 7.62 2.54) + (xy 6.985 3.175) + (xy 7.62 3.81) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "Relay_SPDT_0_1" + (rectangle (start -10.16 5.08) (end 10.16 -5.08) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + (rectangle (start -8.255 1.905) (end -1.905 -1.905) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -7.62 -1.905) + (xy -2.54 1.905) + ) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -5.08 -5.08) + (xy -5.08 -1.905) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -5.08 5.08) + (xy -5.08 1.905) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -1.905 0) + (xy -1.27 0) + ) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -0.635 0) + (xy 0 0) + ) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 0.635 0) + (xy 1.27 0) + ) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 1.905 0) + (xy 2.54 0) + ) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 3.175 0) + (xy 3.81 0) + ) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 5.08 -2.54) + (xy 3.175 3.81) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 5.08 -2.54) + (xy 5.08 -5.08) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy 2.54 5.08) + (xy 2.54 2.54) + (xy 3.175 3.175) + (xy 2.54 3.81) + ) + (stroke (width 0) (type default)) + (fill (type outline)) + ) + ) + (symbol "Relay_SPDT_1_1" + (pin passive line (at 5.08 -7.62 90) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "11" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 2.54 7.62 270) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "12" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 7.62 7.62 270) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "14" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at -5.08 7.62 270) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "A1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at -5.08 -7.62 90) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "A2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Switch:SW_SPST" (pin_names (offset 0) hide) (in_bom yes) (on_board yes) + (property "Reference" "SW" (at 0 3.175 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "SW_SPST" (at 0 -2.54 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "switch lever" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Single Pole Single Throw (SPST) switch" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "SW_SPST_0_0" + (circle (center -2.032 0) (radius 0.508) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -1.524 0.254) + (xy 1.524 1.778) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (circle (center 2.032 0) (radius 0.508) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "SW_SPST_1_1" + (pin passive line (at -5.08 0 0) (length 2.54) + (name "A" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 5.08 0 180) (length 2.54) + (name "B" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "power:GND" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "#PWR" (at 0 -6.35 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 0 -3.81 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "global power" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Power symbol creates a global label with name \"GND\" , ground" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "GND_0_1" + (polyline + (pts + (xy 0 0) + (xy 0 -1.27) + (xy 1.27 -1.27) + (xy 0 -2.54) + (xy -1.27 -1.27) + (xy 0 -1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "GND_1_1" + (pin power_in line (at 0 0 270) (length 0) hide + (name "GND" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "power:PWR_FLAG" (power) (pin_numbers hide) (pin_names (offset 0) hide) (in_bom yes) (on_board yes) + (property "Reference" "#FLG" (at 0 1.905 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "PWR_FLAG" (at 0 3.81 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "flag power" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Special symbol for telling ERC where power comes from" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "PWR_FLAG_0_0" + (pin power_out line (at 0 0 90) (length 0) + (name "pwr" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + ) + (symbol "PWR_FLAG_0_1" + (polyline + (pts + (xy 0 0) + (xy 0 1.27) + (xy -1.016 1.905) + (xy 0 2.54) + (xy 1.016 1.905) + (xy 0 1.27) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + ) + ) + + (junction (at 158.75 101.6) (diameter 0) (color 0 0 0 0) + (uuid 003ea8e4-604c-4827-9f86-4f70325a0cef) + ) + (junction (at 162.56 60.96) (diameter 0) (color 0 0 0 0) + (uuid 077435ab-2781-4e0f-aadb-8d02248f3b67) + ) + (junction (at 143.51 101.6) (diameter 0) (color 0 0 0 0) + (uuid 07be99a3-b1de-434f-a154-680a1d13ec0c) + ) + (junction (at 137.16 46.99) (diameter 0) (color 0 0 0 0) + (uuid 0b348284-e005-4a16-a6c7-2a24844ba717) + ) + (junction (at 137.16 36.83) (diameter 0) (color 0 0 0 0) + (uuid 12db6d15-e97a-487d-95cb-f130af964299) + ) + (junction (at 87.63 36.83) (diameter 0) (color 0 0 0 0) + (uuid 2049dd3d-0ef9-4e38-9d6d-c5bab9ca9a7a) + ) + (junction (at 53.34 33.02) (diameter 0) (color 0 0 0 0) + (uuid 2a35d6f0-62b6-4efb-9a24-f68a637df99c) + ) + (junction (at 53.34 20.32) (diameter 0) (color 0 0 0 0) + (uuid 2b84d178-566f-48a3-8989-f5bcd4070582) + ) + (junction (at 114.3 20.32) (diameter 0) (color 0 0 0 0) + (uuid 35f8a89d-3071-4200-a20f-4035ae12242e) + ) + (junction (at 146.05 45.72) (diameter 0) (color 0 0 0 0) + (uuid 3855fea1-667b-41f6-9f28-2a1c40dbeb47) + ) + (junction (at 119.38 101.6) (diameter 0) (color 0 0 0 0) + (uuid 40c3543e-0d8d-4ec8-a180-a97e24196848) + ) + (junction (at 35.56 45.72) (diameter 0) (color 0 0 0 0) + (uuid 430fea69-5e00-47a3-87f8-9a2ceb24ca0a) + ) + (junction (at 35.56 36.83) (diameter 0) (color 0 0 0 0) + (uuid 5c809956-d59b-4170-8b91-8b6ec1c2598f) + ) + (junction (at 140.97 63.5) (diameter 0) (color 0 0 0 0) + (uuid 6bfd0984-838d-4d2b-b074-fe0033c8bcfd) + ) + (junction (at 162.56 63.5) (diameter 0) (color 0 0 0 0) + (uuid 8c29b209-9e05-448f-a983-060b4eb1a03b) + ) + (junction (at 105.41 30.48) (diameter 0) (color 0 0 0 0) + (uuid 9bef00f2-7a3b-40fc-845b-d753a076f3be) + ) + (junction (at 53.34 25.4) (diameter 0) (color 0 0 0 0) + (uuid 9e6e2a14-95b3-44b2-b4d2-68532db2e85e) + ) + (junction (at 143.51 60.96) (diameter 0) (color 0 0 0 0) + (uuid a5d2dd08-69cb-4ce7-bcdc-6c9a1c56fb1b) + ) + (junction (at 87.63 20.32) (diameter 0) (color 0 0 0 0) + (uuid b0074400-4da4-4a23-92b1-9e98a08c0c8c) + ) + (junction (at 179.07 101.6) (diameter 0) (color 0 0 0 0) + (uuid b0fe28cf-910d-46b0-b630-997d0aad194a) + ) + (junction (at 22.86 45.72) (diameter 0) (color 0 0 0 0) + (uuid c52e998f-f765-4578-a78f-9ee8e860240a) + ) + (junction (at 96.52 20.32) (diameter 0) (color 0 0 0 0) + (uuid ca73923f-c181-494a-b7ab-d7a63e4677a0) + ) + (junction (at 154.94 101.6) (diameter 0) (color 0 0 0 0) + (uuid e172d75f-3efd-40e3-ade7-16d79b59f591) + ) + (junction (at 121.92 36.83) (diameter 0) (color 0 0 0 0) + (uuid e1c0ac0a-077e-4d92-a3ce-ec4ea4fdc706) + ) + (junction (at 163.83 45.72) (diameter 0) (color 0 0 0 0) + (uuid e73fd328-7d2e-466c-88b7-3643aec305ac) + ) + + (no_connect (at 68.58 58.42) (uuid 06c8cc9b-5a4e-4b27-a830-503fcfa52811)) + (no_connect (at 38.1 83.82) (uuid 07c6ea05-ae97-4052-8c88-e003c16891e1)) + (no_connect (at 68.58 66.04) (uuid 0ca3465b-b997-420c-b781-dbf982ce3889)) + (no_connect (at 87.63 104.14) (uuid 16d0d8e8-f4f9-47bd-a07a-93fde94062cc)) + (no_connect (at 68.58 99.06) (uuid 1e7d2c62-444d-45a7-a828-852d913fccc7)) + (no_connect (at 68.58 96.52) (uuid 24c57111-3e9c-4a74-bfa0-4c00a4cfc5d6)) + (no_connect (at 92.71 104.14) (uuid 25ca1f2a-09f5-439d-b39c-7cb9e5acb0c2)) + (no_connect (at 68.58 60.96) (uuid 2724f537-5609-468a-abbb-02c17a36140b)) + (no_connect (at 68.58 71.12) (uuid 2b418ff9-eb54-4e05-a6c9-4a12b52b7403)) + (no_connect (at 38.1 86.36) (uuid 3ca11b64-a6cb-4ad0-841e-b126cadd595a)) + (no_connect (at 38.1 76.2) (uuid 3fbe50ef-5365-4fbe-adac-79f956eb5e97)) + (no_connect (at 38.1 81.28) (uuid 468a0dc0-830c-45bc-bef5-7a36b67f58cf)) + (no_connect (at 106.68 63.5) (uuid 48a44aeb-25c5-4f1a-92f8-815cf690d43d)) + (no_connect (at 68.58 86.36) (uuid 4ebe54bf-56c0-4fb4-ba92-f251fa53025a)) + (no_connect (at 38.1 88.9) (uuid 54efe772-4fec-49a6-a54f-7f4c22531587)) + (no_connect (at 106.68 71.12) (uuid 594a24e9-f37a-4b39-9c74-f88047e85782)) + (no_connect (at 68.58 73.66) (uuid 60417d3f-6976-4bb6-9bee-aa96c25d9466)) + (no_connect (at 106.68 76.2) (uuid 61b0c719-de31-4cf6-b977-f1e7e213fd99)) + (no_connect (at 68.58 104.14) (uuid 63888d57-23e0-4761-8443-fcd2fae9ca79)) + (no_connect (at 38.1 53.34) (uuid 72ad771e-803f-4bf1-9f18-5029f42dbacf)) + (no_connect (at 116.84 40.64) (uuid 7f26a17f-364a-4da8-9b43-293d13f0a8ca)) + (no_connect (at 68.58 76.2) (uuid 866ef9e2-cc97-4ce1-b1ed-363e0f79ea4f)) + (no_connect (at 68.58 78.74) (uuid 8695f1dd-1ea4-4167-865f-644c968a6e9e)) + (no_connect (at 68.58 50.8) (uuid 86d723a6-17c4-4749-94f2-276c3e2954aa)) + (no_connect (at 38.1 78.74) (uuid 88250911-4b01-49c1-9ba8-af5ead25a667)) + (no_connect (at 106.68 78.74) (uuid 89ea5c4c-d13f-4355-a192-02182b276d3b)) + (no_connect (at 106.68 68.58) (uuid 91a9f322-a607-4233-862d-b4bd4cc23061)) + (no_connect (at 106.68 55.88) (uuid 9b4ef8e2-cda9-4898-a881-2545e758853b)) + (no_connect (at 132.08 45.72) (uuid a2f2918b-9ab1-4169-9810-3a7ae5792f56)) + (no_connect (at 68.58 93.98) (uuid ad516f1f-beb9-4322-90fd-9da74089f664)) + (no_connect (at 106.68 83.82) (uuid b99090f6-16e4-43d0-ada8-57a11b86bf5d)) + (no_connect (at 106.68 60.96) (uuid bf297929-ff80-441b-ae5e-331c79552907)) + (no_connect (at 68.58 83.82) (uuid c471bb88-5088-48ba-9cc0-73c856ac6642)) + (no_connect (at 68.58 81.28) (uuid cf7184b5-9f5b-4005-a187-09eb9d867a90)) + (no_connect (at 106.68 53.34) (uuid de1e0cc1-c828-47f7-9795-442b3a02adb8)) + (no_connect (at 68.58 88.9) (uuid e4e59d01-c6f6-4e28-8fc0-813a0beff4e5)) + (no_connect (at 68.58 68.58) (uuid ecddcee9-8c18-44ca-84e0-18face544b75)) + (no_connect (at 68.58 91.44) (uuid efe72e93-ca69-40c5-8801-920d660aa480)) + (no_connect (at 119.38 40.64) (uuid f3fee885-6abd-4bab-b776-1defbe3d02ec)) + (no_connect (at 68.58 63.5) (uuid f5d19cde-9f0a-42dd-8388-4f30de79d7df)) + (no_connect (at 38.1 50.8) (uuid fa93d1cd-b8cd-4daf-ae8e-eaa2a4b22a57)) + (no_connect (at 106.68 81.28) (uuid faf19b5a-1992-46b4-b0ad-87fb5d21975f)) + (no_connect (at 68.58 101.6) (uuid fc5250eb-ad46-4191-ae51-a7335ae5b405)) + (no_connect (at 90.17 88.9) (uuid fd73354c-267d-4e40-ac1a-a84e25131db3)) + + (wire (pts (xy 154.94 50.8) (xy 154.94 67.31)) + (stroke (width 0) (type default)) + (uuid 0182756f-20b5-4ef8-802f-195bf39658b9) + ) + (wire (pts (xy 80.01 71.12) (xy 80.01 88.9)) + (stroke (width 0) (type default)) + (uuid 0b365a7b-e763-4f58-8459-0a691c3b865b) + ) + (wire (pts (xy 96.52 20.32) (xy 97.79 20.32)) + (stroke (width 0) (type default)) + (uuid 0d461ab1-5bf8-4d2e-8dae-0b055ee4ce09) + ) + (wire (pts (xy 158.75 53.34) (xy 163.83 53.34)) + (stroke (width 0) (type default)) + (uuid 0e15da3a-6e75-4315-a1ae-fc26f8e2c0ae) + ) + (wire (pts (xy 121.92 20.32) (xy 121.92 36.83)) + (stroke (width 0) (type default)) + (uuid 12b1f585-97a3-4072-81bc-e1f0abadd968) + ) + (wire (pts (xy 146.05 36.83) (xy 146.05 45.72)) + (stroke (width 0) (type default)) + (uuid 1320cf33-bd2b-4222-80b1-1ab14d66adb9) + ) + (wire (pts (xy 143.51 60.96) (xy 162.56 60.96)) + (stroke (width 0) (type default)) + (uuid 1397044e-1417-4be4-b132-afd8518eaa19) + ) + (wire (pts (xy 186.69 101.6) (xy 179.07 101.6)) + (stroke (width 0) (type default)) + (uuid 1a3d7b23-914c-4ea3-8b08-f5fbeafc666b) + ) + (wire (pts (xy 68.58 53.34) (xy 80.01 53.34)) + (stroke (width 0) (type default)) + (uuid 1c41e3ff-cbcc-453f-8cda-e01a82a9c953) + ) + (wire (pts (xy 35.56 33.02) (xy 35.56 36.83)) + (stroke (width 0) (type default)) + (uuid 1de2e3e7-2f08-4041-b91c-0a530369f5af) + ) + (wire (pts (xy 53.34 33.02) (xy 53.34 40.64)) + (stroke (width 0) (type default)) + (uuid 1e60d29b-f30f-4257-a77e-a4388f439286) + ) + (wire (pts (xy 68.58 48.26) (xy 80.01 48.26)) + (stroke (width 0) (type default)) + (uuid 1f0fd42b-e10e-4219-8253-df30682fe669) + ) + (wire (pts (xy 35.56 20.32) (xy 53.34 20.32)) + (stroke (width 0) (type default)) + (uuid 2181ab84-43ac-48f8-bf16-90c459035ff1) + ) + (wire (pts (xy 154.94 74.93) (xy 154.94 101.6)) + (stroke (width 0) (type default)) + (uuid 21ac6bde-9d69-4b29-b1a3-6a0a1972c868) + ) + (wire (pts (xy 105.41 27.94) (xy 105.41 30.48)) + (stroke (width 0) (type default)) + (uuid 2294f7a6-dc53-4e2f-8197-305ca645da7a) + ) + (wire (pts (xy 137.16 58.42) (xy 137.16 55.88)) + (stroke (width 0) (type default)) + (uuid 25272c2d-bd4b-4d3d-9e3e-d24e6ddeae9e) + ) + (wire (pts (xy 87.63 36.83) (xy 87.63 38.1)) + (stroke (width 0) (type default)) + (uuid 26754b91-42be-444e-bd87-894297665893) + ) + (wire (pts (xy 80.01 36.83) (xy 87.63 36.83)) + (stroke (width 0) (type default)) + (uuid 26a650d0-1380-4bab-b456-45bca3423e00) + ) + (wire (pts (xy 114.3 29.21) (xy 114.3 30.48)) + (stroke (width 0) (type default)) + (uuid 2ceb19d5-c06c-4d4f-b2ef-a166ea38c42f) + ) + (wire (pts (xy 158.75 67.31) (xy 158.75 53.34)) + (stroke (width 0) (type default)) + (uuid 2e3657ca-088e-4e85-b8af-f3278992e24b) + ) + (wire (pts (xy 121.92 20.32) (xy 114.3 20.32)) + (stroke (width 0) (type default)) + (uuid 2e4ae9c8-ffc8-4ad0-9baf-dca501db0d33) + ) + (wire (pts (xy 134.62 46.99) (xy 137.16 46.99)) + (stroke (width 0) (type default)) + (uuid 3078085a-0552-421e-a352-b899ef584ecc) + ) + (wire (pts (xy 163.83 66.04) (xy 162.56 66.04)) + (stroke (width 0) (type default)) + (uuid 30fa0613-3167-4a79-bd09-2abd86bd2ce1) + ) + (wire (pts (xy 143.51 60.96) (xy 143.51 74.93)) + (stroke (width 0) (type default)) + (uuid 33857978-4d75-4eb8-9e56-c2ba9f89e4ed) + ) + (wire (pts (xy 162.56 63.5) (xy 163.83 63.5)) + (stroke (width 0) (type default)) + (uuid 36d9cee0-f174-4a36-8116-c52ba859d093) + ) + (wire (pts (xy 101.6 53.34) (xy 101.6 45.72)) + (stroke (width 0) (type default)) + (uuid 3bfa343f-b3a2-4685-92da-4ac6d11bfc2a) + ) + (wire (pts (xy 80.01 43.18) (xy 80.01 36.83)) + (stroke (width 0) (type default)) + (uuid 3c574b9d-4c10-4a5f-bf62-d0c061159af3) + ) + (wire (pts (xy 35.56 45.72) (xy 38.1 45.72)) + (stroke (width 0) (type default)) + (uuid 406cb6d4-f148-457f-a414-90e3af0d2c92) + ) + (wire (pts (xy 96.52 20.32) (xy 96.52 21.59)) + (stroke (width 0) (type default)) + (uuid 410328a9-2b6b-43b9-9218-fbd625dc7b3a) + ) + (wire (pts (xy 77.47 36.83) (xy 35.56 36.83)) + (stroke (width 0) (type default)) + (uuid 446e6852-8784-4318-80b6-737661ea373d) + ) + (wire (pts (xy 162.56 58.42) (xy 162.56 60.96)) + (stroke (width 0) (type default)) + (uuid 44a97a36-23e9-47a0-9772-8a51e2398103) + ) + (wire (pts (xy 114.3 20.32) (xy 113.03 20.32)) + (stroke (width 0) (type default)) + (uuid 4573eed1-bb96-4dc2-8c04-954fbd1c0988) + ) + (wire (pts (xy 53.34 111.76) (xy 53.34 113.03)) + (stroke (width 0) (type default)) + (uuid 459aee96-ee86-45f1-8f18-111344dbc8fa) + ) + (wire (pts (xy 143.51 101.6) (xy 119.38 101.6)) + (stroke (width 0) (type default)) + (uuid 45e26c6f-6d6b-4c35-aeca-b3fc61aed728) + ) + (wire (pts (xy 92.71 36.83) (xy 121.92 36.83)) + (stroke (width 0) (type default)) + (uuid 475bf3c0-de87-4672-8fd3-705f69a85408) + ) + (wire (pts (xy 106.68 58.42) (xy 104.14 58.42)) + (stroke (width 0) (type default)) + (uuid 47f14f8f-6905-43ce-9fd5-8950c60c9423) + ) + (wire (pts (xy 143.51 102.87) (xy 143.51 101.6)) + (stroke (width 0) (type default)) + (uuid 4e8f01aa-5abc-4fe6-8e29-fa0444694a0b) + ) + (wire (pts (xy 158.75 74.93) (xy 158.75 101.6)) + (stroke (width 0) (type default)) + (uuid 4ffe67fe-2c68-46d4-8647-eb6accb34c54) + ) + (wire (pts (xy 90.17 73.66) (xy 90.17 74.93)) + (stroke (width 0) (type default)) + (uuid 52b69ce5-8a94-4de2-b6e1-27ad909a0dad) + ) + (wire (pts (xy 137.16 45.72) (xy 137.16 46.99)) + (stroke (width 0) (type default)) + (uuid 53633d67-d396-4e02-8c2b-a85aaba87f2f) + ) + (wire (pts (xy 137.16 38.1) (xy 137.16 36.83)) + (stroke (width 0) (type default)) + (uuid 5ba25e59-3a2e-4e33-9b9b-b7531ed81573) + ) + (wire (pts (xy 92.71 36.83) (xy 92.71 38.1)) + (stroke (width 0) (type default)) + (uuid 5c735e5e-b1db-4a7d-abff-27d89514fe00) + ) + (wire (pts (xy 80.01 63.5) (xy 74.93 63.5)) + (stroke (width 0) (type default)) + (uuid 5cffc808-32af-4ed6-a473-a4fe9e6135d4) + ) + (wire (pts (xy 114.3 30.48) (xy 105.41 30.48)) + (stroke (width 0) (type default)) + (uuid 5e9bca3f-b37d-418b-9c82-eae0e0867fc1) + ) + (wire (pts (xy 101.6 45.72) (xy 106.68 45.72)) + (stroke (width 0) (type default)) + (uuid 60c15f39-321b-42b5-8742-df7dd0bb6c98) + ) + (wire (pts (xy 35.56 25.4) (xy 35.56 20.32)) + (stroke (width 0) (type default)) + (uuid 61aaddea-f612-4d1c-af8a-c93fae15c233) + ) + (wire (pts (xy 74.93 63.5) (xy 74.93 45.72)) + (stroke (width 0) (type default)) + (uuid 6279e70c-2eeb-40d8-b0be-41da2265bbbc) + ) + (wire (pts (xy 114.3 20.32) (xy 114.3 21.59)) + (stroke (width 0) (type default)) + (uuid 636a7748-48c0-4036-8c85-0ce1f36dc6de) + ) + (wire (pts (xy 137.16 48.26) (xy 137.16 46.99)) + (stroke (width 0) (type default)) + (uuid 64beeb97-c1a8-431d-b916-68f7c821c9b3) + ) + (wire (pts (xy 96.52 30.48) (xy 96.52 29.21)) + (stroke (width 0) (type default)) + (uuid 65062331-9a92-4104-89ea-bd2eb3714d3d) + ) + (wire (pts (xy 34.29 36.83) (xy 35.56 36.83)) + (stroke (width 0) (type default)) + (uuid 65461eb0-50c5-4090-9290-6ed1ca727217) + ) + (wire (pts (xy 132.08 63.5) (xy 140.97 63.5)) + (stroke (width 0) (type default)) + (uuid 6cb650e5-00cd-4116-b851-f769b9bc3026) + ) + (wire (pts (xy 162.56 66.04) (xy 162.56 63.5)) + (stroke (width 0) (type default)) + (uuid 6d34c9bb-42fe-4c84-b57d-5ce70370fa2c) + ) + (wire (pts (xy 179.07 83.82) (xy 179.07 101.6)) + (stroke (width 0) (type default)) + (uuid 751ed025-93bf-4293-8660-732934f1583a) + ) + (wire (pts (xy 154.94 101.6) (xy 158.75 101.6)) + (stroke (width 0) (type default)) + (uuid 7646b889-097b-4dde-ad1e-d18c8bcb1594) + ) + (wire (pts (xy 104.14 58.42) (xy 104.14 63.5)) + (stroke (width 0) (type default)) + (uuid 77e5980e-4eeb-4351-af1e-0effc70e0955) + ) + (wire (pts (xy 121.92 36.83) (xy 137.16 36.83)) + (stroke (width 0) (type default)) + (uuid 7e96ed0c-6744-4356-864a-962d4929c3d4) + ) + (wire (pts (xy 80.01 58.42) (xy 77.47 58.42)) + (stroke (width 0) (type default)) + (uuid 7f952c48-78af-4a45-92ed-31e0773a7068) + ) + (wire (pts (xy 143.51 85.09) (xy 143.51 101.6)) + (stroke (width 0) (type default)) + (uuid 7ffcfd8d-cd59-455f-a378-77026c5f8dda) + ) + (wire (pts (xy 87.63 20.32) (xy 96.52 20.32)) + (stroke (width 0) (type default)) + (uuid 835fdf80-296f-4d25-8695-d58294cc1a89) + ) + (wire (pts (xy 146.05 45.72) (xy 163.83 45.72)) + (stroke (width 0) (type default)) + (uuid 84c3ff60-f8d4-4681-920f-b6c728dd31a3) + ) + (wire (pts (xy 74.93 45.72) (xy 68.58 45.72)) + (stroke (width 0) (type default)) + (uuid 89cbf45b-1e6e-4785-a8e3-febaceb8b027) + ) + (wire (pts (xy 22.86 45.72) (xy 25.4 45.72)) + (stroke (width 0) (type default)) + (uuid 8ca9db77-4ae4-4f55-95a4-3a535df748d7) + ) + (wire (pts (xy 137.16 36.83) (xy 146.05 36.83)) + (stroke (width 0) (type default)) + (uuid 8cc1f8ce-003e-4dba-abfa-135f047f274a) + ) + (wire (pts (xy 72.39 71.12) (xy 72.39 55.88)) + (stroke (width 0) (type default)) + (uuid 90db8311-098a-4691-9889-44a5f72300fc) + ) + (wire (pts (xy 105.41 30.48) (xy 96.52 30.48)) + (stroke (width 0) (type default)) + (uuid 92e1fdc1-8a90-44ad-a0e3-68bfd7604dea) + ) + (wire (pts (xy 53.34 20.32) (xy 53.34 25.4)) + (stroke (width 0) (type default)) + (uuid 97405a3c-0cb9-4fe8-9710-d93f1fb4f470) + ) + (wire (pts (xy 186.69 83.82) (xy 186.69 101.6)) + (stroke (width 0) (type default)) + (uuid 9a2c4348-3ccf-4661-9f83-613ebf6fd3e7) + ) + (wire (pts (xy 35.56 36.83) (xy 35.56 45.72)) + (stroke (width 0) (type default)) + (uuid 9dbd3b3a-ffae-4f7b-a18a-cc0d66a74f16) + ) + (wire (pts (xy 100.33 58.42) (xy 102.87 58.42)) + (stroke (width 0) (type default)) + (uuid a0208ca6-c3a1-47a2-a280-adce83d9ac8b) + ) + (wire (pts (xy 72.39 55.88) (xy 68.58 55.88)) + (stroke (width 0) (type default)) + (uuid a26bc5a4-6b06-472e-9529-9a2b778e7f6f) + ) + (wire (pts (xy 102.87 58.42) (xy 102.87 50.8)) + (stroke (width 0) (type default)) + (uuid a46d4fd1-5ad5-485c-b316-b3b2f3654b20) + ) + (wire (pts (xy 140.97 63.5) (xy 140.97 74.93)) + (stroke (width 0) (type default)) + (uuid a92f07a2-2f7e-49c4-880b-19404e9871de) + ) + (wire (pts (xy 119.38 96.52) (xy 119.38 101.6)) + (stroke (width 0) (type default)) + (uuid ac37dbd0-5772-46ad-b588-ecdb6b558284) + ) + (wire (pts (xy 77.47 58.42) (xy 77.47 36.83)) + (stroke (width 0) (type default)) + (uuid ac41c32c-758d-437c-a9c8-fae796bda1c5) + ) + (wire (pts (xy 104.14 63.5) (xy 100.33 63.5)) + (stroke (width 0) (type default)) + (uuid b5b51c66-381e-4672-a5c0-7c0176e01322) + ) + (wire (pts (xy 102.87 50.8) (xy 106.68 50.8)) + (stroke (width 0) (type default)) + (uuid b7446e99-9727-40e5-8fe0-82baeb80e035) + ) + (wire (pts (xy 121.92 36.83) (xy 121.92 40.64)) + (stroke (width 0) (type default)) + (uuid b9e3ba20-0cdd-494a-88e0-d8682acc39de) + ) + (wire (pts (xy 22.86 36.83) (xy 22.86 45.72)) + (stroke (width 0) (type default)) + (uuid baf0eab8-17c3-4492-84f8-d430da66b5f2) + ) + (wire (pts (xy 146.05 45.72) (xy 146.05 74.93)) + (stroke (width 0) (type default)) + (uuid bc3e8e93-3e99-45c8-a389-357300c6e825) + ) + (wire (pts (xy 80.01 104.14) (xy 80.01 113.03)) + (stroke (width 0) (type default)) + (uuid bc94f2e7-caf1-439a-b1f7-0f8b3ce9bd6c) + ) + (wire (pts (xy 163.83 50.8) (xy 154.94 50.8)) + (stroke (width 0) (type default)) + (uuid bd7a55ae-e9ed-44b0-a833-5bf21b198c1a) + ) + (wire (pts (xy 100.33 53.34) (xy 101.6 53.34)) + (stroke (width 0) (type default)) + (uuid be979fd9-c82b-4c4e-b344-19d70f1b232c) + ) + (wire (pts (xy 72.39 71.12) (xy 80.01 71.12)) + (stroke (width 0) (type default)) + (uuid c52b8160-2ae4-4188-bb91-363b2d63cb9a) + ) + (wire (pts (xy 132.08 60.96) (xy 143.51 60.96)) + (stroke (width 0) (type default)) + (uuid c5613cee-248b-49f6-89c9-ef698c234021) + ) + (wire (pts (xy 87.63 20.32) (xy 87.63 36.83)) + (stroke (width 0) (type default)) + (uuid c7ad746d-b2d3-4ab8-9c9f-d5c86eb5c3e6) + ) + (wire (pts (xy 163.83 58.42) (xy 162.56 58.42)) + (stroke (width 0) (type default)) + (uuid c82a8b4b-f147-4adf-9b83-561e6361315c) + ) + (wire (pts (xy 132.08 58.42) (xy 134.62 58.42)) + (stroke (width 0) (type default)) + (uuid cf0448ab-e202-4c72-b2f7-7a86d500442f) + ) + (wire (pts (xy 53.34 25.4) (xy 57.15 25.4)) + (stroke (width 0) (type default)) + (uuid d1417c7a-6cda-4661-8114-93725ee46209) + ) + (wire (pts (xy 24.13 36.83) (xy 22.86 36.83)) + (stroke (width 0) (type default)) + (uuid d1d9c706-402c-4791-bca4-7f31a5811d27) + ) + (wire (pts (xy 33.02 45.72) (xy 35.56 45.72)) + (stroke (width 0) (type default)) + (uuid d1e6bef3-345b-49c1-ac4f-1ddb3774f7c7) + ) + (wire (pts (xy 100.33 48.26) (xy 106.68 48.26)) + (stroke (width 0) (type default)) + (uuid d7ed2ff2-7502-4e77-8f19-aaf0e952d1ed) + ) + (wire (pts (xy 22.86 48.26) (xy 22.86 45.72)) + (stroke (width 0) (type default)) + (uuid dd64d773-2c02-4fbd-bf9e-53b1c40e3e8f) + ) + (wire (pts (xy 53.34 33.02) (xy 57.15 33.02)) + (stroke (width 0) (type default)) + (uuid e4a9a80d-7d22-4f9c-bfce-5704d7eccd78) + ) + (wire (pts (xy 158.75 101.6) (xy 179.07 101.6)) + (stroke (width 0) (type default)) + (uuid e4f7912f-a4ec-4bcb-9462-be80f937ec78) + ) + (wire (pts (xy 140.97 63.5) (xy 162.56 63.5)) + (stroke (width 0) (type default)) + (uuid f37f8a28-008b-4afc-96bd-737ba9b0c55d) + ) + (wire (pts (xy 49.53 25.4) (xy 53.34 25.4)) + (stroke (width 0) (type default)) + (uuid f652b3c0-e5b7-4fc8-a010-6e134c0e19fb) + ) + (wire (pts (xy 143.51 101.6) (xy 154.94 101.6)) + (stroke (width 0) (type default)) + (uuid fa3c4eb4-bd35-42f1-b3b0-ab84487ad36f) + ) + (wire (pts (xy 134.62 58.42) (xy 134.62 46.99)) + (stroke (width 0) (type default)) + (uuid fa8e7101-e8a0-4ee9-b1eb-3342b2c9567e) + ) + (wire (pts (xy 49.53 33.02) (xy 53.34 33.02)) + (stroke (width 0) (type default)) + (uuid fb675dc5-e93b-4606-a048-820ea3191316) + ) + (wire (pts (xy 162.56 60.96) (xy 163.83 60.96)) + (stroke (width 0) (type default)) + (uuid fddab112-a175-444b-a827-8eb7610349b8) + ) + (wire (pts (xy 53.34 20.32) (xy 87.63 20.32)) + (stroke (width 0) (type default)) + (uuid fe15d9c7-116a-4c71-81e6-2c732107f4b9) + ) + + (symbol (lib_id "power:PWR_FLAG") (at 163.83 45.72 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 086012f7-bb0b-462b-a30f-82ee94626e53) + (property "Reference" "#FLG01" (at 163.83 43.815 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "PWR_FLAG" (at 163.83 40.64 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Footprint" "" (at 163.83 45.72 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 163.83 45.72 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid eee6deb3-39b8-4233-b981-fcd7c520460c)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#FLG01") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 105.41 30.48 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 14af679c-e147-4801-a2a3-540e76cf4cc1) + (property "Reference" "#PWR07" (at 105.41 36.83 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 105.41 34.29 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 105.41 30.48 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 105.41 30.48 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 2d8bde9e-265a-4cf7-af7b-d21f50b3cde7)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR07") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R_US") (at 35.56 29.21 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 1862af7d-db79-4313-8da6-5c7a7da27dca) + (property "Reference" "R3" (at 36.83 27.94 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "10kΩ" (at 36.83 30.48 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "" (at 34.544 29.464 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 35.56 29.21 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 20eb40a1-7882-4717-a476-81c026cc53c9)) + (pin "2" (uuid e6003d1f-0178-4803-b133-5061fb894cef)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "R3") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 22.86 48.26 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 1e1b5ac0-5bcc-494e-85d2-02345ac5746f) + (property "Reference" "#PWR02" (at 22.86 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 22.86 52.07 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 22.86 48.26 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 22.86 48.26 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid fe9c6aba-100b-4165-b60e-c1210efaad0c)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR02") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R_US") (at 154.94 71.12 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 22c5d59a-a992-406e-b82d-ad9ba675662f) + (property "Reference" "R5" (at 153.67 69.85 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "47.5kΩ" (at 153.67 72.39 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 153.924 71.374 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 154.94 71.12 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 6c267bd0-2c2b-41e8-9cc4-9eb578a94a9a)) + (pin "2" (uuid 8d8a2652-180a-4047-a42b-f2575c140a07)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "R5") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 143.51 102.87 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 31a35f24-db35-4541-948f-6b16ecf7892b) + (property "Reference" "#PWR01" (at 143.51 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 143.51 107.95 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 143.51 102.87 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 143.51 102.87 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 1617e6df-e93d-4929-b32b-2f6d55c743c3)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR01") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:PWR_FLAG") (at 53.34 33.02 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 34deefff-810a-4006-bbd4-b9276e415607) + (property "Reference" "#FLG02" (at 53.34 31.115 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "PWR_FLAG" (at 53.34 27.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Footprint" "" (at 53.34 33.02 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 53.34 33.02 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 1f3d23bc-f3a8-4b07-af39-4eb638039087)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#FLG02") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 49.53 29.21 0) (mirror x) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 3e5da5f7-fb5d-4786-a470-7434870b1a51) + (property "Reference" "C1" (at 46.99 27.94 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "10uF" (at 46.99 30.48 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "" (at 50.4952 25.4 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 49.53 29.21 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "2" (uuid d8a5cb7c-9b1a-40d9-b479-e0538f4be24b)) + (pin "1" (uuid f6d44ead-e720-4600-8336-2dfbf1e14ad4)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "C1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R_US") (at 137.16 52.07 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 48904be6-1f1e-4de5-95ed-ceab60d91146) + (property "Reference" "R2" (at 138.43 50.8 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "47.5kΩ" (at 138.43 53.34 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 138.176 52.324 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 137.16 52.07 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid e3c064cf-6064-44f5-86c1-6c1adfa9776e)) + (pin "2" (uuid 70590eb2-c31e-4349-aba2-a15b71fb8503)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "R2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 29.21 45.72 90) (mirror x) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 4b81143c-da41-4bad-affd-b64a347945cf) + (property "Reference" "C3" (at 29.21 49.53 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "1uF" (at 29.21 52.07 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 33.02 46.6852 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 29.21 45.72 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "2" (uuid c90e1564-b3ca-4bad-a269-5c3cfc66aacc)) + (pin "1" (uuid b0b37e5b-ab6a-44a0-8894-f0e5b04423b3)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "C3") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 80.01 113.03 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 4ebaa7f6-dfe3-454a-b708-2833c7468860) + (property "Reference" "#PWR05" (at 80.01 119.38 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 80.01 118.11 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 80.01 113.03 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 80.01 113.03 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 83921f92-84d0-469f-af1f-addb506233d1)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR05") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R_US") (at 137.16 41.91 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 5731fe00-98d5-430c-849a-16ddb3f3c4da) + (property "Reference" "R1" (at 138.43 40.64 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "22.1kΩ" (at 138.43 43.18 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 138.176 42.164 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 137.16 41.91 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid d8cdc50e-32ae-4a81-8a68-57731b11007e)) + (pin "2" (uuid a38f56a7-376b-4ad3-8a52-258b5ecd1cbe)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "R1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 114.3 25.4 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 75294bc0-1eaf-4911-89cf-47910e10013e) + (property "Reference" "C4" (at 116.84 24.13 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "10uF" (at 116.84 26.67 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 115.2652 29.21 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 114.3 25.4 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "2" (uuid 584525ab-dda8-4394-9d60-240a4e5f8950)) + (pin "1" (uuid a50ddc28-2621-46b5-aaaa-5246129de90c)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "C4") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Power_Protection:SP0503BAHT") (at 143.51 80.01 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 7f2ffa7b-7639-4a02-9955-5c3683f9d7f3) + (property "Reference" "D1" (at 142.24 85.09 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "SP0503BAHT" (at 142.24 87.63 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "Package_TO_SOT_SMD:SOT-143" (at 149.225 81.28 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (property "Datasheet" "http://www.littelfuse.com/~/media/files/littelfuse/technical%20resources/documents/data%20sheets/sp05xxba.pdf" (at 146.685 76.835 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "4" (uuid 1f305413-895e-4aa7-97f3-fa8947226596)) + (pin "3" (uuid 2526518f-768f-4c18-a491-13ac30296cfa)) + (pin "2" (uuid 2079baea-8c94-4004-a07a-768b70813f84)) + (pin "1" (uuid 8730db9c-9eb0-45e0-aee2-f726357d4d7f)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "D1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 96.52 25.4 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 90dc1c06-23a1-4b04-aeac-4664fef42589) + (property "Reference" "C5" (at 93.98 24.13 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "22uF" (at 93.98 26.67 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 95.5548 29.21 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 96.52 25.4 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "2" (uuid 3c74e72c-6697-4e56-ad63-f9c4da822069)) + (pin "1" (uuid 00d3a222-c30f-49f8-a0a7-3fed0337129c)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "C5") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Switch:SW_SPST") (at 29.21 36.83 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 95696a68-a430-49ca-92d8-8c62b71b5d7a) + (property "Reference" "SW1" (at 29.21 30.48 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "SW_SPST" (at 29.21 33.02 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 29.21 36.83 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 29.21 36.83 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 62bb81f3-170c-45e5-860d-9bd81529608a)) + (pin "2" (uuid 3e38813c-a15f-4712-95d2-1e82bdb21baa)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "SW1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Interface_USB:CP2102N-Axx-xQFN24") (at 119.38 68.58 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid a706e2f1-0d10-428a-a699-ef22890c87d5) + (property "Reference" "U2" (at 119.7259 96.52 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "CP2102N-Axx-xQFN24" (at 119.7259 99.06 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "Package_DFN_QFN:QFN-24-1EP_4x4mm_P0.5mm_EP2.6x2.6mm" (at 87.63 95.25 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "https://www.silabs.com/documents/public/data-sheets/cp2102n-datasheet.pdf" (at 118.11 87.63 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "17" (uuid ddb745b8-9410-4c2e-9896-ea6939762805)) + (pin "19" (uuid 2712c048-ddaa-4de3-bf36-7c847bc218bd)) + (pin "7" (uuid 7397b270-1292-489f-8a55-2e6e583e1b8c)) + (pin "21" (uuid c2346f17-1d9d-4005-8d0a-4b121de46457)) + (pin "24" (uuid 5e0af6cb-b3a8-48fb-b2db-8c045c27e1cc)) + (pin "22" (uuid db5bf773-a192-44d4-9651-8c8d10b46322)) + (pin "8" (uuid acb4a442-f368-495d-a8ea-52ecec4e3952)) + (pin "16" (uuid da0c34a0-eefe-4d82-94bd-f4d358d90042)) + (pin "5" (uuid 34d1d3a5-2033-4948-823c-1ba1a73f2f71)) + (pin "1" (uuid 0fe3c721-b405-452a-8600-e5aef5aad9bb)) + (pin "23" (uuid 0103f6c6-d254-4e52-9350-9bceae082f0f)) + (pin "3" (uuid f3ae80bf-9bf6-42a4-bdb1-f71d0e3ac622)) + (pin "10" (uuid ba73037c-b9ef-4608-94fb-74d1215b7ef7)) + (pin "14" (uuid ffa9a5d8-7069-4a98-b92b-c5b00f96a0c2)) + (pin "11" (uuid eeece6be-345d-467d-9024-c9ed9b8ad279)) + (pin "15" (uuid cd730683-13d2-48ff-84a4-6dcf3610d2d0)) + (pin "12" (uuid 528f953c-4cf8-4b7c-af5f-5174152fa629)) + (pin "13" (uuid e09f5284-9b87-481c-813c-10e23c5c017e)) + (pin "6" (uuid 263da9a7-9ac8-4294-9520-f7887f0aa7a1)) + (pin "20" (uuid 8920a1c5-ead0-42ab-8803-367d07545ad6)) + (pin "2" (uuid 4d0d99d3-68ff-48c7-8cbf-4ba64ae2464a)) + (pin "18" (uuid c4d94154-9b2d-49ed-befa-f99a061f0bb8)) + (pin "9" (uuid 9a6f4cb4-d733-418b-be1a-7f6d69584e78)) + (pin "25" (uuid 329a9ca2-3fe0-4c8a-875e-9b9adcafd3f5)) + (pin "4" (uuid 6cdcd976-dcc0-4315-99a7-5052fbf2491d)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "U2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Logic_LevelTranslator:TXB0104PW") (at 90.17 55.88 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid a7dac6c5-a326-434b-99a3-e9bea6f2f292) + (property "Reference" "U4" (at 92.71 72.39 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "TXB0104PW" (at 92.71 74.93 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "Package_SO:TSSOP-14_4.4x5mm_P0.65mm" (at 90.17 74.93 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "http://www.ti.com/lit/ds/symlink/txb0104.pdf" (at 92.964 53.467 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid b9e5f384-ccea-4421-9bfc-8f40b0dcc33b)) + (pin "8" (uuid c4eab8cb-acda-4472-9e01-58343e814a1f)) + (pin "10" (uuid c872e007-5a39-4630-9dfa-c156e21a07c5)) + (pin "13" (uuid 1774d273-e3ce-42d5-b68f-9586d7a11bf2)) + (pin "12" (uuid 24a4f2c6-35c0-4909-a29b-b044802b759a)) + (pin "5" (uuid e7b74c61-6737-4cd8-978b-3e5a0c9b852c)) + (pin "9" (uuid aab37de6-1a62-4c62-920f-4739b4c8f77a)) + (pin "3" (uuid 73244738-d18a-4aaa-b83c-5c458547cccb)) + (pin "4" (uuid ea6f3021-a5a1-44b9-b14b-c71c974a8dce)) + (pin "11" (uuid fc664b3d-2fa6-43da-90e3-848d09cbd427)) + (pin "6" (uuid be7e3ea2-fda2-4cb2-a2fa-24b9d300248d)) + (pin "2" (uuid 06db0a63-b48d-43fa-9e71-56ca8bac7368)) + (pin "7" (uuid d96eef2a-b31e-4ac7-9948-57216f19aa01)) + (pin "14" (uuid bfb28565-4fd3-4747-b535-ea9579c0897c)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "U4") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:PWR_FLAG") (at 119.38 101.6 90) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid a9f1c724-bcbe-4b3a-a9da-f69483433c58) + (property "Reference" "#FLG03" (at 117.475 101.6 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "PWR_FLAG" (at 115.57 101.6 90) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (property "Footprint" "" (at 119.38 101.6 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 119.38 101.6 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid f04e178d-1959-495c-95e7-503fa1da2477)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#FLG03") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Relay:Relay_SPDT") (at 85.09 96.52 0) (mirror x) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid b2225c32-0318-48d8-8562-1a7855b85a5a) + (property "Reference" "K1" (at 96.52 96.52 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "Relay_SPDT" (at 96.52 99.06 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 96.52 95.25 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (property "Datasheet" "~" (at 85.09 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "A2" (uuid 014d2ef8-dbe5-4e93-ad3e-f31ca0bb3a0b)) + (pin "14" (uuid d94c95a8-3f26-4e97-a59b-234b8493ae31)) + (pin "11" (uuid 7a4956cc-c81a-4b0e-9e33-6fa021027ede)) + (pin "12" (uuid 52b82402-932a-4b2a-ad6b-9009a13f4809)) + (pin "A1" (uuid b4dbf8ae-aeaf-463e-9db6-c0615d8c11d7)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "K1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 57.15 29.21 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid b6553355-2d71-43c7-8541-f78b80449c3f) + (property "Reference" "C2" (at 59.69 27.94 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "0.1uF" (at 59.69 30.48 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 58.1152 33.02 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 57.15 29.21 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "2" (uuid 5a85c4f0-a0a6-4468-b442-3faf133371b9)) + (pin "1" (uuid 475c9374-0c20-42f2-b387-f6bead1878ef)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "C2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "RF_Module:ESP32-WROOM-32") (at 53.34 76.2 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid be5a8ef5-ae8b-4fc7-afe1-183692831e15) + (property "Reference" "U1" (at 55.88 39.37 0) + (effects (font (size 1.27 1.27)) (justify left top)) + ) + (property "Value" "ESP32-WROOM-32" (at 55.88 41.91 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "RF_Module:ESP32-WROOM-32" (at 53.34 114.3 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf" (at 45.72 74.93 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "38" (uuid 0631e3a5-f273-4ed4-9b19-cd5973bc5b61)) + (pin "22" (uuid 38bf3184-3eee-450b-8541-09a215634213)) + (pin "31" (uuid 57285170-1d5b-47cd-8e1f-1744903ae5ee)) + (pin "30" (uuid dbacf49e-1f83-413b-87b5-ea87fa06e730)) + (pin "6" (uuid c3b8c1c4-bf1f-4f3b-99e4-d4c06cd906bf)) + (pin "25" (uuid 2fc4c101-9897-4d0c-991a-4cec0a6d61e6)) + (pin "26" (uuid c38f110a-caa7-4385-9a2a-2af6f3623311)) + (pin "2" (uuid ac00d45c-651a-4e21-8e95-90184dfea140)) + (pin "27" (uuid 99d3e7c2-4a68-49be-9686-3400c5ade8ae)) + (pin "32" (uuid e02b1558-1382-488e-847e-594918c8a32f)) + (pin "33" (uuid 4d6ecb8a-f53f-4828-92d7-bd2c87fc608c)) + (pin "28" (uuid 43708d21-dcbb-4cda-ac4e-f2fdcd1d6dab)) + (pin "29" (uuid d54e56f3-4575-4e1a-b0a4-561b8bae401c)) + (pin "16" (uuid 4d593b5c-2410-426b-8a38-e195ba1cc58e)) + (pin "18" (uuid df013d01-730d-4267-ae82-8ee6740868eb)) + (pin "4" (uuid 261a2a98-1e4c-44b8-b772-8932fcd1d56b)) + (pin "9" (uuid 96631215-07b3-411b-9d0b-b60cd97f385e)) + (pin "37" (uuid bad11b9f-9ec3-49a7-9c7c-e22d1e93e062)) + (pin "24" (uuid d947512e-2288-4699-943f-dd7004c46ebb)) + (pin "5" (uuid 3e06e8da-ec3d-48c7-b3ba-adc624c2f716)) + (pin "3" (uuid 8598f3a9-c407-431f-9a38-d9385d28fcd9)) + (pin "36" (uuid f167d308-a99e-460f-819c-3401197fbb8f)) + (pin "12" (uuid 92f33e9b-59f7-4b3f-af70-c0ec403b650a)) + (pin "13" (uuid 9d6a9f61-47c4-4185-8c6a-0831497e411a)) + (pin "11" (uuid 6e94e183-f3e6-4627-b849-b41527514d47)) + (pin "15" (uuid e85b9b70-230b-4f50-9d19-7413aecbeb5b)) + (pin "14" (uuid 68c18644-ff5c-4b2c-ae4d-669b4557587b)) + (pin "35" (uuid 5d731de0-2586-4ebf-a6dc-f6bcc2e798b2)) + (pin "34" (uuid c3e17356-01cf-4b17-b37f-5ac784991d7f)) + (pin "8" (uuid 1562493f-af15-441d-89f3-a52e09510b3c)) + (pin "23" (uuid f397f884-f026-4a30-83bf-3f929818ce43)) + (pin "21" (uuid 78471908-bfb1-4fcd-98dd-a6901ec6d9f6)) + (pin "39" (uuid 1c4c55b4-bc22-4a86-9a10-7e6020c79d91)) + (pin "17" (uuid 89212ae8-01ce-4349-b204-87bfa29b4359)) + (pin "20" (uuid 43f5eebe-03cf-424d-a8e4-a0c56beaa059)) + (pin "7" (uuid a2b1ebfe-f63c-47a8-9858-69e7d818fbfd)) + (pin "19" (uuid 86776017-fb55-40e1-ac17-3c5e3b6cbf37)) + (pin "10" (uuid b7d343cc-77e6-4668-9cdd-181d1460d17d)) + (pin "1" (uuid f16d9ebd-54f2-45c4-9cfb-72ae665bf00e)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "U1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 137.16 58.42 90) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid bfab81b9-6fc8-4d31-a0fb-d0c852db9721) + (property "Reference" "#PWR04" (at 143.51 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 139.7 58.42 90) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "" (at 137.16 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 137.16 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 11867b1c-408c-42e2-bff1-2bb1c0886d76)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR04") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Regulator_Linear:AMS1117-3.3") (at 105.41 20.32 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid c6b75dbc-0de9-411e-a142-ac43349392ac) + (property "Reference" "U5" (at 105.41 13.97 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "AMS1117-3.3" (at 105.41 16.51 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "Package_TO_SOT_SMD:SOT-223-3_TabPin2" (at 105.41 15.24 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "http://www.advanced-monolithic.com/pdf/ds1117.pdf" (at 102.87 26.67 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid e770a176-d479-4bf1-909b-d2bb56429380)) + (pin "3" (uuid 5293b568-6e75-4830-be62-ba5908e2e6dc)) + (pin "2" (uuid e5cd5089-9d7b-453a-82d7-a72fffd810c2)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "U5") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Connector:USB_C_Receptacle_USB2.0_14P") (at 179.07 60.96 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid d439a207-de09-49e1-b756-d2cd9c1af727) + (property "Reference" "P1" (at 190.5 59.69 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "USB_C_Plug_USB2.0" (at 190.5 62.23 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "" (at 175.26 60.96 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "https://www.usb.org/sites/default/files/documents/usb_type-c.zip" (at 175.26 60.96 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "B1" (uuid 546d9506-8205-455a-9cbe-2ef705b35138)) + (pin "B4" (uuid 7dc2fec3-e2cd-4aff-8409-a586272e13a1)) + (pin "S1" (uuid 505e60fb-0985-457d-8a52-a30e686d93a8)) + (pin "B5" (uuid 46a7b756-93ac-450c-98d5-525e92bbd3fb)) + (pin "B9" (uuid bf89b340-b2d0-4c9b-ae11-97a49c504834)) + (pin "B12" (uuid d37ba48d-23ee-4b56-903d-b1c3a94a4f45)) + (pin "A1" (uuid d2c4a3ab-a6af-4e04-a410-f647b0b552d5)) + (pin "A7" (uuid 696cfa5f-feae-44e6-b9cc-a5beee4904fc)) + (pin "A9" (uuid f2a137bb-dd14-44c4-8651-84d199654144)) + (pin "A5" (uuid 5d7ec326-7701-4fd2-90bf-a966fbbf3067)) + (pin "A12" (uuid 1dd48c79-9f76-46be-b6ea-5a64cd710f13)) + (pin "A6" (uuid be26effc-a231-45ae-940a-af1251865ffb)) + (pin "A4" (uuid c5a42036-96e7-433c-9913-bf52b7b72582)) + (pin "B7" (uuid ce62a0a7-e6fb-445c-8604-576441b5eb95)) + (pin "B6" (uuid 376fe37e-755e-472b-aac3-80aad4438073)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "P1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 90.17 74.93 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid d95f6133-8536-418f-a199-e62d4b0129dc) + (property "Reference" "#PWR06" (at 90.17 81.28 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 90.17 80.01 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 90.17 74.93 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 90.17 74.93 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 2c196111-c1a0-4244-b483-aab2992c7bb8)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR06") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R_US") (at 158.75 71.12 0) (mirror y) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid e3821f5c-e4d6-4544-90bc-756fbcb83a78) + (property "Reference" "R4" (at 160.02 69.85 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "47.5kΩ" (at 160.02 72.39 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "" (at 157.734 71.374 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 158.75 71.12 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 92652a48-3e12-4352-afed-c3ebe140b535)) + (pin "2" (uuid a67c7dfd-3afc-4dd7-8ab6-a57a12d83d40)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "R4") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "power:GND") (at 53.34 113.03 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid fb20f153-811c-45a5-a6e1-cf741b8b4483) + (property "Reference" "#PWR03" (at 53.34 119.38 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "GND" (at 53.34 118.11 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 53.34 113.03 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "" (at 53.34 113.03 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid ebfa3b72-18eb-4f58-a5f8-1f0af5c9e64c)) + (instances + (project "ShelSP" + (path "/5a1571d2-9eab-4efc-8681-53811a5db50d" + (reference "#PWR03") (unit 1) + ) + ) + ) + ) + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000..103cb88 --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,24 @@ +list(APPEND + SOURCES + "main.c" + "net.c" + "http.c" + "utils.c" + + "routes/relay.c" + "routes/settings.c" + "routes/shelly.c" + "routes/status.c" +) + +idf_component_register( + SRCS ${SOURCES} + INCLUDE_DIRS "." + PRIV_REQUIRES + esp_http_server + esp_netif + esp_wifi + esp_wifi + nvs_flash + driver +) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild new file mode 100644 index 0000000..a94ccce --- /dev/null +++ b/main/Kconfig.projbuild @@ -0,0 +1,22 @@ +menu "ShelSP Configuration" + + config SHELLSP_MODEL + string "Shelly Model" + default "1" + help + Shell Model Identifier to be used. + + config SHELLSP_AP_IP_ADDR + string "Static IP address" + default "192.168.33.1" + help + Set static IP address for AP mode. + + config SHELLSP_AP_IP_NETMASK + string "Static netmask address" + default "255.255.255.0" + help + Set static netmask address for AP mode. + + +endmenu \ No newline at end of file diff --git a/main/http.c b/main/http.c new file mode 100644 index 0000000..22077a5 --- /dev/null +++ b/main/http.c @@ -0,0 +1,40 @@ +#include +#include "esp_log.h" + +#include "http.h" +#include "routes/routes.h" + +static const char* TAG = "http"; + +httpd_handle_t start_webserver(void) +{ + httpd_handle_t server = NULL; + httpd_config_t config = HTTPD_DEFAULT_CONFIG(); +#if CONFIG_IDF_TARGET_LINUX + // Setting port as 8001 when building for Linux. Port 80 can be used only by a priviliged user in linux. + // So when a unpriviliged user tries to run the application, it throws bind error and the server is not started. + // Port 8001 can be used by an unpriviliged user as well. So the application will not throw bind error and the + // server will be started. + config.server_port = 8001; +#endif // !CONFIG_IDF_TARGET_LINUX + config.lru_purge_enable = true; + + // Start the httpd server + ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port); + if (httpd_start(&server, &config) == ESP_OK) { + // Set URI handlers + const httpd_uri_t* handler = handlers; + + while (handler->uri) + { + ESP_LOGI(TAG, "Registering URI handler %s", handler->uri); + httpd_register_uri_handler(server, handler); + ++handler; + } + + return server; + } + + ESP_LOGI(TAG, "Error starting server!"); + return NULL; +} diff --git a/main/http.h b/main/http.h new file mode 100644 index 0000000..1ff3e88 --- /dev/null +++ b/main/http.h @@ -0,0 +1,6 @@ +#ifndef HTTP_H +#define HTTP_H + +httpd_handle_t start_webserver(void); + +#endif \ No newline at end of file diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 0000000..6571fdc --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,17 @@ +## IDF Component Manager Manifest File +dependencies: + espressif/mdns: "*" + ## Required IDF version + idf: + version: ">=4.1.0" + # # Put list of dependencies here + # # For components maintained by Espressif: + # component: "~1.0.0" + # # For 3rd party components: + # username/component: ">=1.0.0,<2.0.0" + # username2/component2: + # version: "~1.0.0" + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect dependencies of the `main` component. + # # All dependencies of `main` are public by default. + # public: true diff --git a/main/main.c b/main/main.c new file mode 100644 index 0000000..498639e --- /dev/null +++ b/main/main.c @@ -0,0 +1,47 @@ +/* WiFi softAP Example + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include +#include +#include "esp_event.h" +#include "esp_log.h" +#include "esp_netif.h" +#include "nvs_flash.h" + +#include "net.h" +#include "http.h" + +static const char *TAG = "main"; + +void app_main(void) +{ + esp_err_t ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_ERROR_CHECK(nvs_flash_erase()); + ret = nvs_flash_init(); + } + ESP_ERROR_CHECK(ret); + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + + ESP_LOGI(TAG, "Connecting to Network"); + ESP_ERROR_CHECK(net_connect()); + + ESP_LOGI(TAG, "Starting Server"); + static httpd_handle_t server; + server = start_webserver(); + + ESP_LOGI(TAG, "Busy loop"); + while (server) + { + sleep(5); + } +} diff --git a/main/net.c b/main/net.c new file mode 100644 index 0000000..6d9ec7b --- /dev/null +++ b/main/net.c @@ -0,0 +1,239 @@ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/event_groups.h" +#include "esp_log.h" +#include "esp_check.h" + +#include "utils.h" +#include "net.h" + +static const char *TAG = "net"; + +#if !CONFIG_IDF_TARGET_LINUX + +#include "esp_wifi.h" +#include "esp_mac.h" +#include "esp_event.h" +#include "esp_netif_net_stack.h" +#include "esp_netif.h" +#include "nvs_flash.h" +#include "lwip/inet.h" +#include "lwip/netdb.h" +#include "lwip/sockets.h" +#if IP_NAPT +#include "lwip/lwip_napt.h" +#endif +#include "lwip/err.h" +#include "lwip/sys.h" +#include "mdns.h" + +/* The event group allows multiple bits for each event, but we only care about two events: + * - we are connected to the AP with an IP + * - we failed to connect after the maximum amount of retries */ +#define WIFI_CONNECTED_BIT BIT0 +#define WIFI_FAIL_BIT BIT1 + +static const char *TAG_AP = "net SoftAP"; +static const char *TAG_STA = "net Sta"; + +/* FreeRTOS event group to signal when we are connected/disconnected */ +static EventGroupHandle_t s_wifi_event_group; + +static void wifi_event_handler(void *arg, esp_event_base_t event_base, + int32_t event_id, void *event_data) +{ + static int s_retry_num; + + if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { + esp_wifi_connect(); + } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { + if (s_retry_num < 5) { + esp_wifi_connect(); + s_retry_num++; + ESP_LOGI(TAG, "retry to connect to the AP"); + } else { + xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT); + } + ESP_LOGI(TAG,"connect to the AP fail"); + } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { + ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data; + ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip)); + s_retry_num = 0; + xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT); + } + ESP_LOGI(TAG_STA, "%s, %li", event_base, event_id); +} + +static void setup_mdns() +{ + ESP_ERROR_CHECK(mdns_init()); + + char* id; + asprintf( + &id, + "shelly%s-%02X%02X%02X%02X%02X%02X", + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()) + ); + + ESP_LOGI(TAG, "mDNS hostname: %s", id); + mdns_hostname_set(id); + mdns_instance_name_set(id); + + mdns_txt_item_t serviceTxtData[6] = { + {"discoverable", "true"}, + {"fw_id", "20230913-112003/v1.14.0-gcb84623"}, + {"fw_version", "1.0"}, + {"app", "switch1"}, + {"arch", "esp8266"}, + {"id", id}, + }; + mdns_service_add(NULL, "_http", "_tcp", 80, serviceTxtData, 6); +} + +static bool wifi_init_softap(void) +{ + esp_netif_t* netif = esp_netif_create_default_wifi_ap(); + + wifi_config_t wifi_ap_config = { + .ap = { + .channel = 1, + .max_connection = 5, + .authmode = WIFI_AUTH_OPEN, + .pmf_cfg = { + .required = false, + }, + }, + }; + + char* ssid = (char*)wifi_ap_config.ap.ssid; + snprintf( + ssid, 32, + "shelly%s-%02X%02X%02X%02X%02X%02X", + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()) + ); + wifi_ap_config.ap.ssid_len = strlen(ssid); + + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_ap_config)); + + // Stop DHCP so we can configure it + ESP_ERROR_CHECK(esp_netif_dhcps_stop(netif)); + + // Setting a static IP for setup + // Device is expected to be available at 192.168.33.1 + esp_netif_ip_info_t ip = {0}; + ip.ip.addr = ipaddr_addr(CONFIG_SHELLSP_AP_IP_ADDR); + ip.netmask.addr = ipaddr_addr(CONFIG_SHELLSP_AP_IP_NETMASK); + ip.gw.addr = ipaddr_addr(CONFIG_SHELLSP_AP_IP_ADDR); + ESP_ERROR_CHECK(esp_netif_set_ip_info(netif, &ip)); + + // Turn the DHCP server back on + ESP_ERROR_CHECK(esp_netif_dhcps_start(netif)); + + ESP_LOGI(TAG_AP, "wifi_init_softap finished. SSID:%s", wifi_ap_config.ap.ssid); + + return true; +} + +static bool wifi_init_sta(void) +{ + wifi_config_t wifi_cfg; + ESP_RETURN_ON_FALSE(esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) == ESP_OK, false, TAG_STA, "failed to get wifi sta config"); + + ESP_LOGI(TAG_STA, "BLA BLA SSID IS: %s", (char*)wifi_cfg.sta.ssid); + + if (!strlen((const char*)wifi_cfg.sta.ssid)) + return false; + + esp_netif_create_default_wifi_sta(); + + return true; +} + +esp_err_t net_connect(void) +{ + /* Initialize event group */ + s_wifi_event_group = xEventGroupCreate(); + + /* Register Event handler */ + ESP_ERROR_CHECK( + esp_event_handler_instance_register( + WIFI_EVENT, + ESP_EVENT_ANY_ID, + &wifi_event_handler, + NULL, + NULL + ) + ); + ESP_ERROR_CHECK( + esp_event_handler_instance_register( + IP_EVENT, + IP_EVENT_STA_GOT_IP, + &wifi_event_handler, + NULL, + NULL + ) + ); + + /*Initialize WiFi */ + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); + ESP_ERROR_CHECK(esp_wifi_init(&cfg)); + + ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_FLASH)); + + + // Set APSTA ahead of time so we can check data + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA)); + + if (!wifi_init_softap()) + { + ESP_LOGE(TAG, "Failed to initialize SoftAP"); + } + + bool s = wifi_init_sta(); + ESP_ERROR_CHECK(esp_wifi_start()); + + setup_mdns(); + + if (!s) + { + ESP_LOGI(TAG, "Invalid STA config, not waiting for STA"); + return ESP_OK; + } + + /* + * Wait until either the connection is established (WIFI_CONNECTED_BIT) or + * connection failed for the maximum number of re-tries (WIFI_FAIL_BIT). + * The bits are set by event_handler() (see above) + */ + EventBits_t bits = xEventGroupWaitBits( + s_wifi_event_group, + WIFI_CONNECTED_BIT | WIFI_FAIL_BIT, + pdFALSE, + pdFALSE, + portMAX_DELAY + ); + + /* xEventGroupWaitBits() returns the bits before the call returned, + * hence we can test which event actually happened. */ + if (bits & WIFI_CONNECTED_BIT) { + ESP_LOGI(TAG, "Connected to station, setting STA mode"); + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); + } else if (bits & WIFI_FAIL_BIT) { + ESP_LOGI(TAG, "Failed to connect to station"); + } else { + ESP_LOGE(TAG, "UNEXPECTED EVENT"); + return ESP_FAIL; + } + + return ESP_OK; +} + +#else /* CONFIG_IDF_TARGET_LINUX */ + +esp_err_t net_connect(void) { + ESP_LOGI(TAG, "STUB net_connect()"); + return ESP_OK; +} + +#endif /* !CONFIG_IDF_TARGET_LINUX */ diff --git a/main/net.h b/main/net.h new file mode 100644 index 0000000..8234689 --- /dev/null +++ b/main/net.h @@ -0,0 +1,9 @@ +#ifndef NET_H +#define NET_H + +#include "esp_err.h" + +esp_err_t net_connect(void); + +#endif /* NET_H */ + diff --git a/main/routes/relay.c b/main/routes/relay.c new file mode 100644 index 0000000..460e139 --- /dev/null +++ b/main/routes/relay.c @@ -0,0 +1,130 @@ +#include "esp_log.h" +#include "esp_check.h" + +#include "routes.h" + +static const char *TAG = "routes/relay"; + +#define GPIO_RELAY_PIN 4 + +#if !CONFIG_IDF_TARGET_LINUX +#include "driver/gpio.h" + +static gpio_config_t* get_gpio(void) +{ + static gpio_config_t io_conf; + + if (!io_conf.pin_bit_mask) + { + //disable interrupt + io_conf.intr_type = GPIO_INTR_DISABLE; + //set as output mode + io_conf.mode = GPIO_MODE_OUTPUT; + //bit mask of the pins that you want to set,e.g. GPIO4 + io_conf.pin_bit_mask = (1ULL< 1) + { + char* buf = malloc(query_len); + ESP_RETURN_ON_FALSE(buf, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + if (httpd_req_get_url_query_str(req, buf, query_len) == ESP_OK) { + char param[8]; + + if (httpd_query_key_value(buf, "turn", param, sizeof(param)) == ESP_OK) { + ESP_LOGI(TAG, "Found URL query parameter => turn=%s", param); + + if (!strcmp("on", param)) + { + ESP_LOGI(TAG, "Turned %i on", GPIO_RELAY_PIN); + state = 1; + gpio_set_level(GPIO_RELAY_PIN, state); + } + else if (!strcmp("off", param)) + { + ESP_LOGI(TAG, "Turned %i off", GPIO_RELAY_PIN); + state = 0; + gpio_set_level(GPIO_RELAY_PIN, state); + } + else if (!strcmp("toggle", param)) + { + state = !state; + ESP_LOGI(TAG, "Toggled %i", GPIO_RELAY_PIN); + gpio_set_level(GPIO_RELAY_PIN, state); + } + else + { + resp = strdup("Bad turn!"); + } + } + + if (httpd_query_key_value(buf, "timer", param, sizeof(param)) == ESP_OK) { + ESP_LOGI(TAG, "Found URL query parameter => timer=%s", param); + } + } + + free(buf); + } + + if (!resp) + { + httpd_resp_set_type(req, "application/json"); + resp = relay_json(); + ESP_RETURN_ON_FALSE(resp, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + } + + httpd_resp_sendstr(req, resp); + + free(resp); + + return ESP_OK; +} \ No newline at end of file diff --git a/main/routes/routes.h b/main/routes/routes.h new file mode 100644 index 0000000..34986f7 --- /dev/null +++ b/main/routes/routes.h @@ -0,0 +1,66 @@ +#ifndef ROUTES_H +#define ROUTES_H + +#include + +esp_err_t echo_post_handler(httpd_req_t *req); +esp_err_t shelly_get_handler(httpd_req_t *req); +esp_err_t status_handler(httpd_req_t *req); +esp_err_t settings_handler(httpd_req_t *req); +esp_err_t settings_cloud_handler(httpd_req_t *req); +esp_err_t settings_sta_handler(httpd_req_t *req); +esp_err_t settings_relay_handler(httpd_req_t *req); + +esp_err_t relay_handler(httpd_req_t *req); + +extern int state; +char* relay_json(void); + +static const httpd_uri_t handlers[] = { + { + .uri = "/shelly", + .method = HTTP_GET, + .handler = shelly_get_handler, + .user_ctx = NULL + }, + { + .uri = "/status", + .method = HTTP_GET, + .handler = status_handler, + .user_ctx = NULL + }, + { + .uri = "/settings", + .method = HTTP_GET, + .handler = settings_handler, + .user_ctx = NULL + }, + { + .uri = "/settings/cloud", + .method = HTTP_GET, + .handler = settings_cloud_handler, + .user_ctx = NULL + }, + { + .uri = "/settings/sta", + .method = HTTP_GET, + .handler = settings_sta_handler, + .user_ctx = NULL + }, + { + .uri = "/settings/relay/0", + .method = HTTP_GET, + .handler = settings_relay_handler, + .user_ctx = NULL + }, + + { + .uri = "/relay/0", + .method = HTTP_GET, + .handler = relay_handler, + .user_ctx = NULL + }, + { NULL }, +}; + +#endif \ No newline at end of file diff --git a/main/routes/settings.c b/main/routes/settings.c new file mode 100644 index 0000000..88ca6de --- /dev/null +++ b/main/routes/settings.c @@ -0,0 +1,246 @@ +#include "esp_mac.h" +#include "esp_log.h" +#include "esp_check.h" +#include "esp_wifi.h" + +#include "routes.h" +#include "utils.h" + +static const char *TAG = "routes/settings"; + +char* settings_sta_json(void) +{ + wifi_config_t wifi_cfg; + ESP_ERROR_CHECK(esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg)); + + wifi_mode_t mode; + esp_wifi_get_mode(&mode); + + char* resp = NULL; + + int rc = asprintf( + &resp, + "{" + "\"enabled\":%s," + "\"ssid\":\"%s\"," + "\"ipv4_method\":\"dhcp\"," + "\"ip\":null," + "\"gw\":null," + "\"mask\":null," + "\"dns\":null" + "}", + mode == WIFI_MODE_STA ? "true" : "false", + (const char*)wifi_cfg.sta.ssid + ); + + ESP_RETURN_ON_FALSE(resp && rc, NULL, TAG, "buffer alloc failed"); + + return resp; +} + +char* settings_relay_json(void) +{ + char* resp = NULL; + + int rc = asprintf( + &resp, + "{" + "\"name\":null," + "\"appliance_type\":\"General\"," + "\"ison\":%s," + "\"has_timer\":false," + "\"default_state\":\"off\"," + "\"btn_type\":\"toggle\"," + "\"btn_reverse\":1," + "\"auto_on\":0," + "\"auto_off\":0," + "\"power\":0," + "\"schedule\":false," + "\"schedule_rules\":[]" + "}", + state ? "true" : "false" + ); + + ESP_RETURN_ON_FALSE(resp && rc, NULL, TAG, "buffer alloc failed"); + + return resp; +} + +char* settings_json(void) +{ + + char* sta_data = settings_sta_json(); + if (!sta_data) + sta_data = "{}"; + + char* resp = NULL; + + int rc = asprintf( + &resp, + "{" + "\"device\":{" + "\"type\":\"SHSW-%s\"," + "\"mac\":\"%02X%02X%02X%02X%02X%02X\"," + "\"hostname\":\"shelly%s-%02X%02X%02X%02X%02X%02X\"" + "}," + "\"wifi_ap\":{" + "\"enabled\":false," + "\"ssid\":\"shelly%s-%02X%02X%02X%02X%02X%02X\"," + "\"key\":\"\"" + "}," + "\"wifi_sta\":%s," + "\"wifi_sta1\":{" + "\"enabled\":false," + "\"ssid\":null," + "\"ipv4_method\":\"dhcp\"," + "\"ip\":null," + "\"gw\":null," + "\"mask\":null," + "\"dns\":null" + "}," + "\"ap_roaming\":{" + "\"enabled\":false," + "\"threshold\":-70" + "}," + "\"mqtt\":{" + "\"enable\":false," + "\"server\":\"192.168.33.3:1883\"," + "\"user\":\"\"," + "\"id\":\"shelly%s-%02X%02X%02X%02X%02X%02X\"," + "\"reconnect_timeout_max\":60," + "\"reconnect_timeout_min\":2," + "\"clean_session\":true," + "\"keep_alive\":60," + "\"max_qos\":0," + "\"retain\":false," + "\"update_period\":30" + "}," + "\"coiot\":{" + "\"enabled\":true," + "\"update_period\":15," + "\"peer\":\"\"" + "}," + "\"sntp\":{" + "\"server\":\"time.google.com\"," + "\"enabled\":false" + "}," + "\"login\":{" + "\"enabled\":false," + "\"unprotected\":false," + "\"username\":\"admin\"" + "}," + "\"pin_code\":\"123456\"," + "\"name\":\"shelly%s-%02X%02X%02X%02X%02X%02X\"," + "\"fw\":\"20170427-114337/master@79dbb397\"," + "\"discoverable\":true," + "\"build_info\":{" + "\"build_id\":\"20191112-140800\"," + "\"build_timestamp\":\"2019-11-12T14:08:00Z\"," + "\"build_version\":\"1.0\"" + "}," + "\"cloud\":{" + "\"enabled\":false," + "\"connected\":false" + "}," + "\"timezone\":\"Europe/Sofia\"," + "\"lat\":42.1234," + "\"lng\":24.5678," + "\"tzautodetect\":true," + "\"tz_utc_offset\":0," + "\"tz_dst\":false," + "\"tz_dst_auto\":true," + "\"time\":\"16:40\"," + "\"unixtime\":0," + "\"led_status_disable\":false," + "\"debug_enable\":false," + "\"allow_cross_origin\":false," + "\"wifirecovery_reboot_enabled\":true" + "}", + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()), + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()), + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()), + sta_data, + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()), + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac()) + ); + + ESP_RETURN_ON_FALSE(resp && rc, NULL, TAG, "buffer alloc failed"); + + return resp; +} + +esp_err_t settings_handler(httpd_req_t *req) +{ + char *resp = settings_json(); + ESP_RETURN_ON_FALSE(resp, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + httpd_resp_set_type(req, "application/json"); + httpd_resp_sendstr(req, resp); + return ESP_OK; +} + +esp_err_t settings_cloud_handler(httpd_req_t *req) +{ + httpd_resp_set_type(req, "application/json"); + httpd_resp_sendstr(req, "{\"enabled\":false}"); + return ESP_OK; +} + +esp_err_t settings_sta_handler(httpd_req_t *req) +{ + size_t query_len = httpd_req_get_url_query_len(req) + 1; + + if (query_len > 1) + { + char* buf = malloc(query_len); + ESP_RETURN_ON_FALSE(buf, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + if (httpd_req_get_url_query_str(req, buf, query_len) == ESP_OK) + { + char param[64]; + wifi_config_t wifi_cfg; + ESP_ERROR_CHECK(esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg)); + + if (httpd_query_key_value(buf, "ssid", param, sizeof(param)) == ESP_OK) + { + ESP_LOGI(TAG, "Found URL query parameter => ssid=%s", param); + + size_t s = sizeof(wifi_cfg.sta.ssid); + strncpy((char*)wifi_cfg.sta.ssid, param, s); + wifi_cfg.sta.ssid[s] = '\0'; + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg)); + } + + if (httpd_query_key_value(buf, "key", param, sizeof(param)) == ESP_OK) { + ESP_LOGI(TAG, "Found URL query parameter => key=%s", param); + + size_t s = sizeof(wifi_cfg.sta.password) - 1; + strncpy((char*)wifi_cfg.sta.password, param, s); + wifi_cfg.sta.password[s] = '\0'; + wifi_cfg.sta.threshold.authmode = WIFI_AUTH_WPA2_PSK; + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg)); + } + } + + free(buf); + } + + char* resp = settings_sta_json(); + ESP_RETURN_ON_FALSE(resp, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + httpd_resp_set_type(req, "application/json"); + httpd_resp_sendstr(req, resp); + + return ESP_OK; +} + +esp_err_t settings_relay_handler(httpd_req_t *req) +{ + char *resp = settings_relay_json(); + ESP_RETURN_ON_FALSE(resp, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + httpd_resp_set_type(req, "application/json"); + httpd_resp_sendstr(req, resp); + + return ESP_OK; +} diff --git a/main/routes/shelly.c b/main/routes/shelly.c new file mode 100644 index 0000000..80c0675 --- /dev/null +++ b/main/routes/shelly.c @@ -0,0 +1,44 @@ +#include "esp_mac.h" +#include "esp_log.h" + +#include "utils.h" +#include "routes.h" + +static const char *TAG = "routes/shelly"; + +esp_err_t shelly_get_handler(httpd_req_t *req) +{ + + char* resp = NULL; + int rc = asprintf( + &resp, + "{" + "\"type\":\"SHSW-%s\"," + "\"mac\":\"%02X%02X%02X%02X%02X%02X\"," + "\"auth\":false," + "\"fw\":\"20230913-112003/v1.14.0-gcb84623\"," + "\"discoverable\":true," + "\"longid\":1," + "\"num_outputs\":1" + "}", + CONFIG_SHELLSP_MODEL, MAC2STR(get_wifi_mac())); + + if (!rc || !resp) + { + ESP_LOGE(TAG, "Failed to allocate response"); + + httpd_resp_set_status(req, HTTPD_500); + httpd_resp_send(req, NULL, 0); + + return ESP_FAIL; + } + + httpd_resp_set_status(req, HTTPD_200); + httpd_resp_set_type(req, "application/json"); + + httpd_resp_sendstr(req, resp); + + free(resp); + + return ESP_OK; +} diff --git a/main/routes/status.c b/main/routes/status.c new file mode 100644 index 0000000..eb7853f --- /dev/null +++ b/main/routes/status.c @@ -0,0 +1,43 @@ +#include "esp_mac.h" +#include "esp_log.h" +#include "esp_check.h" + +#include "routes.h" + +static const char *TAG = "routes/status"; + +esp_err_t status_handler(httpd_req_t *req) +{ + char* resp = NULL; + char* relay_resp = relay_json(); + + ESP_RETURN_ON_FALSE(relay_resp, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + int rc = asprintf( + &resp, + "{" + "\"relays\":[%s]," + "\"meters\":[]," + "\"inputs\":" + "[" + "{" + "\"input\":0," + "\"event\":\"\"," + "\"event_cnt\":0" + "}" + "]," + "\"ext_sensors\":{}," + "\"ext_temperature\":{}," + "\"ext_humidity\":{}" + "}", + relay_resp + ); + free(relay_resp); + + ESP_RETURN_ON_FALSE(resp && rc, ESP_ERR_NO_MEM, TAG, "buffer alloc failed"); + + httpd_resp_sendstr(req, resp); + free(resp); + + return ESP_OK; +} diff --git a/main/utils.c b/main/utils.c new file mode 100644 index 0000000..6ec78ac --- /dev/null +++ b/main/utils.c @@ -0,0 +1,12 @@ +#include "esp_mac.h" +#include "esp_log.h" + +uint8_t* get_wifi_mac(void) +{ + static uint8_t mac[6]; + + if (!*mac) + esp_read_mac(mac, ESP_MAC_WIFI_STA); + + return mac; +} diff --git a/main/utils.h b/main/utils.h new file mode 100644 index 0000000..605f1f4 --- /dev/null +++ b/main/utils.h @@ -0,0 +1,6 @@ +#ifndef UTILS_H +#define UTILS_H + +uint8_t* get_wifi_mac(void); + +#endif diff --git a/sdkconfig.ci b/sdkconfig.ci new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3