Closed electricspaceman closed 3 years ago
This is the code I'm using: https://github.com/steve71/MAX31865
Can you test whether that works outside of Mycodo?
cd
git clone github.com/steve71/MAX31865
cd MAX31865
Edit max31865.py and change these pins to reflect your connections:
Then run the code using Mycodo's python3:
~/Mycodo/env/bin/python ./max31865.py
Also, I see you're running v6.3.9, which is not the latest stable version (6.4.5). I would always recommend upgrading the latest stable version because your issue may have already been resolved. Upgrade, and if you're still experiencing the same issue, run the code in comment https://github.com/kizniche/Mycodo/issues/570#issuecomment-441255663 and report back. Thanks.
Hi Kyle,
So happy to have your help with this.
With the help of another friend:
1) Upgraded Mycodo to 6.4.5. 2) Altered the script to that the pins are correctly allocated. 3) Run the script - it didn't appear to be Python 3 compliant, so we chanced it by running it in Python 2.* and the terminal gave the following response:
pi@raspberrypi:~/MAX31865 $ python ./max31865.py config register byte: 90 RTD ADC Code: 26676 PT100 Resistance: 325.634766 ohms Straight Line Approx. Temp: 577.625000 degC Callendar-Van Dusen Temp (degC > 0): 637.344271 degC high fault threshold: 32767 low fault threshold:
Strange that the temperature is reading so unusually.
Mycodo only runs in python3, so if you could provide the error(s) from running in the python3 environment, that will help me port it from py2 -> py3.
Also, make sure you're using the proper reference resistor value. This can throw off the measurement if it's incorrect.
Mycodo only runs in python3, so if you could provide the error(s) from running in the python3 environment, that will help me port it from py2 -> py3.
I see that there are 8 pre-existing forks, I wonder perhaps if one of them is Python 3 compliant. I will check it out. Quite new to this sort of thing. :)
Also, make sure you're using the proper reference resistor value. This can throw off the measurement if it's incorrect.
So double and triple checked the hardware and I'm certain that I've not wired things incorrectly. Breakout board that I'm using advises to use 430ohm as the base/reference resistance, with that it reads 715C. Playing around I found:
Base resistance |Temperature 600 | 1209 430 | 715 215 | 198 180 | 120 140 | 35.75 130 | 14.78 125 | 4.34 120 | 577.09 107.5 | 578.81 53.75 | 578.78
Have you ever seen anything like this before?
It's so weird.
Hi Kyle,
I have debugged the file so that it now works with Python3. I've run out of time tonight but I will endeavour to send you the update tomorrow. Which way would suit you best?
I ran the code in Python3 environment and it shows readings of 567C. Do you know of anyone else in the community of this project who has had any issues getting the MAX breakout board working?
I've checked the documentation for the breakout board and it says 430ohms is what is required for the base resistance, do you know if there is a way to check the resistance instead of the temperature?
I don't have any of the MAX chips or probes to test with, so unfortunately I won't be much help debugging the issue. As for how to send the updated file, you can paste the code in a comment in this issue. If you surround the code with three backtics at the top and bottom of the code, it will preserve indentations.
Howdy, I think I have one of these that I haven't put together yet. I'll review the engineering information, build a test environment and see if I can help with the code review for this part.
This is the vendor Primer for MAX31865
The Maxim data sheet specifies the reference resistor value as:
A reference resistor equal to four times the RTD’s 0 degrees C resistance is optimum for a platinum RTD. Therefore, a PT100 uses a 400 ohm reference resistor, and a PT1000 uses a 4k ohm reference resistor.
This is a high precision, low drift resistor value ( 430 ohms sounds like a %5 value ). But I don't think that would introduce that much error. Are you really using a 4-wire connection? Which breakout are you using? Do you have a schematic of the breakout circuitry?
The error values ( lack of apparent linearity ) look to me to be more of a problem with the SPI interface. The Max31865 tries to be clever in sensing the polarity of the clock during CS-low. It could be noise on the power supply. A 10-25 uf tantalum capacitor and 0.1 ceramic capacitor low-pass filter is good. Just put across the supply lines close to the device or breakout, being careful of the tantalum cap polarity.
I don't have any of the MAX chips or probes to test with, so unfortunately I won't be much help debugging the issue. As for how to send the updated file, you can paste the code in a comment in this issue. If you surround the code with three backtics at the top and bottom of the code, it will preserve indentations.
#The MIT License (MIT)
#
#Copyright (c) 2015 Stephen P. Smith
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
import time, math
import RPi.GPIO as GPIO
#import numpy
class max31865(object):
"""Reading Temperature from the MAX31865 with GPIO using
the Raspberry Pi. Any pins can be used.
Numpy can be used to completely solve the Callendar-Van Dusen equation
but it slows the temp reading down. I commented it out in the code.
Both the quadratic formula using Callendar-Van Dusen equation (ignoring the
3rd and 4th degree parts of the polynomial) and the straight line approx.
temperature is calculated with the quadratic formula one being the most accurate.
"""
def __init__(self, csPin = 8, misoPin = 9, mosiPin = 10, clkPin = 11):
self.csPin = csPin
self.misoPin = misoPin
self.mosiPin = mosiPin
self.clkPin = clkPin
self.setupGPIO()
def setupGPIO(self):
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.csPin, GPIO.OUT)
GPIO.setup(self.misoPin, GPIO.IN)
GPIO.setup(self.mosiPin, GPIO.OUT)
GPIO.setup(self.clkPin, GPIO.OUT)
GPIO.output(self.csPin, GPIO.HIGH)
GPIO.output(self.clkPin, GPIO.LOW)
GPIO.output(self.mosiPin, GPIO.LOW)
def readTemp(self):
#
# b10000000 = 0x80
# 0x8x to specify 'write register value'
# 0xx0 to specify 'configuration register'
#
# 0b10110010 = 0xB2
# Config Register
# ---------------
# bit 7: Vbias -> 1 (ON)
# bit 6: Conversion Mode -> 0 (MANUAL)
# bit5: 1-shot ->1 (ON)
# bit4: 3-wire select -> 1 (3 wire config)
# bits 3-2: fault detection cycle -> 0 (none)
# bit 1: fault status clear -> 1 (clear any fault)
# bit 0: 50/60 Hz filter select -> 0 (60Hz)
#
# 0b11010010 or 0xD2 for continuous auto conversion
# at 60Hz (faster conversion)
#
#one shot
self.writeRegister(0, 0xB2)
# conversion time is less than 100ms
time.sleep(.1) #give it 100ms for conversion
# read all registers
out = self.readRegisters(0,8)
conf_reg = out[0]
print ("config register byte: %x" % conf_reg)
[rtd_msb, rtd_lsb] = [out[1], out[2]]
rtd_ADC_Code = (( rtd_msb << 8 ) | rtd_lsb ) >> 1
temp_C = self.calcPT100Temp(rtd_ADC_Code)
[hft_msb, hft_lsb] = [out[3], out[4]]
hft = (( hft_msb << 8 ) | hft_lsb ) >> 1
print ("high fault threshold: %d" % hft)
[lft_msb, lft_lsb] = [out[5], out[6]]
lft = (( lft_msb << 8 ) | lft_lsb ) >> 1
print ("low fault threshold: %d" % lft)
status = out[7]
#
# 10 Mohm resistor is on breakout board to help
# detect cable faults
# bit 7: RTD High Threshold / cable fault open
# bit 6: RTD Low Threshold / cable fault short
# bit 5: REFIN- > 0.85 x VBias -> must be requested
# bit 4: REFIN- < 0.85 x VBias (FORCE- open) -> must be requested
# bit 3: RTDIN- < 0.85 x VBias (FORCE- open) -> must be requested
# bit 2: Overvoltage / undervoltage fault
# bits 1,0 don't care
#print "Status byte: %x" % status
if ((status & 0x80) == 1):
raise FaultError("High threshold limit (Cable fault/open)")
if ((status & 0x40) == 1):
raise FaultError("Low threshold limit (Cable fault/short)")
if ((status & 0x04) == 1):
raise FaultError("Overvoltage or Undervoltage Error")
def writeRegister(self, regNum, dataByte):
GPIO.output(self.csPin, GPIO.LOW)
# 0x8x to specify 'write register value'
addressByte = 0x80 | regNum;
# first byte is address byte
self.sendByte(addressByte)
# the rest are data bytes
self.sendByte(dataByte)
GPIO.output(self.csPin, GPIO.HIGH)
def readRegisters(self, regNumStart, numRegisters):
out = []
GPIO.output(self.csPin, GPIO.LOW)
# 0x to specify 'read register value'
self.sendByte(regNumStart)
for byte in range(numRegisters):
data = self.recvByte()
out.append(data)
GPIO.output(self.csPin, GPIO.HIGH)
return out
def sendByte(self,byte):
for bit in range(8):
GPIO.output(self.clkPin, GPIO.HIGH)
if (byte & 0x80):
GPIO.output(self.mosiPin, GPIO.HIGH)
else:
GPIO.output(self.mosiPin, GPIO.LOW)
byte <<= 1
GPIO.output(self.clkPin, GPIO.LOW)
def recvByte(self):
byte = 0x00
for bit in range(8):
GPIO.output(self.clkPin, GPIO.HIGH)
byte <<= 1
if GPIO.input(self.misoPin):
byte |= 0x1
GPIO.output(self.clkPin, GPIO.LOW)
return byte
def calcPT100Temp(self, RTD_ADC_Code):
R_REF = 400.0 # Reference Resistor
Res0 = 100.0; # Resistance at 0 degC for 400ohm R_Ref
a = .00390830
b = -.000000577500
# c = -4.18301e-12 # for -200 <= T <= 0 (degC)
c = -0.00000000000418301
# c = 0 # for 0 <= T <= 850 (degC)
print ("RTD ADC Code: %d" % RTD_ADC_Code)
Res_RTD = (RTD_ADC_Code * R_REF) / 32768.0 # PT100 Resistance
print ("PT100 Resistance: %f ohms" % Res_RTD)
#
# Callendar-Van Dusen equation
# Res_RTD = Res0 * (1 + a*T + b*T**2 + c*(T-100)*T**3)
# Res_RTD = Res0 + a*Res0*T + b*Res0*T**2 # c = 0
# (c*Res0)T**4 - (c*Res0)*100*T**3
# + (b*Res0)*T**2 + (a*Res0)*T + (Res0 - Res_RTD) = 0
#
# quadratic formula:
# for 0 <= T <= 850 (degC)
temp_C = -(a*Res0) + math.sqrt(a*a*Res0*Res0 - 4*(b*Res0)*(Res0 - Res_RTD))
temp_C = temp_C / (2*(b*Res0))
temp_C_line = (RTD_ADC_Code/32.0) - 256.0
# removing numpy.roots will greatly speed things up
#temp_C_numpy = numpy.roots([c*Res0, -c*Res0*100, b*Res0, a*Res0, (Res0 - Res_RTD)])
#temp_C_numpy = abs(temp_C_numpy[-1])
print ("Straight Line Approx. Temp: %f degC" % temp_C_line)
print ("Callendar-Van Dusen Temp (degC > 0): %f degC" % temp_C)
#print "Solving Full Callendar-Van Dusen using numpy: %f" % temp_C_numpy
if (temp_C < 0): #use straight line approximation if less than 0
# Can also use python lib numpy to solve cubic
# Should never get here in this application
temp_C = (RTD_ADC_Code/32) - 256
return temp_C
class FaultError(Exception):
pass
if __name__ == "__main__":
import max31865
csPin = 8
misoPin = 9
mosiPin = 10
clkPin = 11
max = max31865.max31865(csPin,misoPin,mosiPin,clkPin)
tempC = max.readTemp()
GPIO.cleanup()
Hello! :)
This is a high precision, low drift resistor value ( 430 ohms sounds like a %5 value ). But I don't think that would introduce that much error. Are you really using a 4-wire connection? Which breakout are you using?
I am using Adafruit MAX31865 and 4 wire connection.
Do you have a schematic of the breakout circuitry?
Here is a copy of the schematic .
A reference resistor equal to four times the RTD’s 0 degrees C resistance is optimum for a platinum RTD. Therefore, a PT100 uses a 400 ohm reference resistor, and a PT1000 uses a 4k ohm reference resistor.
I changed the Reference Resistance from 430ohm to 400ohm but no dice, and I noticed the temperature now reads 636C.
I also noticed, and I'm not sure how this is the case, there are now two options to select the clock pins. Please see the above screenshot, as well as this one...
Perhaps the Mycodo update has meant the addition of a new an addtioanl CS field? @kizniche what values should I have for each? I actually have two MAX31865, sorry I didn't mention this earlier but I just wanted to get one working before trying the second unit, is the second field for a second MAX31865? I'd like to use two so I have a humidity sensor that relies on evapouration to work (ie Wet Bulb Dry Bulb).
The error values ( lack of apparent linearity ) look to me to be more of a problem with the SPI interface. The Max31865 tries to be clever in sensing the polarity of the clock during CS-low. It could be noise on the power supply. A 10-25 uf tantalum capacitor and 0.1 ceramic capacitor low-pass filter is good. Just put across the supply lines close to the device or breakout, being careful of the tantalum cap polarity.
I've been trying my best to imitate Kyle's build and so I do have a 5v power supply (CUI VOF-10-5) at hand which I could use - presumably that will produce a clean/quiet electrical source. So far I've been using the onboard power supply of the Raspberrry Pi, which in turn is powered by a little 5w iPhone usb thingy. How much difference will it make, or is it a case of trying rule out possibilities? Merely curious.
Thank you both for your time, I do really appreciate some help.
There are some options appearing that shouldn't be (again, fixed in 7.0). I'll review the code later and let you k ow which aren't used to set the options for the module.
Don't worry about the second Clock Pin option. As long as you have them set to the same pin, one will be used to set the clock pin properly. I noticed you changed the CS pin from the default. Have you tried using the default pins?
Hi there, So:
The error values ( lack of apparent linearity ) look to me to be more of a problem with the SPI interface. The Max31865 tries to be clever in sensing the polarity of the clock during CS-low. It could be noise on the power supply. A 10-25 uf tantalum capacitor and 0.1 ceramic capacitor low-pass filter is good. Just put across the supply lines close to the device or breakout, being careful of the tantalum cap polarity.
Had to order a few bits but I now have a 5v power supply (CUI VOF-10-5) powering the PI and supply a common DC supply two terminal blocks.
Sadly the powersupply has had no effect on the signal and in mycodo, it's still reading ~715C.
I am correct in suggesting that using this power supply addressing any possible noise or interference? If not, should I pursue installing the snubber circuit?
Don't worry about the second Clock Pin option. As long as you have them set to the same pin, one will be used to set the clock pin properly. I noticed you changed the CS pin from the default. Have you tried using the default pins?
Thanks for the idea, I've been really wracking my brain. I changed it over to the default CS as you suggested and that made no difference.
I bet it's something like really obvious. Will spend a bit more time trying different things, a tough nut to crack!
Do you know if anyone else in the mycodo-verse has a built a wet bulb dry bulb sensor for mushroom cultivation?
Do you know if anyone else in the mycodo-verse has a built a wet bulb dry bulb sensor for mushroom cultivation?
I have with two DS18B20 sensors, a conical vial of deionized water, and a hydrophilic hollow cotton wick surrounding the wet-bulb thermometer that was placed in front of a continuously moving airflow in the chamber. It worked very well. There were no issues with condensation throwing off the measurements as digital sensors often experience, however you must make sure to have a microbial control regimen in place because the wick will begin to be colonized after a few weeks exposed to the environment. I never had any issue with the reservoir water so long as the water was free of contaminants and nutrients/minerals.
I have the wet bulb system running for about 2 months now, albeit not for mushroom, my temperature range is 5-10 degrees Celsius for cheese aging. This is good for avoiding contamination, but I would definitely agree to have distilled water and probably something against mold at higher temperatures.
I tested several DS18B20 sensors to make sure they give sufficiently close readings, then used a setup similar to Kyle's. Although the wick is not a specialized one that was discussed in another thread here, just a simple cotton diaper piece. Still get readings within a few % points of a control hygrometer.
In conclusion, I'll probably never go back to any humidity sensor, since I already have a big pile of failed DHT, HTU and BMP sensors, all stopped working after 3-6 months at 92-98% RH.
Thanks to @Theoi-Meteoroi, @kizniche and @zsole2 for all your help.
Not sure why now, but I had completely overlooked the 1-wire interface. It's amazing! I found some good breakouts and an adapter on www.sheepwalkelectronics.co.uk - very pleased.
Will hang on to the MAX31865 sensors and if I have spare time in the future I will endeavour to get them working on a different project.
Probably safe to close this off as I'm now taking a different (from your advice) direction.
Would like to see any images of how you constructed your sensor? Wood is not an ideal material in a mushroom growing environment (although I do have some yacht varnish).
You can check out #335 for the issue developing this feature and photos of my wet-bulb setup. I essentially dipped my sensor/wire end in the material typically used for coating tool handles that have degraded. For this particular application, I used the spray version.
Thank you for all your help with this,
Hello. Is there a reason this issue was reopened?
Hi,
Sorry, I reopened it and then immediately had to go do something else. sorry.
I wanted to have another go with the max31865 RTD PT1000 sensors in order to make my own super-accurate psychrometer for measuring humidity for a mushroom growing environment that I am building.
Side note: I tried using DS18B20 and with your help, I was able to get them working however the temperature readings were not accurate enough for my liking. The mushroom farm where I used to work used PT100 sensors for their psychrometer and it would bring me great satisfaction to be able to do the same.
Prior to initialising Mycodo, I connected my two adafruit max31865 breakout boards and using the tutorial on their website I was able to get norminal readings from the probes! I was extremely happy about this and thought the next best thing to do would be to fire up mycodo and see if it works there too. This is where things took a U-turn and I started getting funny readings like 800C etc. I then, without doing anything else, decided to run my python script from the adafruit tutorial and the sensors were putting funny readings again but like -245C this time. All this while the hardware had not been touched and nothing powered down or rebooted.
This makes me wonder if the module for the max31865 is set up correctly. I'm not 100% confident with SPI but I'm guessing once Mycodo initialized that it reconfigured the way the pins are read on the GPIO for SPI (complete conjecture). The pins must've been connected correclty as the code ran correctly in my script and I quadruple checked that I had the same pins (using BCM numbering) were configured in mycodo.
Normally I would include screenshots but I'm not at work right now.
If I recall correctly you said that you aren't able to debug the max31865 as you don't have any, but I wonder if you could help by checking the code in the module and the code in the tutorial?
https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier/python-circuitpython
I also used the code on this page for multiple sensors, adapting it for 2 channels as the adafruit tutorial only shows how to code for one sensor and I'm not a sufficiently adept coder to synthesize code.
import time
import board
import busio
import digitalio
import adafruit_max31865
import wiringpi
print('MAX31865 4 Channel')
#initialize
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs1 = digitalio.DigitalInOut(board.D5)
cs2 = digitalio.DigitalInOut(board.D6)
cs3 = digitalio.DigitalInOut(board.D12)
cs4 = digitalio.DigitalInOut(board.D13)
sensor1 = adafruit_max31865.MAX31865(spi, cs1, rtd_nominal=100, ref_resistor=431.0, wires=2)
sensor2 = adafruit_max31865.MAX31865(spi, cs2, rtd_nominal=100, ref_resistor=431.0, wires=2)
sensor3 = adafruit_max31865.MAX31865(spi, cs3, rtd_nominal=100, ref_resistor=431.0, wires=2)
sensor4 = adafruit_max31865.MAX31865(spi, cs4, rtd_nominal=100, ref_resistor=431.0, wires=2)
while True:
temp1 = sensor1.temperature
temp2 = sensor2.temperature
temp3 = sensor3.temperature
temp4 = sensor4.temperature
print('Temperature: {0:0.3f}C'.format(temp1))
print('Temperature: {0:0.3f}C'.format(temp2))
print('Temperature: {0:0.3f}C'.format(temp3))
print('Temperature: {0:0.3f}C'.format(temp4))
time.sleep(0.1)
Many thanks for your time Kyle,
Hi Kyle,
Back at work! I've got screenshots for you to look at. I rebooted the pi when I got in and tried to run my test script and it showed norminal readings. I think the problem might be due to the fact that I am using four wires which is possibly an unusual amount. Maybe the mycodo max31865 software module is configured for a different amount of wires?
I just retried 'activating' the sensors again and then trying my maxtest.py script again and this time the correct readings are showing in the terminal window which contradicts my earlier post.
Data in mycodo is still showing -256.
Hey Kyle,
Just wondering you'd be interested in helping me get this sensor working? I had a review of the code, my coding skills are weak! but I think I think the MAX31865 module is broken. It doesn't contain libraries that I think will make it functional and also it ommits things like a way to properly set the ref-resistance and the number of wires being used.
I did try have a look at making my own custom input but it's an almost insurmountable challenge right now. I could do it with enough time, but perhaps with your help, it would be much less.
@electricspaceman I've been using the MAX31865 module for awhile now (over a year) in Mycodo and have only had small issues (unrelated to Mycodo, has to do with EM interference, I think) with it. What exactly is the issue you're having?
I think creating a new input with the adafruit library is the best way to go, however since I don't have this sensor, developing it myself may be difficult. When developing an input module, I like to be able to let the user select which pins to use, and referencing your code I notice there are variables used rather than integers for the pins. I have several modules that use Adafruit's Circuitpython libraries, but only for I2C using Adafruit_Extended_Bus, none for UART. If you can you provide example code that allows specific pins (as integers) to be used with the adafruit library, I can probably take it from there to make it into a module.
Relooking at this in further detail, you're using the wrong pins... you're putting in Board numbering when it should be BCM numbering. Try looking at the mycodo info screen and cross referencing the board pin that you input and the BCM numbers.
FYI a new MAX31865 input using the adafruit CircuitPython library was just added and will be available in the next release. You can upgrade to master to test it out before release. (see #900)
Hey Kyle,
Sorry that I didn't see this sooner. Thank you for time on this. Super grateful.
@electricspaceman I've been using the MAX31865 module for awhile now (over a year) in Mycodo and have only had small issues (unrelated to Mycodo, has to do with EM interference, I think) with it. What exactly is the issue you're having?
I'm trying to add two PT1000 4-wire sensors using the adafruit MAX31865 breakout boards for a psychrometer I'm making. It would come up with incorrect temperature readings as per the title. Yet when running a script outside of Mycodo, in the screenshot above it would work fine.
I think creating a new input with the adafruit library is the best way to go, however since I don't have this sensor, developing it myself may be difficult. When developing an input module, I like to be able to let the user select which pins to use, and referencing your code I notice there are variables used rather than integers for the pins. I have several modules that use Adafruit's Circuitpython libraries, but only for I2C using Adafruit_Extended_Bus, none for UART. If you can you provide example code that allows specific pins (as integers) to be used with the adafruit library, I can probably take it from there to make it into a module.
My friend and I had also been working on this but it seems like you have beaten us to it! 🥇 Thanks for implementing this.
I upgraded to the master branch to test this out and added the new MAX31865_CIRCUITPYTHON data inputs using the GPIO numbering (5,6), this yielded 0C for both sensors. Out of curiosity I also tried BCM numbering (29,31) and this gave the same 0C reading. I'll stick to the GPIO numbering as the tooltip suggests, just felt like it needed trying!
Something I have noticed, if I boot up the raspberry pi and run my script outside of mycodo it works fine, but then when I try the script again having added the sensors in mycodo it gives readings of -242C. Which is really weird.
Based on your images above, the BCM numbering for the cs pins is 5 and 6. Make sure SPI is enabled on your pi: https://localhost/settings/pi this may be a silly question, but make sure your board is soldered correctly.
Based on your images above, the BCM numbering for the cs pins is 5 and 6. Make sure SPI is enabled on your pi: https://localhost/settings/pi this may be a silly question, but make sure your board is soldered correctly.
I’m pretty sure the hardware is configured correctly as I was able to acquire correct readings outside mycodo just fine using a python script I cobbled together.
It’s when we activate the sensors in mycodo that things go awry.
Good news!
I think I have found the issue. I have commented out the SPI try lock code, as shown in the screenshot below, I get temperature readings in mycodo :D
I don't understand what the SPI try lock does, is there something on my system config, is this needed?
Not sure what the SPI lock was added for... SPI is a party bus, so it shouldn't be "locked." Kyle, was there a reason you added that portion to the input code?
I was testing. I'll remove it for release.
@electricspaceman sounds like we can close this issue?
This is the info I was reading when I started testing locking: https://www.digikey.com/en/maker/projects/circuitpython-basics-i2c-and-spi/9799e0554de14af3850975dfb0174ae3
Thanks for getting this working now. I did a fresh install at it's working great!
Mycodo Issue Report:
Version 6.3.9
Problem Description
PINOUTS: 5V -> Vin Ground -> GND BCM 10 MOSI -> SDI BCM 9 MISO -> SDO BCM 11 SCLK -> CLK BCM 23 -> CS
Can't figure this out! Have I got faulty hardware??
Any help would be greatly appreciated.