Git Product home page Git Product logo

pithermserver's Introduction

PiThermServer

Simple NodeJS server and SQLite3 logger for the DS18B20 digital temperature sensor on the Raspberry Pi.

Description

A NodeJS server for the DS18B20 GPIO temperature sensor on the Raspberry Pi. The sensor is accessed using the w1-gpio and w1-therm kernel modules in the Raspbian distro. The server parses data from the sensor and returns the temperature and a Unix time-stamp in JSON format, this is then written to an SQLite database on the Pi. A simple front-end is included and served using node-static, which performs ajax calls to the server/database and plots temperature in real time or from a time-series, using the highcharts JavaScript library.

Files

  • load_gpio.sh - bash commands to load kernel modules
  • server.js - NodeJS server, returns temperature as JSON, logs to database and serves other static files
  • temperature_plot.htm - example client front-end showing live temperatures
  • temperature_log.htm - example client front-end showing time-series from database records
  • build_database.sh - shell script to create database schema
  • sample_database.db - example database with real world data from the Pi recorded in UK Jan-Feb 2013

Dependencies

  • NodeJS
  • SQLite3
  • node-sqlite3
  • node-static

Install/Setup

  1. Run npm install in this directory
  2. Run load_gpio.sh script as root to load kernel modules for the sensor
  3. Run the build_database.sh script to create "piTemps.db". Note this wil drop any existing database of the same name in the directory
  4. Open "server.js" and edit line 35 to read the serial number of your sensor in /sys/bus.
  5. In a terminal run "node server.js" to start the server.
  6. Open a web browser on the Pi and go to http://localhost:8000/temperature_plot.htm to see a plot of current temperature. Go to http://localhost:8000/temperature_log.htm to see a plot of logged temperature.

References

http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/temperature/

Screenshots/Images

Temperature time-series plot

Temperature plot

Screenshot of temperature plot

Raspberry Pi & DS18B20 digital thermometer

pithermserver's People

Contributors

tomasholderness avatar tarciosaraiva avatar dereke avatar

Watchers

James Cloos avatar Oliver Harvey 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.