Digital Temperature Logger (DTL)
This is a resin.io supercharged application. Clone it, push it to your resin endpoint and you're good to go!
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.
Warning: disconnect the raspberry pi for power before wiring up these parts
- 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.
- 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Ω.
- Connect the ethernet cable to the raspberry pi and power it up using the micro usb. Here is a diagram of the circuit:
Resin.io Setup & Deployment
- If you haven't got a resin.io alpha account, visit alpha.resin.io and sign up.
- start a new applicaton on resin.io, name it as you want, download the .zip file and extract it to your SD card.
- Insert the SD card into the Rasoberry pi, connect the ethernet cable and power it up using the micro-usb cable.
- After about 10 minutes your new device should show up on the resin.io applications dashboard.
- Setup an empty firebase application.
- Add your application's firebase url as an environment variable in the resin application dashboard called FIREBASE_URL.
- 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.
- 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 email@example.com:<myUserName>/<myApplicationName>.git
and finally push the code to your raspberry pi:
$ git push resin master
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.