Max31865 on Raspberry Pi4 (Blinka)

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

I can't seem to get my max31865 board working on my R-Pi4.
I'm guessing its software related that's why i'm posting it here.

I followed the steps on the adafruit website to install it but it keeps giving a: Temperature: -242.020C output.

I ran the Blinka test script and all the output looks fine:
Hello Blinka!
Digital IO ok!
I2C ok!
SPI ok!
done!


So I decided to hook the SPI connections to my scope and noticed the CS got pulled down like it should.
But I only got a couple of clock pulses ans nothing on the data lines (MISO - MOSI ).
pt100.jpg
pt100.jpg (100.86 KiB) Viewed 75 times
(Green=CS, Yellow=CLK, Blue=SDO, Red=SDI)

Then I ran a known good regular Python SPI script and that all worked fine.

Is there someone who can help me with this problem ?

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

To add.
-The board is an original Adafruit.

-I used this tutorial:
https://learn.adafruit.com/adafruit-max ... cuitpython

-Tried it on two different Pi4's with the same result.

-Tried it with two different PT100's, two and thee wire and soldered the corresponding bridges (as described) on the board.

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

Small update:
Today I decided to give it a try on a Rpi Pico.
Got it running with some tweaking of the code on the Adafruit website but with the same result.
CS pulled down, some clock pulses but that's it. :(

20220817_030249.JPG
20220817_030249.JPG (110.07 KiB) Viewed 59 times
The code I used:

Code: Select all

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# Simple demo of the MAX31865 thermocouple amplifier.
# Will print the temperature every second.

import time
import board
import digitalio
import adafruit_max31865
import busio


# Create sensor object, communicating over the board's default SPI bus
spi = busio.SPI(clock=board.GP6, MOSI=board.GP3, MISO=board.GP4)
cs = digitalio.DigitalInOut(board.GP5)  # Chip select of the MAX31865 board.
sensor = adafruit_max31865.MAX31865(spi, cs)
# Note you can optionally provide the thermocouple RTD nominal, the reference
# resistance, and the number of wires for the sensor (2 the default, 3, or 4)
# with keyword args:
sensor = adafruit_max31865.MAX31865(spi, cs, rtd_nominal=100, ref_resistor=430.0, wires=2)

# Main loop to print the temperature every second.
while True:
    # Read temperature.
    temp = sensor.temperature
    # Print the value.
    print("Temperature: {0:0.3f}C".format(temp))
    # Delay for a second.
    time.sleep(1.0)
One more thing I noticed was when I commented out the first "sensor" line the CS would stay low.

Some help would be very welcome.

User avatar
adafruit_support_carter
 
Posts: 24419
Joined: Tue Nov 29, 2016 2:45 pm

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by adafruit_support_carter »

Please post a photo of your setup showing how everything is connected.

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

Hello Carter.
These are some pictures of my current test setup with the Pico.
IMG_20220816_215629sml.jpg
IMG_20220816_215629sml.jpg (64.88 KiB) Viewed 56 times
IMG_20220816_215703sml.jpg
IMG_20220816_215703sml.jpg (80.24 KiB) Viewed 56 times
IMG_20220816_215614 sml.jpg
IMG_20220816_215614 sml.jpg (69.96 KiB) Viewed 56 times
By the way, I have confirmed getting 3.3V between the soldering connections (GND-VIN) of the breakout board.
Although I dont think that has anything to do with nothing coming out of the MOSI of the boards (Pico and PI4's).

User avatar
adafruit_support_carter
 
Posts: 24419
Joined: Tue Nov 29, 2016 2:45 pm

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by adafruit_support_carter »

Your code does not appear to be matching the pins being used.

Code: Select all

spi = busio.SPI(clock=board.GP6, MOSI=board.GP3, MISO=board.GP4)
cs = digitalio.DigitalInOut(board.GP5)  # Chip select of the MAX31865 board.
Also, why the pull up resistor on CS?

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

Went over it again but it should be correct right ?
(Or am I missing something ?)

Image

Could have grabbed pin 4 (GP2) for clock to get a nice group of connections but it should not really matter right.

I added the (10k) pullup resistor to the CS line when i ran into the "One more thing I noticed was when I commented out the first "sensor" line the CS would stay low." problem.

I left it in because it did not cause any problem (as seen on the scope).

In the meantime I have been testing with a MCP3008 ADC chip and the corresponding Adafruit library on the Pico with the same breadboard setup and it works good over SPI...
IMG_20220819_085911.jpg
IMG_20220819_085911.jpg (993.24 KiB) Viewed 39 times
The code:

Code: Select all

import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3008 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
import time

# create the spi bus
spi = busio.SPI(clock=board.GP6, MOSI=board.GP3, MISO=board.GP4)

# create the cs (chip select)
cs = digitalio.DigitalInOut(board.GP5)

# create the mcp object
mcp = MCP.MCP3008(spi, cs)

# create an analog input channel on pin 0
chan = AnalogIn(mcp, MCP.P0)

while True:
    print('Raw ADC Value: ', chan.value)
    print('ADC Voltage: ' + str(chan.voltage) + 'V')
    time.sleep(1)
Output:

Adafruit CircuitPython 7.3.2 on 2022-07-20; Raspberry Pi Pico with rp2040
>>> %Run -c $EDITOR_CONTENT
Raw ADC Value: 65216
ADC Voltage: 3.28394V
Raw ADC Value: 65472
ADC Voltage: 3.2936V
Raw ADC Value: 65344
ADC Voltage: 3.27104V

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

And the scope shows the spi protocol working well with this code.
(Bit of noise because of the crude setup, but nothing to cause problems in this case.)
mcp3008ok.jpg
mcp3008ok.jpg (145.96 KiB) Viewed 39 times

User avatar
adafruit_support_carter
 
Posts: 24419
Joined: Tue Nov 29, 2016 2:45 pm

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by adafruit_support_carter »

Oops, yah. Should be OK. Was confusing physical pin vs. GPx number.

Let's go back to checking hardware.

What RTD are you using? Can you link to a product page.

Is the solder jumper here OK? It's not shorting to the 3 pin pad? The pad already had a short for the 2/4 pin mode, so could have been left alone.
jumper.jpg
jumper.jpg (43.62 KiB) Viewed 33 times

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

The 2-4 pins are bridged with solder because I started out with a 3 wire PT100 but then moved to a 2 wire again for convenience.
(The 3 wire one is sealed on the outside of the house.)
The 2-4 and 3 pads are not bridged, measured it with a multimeter.
Both measure ok as described on the Adafruit website:
https://learn.adafruit.com/adafruit-max ... ing-config
And come from an existing Siemens LOGO system where they work correctly.

But it seems that the problem exists before the PT100 board, since I have no output on the MOSI pin.
(See the red line in the first two posts.)
Not on the Pico and not on the PI4.
Even measured directly on the board and without de PT100 board attached.
So there is nothing for the PT100 to work with to begin with.

User avatar
DutchMicro
 
Posts: 8
Joined: Sun Aug 14, 2022 5:36 am

Re: Max31865 on Raspberry Pi4 (Blinka)

Post by DutchMicro »

I have decided to quit this attempt to keep using the excising PT100 sensor and upgrade to a BME680.
After almost a week with no progress it's time to move on.

As I already use this BME680 for my indoor climate data I know this will work and it will give more interesting data.
The PT100 board is going into the "maybe later" box.

Thanks for the help and if I manage to fix it I will post it here.

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”