12.07.2015 Views

Steady Hand Fun With The Raspberry Pi - Adrirobot

Steady Hand Fun With The Raspberry Pi - Adrirobot

Steady Hand Fun With The Raspberry Pi - Adrirobot

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DIFFICULTY: INTERMEDIATEDr Duncan Rowland – University of LincolnThis article builds on topics fromprevious issues of <strong>The</strong> Mag<strong>Pi</strong> and showshow to add a temperature sensor to your<strong>Pi</strong> together with a simple method torecord and display the data on the web.<strong>The</strong> temperature sensor used is the ‘tmp1 02’(http://www.ti.com/product/tmp1 02) andconnects via the i2c bus (i.e. the same wayRob McDougall connected his accelerometerin last month issue). <strong>The</strong> temperature sensoris readily available already mounted on abreakoutboard(http://www.sparkfun.com/products/941 8) sowith the addition of some header pins it can bepushed straight onto a breadboard forprototyping (see photos). <strong>The</strong> recentlyreleased Raspbian build (201 2-07-1 5-wheezy-raspbian) now already has the i2cmodules included and the firmware is ready togo too.Starting with a fresh install, the instructionsthat follow do not require the graphical userinterface, so you can boot your <strong>Pi</strong> and use aterminal window and keyboard or remotelylogin via ssh as you prefer.First we need to install the tools for talking tothe i2c bus:sudo apt-get updatesudo apt-get install i2c-tools<strong>The</strong>re are a couple of modules we need to add(i2c-bcm2708 and i2c-dev). You can eitherinclude then manually by issuing the following‘modprobe’ commands (in which case you willneed to do this each time you reboot); or youcan add them to the file ‘/etc/modules’ (inwhich case they will be loaded automaticallywhen you reboot):sudo modprobe i2c-bcm2708sudo modprobe i2c-devFinally, so that you can read from the i2c bus,you need to add the pi user to the i2c usergroup (after which you will need to logout andlog back in for the change to take effect).sudo usermod –a –G i2c pilogoutIf you have correctly connected your tmp1 02sensor (as shown in the photos) it should nowbe accessible to you on the i2c bus when youlog back in.7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!