Skip to main content

Get sensor data over the serial line and send it to an URL (JSON).

Project description

Python CLI to report back the sensor data from our arduino(s). See (https://pypi.org/project/ardu-report-lib/ / https://github.com/inofix/ardu-report-lib) for the main library.

Dependencies, Requirements

  • Unix/Linux

  • Python 2/3

  • tested against: 2.7 and 3.5 (main lib has unittests and Travis-CI)

  • this is just a frontend for ‘ardu-report-lib’ (main dependency)

  • see requrements.txt for further dependencies

Basic Idea

For now we have one arduino reporting sensor values back over the serial line. On the other end there is a raspberry pi collecting the data. The data is then processed and either just printed to the console or a file, or sent over mobile or wired/wireless network to, e.g., a webserver..

If more than one arduino are connected. For each one of them the data processing can be configured individually.

Use it for Your Project?

I am rewriting the input parser to accept any JSON schema following the meta schema to control the object index names. As it really only needs some sort of identifier and a value, there should not be too many obstacles to use it for your project too.

See the ‘schema’ folder for details on the implementation.

The ‘example’ folder contains JSON file that validates against the schema and the tests/test_json.py has a test run for both the input.json against the schema and the schema against the meta-schema.. Furthermore there is an extended-input.json that validates against an example customized schema (extended-input-schema.json), with itself still validates against the meta-schema.json.

Example Data for Python Processing

INPUT: JSON from the arduino over the serial line

There are two examples under the ‘examples’ folder.

The simple ‘input.json’ shows two example measurements. The “id” and “value” entries in the object are mandatory. The “unit” and “threshold” are interpreted for the stdout log. Any other entry will just be passed on to the output (except for the sdtout log case).

Note that no timestamp joins the data. Most of the time there is no clock source available to the dump sensor controller. The timestamp is added in the output below though. If a timestamp is available in the input, it can still be passed on of course.

See the ‘extended-input.json’ for an example with more enries and custom naming.

OUTPUT: Target JSON from the raspberry pi for the use in e.g. a web app

Based on the URL specified, the data is appended to a file (”file://”) as a continuing list of JSON objects containing sensor value entries or sent as a complete JSON array to a web server (”http://” / “https://”) as a POST request. If the URL string is empty, the data is just printed in text form to stdout.

Example JSON output can be found under the examples folder:

  • output.json - default

  • custom-output.json - if an output JSON scheme is defined, the entries can be translated. The output JSON must validate against the meta schema..

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ardu-report-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

ardu_report-1.0.0-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ardu-report-1.0.0.tar.gz.

File metadata

  • Download URL: ardu-report-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ardu-report-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ba60f240a0a9f941488ca6b4d286fbfd8234f97528983808eba7fd71e0810246
MD5 8aea65485a419f281f0b68d5fce5bbbd
BLAKE2b-256 7bd3d2cfcde5c713ed7cc281a288ee8656df515513be3d33ecd84b5125403687

See more details on using hashes here.

File details

Details for the file ardu_report-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ardu_report-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3d15422e24802d9bd563fd3b591e1d52384132a4faf9ef822552d48b82ead6a7
MD5 3992ea986eb1c65dc227ada8dec62dac
BLAKE2b-256 67d1ddceeb02d61f5a97b182c282dd1fa3e6097f17a7e1cf2fedff745873b6a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page