serialreader-server

command module
v0.0.0-...-3291b05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2021 License: BSD-3-Clause Imports: 1 Imported by: 0

README

serialreader-server

Overview

The purpose of this application is to provide a remote procedure call (gRPC) interface over an external Arduino device with a SparkFun Weather Shield (DEV-13956).

Supports collection of multiple time-series data from 6 different sensors and the following features:

  • Temperature
  • Humidity
  • Pressure
  • Altitude
  • Illuminance
  • Supports JSON formatted outputs
  • Powered by open-source hardware and software!

Prerequisites

You must have the following installed before proceeding. If you are missing any one of these then you cannot begin.

  • Go 1.16.3

Installation

  1. Please visit the sparkfunweathershield-arduino repository and setup the external device and connect it to your development machine.

  2. 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.

  3. Download the source code, build and install the application.

    GO111MODULE=on go get -u github.com/bartmika/serialreader-server
    

Usage

Run our application.

serialreader-server --port=50052 --arduinoDevicePath="/dev/cu.usbmodem14201"

If you see a message saying gRPC server is running. then the application has been successfully started.

How does it work?

This device runs continuously waiting for you to pull data from it.

When you pull data, it will send you a JSON formatted object with all the time series data.

To pull data, you must first connect to the Arduino device with a USB cable.

Once connected, you use serial usb communication to read data from the device and write commands to the device.

Once your device recieves the JSON data, you do what you want with the data.

Why did you choose Arduino?

The Arduino platform has a wonderful ecosystem of open-source hardware with libraries. Our goal is to take advantage of the libraries the hardware manufacturers wrote and not worry about the complicated implementation details.

How does the data output look like?

When the device is ready to be used, you will see this output:

{"status":"READY","runtime":2,"id":1,"sensors":["humidity","temperature","pressure","illuminance","soil"]}

When you poll the device for data, you will see this output:

{"status":"RUNNING","runtime":24771,"id":2,"humidity":{"value":47.92456,"unit":"%","status":1,"error":""},"temperature_primary":{"value":80.47031,"unit":"F","status":1,"error":""},"pressure":{"value":0,"unit":"Pa","status":1,"error":""},"temperature_secondary":{"value":78.2375,"unit":"F","status":1,"error":""},"altitude":{"value":80440.25,"unit":"ft","status":1,"error":""},"illuminance":{"value":0.040305,"unit":"V","status":1,"error":""}}

Why should I use it?

This code is a easy to connect and read realtime time-series data using any language that supports serial communication over USB.

License

This application is licensed under the BSD 3-Clause License. See LICENSE for more information.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL