Hi everyone,
I am having issues with running a python script in Node Red. A bit of background into what I am trying to do:
I have a Raspberry Pi that use to run CraftBeerPi which is a Python based brewing application. I have decided to try and implement the brewery into Node Red. I have 4 PT100's that use the Max31865 boards. Currently the plugin for CBPI allows you to specify the CS pin to suit your application. I am using every GPIO pin on my Pi to run the brewery. The only option currently is to use the Max31865 node to do this communication, however it only allows you to use the fixed CS pins CS0.0 and 0.1 or CS1.0, 1.1 or 1.2 I believe. I can not add a second lot of SPI pins to use the other specified CS pins for the second SPI bus due to not having the available space. What I want to do is implement the PT100 plugin written in python into Node Red. Here is the issue..... I can't code. I can follow instructions and try things but my coding skills are very limited. I am learning however I tend to jump into the deep end with concrete blocks on my feet.
What I have done is download the python script onto the pi, and tried to use the exc node and also the pythonshell node. So far I have been unsucessful.
Here is the EXC flow I have tried
[{"id":"6a1243c1.c1df5c","type":"debug","z":"7b5c5210.c7dc5c","name":"HLT Temp Feedback","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":780,"y":240,"wires":[]},[MAX31865 Modified Code.txt|attachment](upload://peBgRtBcNUrXLMiXsf4P9eQbCUk.txt) (9.2 KB) {"id":"e5b43415.3285f8","type":"exec","z":"7b5c5210.c7dc5c","command":"python ~/MAX31865/max31865.py 8 ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":350,"y":300,"wires":[["6a1243c1.c1df5c"],["542f6378.7aea1c"],["24dd757c.e54d1a"]]},{"id":"542f6378.7aea1c","type":"debug","z":"7b5c5210.c7dc5c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":320,"wires":[]},{"id":"24dd757c.e54d1a","type":"debug","z":"7b5c5210.c7dc5c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":400,"wires":[]},{"id":"d17a44af.52f008","type":"inject","z":"7b5c5210.c7dc5c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":360,"wires":[["e5b43415.3285f8"]]}]
The python Shell I managed to get working but not by adding any valves to change the cs pin assignment.
I have attached the python script where I have changed a couple of things to suit. First is to make csPin=sys.argv[1] and then I have adjusted the ref resistor to suit that of the board and one other parameter to account for the PT100 wiring.
When using a debug node, I get the following
Traceback (most recent call last): File "/home/pi/MAX31865/max31865.py", line 215, in <module> max = max31865.max31865(csPin,misoPin,mosiPin,clkPin) File "/home/pi/MAX31865/max31865.py", line 43, in __init__ self.setupGPIO() File "/home/pi/MAX31865/max31865.py", line 48, in setupGPIO GPIO.setup(self.csPin, GPIO.OUT)ValueError: Channel must be an integer or list/tuple of integers
Is anyone able to help?
Kind Regards,
Sam