Code Monkey home page Code Monkey logo

raspi-temp-report's Introduction

Temperature Monitor

This is a simple Node.js app to collect ambient data using a DHT22/AM2302 sensor attached to a Raspberry Pi and send it to a datastore (under development, ideally PostgreSQL).

Requirements

Installation

Open an SSH session on your Raspberry Pi, then type the following commands:

git clone https://github.com/mcdado/raspi-temp-report.git # to run on the Pi
cd raspi-temp-report # to run on the Pi
npm run setup # to run on the Pi

Alternatively, you can checkout the project locally on your coding machine, and use the deploy script.

npm run deploy raspberrypi.local # to run on your coding machine

You have to change raspberrypi.local to whatever hostname you Pi has, or even better to the name of the SSH configuration you might have set up.
The deploy script will copy the necessary project files, but will not run the setup on the Pi.
You have to run the setup the first time you deploy the app to the Pi.

Setup the sensor

In .env file declare the id of the sensor as UNITNAME, the type of sensor as UNITTYPE, and the pin to which it is connected with UNITPIN.

Storage: PostgreSQL

Setup PostgreSQL with these tables:

create table sensors (
    id serial PRIMARY KEY,
    name text
);

create table recordings (
    id serial PRIMARY KEY,
    sensor text,
    temperature float(2),
    humidity float(2),
    timestamp timestamp
);

Debugging

You can run the app on the Raspberry Pi in debug mode by running with the dedicated npm script:

npm run debug

Behind the scenes, it will will run node app.js with the inspect flag, binded on the Raspberry Pi's IP address and port 9229. Now you can use Visual Studio Code's built-in debugging tools to start a Debug session.

raspi-temp-report's People

Contributors

mcdado avatar

Watchers

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