SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
#201503
Hello,

We are attempting to read data in from a K-type thermocouple through a MAX31855K thermocouple breakout board into a Raspberry Pi 3 B+. When we run our Python code, we our only receiving zeros.

One comment to make is that we have soldered the connection between our K-type connectors and the breakout board, but not the wires and the breadboard, which we believe might be part of the issue.

Below is the code:
Code: Select all
import os
import spidev
import Adafruit_GPIO.SPI as SPI
import Adafruit_MAX31855.MAX31855 as MAX31855

# Raspberry Pi software SPI configuration.
CLK = 25
CS  = 24
DO  = 18
sensor = MAX31855.MAX31855(CLK, CS, DO)
 
# Raspberry Pi hardware SPI configuration.
SPI_PORT   = 0
SPI_DEVICE = 0
sensor = MAX31855.MAX31855(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=5000000))

def c_to_f1 (temp):
    return(temp * (9.0/5.0)) + 32.0
    
def c_to_f2 (internal):
    return(internal * (9.0/5.0)) + 32.0
    

print ('Press Ctrl-C to quit.')
while True:
	temp = sensor.readTempC()
	internal = sensor.readInternalC()
	print(('Thermocouple Temperature: {0:0.3F}*C / {1:0.3F}*F').format(temp, c_to_f1(temp)))
	print (('Internal Temperature: {0:0.3F}*C / {1:0.3F}*F').format(internal, c_to_f2(internal)))
	
	print(temp)
	print(internal)
    
    
	time.sleep(1.0)