Serial Devices MCP3008 (solved)

After a long and lengthy battle with a MAX31865 thermocouple amp, I'm now ready to add a potentiometer to the mix. Ideally I'd like to use a single raspberry pi, not an Arduino and pi set up that most tutorials seem to favor. I've wired a MCP3008 to the same pi as the Max31865 per the Adafruit instructions and other tutorials. I'm fairly confidant the wiring and connections are correct, the Max is connected to CEO and the MCP to CE1. When I attempt to use the Pot the only value i and get from debug is zero

My questions are:
1- is it possible to use these two devices on the same pi simultaneously?
2- all of the wiring is shared (Clk,miso,mosi) with the Max other than the CE0 and CE1. Is that correct?
3- why is combining a pi and an arduino such a common thing?
4- What type of simple test can I run on the MCP to make sure its working properly with the A/D converter node that was in the pallet.

Thank you all.

  1. should be possible as long as wiring correct (as per 2)
  2. yes should be correct like that
  3. an arduino has many more analogue inputs and is easy to program, and can do a whole lot of other real time things. (like measure length of pulses, drive servos more accurately, etc) and can talk serial so can can pre-process or filter data and format it nicely for pi/Node-RED to consume. Also loads of "driver" code and examples for loads of devices (like these MCP devices) so why struggle :slight_smile:
  4. if possible - unwire the MAX31865 and just run the MCP3008 as per the default settings (CE0 etc) - so you can check both run on their own then - re-add the MAX device.

Wow, you are right, I used arduino board and had the poteniomoter working in about 30 seconds. Its work the extra money and space in the project just to get that to work, thank you.

I would like to figure out how to do the next step on my own but if you could guide me to the correct tutorial links that would be fantastic. I think what I need help with are the correct terms to search for.

1- I want to take the output of the Arduino node and multiply it by 0.62.
2- then take that message and use that a [variable?] in another node as the target temp
3- Then, check the current temp (from the max 31865) against the target temp and do stuff.

I have a working node but there is only one variable (the current temp) the set temp is static. I have several other projects that I could use this process on so I'd like to learn this.

where do I start reading?

Here is some information that I hope will clarify my questions.

I want to multiply the arduino output by .62 because that will convert the 0-1023 directly in to a number that is in degrees F for my oven set temperature.

My existing node from the fridge that I built is here. I could modify this to work with the oven settings. I'd like to change const fHigh to equal the output from the arduino (setTemp) plus a few degrees and the fLow to the setTemp minus a few degrees.

const fHigh =2.5
const fLow =-.5
let currentTemp = msg.payload

if (currentTemp >= fHigh) {
    return {payload: 0}
} else if (currentTemp <= fLow) {
    return {payload: 1}

Maybe first look at the range node. This lets you change a range of numbers (eg 0 -1023) to something else. It may already do what you want.

Well that was easy
thank you

Opps, I said solved too early! Due to some hardware constraints I decided to give the MCP3008 another try and it worked perfectly! The MCP3008 is connected to a poteniomoter and after a reboot it works great, but when I request information from the MAX31865 node it shuts down the MCP and it won't work until I reboot. I receive no error codes , the output just drops to a zero ever time i inject a time stamp to the MCP node.

The devices are set up in this way
MAX31865 is on the CE0 pin
MCP3008 is on the CE1 pin
Both share the other pins (MOSi, MISO, Clk)

The space i have for this project will not allow for the arduino with is why I'm going with the MCP.
Please let me know if you need more information and as always thank you for the assistance. If this is inappropriate for this forum, I'm happy to remove since I think this might be more of a Pi issue than NodeRed.

no worries with it here as there are lots of Pi users here as well.
It must be some interaction with the CE0 and CE1 etc. One or other of the nodes must be doing something wrong and dragging the other down. It's going to need some digging in debugging. Sadly I don't have both devices so I'm not in a place to volunteer.

So after some digging, the python shell that reads the MAX31865 changes the MISO MOSI and SCLK pins to 'in" and the MCP only works in ALT0 state. Any suggestions? I tried brute force by
making exec node that changed the pins every time it needs to access the MCP but that's not working.

maybe try the nodejs library that someone else pointed us at.

to start with it would need to be called outside of node red - it has some example code you can call from a command line to test.