Raspberry pi ADC mcp3008

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
18 —–> CLK
23 —–> DOUT
34 —–> DIN
35 —–> CS

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

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() 
	    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)
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.

RPI and my board.

Close up of my board.


(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).

Leave a Reply

Your email address will not be published. Required fields are marked *