问题
I am pretty new to the GPIO part of the raspberry Pi. When I need pins I normally just use Arduino. However I would really like this project to be consolidated to one platform if possible, I would like to do it all on the PI.
So I have three (3) MAX31855 boards and type K Thermocouples. I just don't know where to go with hooking up the other two. I don't know if I can just use any other pins (besides power and ground pins) for the MISO, CSO, and SCLK pins. This may sound like a rookie question but like I said I'm used to using arduino for this stuff. Any input is appreciated. Thanks in advance.
I'm using code from https://github.com/Tuckie/max31855
from max31855 import MAX31855, MAX31855Error
cs_pin=24
clock_pin=23
data_pin=22
unit="f"
thermocouple1=MAX31855(cs_pin, clock_pin, data_pin, units)
print(thermocouple.get())
thermocouple.cleanup()
回答1:
You can share the MISO
and SCLK
lines among the devices, and then each device will need its own CS
. Something like:
In this case Master
is the Pi, and Slaves are the MAX31855's. SS (Slave Select) is the same as CS (Chip Select).
from max31855 import MAX31855, MAX31855Error
cs_pin_1=24
clock_pin=23
data_pin=22
cs_pin_2=21
cs_pin_3=20
units = "f"
thermocouple1=MAX31855(cs_pin_1, clock_pin, data_pin, units)
thermocouple2=MAX31855(cs_pin_2, clock_pin, data_pin, units)
thermocouple3=MAX31855(cs_pin_3, clock_pin, data_pin, units)
回答2:
You could use a TH7 pi hat which allows up to seven thermocouple inputs. This PCB uses the standard python SPI interface. Python Code plus documentation below. https://github.com/robin48gx/TH7
来源:https://stackoverflow.com/questions/43622224/multiple-thermocouples-on-raspberry-pi