MAX31865 + raspberry pi 3B+ not working

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.
User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »

Hi.
I bought the max31865 board and I'm trying to measure temperature with pt100 sensor. I used the guide on your side and have few problems with it. Now when I try run it with python3 example.py it says resistance is 0 ohms. On arduino its working perfectly.
First issue is that your library requires spidev in version 3.4, but only avalaible is 3.3. It has to be downloaded from github and upgraded. Which I dont think I succeeded. Can you help me?

User avatar
SnarfQ
 
Posts: 4
Joined: Wed Oct 23, 2019 2:23 pm

Re: MAX31865 + raspberry pi 3B+ not working

Post by SnarfQ »

This command fixed that error:
python3 -m pip install --upgrade --force-reinstall spidev

I struggled with the same problem

User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

Re: MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »


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

Re: MAX31865 + raspberry pi 3B+ not working

Post by adafruit_support_carter »

Post a photo of your setup showing how you have everything wired together using the Pi.


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

Re: MAX31865 + raspberry pi 3B+ not working

Post by adafruit_support_carter »

Soldering *might* be an issue on the header pins. But first, try swapping the purple/grey wires on one end. It looks like you have your MOSI/MISO lines swapped. See here:
https://learn.adafruit.com/adafruit-max ... wiring-6-3
and here:
https://pinout.xyz/#

User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

Re: MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »

Soldering isn't issue because on arduino platform it works perfectly.

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

Re: MAX31865 + raspberry pi 3B+ not working

Post by adafruit_support_carter »

Did swapping the wires work?

User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

Re: MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »

No, but when I swapped, its sometimes returning 2 ohm result. But about one on ten times gives me that value. Others are giving me 0 ohm value

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

Re: MAX31865 + raspberry pi 3B+ not working

Post by adafruit_support_carter »

What program are you running? Is it the example from the library?
https://github.com/adafruit/Adafruit_Ci ... pletest.py

User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

Re: MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »

This is the program I'm currently using :
https://drive.google.com/open?id=1zdu6j ... wUkK4MS5bH

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

Re: MAX31865 + raspberry pi 3B+ not working

Post by adafruit_support_carter »

Try using something other the CE0 or CE1 for chip select. See warning here:
https://learn.adafruit.com/circuitpytho ... rs-devices
and the wiring example that is known to work here:
https://learn.adafruit.com/adafruit-max ... wiring-6-3

User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

Re: MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »

I dont understand. Theoretically any raspberry pi's pinout can become chip select, but for spi interfaces are only two. The cs pinout for spi is called D8 which I did in my program. You are using D5 but this is not mentioned anywhere as spi chip select pinout. Is that because some settings in library or something?
And I dont understand the other thing. Every library related with communication systems has open() and close() methods. But your doesnt. Is that because is somewhere hidden? Or making object like sensor.temperature opens connection, gathers data and close it?

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

Re: MAX31865 + raspberry pi 3B+ not working

Post by adafruit_support_carter »

You are using D5 but this is not mentioned anywhere as spi chip select pinout. Is that because some settings in library or something?
It should be explained in the first link above.
Or making object like sensor.temperature opens connection, gathers data and close it?
Yes. This is an example of a Python property. The basic idea is to hide all the SPI comms and take care of that behind the scenes for you.

You can see all the code that gets run here:
https://github.com/adafruit/Adafruit_Ci ... 65.py#L231
It calls another property, resistance:
https://github.com/adafruit/Adafruit_Ci ... 65.py#L223
which then calls read_rtd():
https://github.com/adafruit/Adafruit_Ci ... 65.py#L204
which then calls the basic SPI transaction functions, like _read_u8:
https://github.com/adafruit/Adafruit_Ci ... 65.py#L119
etc.

If you're not familiar with Python context managers, that's another level of abstraction. So here:
https://github.com/adafruit/Adafruit_Ci ... 65.py#L121
ends up calling here:
https://github.com/adafruit/Adafruit_Ci ... ice.py#L79

User avatar
M_K_
 
Posts: 9
Joined: Tue Oct 22, 2019 5:52 am

Re: MAX31865 + raspberry pi 3B+ not working

Post by M_K_ »

I added another spi, like you wrote in your website.
I dont understand this part:
Here's the wiring for SPI #1:

SCK_1 on GPIO #21
MOSI_1 on GPIO #20
MISO_1 on GPIO #19
SPI #1 CS0 on GPIO 18
SPI #1 CS1 on GPIO 17
SPI #1 CS2 on GPIO 16

because on this site it says https://learn.sparkfun.com/tutorials/ra ... pio-pinout that pin 20 is ground. Anyway when I connected all wires I tried to run program but this time it says some errors:
https://drive.google.com/open?id=167P7W ... L8NHMmzedf

I swear I followed your every step.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”