Coder Social home page Coder Social logo

arduino-serial-sensor-comm's Introduction

arduino-serial-sensor-comm

Read sensor status from an Arduino over the serial (USB) port. A Python client is provided, but the protocol used should be able to be read in any programming language that supports numbers.

This repository contains two pieces of code:

Arduino server

A simple sketch to transmit the state of DIO pins 2–12 and AIO 0–5 over the serial USB connection on an Arduino Uno. Requires base64_arduino.

Transmits a packet roughly 100 times per second; this can be adjusted by changing the value given to delay() at the bottom.

Packet format

Type Description Byte #
Raw bits 5 bits of 0-padding followed by DIOs 2–4 in order 0
Raw bits DIOs 5–12 in order 1
int16 6 2-byte ints for each analog channel 2–13
byte Checksum 13

This is then Base64-encoded and a trailing newline is added. All numbers are transmitted big-endian.

Python client

A simple Python 3 client to read the aforementioned data packets from a serial port (the address of which can be changed by modifying line 3) and print them to the console. Requires PySerial.

arduino-serial-sensor-comm's People

Contributors

robinsonz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.