Skip to content

Application written in Go which provides gRPC access to time-series data from a custom configured Arduino device with SparkFun Weather Shield.

License

bartmika/serialreader-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Application written in Go which provides gRPC access to time-series data from a custom configured Arduino device with SparkFun Weather Shield.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages