0
\$\begingroup\$

I want to continuously acquire temperature from many ( ~20) thermocouple MAX 31856 all on one PCB ultimately. This chip interface with spi. The project language is python Because of the sensor latency, One multislave spi bus will be too slow.

So I would like to break down the sensors in several (4 or 5) independent spi buses that I could address in parallel with multithreading from a small computer ( raspi or other) on One addressable bus. I have found mcu with 2 spi master but none with more than that. I am considering using small mcu like the raspi pico for example and address them separately over an usb bus but i have not found any project doing that. Is there a problem with that approach? What will be other alternatives?

\$\endgroup\$
11
  • \$\begingroup\$ One thing that will be too slow for sure is your PC fluff running Python. That's the wrong tool. Unless you have any harder real-time requirements, you could either just mux slave select or make a SPI daisy chain. What you need to do is to write a specification. What is the real-time response of the system overall? How are the sensors placed physically? What are the distances? How much data is there? From there on you can pick a suitable SPI setup and a MCU. \$\endgroup\$
    – Lundin
    Mar 26 at 11:04
  • \$\begingroup\$ Ok I can add more specifics as per the Max 31856 datasheet one measurement takes ~200ms. 20 sensor on one spi bus ~4sec. the system already exists in Python with many other sensors and loop in 400ms without these new sensors. we can accept a loop time up to 1s but no more. There is jno distance this is a lab setting that will be ultimately integrated on One pcb, \$\endgroup\$
    – jf_vt
    Mar 26 at 11:08
  • \$\begingroup\$ Surely you can read from the sensors even if they have no new data. Just read away once per ms or so, no higher baudrate is needed. Muxing /SS is the simplest solution but you could probably use daisy chain here too, to save a little bit of BoM. There seems to be no need for several SPI buses. \$\endgroup\$
    – Lundin
    Mar 26 at 11:16
  • \$\begingroup\$ we can definitively try. we have a prototype for that.we just did not think of it thank you for suggesting it. \$\endgroup\$
    – jf_vt
    Mar 26 at 11:22
  • 1
    \$\begingroup\$ @tlfong01 I think a Pi Zero is cheaper than a Pico and has (at least) two SPI interfaces. \$\endgroup\$ Mar 26 at 13:49
0
\$\begingroup\$

If you want to multiplex your devices using the USB interface, make sure you:

  1. Have an external USB hub

or

  1. The data collector system has USB hub on-board

USB is a 1:1 peer-to-peer interface.

ou can't just wire in parallel the extarnal devices.

\$\endgroup\$
1
  • \$\begingroup\$ I agree with that and I could not found one project where it was done, this is why I am asking for advice as there might be non obvious difficulties or roadblock with that solution \$\endgroup\$
    – jf_vt
    Mar 26 at 11:16
0
\$\begingroup\$

RS485 is the right answer for your problem.

It's master-slave interface meant for fairly high speed (up to 10 Kbyte/s) and long distances (up to 1 km).

Slave devices can be wired in parallel.

It requires a UART interface on the microprocessor. All microprocessors have at least one.

It requires a very simple software stack that you may find by googling: "serial communications C driver".


The CAN interface will also do because it's the automotive version of RS485 but it's far less used in the maker's world.

\$\endgroup\$
2
  • \$\begingroup\$ The OP clarified in comments that this might end up a single PCB solution, so RS485 would be completely overkill and means you have to drag in de-centralized microcontrollers. The MAX parts used by the OP are also fairly low level. I see no reason not to use SPI. \$\endgroup\$
    – Lundin
    Mar 26 at 11:26
  • \$\begingroup\$ (As for CAN vs RS485, the main reason people still pick RS485 is "I don't know CAN" - CAN is superior in almost every single way. There's even CAN FD nowadays if you need more extreme data rates.) \$\endgroup\$
    – Lundin
    Mar 26 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.