{"id":20166728,"url":"https://github.com/cdr-chakotay/emfduino","last_synced_at":"2025-03-03T03:40:59.669Z","repository":{"id":189740514,"uuid":"625247588","full_name":"cdr-chakotay/EMFduino","owner":"cdr-chakotay","description":"  EMFDuino is a project about measuring Eletric Mains Frequency (EMF) with low-cost Arduino hardware as measurement device and a Raspberry Pi Database Server and measurement interpretation computer (Also other computers are possible).","archived":false,"fork":false,"pushed_at":"2023-08-21T14:28:23.000Z","size":168,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T14:53:25.442Z","etag":null,"topics":["emf","enf","mains-frequency"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdr-chakotay.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":"2023-04-08T14:20:24.000Z","updated_at":"2024-04-13T12:22:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"4c29e919-1f9c-4246-912b-633cad33d387","html_url":"https://github.com/cdr-chakotay/EMFduino","commit_stats":null,"previous_names":["cdr-chakotay/emfduino"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdr-chakotay%2FEMFduino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdr-chakotay%2FEMFduino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdr-chakotay%2FEMFduino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdr-chakotay%2FEMFduino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdr-chakotay","download_url":"https://codeload.github.com/cdr-chakotay/EMFduino/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241605737,"owners_count":19989608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["emf","enf","mains-frequency"],"created_at":"2024-11-14T00:45:56.650Z","updated_at":"2025-03-03T03:40:59.662Z","avatar_url":"https://github.com/cdr-chakotay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EMFduino\n\nEMFduino is a project about measuring Electric Mains Frequency (EMF) with low-cost Arduino hardware as measurement device and a Raspberry Pi Database Server and measurement interpretation computer (Also other computers are possible).\nThis repository contains the software for the measurement device and the middleware to connect the measurement device to the database server.\nAlso, the helper tools for querying and saving output from the Gridradar Database and saving data of a micromax-fgps PMU are included.\n\nThe end targeted result is an Influx Database with Electric Mains Frequency measurements for every second of the day.\n\nThis project has no commercial purpose and should only be used for research and educational purposes.\n\n## Installation\n\n### Prerequisites\n\n1. Install Arduino IDE v2, Python and Node.js on your machine.\n\n2. Checkout repo with:\n\n```bash\ngit clone \u003crepo-url\u003e\n```\n\n### Install necessary libraries\n\n1. Install necessary python packages:\n\n```bash\npip3 install requests influxdb-client-python\n```\n\n2. Change in the directory of the emf_logger_cli and install the necessary node packages:\n\n```bash\ncd emf_logger_cli\nnpm install\n```\n\n3. Copy the folder `rtc_methods` with its content to the Arduino library folder. The location of the Arduino library folder can be found in the Arduino IDE under `File -\u003e Preferences -\u003e Sketchbook location`.\n\n4. Install the Arduino library `SparkFun_Ublox_Arduino_Library` from the Arduino IDE library manager.\n\n5. Copy the emf_device folder to the Arduino library folder. The location of the Arduino library folder can be found in the Arduino IDE under `File -\u003e Preferences -\u003e Sketchbook location`.\n\n### DataBase Setup\n\nPlease set up a [InfluxDB](https://www.influxdata.com/products/influxdb/) v2 instance and create a bucket for the data.\nAlso configure a retention policy to not delete data, to be able to query it later.\nThe generation of an API token is also necessary to be able to write data to the database.\n\n## Configuration and usage of client software\n\nThe software is configurable and usable via command line interface. Despite there are multiple operation modes possible, this tutorial focuses on the most important parts.\n\n### Configuration\n\nThe configuration of the software components, especially the InfluxDatabaseConnection is done via environment variables:\nThe following table lists the environment variables that are used by the software components and are necessary to be set.\n\n\n\u003c!-- prettier-ignore --\u003e\n**Tabel 1:** *Environment variables for configuration and operation of the measurement software*\n| Variable name       |     Used by       | Description  |\n| ------------------- | ----------------- | ------------ |\n| GRIDRADAR_TOKEN     | gridradar_scraper | Authentication token for the Gridradar API                                              |\n| INFLUXDB_BATCH_SIZE | all               | Number of measurement points to buffer before writing them to the database together     |\n| INFLUXDB_BUCKET     | all               | Name of the target bucket in the InfluxDB                                               |\n| INFLUXDB_CERT_PATH  | all               | Path to a TLS certificate file with the public part of the certificate of the InfluxDB. |\n| INFLUXDB_ORG        | all               | Name of the organization unit within the InfluxDB                                       |\n| INFLUXDB_TOKEN      | all               | Authentication token for the InfluxDB                                                   |\n| INFLUXDB_URL        | all               | URL under which the InfluxDB is reachable in the schema: https://\u003cURL                   | IP\u003e:PORT |\n| MICROMAX_URL        | micromax_scraper  | URL to the web interface of the micromax_fgps device in the format http://\u003cURL          | IP\u003e:PORT |\n\n## Usage\n\nFor using the main functionality of the software, the following steps and materials are necessary:\n\n### Using the EMFduino as measurement device\n\n-   A precise time source (e.g. GPS, NTP, RTC) pre-configured is either a DS3231 or an Ublox GPS module and connect its I2C-Bus to the Arduino's Pins A4 and A5\n-   Get a 1 Hz signal from the RTC to Pin D3 of the Arduino\n-   Connect a 3 - 5 V transformed and full bridge rectified mains frequency signal to the Arduino Pin D2\n-   The following circuit is recommended for setting up an EMFduino:\n    | ![EMFduino_schematic](https://github.com/cdr-chakotay/EMFduino/assets/60937022/5cf2b62b-9f43-4fbb-bb54-e75205f63704) |\n    |:--:| \n    | **Figure 1:** *Schematic circuit diagram of an EMFduino measuring device*  |\n-  Ensure a measurement environment free of voltage peaks at room temperature\n-   Connect the Arduino to the computer via USB\n-   Make sure the environment variables are set correctly (see Tab. 1)\n-   Start the emf_logger_cli and hand it over the necessary port number the Arduino is connected to (e.g. COM3 on Windows or /dev/ttyACM0 on Linux)\n  \n### Using another Measurement Device\n\n-   Make sure the environment variables are set correctly\n-   Start the emf_logger_cli and hand it over the necessary port number the Arduino is connected to (e.g. COM3 on Windows or /dev/ttyACM0 on Linux)\n-   The measurement device has to send the measurement data as binary encoded message with the following content each second:\n    -   `Uint32LE` - POSIX timestamp in seconds\n    -   `Float32LE` - Frequency in Hz\n\n## Declaration of third party software usage\n\nThis software uses third party software as part of its functionality. The following table lists the used libraries, their licenses and the parts of the software that use them. It only shows libraries, which are not a part of the standard library and also not the language/framework or part of the listed libraries itself.\n\n**Tabel 2:** *Overview of used 3rd party software*\n| Library                                                                                      | License      | Usage                               | Language/Framework |\n| -------------------------------------------------------------------------------------------- | ------------ | ----------------------------------- | ------------------ |\n| [glob](https://github.com/isaacs/node-glob)                                                  | ISC          | emf_logger_cli                      | node.js            |\n| [influxdb-client-js](https://github.com/influxdata/influxdb-client-js)                       | MIT          | emf_logger_cli                      | node.js            |\n| [influxdb-client-python](https://github.com/influxdata/influxdb-client-python)               | MIT          | gridradar_scraper, micromax_scraper | python             |\n| [requests](https://github.com/psf/requests)                                                  | Apache 2.0   | gridradar_scraper, micromax_scraper | python             |\n| [node-serialport](https://github.com/serialport/node-serialport)                             | MIT          | emf_logger_cli                      | node.js            |\n| [simple-statistics](https://github.com/simple-statistics/simple-statistics)                  | ISC          | emf_logger_cli                      | node.js            |\n| [SparkFun_Ublox_Arduino_Library](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library) | CC BY-SA 4.0 | rtc_methods                         | C++                |\n| [yargs](https://github.com/yargs/yargs)                                                      | MIT          | emf_logger_cli                      | node.js            |\n\n## License\n\nThis project was authored by Florian Künzig (2023) during a Bachelor Thesis at the University of Applied Sciences in Mittweida, Germany. The project is licensed under the GPL-3.0 License. See the LICENSE files for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdr-chakotay%2Femfduino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdr-chakotay%2Femfduino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdr-chakotay%2Femfduino/lists"}