johnagall
Posts: 3
Joined: Mon Jun 17, 2013 11:05 am

Total Noob- Temperature sensing project

Wed Aug 13, 2014 7:14 pm

Hi guys,

I bought a pi with the intention of doing projects to learn about software and basic use but my pi has been such a great media player that I almost forgot it can do lots of cool stuff.

Anyway to start I would like to do a simple project and I have settled on measuring the temperature of various cupboards (one at a time) to find the one with the most stable temperature for storing home brew.

I would like to have the results logged to a Google spreadsheet on an hourly basis.

Could you advise on what temperature sensor I could source in the UK and any possible guides for a total noob?

User avatar
rpdom
Posts: 16119
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Total Noob- Temperature sensing project

Wed Aug 13, 2014 7:34 pm

One of the easiest and cheapest temperature sensors to use is a DS18B20. You can pick them up for a pound or so on ebay. They need some wire and a 4.7K Ohm resistor to work with the Pi. They use the One Wire Bus interface which is available on GPIO 4. Do a quick google search on "site:raspberrypi.org DS18B20" and you will find lots of information on how to use these things.

rgrbic
Posts: 128
Joined: Thu Jun 12, 2014 1:07 pm
Contact: Website

Re: Total Noob- Temperature sensing project

Thu Aug 14, 2014 6:24 am

Here you can see how to connect DS18B20 sensors to the Raspberry Pi, read the values and store them to mysql database.
At 127.0.0.1
Twitter: @rgrbic
IoT-projects.com

User avatar
rpdom
Posts: 16119
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Total Noob- Temperature sensing project

Thu Aug 14, 2014 6:46 am

One example of a project is something I set up last winter.

My wife keeps tarantulas as pets (they're actually not really scary and really easy to look after). They need to be kept at around normal room temperature. We were going away for a few days and didn't want to heat an entire empty house. So I put the Ts in a small spare room with a Pi connected to a DS18B20 and a relay driving a small mains heater.

The easy way to do it would be to just set up a cron job that runs every 5 minutes and says "If temperature below X°C turn on heater", "If temperature above Y°C turn off heater", but that would keep them at the same temperature all day and night which isn't natural. So I set up a parameter file with a list of temperatures for each 5 minute slot and set the program to try and keep it within 1°C of that. It worked really well and I then fed the readings to my webserver (not running on a Pi) and generated a dynamic web page with a graph of the actual and desired temperatures over the previous 24 hours.

I was also able to ssh into the Pi from where we were staying, so I could tweak the settings and update the code if needed.

It worked really well :)

Return to “Beginners”