{"id":15416967,"url":"https://github.com/blueandi/avr-net-io-smartmeter","last_synced_at":"2026-05-09T02:18:31.023Z","repository":{"id":89190826,"uuid":"310860242","full_name":"BlueAndi/avr-net-io-smartmeter","owner":"BlueAndi","description":"Smartmeter server based on a AVR-NET-IO board.","archived":false,"fork":false,"pushed_at":"2024-03-22T23:02:57.000Z","size":2659,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T03:41:23.868Z","etag":null,"topics":["arduino","avr-net-io","cpp11","platformio","smartmeter"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlueAndi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-07T14:17:48.000Z","updated_at":"2022-03-10T16:41:48.000Z","dependencies_parsed_at":"2024-10-21T15:40:17.291Z","dependency_job_id":null,"html_url":"https://github.com/BlueAndi/avr-net-io-smartmeter","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"cc1540bb0d1b98f6d1cd9d6f768f6f8a39db48d1"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/BlueAndi/avr-net-io-smartmeter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Favr-net-io-smartmeter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Favr-net-io-smartmeter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Favr-net-io-smartmeter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Favr-net-io-smartmeter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlueAndi","download_url":"https://codeload.github.com/BlueAndi/avr-net-io-smartmeter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Favr-net-io-smartmeter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32804672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","avr-net-io","cpp11","platformio","smartmeter"],"created_at":"2024-10-01T17:14:18.752Z","updated_at":"2026-05-09T02:18:30.994Z","avatar_url":"https://github.com/BlueAndi.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AVR-NET-IO-Smartmeter\r\nA simple smartmeter which is connected to a S0-interface and counts the energy consumption or provides the current power consumption. The informations can be read via REST-API.\r\n\r\nIt runs on the [Pollin AVR-NET-IO](https://www.pollin.de/p/avr-net-io-fertigmodul-810073) board.\r\n\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)\r\n[![Repo Status](https://www.repostatus.org/badges/latest/inactive.svg)](https://www.repostatus.org/#inactive)\r\n[![Release](https://img.shields.io/github/release/BlueAndi/avr-net-io-smartmeter.svg)](https://github.com/BlueAndi/avr-net-io-smartmeter/releases)\r\n[![PlatformIO CI](https://github.com/BlueAndi/avr-net-io-smartmeter/workflows/PlatformIO%20CI/badge.svg?branch=main)](https://github.com/BlueAndi/avr-net-io-smartmeter/actions?query=workflow%3A%22PlatformIO+CI%22)\r\n\r\n* [AVR-NET-IO-Smartmeter](#avr-net-io-smartmeter)\r\n* [Motivation](#motivation)\r\n* [Usage](#usage)\r\n* [Electronic](#electronic)\r\n* [Software](#software)\r\n  * [IDE](#ide)\r\n  * [Installation](#installation)\r\n  * [Install bootloader](#install-bootloader)\r\n  * [Change MAC address of network interface controller](#change-mac-address-of-network-interface-controller)\r\n  * [Build Project](#build-project)\r\n  * [Update of the device](#update-of-the-device)\r\n    * [Update via serial interface](#update-via-serial-interface)\r\n  * [Used Libraries](#used-libraries)\r\n* [REST API](#rest-api)\r\n  * [Get data from one single S0 interface (GET /api/s0-interface/\\\u003cs0-interface-id\\\u003e)](#get-data-from-one-single-s0-interface-get-apis0-interfaces0-interface-id)\r\n  * [Get data from all S0 interfaces at once (GET /api/s0-interfaces)](#get-data-from-all-s0-interfaces-at-once-get-apis0-interfaces)\r\n* [Issues, Ideas And Bugs](#issues-ideas-and-bugs)\r\n* [License](#license)\r\n* [Contribution](#contribution)\r\n\r\n# Motivation\r\nThe idea was to have a simple way to get the power consumption of the heatpump and the rest of the house. The data shall be provided over a REST-API, which can easily be used from e.g. bash via curl. The data is retrieved periodically, pushed to a [influx-database](https://www.influxdata.com/) and visualized with [grafana](https://grafana.com/).\r\n\r\nUp to 8 S0 interface would be possible with the AVR-NET-IO board, but because of RAM limitation only 2 are configured. More may be possible, but that was never verified.\r\n\r\n# Usage\r\n\r\n1. Connect your S0 signal with the board, see the table in the next chapter.\r\n2. Configure S0 interface (0-1) by browsing to http://\u0026lt;device-ip-address\u0026gt;/configure/\u0026lt;s0-interface\u0026gt; with your favorite browser. Replace \u0026lt;s0-interface\u0026gt; with the S0 interface id.\r\n3. Configure the S0 interface and enable it.\r\n\r\n# Electronic\r\n\r\n* [Pollin AVR-NET-IO](https://www.pollin.de/p/avr-net-io-fertigmodul-810073)\r\n\r\nNote, the AVR-NET-IO has original a ATmega32-16PU, which was replaced with a ATmega644p.\r\n\r\n\u003e [!WARNING]  \r\n\u003e 2024-01-01: The Pollin AVR-NET-IO development is obsolete and not available anymore.\\\r\n\u003e There is no known successor development board.\r\n\r\nThe following table shows the possible connections for S0 signals.\r\n\r\n| Terminal | Name | MCU Pin | Arduino Pin |\r\n| -------- | ---- |-------- | ----------- |\r\n| J3 | Input 1 | PA0 | 24 |\r\n| J3 | Input 2 | PA1 | 25 |\r\n| J3 | Input 3 | PA2 | 26 |\r\n| J3 | Input 4 | PA3 | 27 |\r\n| J9 | ADC1 | PA4 | 28 |\r\n| J9 | ADC2 | PA5 | 29 |\r\n| J7 | ADC3 | PA6 | 30 |\r\n| J7 | ADC4 | PA7 | 31 |\r\n\r\n# Software\r\n\r\n## IDE\r\nThe [PlatformIO IDE](https://platformio.org/platformio-ide) is used for the development. Its build on top of Microsoft Visual Studio Code.\r\n\r\n## Installation\r\n1. Install [VSCode](https://code.visualstudio.com/).\r\n2. Install PlatformIO IDE according to this [HowTo](https://platformio.org/install/ide?install=vscode).\r\n3. Close and start VSCode again.\r\n4. Recommended is to take a look to the [quick-start guide](https://docs.platformio.org/en/latest/ide/vscode.html#quick-start).\r\n\r\n## Install bootloader\r\nNote, for the following steps I used the AtmelStudio v7.0 with my AVR-ISP programmer, because I didn't manage to get this setup work with VSCode + Platformio or the Arduino IDE.\r\n1. Set fuse bits: lfuse = 0xf7, hfuse = 0xd6, efuse = 0xfd\r\n2. The MightyCore provides in the platformio installation directy bootloaders. Choose ```.platformio/packages/framework-arduino-avr-mightycore/bootloaders/optiboot_flash/bootloaders/atmega644p/16000000L/optiboot_flash_atmega644p_UART0_115200_16000000L_B0_BIGBOOT.hex```\r\n3. If the bootloader is active, two pulses are shown on pin B0 (= Arduino pin 0), which can be checked with a oscilloscope.\r\n\r\nAfter the bootloader is installed and running, the typical Arduino upload can be used over the serial interface.\r\n\r\n## Change MAC address of network interface controller\r\nEvery AVR-NET-IO board comes with a unique MAC address of the network interface controller. Before you build the software it is necessary to set it in the sourcecode. Therefore open ```./src/main.cpp``` in the editor, search for the variable ```DEVICE_MAC_ADDR``` and change it accordingly.\r\n\r\n## Build Project\r\n1. Load workspace in VSCode.\r\n2. Change to PlatformIO toolbar.\r\n3. _Project Tasks -\u003e Build All_ or via hotkey ctrl-alt-b\r\n\r\n## Update of the device\r\n\r\n### Update via serial interface\r\n1. Connect the AVR-NET-IO board to your PC via serial interface.\r\n2. Build and upload the software via _Project Tasks -\u003e Upload All_.\r\n3. Note, if the AVR-NET-IO board is not modified, you need to keep it off until in the console ```Uploading .pio\\build\\MightyCore\\firmware.hex``` is shown. Just in this moment power the board and the upload starts.\r\n\r\n## Used Libraries\r\n* [MightyCore](https://github.com/MCUdude/MightyCore) - Arduino core for ATmega644.\r\n* [EthernetENC](https://github.com/jandrassy/EthernetENC) - Ethernet library for ENC28J60 with Arduino compatible interface.\r\n* [ArduinoHttpServer](https://github.com/QuickSander/ArduinoHttpServer) - Server side minimalistic object oriented HTTP protocol implementation.\r\n* [ArduinoJSON](https://arduinojson.org/) - JSON library.\r\n\r\n# REST API\r\n\r\n## Get data from one single S0 interface (GET /api/s0-interface/\u0026lt;s0-interface-id\u0026gt;)\r\nGet S0 interface data:\r\n* S0 interface unique id.\r\n* S0 interface name.\r\n* The current power consumption in W.\r\n* Number of counted pulses.\r\n* Energy consumption in Wh, depended on the number of counted pulses.\r\n\r\n```\u003cs0-interface-id\u003e```:\r\n* The S0 interface id is in range [0; 1].\r\n\r\nResponse:\r\n```json\r\n{\r\n  \"data\": {\r\n    \"id\": 0,\r\n    \"name\": \"S0-0\",\r\n    \"pulsesPer1KWh\": 1000,\r\n    \"powerConsumption\": 230,\r\n    \"pulses\": 40,\r\n    \"energyConsumption\": 460\r\n  },\r\n  \"status\":0\r\n}\r\n```\r\n\r\nStatus 0 means successful. If the request fails, it the status will be non-zero and data is empty.\r\n\r\n## Get data from all S0 interfaces at once (GET /api/s0-interfaces)\r\nGet data from all S0 interfaces at once.\r\n\r\nA S0 interface contains the following data:\r\n* S0 interface unique id.\r\n* S0 interface name.\r\n* The current power consumption in W.\r\n* Number of counted pulses.\r\n* Energy consumption in Wh, depended on the number of counted pulses.\r\n\r\nResponse:\r\n```json\r\n{\r\n  \"data\": [{\r\n    \"id\": 0,\r\n    \"name\": \"S0-0\",\r\n    \"pulsesPer1KWh\": 1000,\r\n    \"powerConsumption\": 230,\r\n    \"pulses\": 40,\r\n    \"energyConsumption\": 460\r\n  }, {\r\n    \"id\": 1,\r\n    \"name\": \"S0-1\",\r\n    \"pulsesPer1KWh\": 1000,\r\n    \"powerConsumption\": 50,\r\n    \"pulses\": 20,\r\n    \"energyConsumption\": 100\r\n  }],\r\n  \"status\":0\r\n}\r\n```\r\n\r\nStatus 0 means successful. If the request fails, it the status will be non-zero and data is empty.\r\n\r\n# Issues, Ideas And Bugs\r\nIf you have further ideas or you found some bugs, great! Create a [issue](https://github.com/BlueAndi/avr-net-io-smartmeter/issues) or if you are able and willing to fix it by yourself, clone the repository and create a pull request.\r\n\r\n# License\r\nThe whole source code is published under the [MIT license](http://choosealicense.com/licenses/mit/).\r\nConsider the different licenses of the used third party libraries too!\r\n\r\n# Contribution\r\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any\r\nadditional terms or conditions.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueandi%2Favr-net-io-smartmeter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueandi%2Favr-net-io-smartmeter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueandi%2Favr-net-io-smartmeter/lists"}