GithubHelp home page GithubHelp logo

hw_code's Introduction

HW_code

Holds the code for RPI and A0

RPI

The serial_read.py script reads the data received via serial from A0. The data respects the SenML format. The only missing information from the received data is the timestamp, which can be added in python before forwarding it to the server.

The RPi_A0_comm.py script transmits a reading command to A0 via serial. A0 triggers an interrupt on GPIO9 to announce that its answer is ready. This triggers data reception via serial.

The RPi_command_manager.py creates schedules for reading each sensor attached to Arduino. It also publishes the temperature data as thing1 of user [email protected]. Using 'bn'='ArduinoMKR1000' when sending SenML just merges with the 'n'='Temperature' and Grafana is not able to show it in the temperature dashboard, as name become 'ArduinoMKR1000Temperature'. For this reason, send 'bn' void, so as the dashboard can extract data for the "Temperature". 'Bn' is not needed anyway, as we assume that Thing1=ArduinoMKR1000.

A0

The serial_transmit.ino script reads the analog data from pin A0 and adds it, together with a fixed temperature value, to a SenML message. The message is sent via Serial1 to RPI, each 5s. No timestamp data.

The serial_RPi_commands.ino file receives interrupts from RPi on D8. It also triggers interrupts to RPi using D7. After serial data reception, it processes the received command and sends an answer via serial after interrupting RPi.

The A0_command_manager.ino parses the serial commands received from RPi (one at a time)! The current version can read analog, digital and onewire sensors. Future development should deal with spi sensors. It only answers with the pintype and pinvalue, so RPi is in charge of completing the SenML by adding timestamp, name and unit.

WiFi trials

Python and A0 are communicating over the RPi WiFi Network. Python needs to know A0 device's IP in this network. A0 needs to know the RPi WiFi SSID and password in advance (easy, as RPi acts as an AP). Messages are successfully exchanged between python and Arduino MKR1000.

Future development: have A0 open the socket, as RPi IP is fixed and known. Try to eliminate the need for python to know the IP in advance, or have it find it out by itself.

hw_code's People

Contributors

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