Here are the instructions to build a simple temperature logger using a $5.00 I2C temperature sensor. The data is stored to the SD card and can be easily imported into excel. Simply by changing or adding other sensors other types of data can also be collected.

The following components are used for this project:
Raspberry Pi(single board computer)
Temperature Sensor (SF-SEN-11931)

Solderless Breadboard
Hookup Wires

The Zagros Raspberry Pi 2 starter kit also includes everything needed for this project except the temperature sensor!

Step 1: Wire Up the Temperature Sensor

First, solder header pins or lead wires on to the sensor. We used headers so it would be could simply plug the sensor into a breadboard.

Make the following connections to the Raspberry Pi GPIO port. The ADD0 connection to ground determines the device I2C address. More than one sensor can be connected to the I2C bus, but they must each have a unique address.

Sensor RPi GPIO
VCC +3.3V




ADD0 GND (note this sets the I2C device address)



<p>Don't forget to install the python-smbus python module:</p><p>sudo apt-get install python-smbus </p>
<p>without that I got this error on Raspian-jessie</p><blockquote><strong>pi@raspberrypi</strong>:<strong>~/tempsens $</strong> python temp_logger.py<br>Traceback (most recent call last):<br>File &quot;temp_logger.py&quot;, line 6, in &lt;module&gt;<br>import smbus<br>ImportError: No module named smbus</blockquote>
<p>hello</p><p> i had done all the thing but i am using another sensor so i want to know how this calculation of converting in to data is done please expline</p><p>thanks in advance</p>
<p>Hi RobZ314. I'm very green in the Pi business... :-) I'd like to have my Pi bootup and autorun the program without any user intervention. Ie. I'd like to apply only power and have the program run by itself logging the results for some time. Reason for this is that I need the unit to record temperature in a location far from keyboards, monitors, etc. </p><p>Is this possible, or should I make a plan to carry the peripherals with?</p><p>Thank you for your time.</p><p>Regards</p>
<p>I like it. Thanks. I ran into a few different troubles and think I found the solutions Has anyone else had an issue with i2cdetect finding the file? I added these steps and it started working afterwards:</p><p>If you are running a recent Raspberry Pi (3.18 kernel or higher) you will also need to update the<strong>/boot/config.txt</strong> file. Edit it with <strong>sudo nano /boot/config.txt</strong> and add the text</p><p><strong>dtparam=i2c1=on<br>dtparam=i2c_arm=on</strong></p><p><strong><br></strong></p><p><strong><br></strong></p><p><strong>and:</strong></p><p><strong><br></strong></p><p><strong><br></strong></p><p><strong><br></strong></p><pre><ol><li>sudo nano /etc/modules</ol></pre><p>and add these two lines to the end of the file:</p><pre><ol><li>i2c-bcm2708 <li>i2c-dev</ol></pre>
<p>I am still getting the error if I do that...do you know what else I can do </p>
<p>Hi. I am hoping to use the ultimate starter kit to construct an continuous data logging system for pH and temperature. I am an beginner beginner on building raspberry pis and programming!!!</p>
<p>Works great! But I want to connect TWO of these sensors. How do I change the address of the second one?</p>
<p>excuse me sir if i used thermocouple type k ,can it work using your method?? please reply as soon as possible.thx :D</p>
<p>How to set time, date and timezone in raspberry pi without RTC.</p><p>date in my raspberry pi is default, not date now</p>
<p>Thanks a very awesome tutorial, ZRob314<br>Could you show us how to write your logger record to online SQL database like in Windows Azure's Management Portal?</p>
Hey i am also in Toronto. Very cool projects you have. Would you be i nterested In a paid project? Need something done right away.

About This Instructable




More by ZRob314:Piano Pi - Play a Duet With Your Pi! Raspberry Pi Touchscreen Setup Times Square in your living room!   Turn your Sense Hat LED into a news ticker. 
Add instructable to: