balena-io-experimental / firebaseDTL

A Firebase and Resin.io powered digital temperature logging system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Digital Temperature Logger (DTL)

DTL is a node application that collects data from up to 64 DS18b20 digital temperature sensors connected to the GPIO interface of a Raspberry Pi and pushes the data in to a firebase cloud datastore.

Usage

This is a resin.io supercharged application. Clone it, push it to your resin endpoint and you're good to go!

Parts

The recipe for this project is as follows:

  • Raspberry Pi with ethernet cable for internet connectivity and USB -> micro USB cable for power.
  • one or more DS18b20 digital temperature sensors.
  • a 4.7KΩ or 10KΩ.
  • A breadboard, for example the AD-102 from Maplin.
  • Jumper wires to connect everything. For example, these male-to-female connectors from Maplin.

Build Instructions

Wiring

Warning: disconnect the raspberry pi for power before wiring up these parts

  1. Connect up the DS18b20 as shown in the diagram, with pin1 connected to ground (GND), pin2 connected to GPIO4 of the raspberry pi and pin3 connected to 3.3V.
  2. Additionally you will need to connect a resistor between pin2 (the data line) and the 3.3V supply voltage. This resistor can be any value between 4.7KΩ and 10KΩ.
  3. Connect the ethernet cable to the raspberry pi and power it up using the micro usb. Here is a diagram of the circuit: Circuit diagram

Resin.io Setup & Deployment

  1. If you haven't got a resin.io alpha account, visit alpha.resin.io and sign up.
  2. start a new applicaton on resin.io, name it as you want, download the .zip file and extract it to your SD card.
  3. Insert the SD card into the Rasoberry pi, connect the ethernet cable and power it up using the micro-usb cable.
  4. After about 10 minutes your new device should show up on the resin.io applications dashboard.
  5. Setup an empty firebase application.
  6. Add your application's firebase url as an environment variable in the resin application dashboard called FIREBASE_URL.
  7. Add a second environment variable called INTERVAL_TIME and set its value to the time between sensor measurement, this value is set in seconds and defaults to 600 seconds (10 minutes) if you do not set a time interval. Environment Variables
  8. you can now clone down the firebaseDTL folder:

$ git clone https://github.com/shaunmulligan/firebaseDTL.git

then add the resin remote: (replacing and with yours from the resin.io dashboard)

$ git remote add resin git@git.staging.resin.io:<myUserName>/<myApplicationName>.git

and finally push the code to your raspberry pi:

$ git push resin master

After some time your firebase should look something like this: Data structure

Where the long alphanumeric number at the top is the unique ID for your raspberry pi and the following sublevels are year, integer day of the year and sample number. For a sample interval of 10 minutes you will get 144 samples. Each sample object consists of temp and time, the temp object contains a list of all the connected sensors. Here we can see one sensor connected, called 28-00000054b548. Note: If you don't have any DS18b20 sensors connected, the RPi will just push time stamps up to the firebase.

Extending the system

To extend the system to multiple sensors, all you need to do is connect up the additional DS18b20's in parallel to the first one, so they will all share the same 3.3V, ground and data line. Only one resistor is needed in this case.

About

A Firebase and Resin.io powered digital temperature logging system


Languages

Language:JavaScript 100.0%