In my previous post I have connected a TC74 via USB to the Raspberry Pi. It works, but I consider it a waste because the Raspberry Pi has GPIO’s available.
So, I have connected a TC74 directly to GPIO-0 & GPIO-1 of the Raspberry Pi.
On the software side, I make use of the Debian Sqeeuze Image, but upgraded the kernel to Chris Boot’s Raspberry Pi Kernel. I have also installed i2c-tools.
With i2cdetect I can see the TC74 on the I²C bus.
And with i2cget, I can read the current temperature (hex) of the TC74.
To make all this available to a webserver like in my previous post, I have changed cgi-bin/temp to the following:
#!/bin/bash echo Content-type: text/html echo # USB : # echo "document.write(\"`/home/pi/usb/temp`\");" # I2C : Thex=`/usr/sbin/i2cget -y 0 0x48 0 b | cut -d"x" -f2 | tr '[:lower:]' '[:upper:]'` T=`echo "ibase=16 ; $Thex" | bc` echo "document.write(\"$T\");"
Which gives the following result when I connect with a web browser to the Raspberry Pi: