commit afcb5957e6d9b960b31fec8884b2d98176f41982 Author: minie4 Date: Thu Jul 18 16:53:48 2024 +0200 Add project files diff --git a/README.md b/README.md new file mode 100644 index 0000000..877c843 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# ESPHome Energy Meter + +These are the source files for my ESPHome Energy Meter project, a battery-powered device that reads electricity consumption data from a digital electricity meter and sends the data to a Home Assistant server (or any other MQTT-compatible platform) at configurable intervals. + +The basic idea is to regularly read the SML data transmitted by the electricity meter via its infrared LED, decode the data, and then send the decoded values to an MQTT server via WiFi. These values can then be integrated into Home Assistant using the MQTT integration. + +## 📋 Required Components + +- ESP-01 microcontroller +- Attiny85 microcontroller +- BPW40 infrared phototransistor +- LM358P op amp +- 2x 1MΩ resistor +- 1x 2KΩ resistor + +The additional Attiny85 microcontroller is required because the ESP-01 does not have a built-in brownout detector. Because of this, the ESP does not boot properly when the battery voltage drops below a certain threshold, causing it to overheat. Additionally, the ESP-01 does not support waking up from deep sleep without an external interrupt, unless I manually bridge two tiny contacts on the chip itself. + +In my case, I also needed an op amp because the electricity meter is behind a plastic window, and the signal captured by the phototransistor was not strong enough for the ESP to reliably read the data without any amplification. + +## 🧩 Overview + +The Attiny85 is flashed with the firmware found in the `attiny_firmware/` directory. Its only job is to turn on the ESP-01 every few minutes (the default is 5 minutes) using the ESP's CH-PD pin, make sure the ESP boots up properly (`GPIO 3` is set to HIGH) and then turn the ESP back off if it fails to set `GPIO 3` to HIGH within 200ms or if the ESP is done. + +The ESP-01 is flashed with the [ESPHome](https://esphome.io) firmware (using the [`energy-meter.yaml`](energy-meter.yaml) configuration file). During startup, it sets `GPIO 1` to LOW to notify the Attiny that it has successfully booted. Then, it connects to WiFi, waits for an [SML](https://de.wikipedia.org/wiki/Smart_Message_Language) data transmission from the smart meter on the `UART RX` port, publishes the states to MQTT, and sets `GPIO 1` back to HIGH to signal to the Attiny that it is done. The ESP also measures and sends its own input voltage, which can be used to estimate the remaining battery capacity. + +As a power supply, I am using a battery pack of three rechargeable AA batteries. With a five-minute update interval, the batteries last about one month before needing to be recharged. + +## 🔬 Schematic + +![Schematic](assets/energy-meter-schematic.svg) + +([KiCad Schematic](schematic/energy-meter-schematic.kicad_sch), [PDF Version](schematic/energy-meter-schematic.pdf)) + +## 📦 3D-Printed Case + +The case was designed in [FreeCAD](https://www.freecad.org). Both the [FreeCAD project file](case/energy-meter-case.FCStd) and a [`.3mf` file](case/energy-meter-case.3mf) are available. + +## 🖼️ Photos + +![Assembled Device](assets/photo_assembled.webp) + +![Mounted Device](assets/photo_mounted.webp) diff --git a/assets/energy-meter-schematic.svg b/assets/energy-meter-schematic.svg new file mode 100644 index 0000000..a7b23fb --- /dev/null +++ b/assets/energy-meter-schematic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/photo_assembled.webp b/assets/photo_assembled.webp new file mode 100644 index 0000000..bd8c7f9 Binary files /dev/null and b/assets/photo_assembled.webp differ diff --git a/assets/photo_mounted.webp b/assets/photo_mounted.webp new file mode 100644 index 0000000..1c51537 Binary files /dev/null and b/assets/photo_mounted.webp differ diff --git a/attiny_firmware/.gitignore b/attiny_firmware/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/attiny_firmware/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/attiny_firmware/.vscode/extensions.json b/attiny_firmware/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/attiny_firmware/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/attiny_firmware/include/README b/attiny_firmware/include/README new file mode 100644 index 0000000..194dcd4 --- /dev/null +++ b/attiny_firmware/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/attiny_firmware/lib/README b/attiny_firmware/lib/README new file mode 100644 index 0000000..2593a33 --- /dev/null +++ b/attiny_firmware/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/attiny_firmware/platformio.ini b/attiny_firmware/platformio.ini new file mode 100644 index 0000000..822ccc0 --- /dev/null +++ b/attiny_firmware/platformio.ini @@ -0,0 +1,36 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:attiny85] +platform = atmelavr +board = attiny85 +framework = arduino +upload_protocol = custom +upload_port = /dev/ttyACM0 +upload_speed = 19200 +upload_flags = + -C + ${platformio.packages_dir}/tool-avrdude/avrdude.conf + -p + $BOARD_MCU + -P + $UPLOAD_PORT + -b + $UPLOAD_SPEED + -c + stk500v1 +upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i +lib_deps = connornishijima/TinySnore@^1.0.1 + +monitor_speed=115200 +board_build.f_cpu=1000000L +board_fuses.lfuse = 0x62 +board_fuses.hfuse = 0xD7 +board_fuses.efuse = 0xFF \ No newline at end of file diff --git a/attiny_firmware/src/main.cpp b/attiny_firmware/src/main.cpp new file mode 100644 index 0000000..76f2f4a --- /dev/null +++ b/attiny_firmware/src/main.cpp @@ -0,0 +1,78 @@ +#include "tinysnore.h" +#include + +// Define to enable serial debug +// messages on pin 1 +#define debug + +// Pin connected to the ESP-01's CH_PD pin (Pin 3) +#define esp_enable_pin 4 +// Pin connected to the ESP-01's feedback pin (UTXD / Pin 1) +#define esp_status_pin 3 + +// Wake up the ESP-01 every 5 minutes +const long update_interval = 1000L * 60L * 5L; +// Cut power to the ESP-01 if the update takes longer than 30 seconds +const long update_timeout = 1000L * 30L; + +#ifdef debug +#include +SoftwareSerial Debug(PB0, PB1); +#endif + +void setup() { +#ifdef debug + Debug.begin(9600); + Debug.println("-> Reset"); +#endif + pinMode(esp_enable_pin, OUTPUT); + pinMode(esp_status_pin, INPUT_PULLUP); +} + +unsigned long runESP() { + // Reset the ESP + digitalWrite(esp_enable_pin, LOW); + snore(100); + digitalWrite(esp_enable_pin, HIGH); + // Wait 0.2s for the ESP to boot up + snore(200); + // Wait until either the status pin gets pulled HIGH + // by the ESP or `update_timeout` milliseconds have passed + unsigned long elapsed_time_ms = 0; + while (digitalRead(esp_status_pin) == LOW && + elapsed_time_ms < update_timeout) { + snore(100); + elapsed_time_ms += 100; + } + // Turn off the ESP + digitalWrite(esp_enable_pin, LOW); + + // Return time the mcu was asleep + return 100L + 200L + elapsed_time_ms; +} + +void loop() { + // Store the current time + unsigned long start_time = millis(); +#ifdef debug + Debug.print("Start time: "); + Debug.println(start_time); + Debug.println("-> Running ESP"); +#endif + // Run the ESP and store the sleep time + long elapsed_asleep = runESP(); + // Calculate elapsed time the mcu was awake + long elapsed_awake = millis() - start_time; + // Calculate the total elapsed time + long delta_time = elapsed_awake + elapsed_asleep; + // Sleep until next interval + long sleep_time = max(0, update_interval - delta_time); +#ifdef debug + Debug.println("-> ESP Done"); + Debug.print("Took: "); + Debug.println(delta_time); + Debug.print("-> Sleeping for "); + Debug.println(sleep_time); +#endif + snore(sleep_time); +} \ No newline at end of file diff --git a/attiny_firmware/test/README b/attiny_firmware/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/attiny_firmware/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/case/energy-meter-case.3mf b/case/energy-meter-case.3mf new file mode 100644 index 0000000..6dbb828 Binary files /dev/null and b/case/energy-meter-case.3mf differ diff --git a/case/energy-meter-case.FCStd b/case/energy-meter-case.FCStd new file mode 100644 index 0000000..f5f681e Binary files /dev/null and b/case/energy-meter-case.FCStd differ diff --git a/energy-meter.yaml b/energy-meter.yaml new file mode 100644 index 0000000..a9ae651 --- /dev/null +++ b/energy-meter.yaml @@ -0,0 +1,156 @@ +esphome: + name: energy-meter + friendly_name: energy-meter + on_boot: + - priority: 600.0 + then: + - output.turn_off: watchdog_state + - delay: + seconds: 30 + - if: + condition: + lambda: "return !id(ota_running);" + then: + - output.turn_on: watchdog_state + +esp8266: + board: esp01_1m + +# Stop the device from sleeping while ota is running +globals: + - id: ota_running + type: bool + initial_value: "false" + restore_value: False + +# Disable safe mode so the resets from +# the Attiny watchdog don't trigger safe mode +safe_mode: + disabled: true + +# Enable logging +logger: + baud_rate: 0 + level: INFO + +mqtt: + discovery: true + # Set your MQTT broker IP here! + broker: 192.168.1.2 + birth_message: # Empty - this prevents status reporting as unavailabile in HA + will_message: # Empty - this prevents status reporting as unavailabile in HA + on_message: + topic: energy-meter/sensor/current_power/state + then: + - delay: + seconds: 1 + - if: + condition: + lambda: "return !id(ota_running);" + then: + - output.turn_on: watchdog_state + +ota: + platform: esphome + password: !secret ota_password + on_begin: + then: + - globals.set: + id: ota_running + value: "true" + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + domain: ".lan" + fast_connect: true + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Energy-Meter Fallback Hotspot" + password: !secret hotspot_password + +captive_portal: + +web_server: + port: 80 + +uart: + id: uart_bus + rx_pin: + # RXD0 on ESP-01 + number: 3 + inverted: false + baud_rate: 9600 + data_bits: 8 + parity: NONE + stop_bits: 1 + debug: + +output: + # Communication with Attiny85 watchdog + - platform: gpio + id: watchdog_state + pin: + number: 1 + +sml: + id: mysml + uart_id: uart_bus + +sensor: + - platform: sml + retain: False + name: "Total energy" + sml_id: mysml + obis_code: "1-0:1.8.0" + unit_of_measurement: kWh + accuracy_decimals: 4 + device_class: energy + state_class: total_increasing + filters: + - multiply: 0.0001 + + - platform: sml + retain: False + name: "Total energy (Tarif 1)" + sml_id: mysml + obis_code: "1-0:1.8.1" + unit_of_measurement: kWh + accuracy_decimals: 4 + device_class: energy + state_class: total_increasing + filters: + - multiply: 0.0001 + + - platform: sml + retain: False + name: "Total energy (Tarif 2)" + sml_id: mysml + obis_code: "1-0:1.8.2" + unit_of_measurement: kWh + accuracy_decimals: 4 + device_class: energy + state_class: total_increasing + filters: + - multiply: 0.0001 + + - platform: sml + retain: False + name: "Current power" + sml_id: mysml + obis_code: "1-0:16.7.0" + unit_of_measurement: W + accuracy_decimals: 4 + device_class: power + state_class: measurement + + - platform: adc + pin: VCC + icon: "mdi:battery" + name: "Battery Voltage" + +# The ESP's deep sleep is not being used, but adding it +# may prevent the device from showing as offline in Home Assistant +deep_sleep: + sleep_duration: 5min diff --git a/schematic/energy-meter-schematic.kicad_sch b/schematic/energy-meter-schematic.kicad_sch new file mode 100644 index 0000000..3e558f1 --- /dev/null +++ b/schematic/energy-meter-schematic.kicad_sch @@ -0,0 +1,2799 @@ +(kicad_sch + (version 20231120) + (generator "eeschema") + (generator_version "8.0") + (uuid "c6f13057-f7c7-4601-8c33-66d50f455964") + (paper "A4") + (title_block + (title "ESP Smartmeter Node") + (date "2024-06-28") + (rev "v1.0") + ) + (lib_symbols + (symbol "Amplifier_Operational:LM358" + (pin_names + (offset 0.127) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "U" + (at 0 5.08 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "LM358" + (at 0 -5.08 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "http://www.ti.com/lit/ds/symlink/lm2904-n.pdf" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Low-Power, Dual Operational Amplifiers, DIP-8/SOIC-8/TO-99-8" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_locked" "" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "ki_keywords" "dual opamp" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "SOIC*3.9x4.9mm*P1.27mm* DIP*W7.62mm* TO*99* OnSemi*Micro8* TSSOP*3x3mm*P0.65mm* TSSOP*4.4x3mm*P0.65mm* MSOP*3x3mm*P0.65mm* SSOP*3.9x4.9mm*P0.635mm* LFCSP*2x2mm*P0.5mm* *SIP* SOIC*5.3x6.2mm*P1.27mm*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "LM358_1_1" + (polyline + (pts + (xy -5.08 5.08) (xy 5.08 0) (xy -5.08 -5.08) (xy -5.08 5.08) + ) + (stroke + (width 0.254) + (type default) + ) + (fill + (type background) + ) + ) + (pin output line + (at 7.62 0 180) + (length 2.54) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -7.62 -2.54 0) + (length 2.54) + (name "-" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -7.62 2.54 0) + (length 2.54) + (name "+" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (symbol "LM358_2_1" + (polyline + (pts + (xy -5.08 5.08) (xy 5.08 0) (xy -5.08 -5.08) (xy -5.08 5.08) + ) + (stroke + (width 0.254) + (type default) + ) + (fill + (type background) + ) + ) + (pin input line + (at -7.62 2.54 0) + (length 2.54) + (name "+" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "5" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -7.62 -2.54 0) + (length 2.54) + (name "-" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin output line + (at 7.62 0 180) + (length 2.54) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "7" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (symbol "LM358_3_1" + (pin power_in line + (at -2.54 -7.62 90) + (length 3.81) + (name "V-" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at -2.54 7.62 270) + (length 3.81) + (name "V+" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "8" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "Connector:Screw_Terminal_01x02" + (pin_names + (offset 1.016) hide) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "J" + (at 0 2.54 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "Screw_Terminal_01x02" + (at 0 -5.08 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Generic screw terminal, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "screw terminal" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "TerminalBlock*:*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "Screw_Terminal_01x02_1_1" + (rectangle + (start -1.27 1.27) + (end 1.27 -3.81) + (stroke + (width 0.254) + (type default) + ) + (fill + (type background) + ) + ) + (circle + (center 0 -2.54) + (radius 0.635) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -0.5334 -2.2098) (xy 0.3302 -3.048) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -0.5334 0.3302) (xy 0.3302 -0.508) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -0.3556 -2.032) (xy 0.508 -2.8702) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -0.3556 0.508) (xy 0.508 -0.3302) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (circle + (center 0 0) + (radius 0.635) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (pin passive line + (at -5.08 0 0) + (length 3.81) + (name "Pin_1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at -5.08 -2.54 0) + (length 3.81) + (name "Pin_2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "Device:R" + (pin_numbers hide) + (pin_names + (offset 0) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "R" + (at 2.032 0 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "R" + (at 0 0 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "" + (at -1.778 0 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "R res resistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "R_*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "R_0_1" + (rectangle + (start -1.016 -2.54) + (end 1.016 2.54) + (stroke + (width 0.254) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "R_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 "ESP8266:ESP-01v090" + (pin_names + (offset 1.016) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "U" + (at 0 -2.54 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "ESP-01v090" + (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 yes) + ) + ) + (property "Datasheet" "http://l0l.org.uk/2014/12/esp8266-modules-hardware-guide-gotta-catch-em-all/" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "ESP8266 ESP-01 module, v090" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "MODULE ESP8266 ESP-8266" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "ESP-01*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "ESP-01v090_1_0" + (rectangle + (start -16.51 -8.89) + (end 16.51 8.89) + (stroke + (width 0) + (type solid) + ) + (fill + (type none) + ) + ) + ) + (symbol "ESP-01v090_1_1" + (pin output line + (at -24.13 3.81 0) + (length 7.62) + (name "UTXD" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 24.13 3.81 180) + (length 7.62) + (name "GND" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -24.13 1.27 0) + (length 7.62) + (name "CH_PD" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin tri_state line + (at 24.13 1.27 180) + (length 7.62) + (name "GPIO2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -24.13 -1.27 0) + (length 7.62) + (name "RST" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "5" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin tri_state line + (at 24.13 -1.27 180) + (length 7.62) + (name "GPIO0" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at -24.13 -3.81 0) + (length 7.62) + (name "VCC" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "7" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at 24.13 -3.81 180) + (length 7.62) + (name "URXD" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "8" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "MCU_Microchip_ATtiny:ATtiny85-20P" + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "U" + (at -12.7 13.97 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left bottom) + ) + ) + (property "Value" "ATtiny85-20P" + (at 2.54 -13.97 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left top) + ) + ) + (property "Footprint" "Package_DIP:DIP-8_W7.62mm" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + (italic yes) + ) + (hide yes) + ) + ) + (property "Datasheet" "http://ww1.microchip.com/downloads/en/DeviceDoc/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "20MHz, 8kB Flash, 512B SRAM, 512B EEPROM, debugWIRE, DIP-8" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "AVR 8bit Microcontroller tinyAVR" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "DIP*W7.62mm*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "ATtiny85-20P_0_1" + (rectangle + (start -12.7 -12.7) + (end 12.7 12.7) + (stroke + (width 0.254) + (type default) + ) + (fill + (type background) + ) + ) + ) + (symbol "ATtiny85-20P_1_1" + (pin bidirectional line + (at 15.24 -5.08 180) + (length 2.54) + (name "~{RESET}/PB5" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 15.24 0 180) + (length 2.54) + (name "XTAL1/PB3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 15.24 -2.54 180) + (length 2.54) + (name "XTAL2/PB4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 0 -15.24 90) + (length 2.54) + (name "GND" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 15.24 7.62 180) + (length 2.54) + (name "AREF/PB0" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "5" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 15.24 5.08 180) + (length 2.54) + (name "PB1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 15.24 2.54 180) + (length 2.54) + (name "PB2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "7" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 0 15.24 270) + (length 2.54) + (name "VCC" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "8" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "Sensor_Optical:BPW40" + (pin_names + (offset 0) hide) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "Q" + (at 5.08 1.27 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "BPW40" + (at 5.08 -1.27 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "LED_THT:LED_D5.0mm_Clear" + (at 12.192 -3.556 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "https://www.rcscomponents.kiev.ua/datasheets/bpw40.pdf" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Phototransistor NPN" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "npn phototransistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "LED*D5.0mm*Clear*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "BPW40_0_1" + (polyline + (pts + (xy -1.905 1.27) (xy -2.54 1.27) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.27 2.54) (xy -1.905 2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0.635 0.635) (xy 2.54 2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -3.81 3.175) (xy -1.905 1.27) (xy -1.905 1.905) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -3.175 4.445) (xy -1.27 2.54) (xy -1.27 3.175) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0.635 -0.635) (xy 2.54 -2.54) (xy 2.54 -2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0.635 1.905) (xy 0.635 -1.905) (xy 0.635 -1.905) + ) + (stroke + (width 0.508) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 1.27 -1.778) (xy 1.778 -1.27) (xy 2.286 -2.286) (xy 1.27 -1.778) (xy 1.27 -1.778) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) + (circle + (center 1.27 0) + (radius 2.8194) + (stroke + (width 0.254) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "BPW40_1_1" + (pin passive line + (at 2.54 5.08 270) + (length 2.54) + (name "C" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 2.54 -5.08 90) + (length 2.54) + (name "E" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + (symbol "power:GND" + (power) + (pin_numbers hide) + (pin_names + (offset 0) hide) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "#PWR" + (at 0 -6.35 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (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 yes) + ) + ) + (property "Datasheet" "" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Power symbol creates a global label with name \"GND\" , ground" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "global power" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (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) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + ) + ) + (junction + (at 66.04 104.14) + (diameter 0) + (color 0 0 0 0) + (uuid "1c4cbfa7-b54b-448c-806e-cf32f05d61fa") + ) + (junction + (at 40.64 69.85) + (diameter 0) + (color 0 0 0 0) + (uuid "2541b8a4-3cfc-4470-a834-5389304df6ef") + ) + (junction + (at 49.53 90.17) + (diameter 0) + (color 0 0 0 0) + (uuid "2ac7b149-4554-4a68-a3ba-c3c2a5354b97") + ) + (junction + (at 121.92 71.12) + (diameter 0) + (color 0 0 0 0) + (uuid "3157cad6-6a3b-4cd9-b726-e651431fda88") + ) + (junction + (at 91.44 34.29) + (diameter 0) + (color 0 0 0 0) + (uuid "3ed5e6d5-69fe-4f82-8225-8a3eeb622306") + ) + (junction + (at 29.21 104.14) + (diameter 0) + (color 0 0 0 0) + (uuid "4822620e-96fc-43df-9290-5f2ca492b28d") + ) + (junction + (at 29.21 69.85) + (diameter 0) + (color 0 0 0 0) + (uuid "51bee7a4-a005-4d99-9e10-24b37e8dad7f") + ) + (junction + (at 93.98 49.53) + (diameter 0) + (color 0 0 0 0) + (uuid "7e991efe-4c4d-4834-bcb0-6cfb87db35a9") + ) + (junction + (at 88.9 34.29) + (diameter 0) + (color 0 0 0 0) + (uuid "8fa3738b-b36f-4fd8-8cf7-2f68808592c4") + ) + (junction + (at 93.98 54.61) + (diameter 0) + (color 0 0 0 0) + (uuid "bfc3edf9-da67-4a16-9a37-db2c8eaa55fa") + ) + (junction + (at 50.8 104.14) + (diameter 0) + (color 0 0 0 0) + (uuid "c489f8d1-e068-49e6-b34d-b5143d2c30af") + ) + (junction + (at 29.21 57.15) + (diameter 0) + (color 0 0 0 0) + (uuid "f3848626-e5b2-41ca-a0f0-8ca5259f8492") + ) + (junction + (at 74.93 92.71) + (diameter 0) + (color 0 0 0 0) + (uuid "f7ffaa98-8ae9-4ad9-bb9f-ab46ee602c5a") + ) + (wire + (pts + (xy 106.68 86.36) (xy 95.25 86.36) + ) + (stroke + (width 0) + (type default) + ) + (uuid "0103b35c-6c18-440d-99b4-623c8a61f814") + ) + (wire + (pts + (xy 86.36 52.07) (xy 88.9 52.07) + ) + (stroke + (width 0) + (type default) + ) + (uuid "01366161-4d7f-41ad-ac3d-3f275dc2b2d3") + ) + (wire + (pts + (xy 60.96 104.14) (xy 66.04 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "0e717217-ff16-4a8d-ab9c-0ffc9b9b4618") + ) + (wire + (pts + (xy 97.79 83.82) (xy 97.79 64.77) + ) + (stroke + (width 0) + (type default) + ) + (uuid "147cb48a-1497-47ed-9fb5-65cfd62cef3a") + ) + (wire + (pts + (xy 121.92 54.61) (xy 93.98 54.61) + ) + (stroke + (width 0) + (type default) + ) + (uuid "16244768-4cf7-4cfa-943e-df336df2741a") + ) + (wire + (pts + (xy 35.56 64.77) (xy 35.56 52.07) + ) + (stroke + (width 0) + (type default) + ) + (uuid "17cbcbda-0d85-4c4f-9526-e8341f5a9e10") + ) + (wire + (pts + (xy 93.98 54.61) (xy 93.98 57.15) + ) + (stroke + (width 0) + (type default) + ) + (uuid "1a20a6f7-0772-4122-972e-d835fc5a6958") + ) + (wire + (pts + (xy 40.64 90.17) (xy 49.53 90.17) + ) + (stroke + (width 0) + (type default) + ) + (uuid "1e777d8f-97d8-4ada-8a79-5e1a5a774a56") + ) + (wire + (pts + (xy 62.23 78.74) (xy 74.93 78.74) + ) + (stroke + (width 0) + (type default) + ) + (uuid "25966eb2-2017-4c19-87d1-05b9cd79c818") + ) + (wire + (pts + (xy 29.21 34.29) (xy 29.21 57.15) + ) + (stroke + (width 0) + (type default) + ) + (uuid "2e545b6e-ee3b-4e86-b78a-51a26a6cdf80") + ) + (wire + (pts + (xy 40.64 76.2) (xy 40.64 69.85) + ) + (stroke + (width 0) + (type default) + ) + (uuid "2e71c128-c59c-4764-99a2-72030c66e756") + ) + (wire + (pts + (xy 88.9 34.29) (xy 91.44 34.29) + ) + (stroke + (width 0) + (type default) + ) + (uuid "33bb5c4f-db07-4400-97dd-de7421cc3ac5") + ) + (wire + (pts + (xy 29.21 34.29) (xy 88.9 34.29) + ) + (stroke + (width 0) + (type default) + ) + (uuid "38deff24-fc1f-4419-ab6b-4868c4a75227") + ) + (wire + (pts + (xy 74.93 92.71) (xy 88.9 92.71) + ) + (stroke + (width 0) + (type default) + ) + (uuid "3b9b7f54-2153-4042-b980-56c7130e2fad") + ) + (wire + (pts + (xy 74.93 78.74) (xy 74.93 92.71) + ) + (stroke + (width 0) + (type default) + ) + (uuid "3f6e93d7-11ff-463d-8a97-11a3598d893a") + ) + (wire + (pts + (xy 48.26 104.14) (xy 50.8 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "4583c147-aa27-43f8-98ec-bcea11545f2d") + ) + (wire + (pts + (xy 66.04 85.09) (xy 66.04 69.85) + ) + (stroke + (width 0) + (type default) + ) + (uuid "48758a08-3db1-473a-8d40-f10e9d59c60b") + ) + (wire + (pts + (xy 93.98 49.53) (xy 93.98 36.83) + ) + (stroke + (width 0) + (type default) + ) + (uuid "52077f17-ef07-4668-a456-e15fe996e45b") + ) + (wire + (pts + (xy 33.02 67.31) (xy 33.02 49.53) + ) + (stroke + (width 0) + (type default) + ) + (uuid "5987da51-90ef-46fe-8a73-4af2fa812fdc") + ) + (wire + (pts + (xy 29.21 69.85) (xy 40.64 69.85) + ) + (stroke + (width 0) + (type default) + ) + (uuid "59d7d057-a5cc-4d12-a070-d0c1d92d63e7") + ) + (wire + (pts + (xy 66.04 100.33) (xy 66.04 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "674396ad-6854-4859-8f24-e90c599f8fd6") + ) + (wire + (pts + (xy 121.92 72.39) (xy 121.92 71.12) + ) + (stroke + (width 0) + (type default) + ) + (uuid "6927bccf-2769-4b64-96f3-7c1623e83a1b") + ) + (wire + (pts + (xy 106.68 83.82) (xy 97.79 83.82) + ) + (stroke + (width 0) + (type default) + ) + (uuid "6aa92355-8e82-4503-80de-be21fab25bbf") + ) + (wire + (pts + (xy 97.79 64.77) (xy 35.56 64.77) + ) + (stroke + (width 0) + (type default) + ) + (uuid "6b301266-07d4-4427-a22b-d746209436bb") + ) + (wire + (pts + (xy 29.21 57.15) (xy 38.1 57.15) + ) + (stroke + (width 0) + (type default) + ) + (uuid "70116f83-3059-427b-be1d-6724f10f6e02") + ) + (wire + (pts + (xy 29.21 104.14) (xy 29.21 115.57) + ) + (stroke + (width 0) + (type default) + ) + (uuid "74d612a4-3bce-4846-a978-b6bf06525d77") + ) + (wire + (pts + (xy 86.36 54.61) (xy 91.44 54.61) + ) + (stroke + (width 0) + (type default) + ) + (uuid "76e50822-3c45-4450-97a8-ef3538e43075") + ) + (wire + (pts + (xy 29.21 69.85) (xy 29.21 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "782017d3-6baa-429e-878e-2370f7caf0c5") + ) + (wire + (pts + (xy 95.25 86.36) (xy 95.25 67.31) + ) + (stroke + (width 0) + (type default) + ) + (uuid "7b8b5d05-88f4-4a83-8b5b-b6a64f290fb5") + ) + (wire + (pts + (xy 86.36 49.53) (xy 93.98 49.53) + ) + (stroke + (width 0) + (type default) + ) + (uuid "8508c34f-7e77-4007-9e91-b16f68c9ef24") + ) + (wire + (pts + (xy 29.21 115.57) (xy 121.92 115.57) + ) + (stroke + (width 0) + (type default) + ) + (uuid "8d637db0-1038-41cb-b18d-8587102df696") + ) + (wire + (pts + (xy 40.64 86.36) (xy 40.64 90.17) + ) + (stroke + (width 0) + (type default) + ) + (uuid "8dc25bb3-99c0-4809-b8ff-41fa1776ee0c") + ) + (wire + (pts + (xy 57.15 90.17) (xy 49.53 90.17) + ) + (stroke + (width 0) + (type default) + ) + (uuid "9888fc2c-b2bc-4c46-837e-841a3ae35574") + ) + (wire + (pts + (xy 121.92 71.12) (xy 121.92 54.61) + ) + (stroke + (width 0) + (type default) + ) + (uuid "9e9afd18-7002-41c1-ba14-3a102fc9577c") + ) + (wire + (pts + (xy 49.53 78.74) (xy 54.61 78.74) + ) + (stroke + (width 0) + (type default) + ) + (uuid "a1ee679a-bbc4-45b5-ae89-c7ca4070bd34") + ) + (wire + (pts + (xy 88.9 92.71) (xy 88.9 57.15) + ) + (stroke + (width 0) + (type default) + ) + (uuid "a99d7529-ccf8-4a72-aba7-130cc106f739") + ) + (wire + (pts + (xy 88.9 57.15) (xy 86.36 57.15) + ) + (stroke + (width 0) + (type default) + ) + (uuid "ac0e06c9-ebe8-4ed0-9dbb-70b745504703") + ) + (wire + (pts + (xy 91.44 54.61) (xy 91.44 34.29) + ) + (stroke + (width 0) + (type default) + ) + (uuid "b6433c9f-c861-41eb-b194-d05e4d1d11e7") + ) + (wire + (pts + (xy 72.39 92.71) (xy 74.93 92.71) + ) + (stroke + (width 0) + (type default) + ) + (uuid "bccefb1e-ab1c-4642-ac0a-f83af88a6233") + ) + (wire + (pts + (xy 50.8 95.25) (xy 50.8 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "bfd14332-48d0-46ea-8f07-2b8b2b80e4d0") + ) + (wire + (pts + (xy 49.53 90.17) (xy 49.53 78.74) + ) + (stroke + (width 0) + (type default) + ) + (uuid "c0550a44-afbd-4e20-8671-50a1caa75ff3") + ) + (wire + (pts + (xy 93.98 36.83) (xy 105.41 36.83) + ) + (stroke + (width 0) + (type default) + ) + (uuid "c45a84b4-b6d1-4bf5-8fbf-b4d34b8651b0") + ) + (wire + (pts + (xy 33.02 49.53) (xy 38.1 49.53) + ) + (stroke + (width 0) + (type default) + ) + (uuid "c667d492-8d75-47db-9155-3a342fe304dc") + ) + (wire + (pts + (xy 121.92 115.57) (xy 121.92 101.6) + ) + (stroke + (width 0) + (type default) + ) + (uuid "ce29af35-a5ee-4f57-ac3b-fe9366d2a002") + ) + (wire + (pts + (xy 88.9 52.07) (xy 88.9 34.29) + ) + (stroke + (width 0) + (type default) + ) + (uuid "d6b1b1c3-23db-44f3-82ac-e1b4dbc5e26b") + ) + (wire + (pts + (xy 66.04 104.14) (xy 66.04 105.41) + ) + (stroke + (width 0) + (type default) + ) + (uuid "dce234b7-4d38-4d58-bd1a-6591cd26cdc1") + ) + (wire + (pts + (xy 35.56 52.07) (xy 38.1 52.07) + ) + (stroke + (width 0) + (type default) + ) + (uuid "e935bdf7-d8ff-4f6f-88e7-3096bdfd08ff") + ) + (wire + (pts + (xy 95.25 67.31) (xy 33.02 67.31) + ) + (stroke + (width 0) + (type default) + ) + (uuid "ed6c0e1c-bf76-414f-860c-87860cedf3b5") + ) + (wire + (pts + (xy 40.64 69.85) (xy 66.04 69.85) + ) + (stroke + (width 0) + (type default) + ) + (uuid "ef03782b-7c8b-457d-b700-714e276627d6") + ) + (wire + (pts + (xy 57.15 95.25) (xy 50.8 95.25) + ) + (stroke + (width 0) + (type default) + ) + (uuid "ef2b12dc-c05e-41fb-87cf-1c812ed81e39") + ) + (wire + (pts + (xy 29.21 57.15) (xy 29.21 69.85) + ) + (stroke + (width 0) + (type default) + ) + (uuid "f0dccfee-85ee-4633-869b-d1f89685fe86") + ) + (wire + (pts + (xy 50.8 104.14) (xy 53.34 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "f4f64c8b-0603-4e4b-b2b7-8cea8edbaaa8") + ) + (wire + (pts + (xy 93.98 49.53) (xy 93.98 54.61) + ) + (stroke + (width 0) + (type default) + ) + (uuid "f7609efd-e8f9-4bc6-a48c-49ad8f68cccf") + ) + (wire + (pts + (xy 40.64 104.14) (xy 29.21 104.14) + ) + (stroke + (width 0) + (type default) + ) + (uuid "f775c618-5648-4f4d-bec8-57ba856c0c0a") + ) + (wire + (pts + (xy 91.44 34.29) (xy 105.41 34.29) + ) + (stroke + (width 0) + (type default) + ) + (uuid "ffe9c320-2a4f-47d5-a339-378540522e1c") + ) + (symbol + (lib_id "Amplifier_Operational:LM358") + (at 64.77 92.71 0) + (mirror x) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "1121459c-b670-4372-9ee1-3343a1fbf328") + (property "Reference" "U2" + (at 65.024 92.964 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "LM358" + (at 61.722 100.33 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "LM358:DIP8_300" + (at 64.77 92.71 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "http://www.ti.com/lit/ds/symlink/lm2904-n.pdf" + (at 64.77 92.71 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Low-Power, Dual Operational Amplifiers, DIP-8/SOIC-8/TO-99-8" + (at 64.77 92.71 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "8" + (uuid "5383ecbc-e4a4-4a00-877f-8af6906394ff") + ) + (pin "3" + (uuid "df919387-0b0c-432f-9a8f-8870fbbabb63") + ) + (pin "2" + (uuid "afee4c5d-5671-48ed-973d-7e63ce7d4f99") + ) + (pin "1" + (uuid "0f7250ad-fed1-455c-88af-97c4227e862c") + ) + (pin "4" + (uuid "35b80b14-d879-4205-b26e-22bbd11c018a") + ) + (pin "7" + (uuid "e04e66c8-01d2-4c34-bd5f-483813c4f24d") + ) + (pin "5" + (uuid "0e851b18-1e05-466a-8127-abe74ce35092") + ) + (pin "6" + (uuid "bcd33606-bf44-4cbe-b57b-b4ad3135a860") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "U2") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "power:GND") + (at 93.98 57.15 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "29258747-98c1-46d8-a83d-336c0264a159") + (property "Reference" "#PWR01" + (at 93.98 63.5 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Value" "GND" + (at 93.98 62.23 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "" + (at 93.98 57.15 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 93.98 57.15 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Power symbol creates a global label with name \"GND\" , ground" + (at 93.98 57.15 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "08832bc3-f7cb-4af9-b6fd-beece8337b74") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "#PWR01") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "Amplifier_Operational:LM358") + (at 68.58 92.71 0) + (unit 3) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "36d097fd-8c20-4f2a-a29a-feab120eabc4") + (property "Reference" "U2" + (at 67.31 91.4399 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Value" "LM358" + (at 67.31 93.9799 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Footprint" "LM358:DIP8_300" + (at 68.58 92.71 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "http://www.ti.com/lit/ds/symlink/lm2904-n.pdf" + (at 68.58 92.71 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Low-Power, Dual Operational Amplifiers, DIP-8/SOIC-8/TO-99-8" + (at 68.58 92.71 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "8" + (uuid "5383ecbc-e4a4-4a00-877f-8af690639500") + ) + (pin "3" + (uuid "318bb934-9197-4c2f-839a-d4a930f85815") + ) + (pin "2" + (uuid "795552d7-86e7-463a-97c5-cca4b4127567") + ) + (pin "1" + (uuid "f8ce706d-6ac9-4c64-a1fd-4f592500d1b0") + ) + (pin "4" + (uuid "35b80b14-d879-4205-b26e-22bbd11c018b") + ) + (pin "7" + (uuid "e04e66c8-01d2-4c34-bd5f-483813c4f24e") + ) + (pin "5" + (uuid "0e851b18-1e05-466a-8127-abe74ce35093") + ) + (pin "6" + (uuid "bcd33606-bf44-4cbe-b57b-b4ad3135a861") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "U2") + (unit 3) + ) + ) + ) + ) + (symbol + (lib_id "Device:R") + (at 57.15 104.14 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "5ca962e8-2b2f-43cd-a9e3-c43e11eafc35") + (property "Reference" "R2" + (at 57.15 99.822 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "1M" + (at 57.15 101.854 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal" + (at 57.15 105.918 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 57.15 104.14 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 57.15 104.14 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "2" + (uuid "823959bd-c8f9-4c2e-8ff8-222b9c7858ea") + ) + (pin "1" + (uuid "7a38fa50-8ea6-47b9-bfab-8fcf5a859310") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "R2") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "power:GND") + (at 66.04 105.41 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "7757c6d9-65e9-4d19-bfed-abffb5c2836d") + (property "Reference" "#PWR03" + (at 66.04 111.76 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Value" "GND" + (at 66.04 110.49 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "" + (at 66.04 105.41 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 66.04 105.41 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Power symbol creates a global label with name \"GND\" , ground" + (at 66.04 105.41 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "4199b493-1b0e-449a-9522-4670591a12a7") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "#PWR03") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "ESP8266:ESP-01v090") + (at 62.23 53.34 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "95117eba-d750-4f14-87f9-6c291171ff5f") + (property "Reference" "U1" + (at 62.23 39.37 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "ESP-01v090" + (at 62.23 41.91 0) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "ESP8266:ESP-01" + (at 62.23 53.34 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "http://l0l.org.uk/2014/12/esp8266-modules-hardware-guide-gotta-catch-em-all/" + (at 62.23 53.34 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "ESP8266 ESP-01 module, v090" + (at 62.23 53.34 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "7" + (uuid "88b6882c-4b80-4148-be5b-0679cfec8d7e") + ) + (pin "6" + (uuid "c5eb218a-320e-4793-9f77-addfec43be86") + ) + (pin "2" + (uuid "6e985382-4e9c-4890-b245-d9e180d35eca") + ) + (pin "1" + (uuid "cbba95a9-a9b1-477d-bddc-f0bffeceb233") + ) + (pin "8" + (uuid "7bcc1012-b588-4ec6-9bc1-d897f84e7460") + ) + (pin "3" + (uuid "5e94b99c-5a97-4091-aa3a-275761f05ff6") + ) + (pin "5" + (uuid "818d9ee1-5329-4efe-ad17-0e52b1676ee6") + ) + (pin "4" + (uuid "397809e9-f355-443d-a2ca-d00fe140dd5e") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "U1") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "Sensor_Optical:BPW40") + (at 38.1 81.28 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "9988f177-9baa-4c94-b24a-f1e87be6593c") + (property "Reference" "Q1" + (at 42.672 79.248 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "BPW40" + (at 42.672 81.788 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "LED_THT:LED_D5.0mm_Clear" + (at 50.292 84.836 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "https://www.rcscomponents.kiev.ua/datasheets/bpw40.pdf" + (at 38.1 81.28 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Phototransistor NPN" + (at 38.1 81.28 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "2" + (uuid "518fb33e-095d-4a83-85a2-3d681aa4cff7") + ) + (pin "1" + (uuid "6ac1e4cb-4611-4e9e-9416-15daace3608c") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "Q1") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "MCU_Microchip_ATtiny:ATtiny85-20P") + (at 121.92 86.36 180) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "ab48d539-52fa-4d12-bd7a-12dc1b0aa515") + (property "Reference" "U3" + (at 135.89 85.0899 0) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + ) + ) + (property "Value" "ATtiny85-20P" + (at 135.89 87.6299 0) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + ) + ) + (property "Footprint" "Package_DIP:DIP-8_W7.62mm" + (at 121.92 86.36 0) + (effects + (font + (size 1.27 1.27) + (italic yes) + ) + (hide yes) + ) + ) + (property "Datasheet" "http://ww1.microchip.com/downloads/en/DeviceDoc/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf" + (at 121.92 86.36 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "20MHz, 8kB Flash, 512B SRAM, 512B EEPROM, debugWIRE, DIP-8" + (at 121.92 86.36 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "5" + (uuid "b36d2576-ccc0-450c-8a44-3fb8e3680dcc") + ) + (pin "4" + (uuid "e01a3991-3c55-4024-868c-8f7e0a15a138") + ) + (pin "2" + (uuid "5f017523-0597-4861-880a-a44d47f39667") + ) + (pin "1" + (uuid "6502a1fe-8dba-49e4-a972-3e8c3ed9452a") + ) + (pin "7" + (uuid "bbbee79e-2301-4e07-ade6-6265cd52b0f8") + ) + (pin "6" + (uuid "fd432ccc-a70a-488e-8337-1af966ae1774") + ) + (pin "3" + (uuid "4ade4245-cc92-418e-a29f-c3aed3363005") + ) + (pin "8" + (uuid "73d10e34-908b-40c0-8e30-2ec94eaff244") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "U3") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "Connector:Screw_Terminal_01x02") + (at 110.49 34.29 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "ab67a914-139f-49ed-be0e-18e43b86e0a0") + (property "Reference" "VCC1" + (at 113.03 34.2899 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "GND" + (at 113.03 36.8299 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "TerminalBlock:TerminalBlock_bornier-2_P5.08mm" + (at 110.49 34.29 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 110.49 34.29 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Generic screw terminal, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)" + (at 110.49 34.29 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "f2bad11e-d872-4454-a21e-592aa4b861f3") + ) + (pin "2" + (uuid "e49dd3f2-1bf8-45f0-9b85-a7be4da70019") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "VCC1") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "Device:R") + (at 44.45 104.14 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "bee1a7c2-d23e-4644-8d58-ba24af977f8c") + (property "Reference" "R1" + (at 44.45 99.822 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "1M" + (at 44.45 101.854 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal" + (at 44.45 105.918 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 44.45 104.14 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 44.45 104.14 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "e8bfc7c7-d684-47dc-ae06-e63c693ea893") + ) + (pin "2" + (uuid "5134148a-8711-490d-a34c-9d6b28830712") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "R1") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "Device:R") + (at 58.42 78.74 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "f9da12e2-3de3-44d1-bbae-e2ed52dbbec7") + (property "Reference" "R3" + (at 58.674 74.422 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "2K" + (at 58.674 76.454 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal" + (at 58.42 80.518 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 58.42 78.74 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 58.42 78.74 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "2" + (uuid "e7960fb9-7227-462e-926b-74fe89a7a61b") + ) + (pin "1" + (uuid "32abe75c-5e1e-49ef-bf53-08ffc18c8e6e") + ) + (instances + (project "esp_smartmeter_node_supervised" + (path "/c6f13057-f7c7-4601-8c33-66d50f455964" + (reference "R3") + (unit 1) + ) + ) + ) + ) + (sheet_instances + (path "/" + (page "1") + ) + ) +) diff --git a/schematic/energy-meter-schematic.pdf b/schematic/energy-meter-schematic.pdf new file mode 100644 index 0000000..eeccaf2 Binary files /dev/null and b/schematic/energy-meter-schematic.pdf differ