I finally had time to sit down and finish soldering up the board to take the thermisistor from analog to digital, so I can use it in my raspberry pi. I used the mcp3008 this chip is great it has inputs for up to 8 other analog devices, SWEET, I plan on using that!!
I relied heavily on adafruit’s website to help me get this going, but here is what it boiled down to
RPI —-> mcp3008
3.3 v –> vcc
3.3 v –> vhref
GND —-> AGND
18 —–> CLK
23 —–> DOUT
34 —–> DIN
35 —–> CS
GND —-> GND
I then bought a mini jack from radio shack the mono one (in fact this is the only place I found them), the tip is GND and the shaft is +3.3 volts. I decided on a 10k ohm resistor, and this appeared to function well after fiddling with a few things inside the python application (attached tar.gz)
A = 3.3501 B = 0.5899 C = 0.0104 R_25C = 10000.0 #ohms R_STD = 500.0 #ohms ADC_CHANNEL = 0 |
I found most of the above values somewhere (I really can’t remember where) they seemed to work well though. The only 2 I changed was r_25C (calibration of the thermisistor @ 25 Celcius) and r_STD, the resistor on the board. I did fudge these numbers to make it work, but it works through the whole heat spectrum (very cold to very hot) I calibrated with a Dallas one wire, and my brewing thermometer, So I am fairly certain of the accuracy.
if you don’t plan on using the Dallas one wire as well (or if you do you still need to change the directory) remove this:
fi = open ("/sys/bus/w1/devices/28-000004da0be2/w1_slave", 'r') sensor = fi.readlines() fi.close() crc=sensor[0].split()[-1] temp=float(sensor[1].split()[-1].strip('t=')) temp_C=(temp/1000.000) temp_F = ( temp_C * 9.0 / 5.0 ) + 32 print "temperature: %0.2f %0.2f *F w1: %s" % (T,f,temp_F) |
and change this:
print "temperature: %0.2f %0.2f *F w1: %s" % (T,f,temp_F) to print "temperature: %0.2f %0.2f *F" % (T,f) |
I will simply attach the code and videos so you can see it in action, check out adafruit’s website it’s helpful!
Close up picture of the output
The cup of water I tested with.
–John
(don’t run the make, it’s of no value run chmod +x thermistor.py and ./thermistor.py take out the dallas one wire code if you don’t need it).
raspi-openlabmonitor.tar.gz