{"id":19349144,"url":"https://github.com/bartmika/treader-server","last_synced_at":"2025-02-24T10:19:03.538Z","repository":{"id":74312899,"uuid":"385804760","full_name":"bartmika/treader-server","owner":"bartmika","description":"Read time-series data, using serial communication over USB, for your externally connected Arduino device and attached Arduino shield; afterwords, share your data through gRPC","archived":false,"fork":false,"pushed_at":"2021-08-01T17:29:53.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-06T15:18:25.505Z","etag":null,"topics":["golang","grpc-go","iot","time-series-data"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartmika.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":"2021-07-14T03:41:56.000Z","updated_at":"2021-08-01T17:29:55.000Z","dependencies_parsed_at":"2023-06-09T05:30:24.708Z","dependency_job_id":null,"html_url":"https://github.com/bartmika/treader-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartmika%2Ftreader-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartmika%2Ftreader-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartmika%2Ftreader-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartmika%2Ftreader-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartmika","download_url":"https://codeload.github.com/bartmika/treader-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240457988,"owners_count":19804489,"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":["golang","grpc-go","iot","time-series-data"],"created_at":"2024-11-10T04:24:52.797Z","updated_at":"2025-02-24T10:19:03.497Z","avatar_url":"https://github.com/bartmika.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Time-Series Data Reader and gRPC Server\n\nRead **time-series data**, using `serial communication over USB`, for your externally connected *Arduino device* and attached *Arduino shield*; afterwords, share your data through [`gRPC`](https://github.com/bartmika/tpoller-server/blob/master/proto/telemetry.proto).\n\nCurrently this server only supports the following shield:\n\n* [SparkFun Weather Shield (DEV-13956)](https://github.com/sparkfun/Weather_Shield).\n\nExample:\n![SparkFun Weather Shield](https://github.com/bartmika/sparkfunweathershield-arduino/blob/master/media/red_mulberries_germination_with_sparkfun_weather_shield.jpg?raw=true)\n*SparkFun Weather Shield monitoring dutifully a red mulberry seedling, the code is powered by this code repository* - read more via [this blog post](https://bartlomiejmika.com/post/2021/red-mulberry-growlog-2/).\n\n## Background\n### The Problem\n\nImagine having purchased multiple measuring instruments for an IoT project, for example: pressure monitor, temperature probe, multi-sensor reader, etc. Each sensor provides different measured data - **Is it possible to create a simple *get data from device* interface to abstract all implantation detail and provide an easy-to-use API?**\n\nImagine having built an application which can provide an easy-to-use API for multiple hardware sensors. **How do you make the API accessible between *one* or *many* applications running concurrently? How do you make this API accessible either *locally* and or *remotely*?**\n\n### The Solution\n\n`treader-server` tries to provide an easy-to-use interface for you to connect many interprocess communication requests either locally on your computer or remotely across the internet or your network.\n\n### What do I need?\nTo run this code, you need the following:\n\n1. You need an Arduino device.\n2. You need to have the Arduino device running either one of the following code:\n\n  * [sparkfunweathershield-arduino](https://github.com/bartmika/sparkfunweathershield-arduino)\n3. The computer running this server needs to be connected to the Arduino device over `serial communication` USB port.\n4. The computer running this server needs to know the port address of your externally connected Arduino. Please find out what USB port your external device is connected on. Note: please replace ``/dev/cu.usbmodem14201`` with the value on your machine, a Raspberry Pi would most likely have the value ``/dev/ttyACM0``.\n\n### How does this work?\n\nThis server starts by connecting to the Arduino device, warms up sensors if necessary and runs continuously waiting for you to make gRPC requests.\n\nWhen you make a gRPC request, this server will pull data from the external device and send you back a gRPC response. You do what you want with the data.\n\n### What is the gRPC service definition?\n\nYour application must implement the `Telemetry` service definition found [here](https://github.com/bartmika/tpoller-server/blob/master/proto/telemetry.proto). The service definition code snippet is as follows:\n\n```protobuf\nservice Telemetry {\n    rpc GetTimeSeriesData (google.protobuf.Empty) returns (stream TelemetryDatum) {}\n}\n\nmessage TelemetryLabel {\n    string name = 1;\n    string value = 2;\n}\n\nmessage TelemetryDatum {\n    string metric = 1;\n    repeated TelemetryLabel labels = 2;\n    double value = 3;\n    google.protobuf.Timestamp timestamp = 4;\n}\n```\n\n### Why did you choose Arduino?\nThe Arduino platform has a wonderful ecosystem of open-source hardware with libraries. The goal is to take advantage of the libraries the hardware manufacturers wrote and not worry about the complicated implementation details; nor conflicting non-open source licensing agreements.\n\n### Why should I use it?\n* You want to focus on writing software or web-applications utilizing IoT sensors, not focus low-level hardware code.\n\n* You want to treat the sensor like a micro-service.\n\n* You want to use Golang.\n\n### You don't support too many sensors...\n\nNo problem, you can help change that by contributing via [pull requeests](https://github.com/bartmika/treader-server/pulls) code for any sensors you think this project should have. If you are looking for a specific sensor, create a [request issue](https://github.com/bartmika/treader-server/issues).\n\n### Anyone using this?\n\nThe following project is currently using this project:\n\n* [tpoller-server](https://github.com/bartmika/tpoller-server) - *Application written in Go which polls Time-series data at specific intervals and saves to persistent storage*\n* [tstorage-server](https://github.com/bartmika/tstorage-server) - *Fast time-series data storage server accessible over gRPC*\n* [sparkfunweathershield-arduino](https://github.com/bartmika/sparkfunweathershield-arduino) - *Application implemented in C++ which measures time-series data from the SparkFun Weather Shield board and provides serial usb interface for other devices*\n\nIf you want to add your own, feel free to make a [PR](https://github.com/bartmika/treader-server/pulls).\n\n## Installation\n\nInstall the application.\n\n```bash\ngo install github.com/bartmika/treader-server@latest\n```\n\n## Usage\nRun our server continuously in the foreground:\n\n```bash\n$GOBIN/treader-server serve -f=\"/dev/cu.usbmodem14401\" -s=\"SPARKFUN-DEV-13956\" -p=50052\n```\n\nIf your console output looks as the following then the application has been successfully started. You are ready to use the service!\n\n```text\n2021/07/15 22:00:16 READER: Attempting to connect Arduino device...\n2021/07/15 22:00:16 READER: Waiting for Arduino external sensors to warm up\n2021/07/15 22:00:26 gRPC server is running.\n```\n\nThe sub-command details are as follows:\n\n```text\nRun the gRPC server to allow other services to access the time-series data reader\n\nUsage:\n  treader-server serve [flags]\n\nFlags:\n  -f, --arduino_path string     The location of the connected arduino device on your computer. (default \"/dev/cu.usbmodem14201\")\n  -s, --arduino_shield string   The shield hardware attached to the arduino. (default \"SPARKFUN-DEV-13956\")\n  -h, --help                    help for serve\n  -p, --port int                The port to run this server on (default 50052)\n```\n\nPlease note for `arduino_shield` the only supported values are:\n\n* ``SPARKFUN-DEV-13956`` for [sparkfunweathershield-arduino](https://github.com/bartmika/sparkfunweathershield-arduino) code repo.\n\n## Contributing\n### Development\nIf you'd like to setup the project for development. Here are the installation steps:\n\n1. Go to your development folder.\n\n    ```bash\n    cd ~/go/src/github.com/bartmika\n    ```\n\n2. Clone the repository.\n\n    ```bash\n    git clone https://github.com/bartmika/treader-server.git\n    cd treader-server\n    ```\n\n3. Install the package dependencies\n\n    ```bash\n    go mod tidy\n    ```\n\n4. In your **terminal**, make sure we export our path (if you haven’t done this before) by writing the following:\n\n    ```bash\n    export PATH=\"$PATH:$(go env GOPATH)/bin\"\n    ```\n\n5. Run the following to generate our new gRPC interface. Please note in your development, if you make any changes to the gRPC service definition then you'll need to rerun the following:\n\n    ```bash\n    protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/telemetry.proto\n    ```\n\n6. You are now ready to start the server and begin contributing!\n\n    ```bash\n    go run main.go serve -f=\"/dev/cu.usbmodem14401\" -s=\"SPARKFUN-DEV-13956\" -p=50052\n    ```\n\n### Quality Assurance\n\nFound a bug? Need Help? Please create an [issue](https://github.com/bartmika/treader-server/issues).\n\n## License\n\n[**ISC License**](LICENSE) © Bartlomiej Mika\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartmika%2Ftreader-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartmika%2Ftreader-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartmika%2Ftreader-server/lists"}