Many sensors connection to ESP32S3 board with limited ports

DoDobro!
Posts: 14
Joined: Mon Oct 02, 2023 4:39 pm

Many sensors connection to ESP32S3 board with limited ports

Postby DoDobro! » Tue Oct 03, 2023 11:05 am

Hello!

I create a multifunctional device and for all purpose I need to connect to my very nice and very functional all-in-one ESP32S3 board (photo attached) next devices:
+ 1xUSB device;
+ 1xSPI module (as fast as possible!);
+ 4xI2C modules;
+ 2-3 OneWire sensors like temperature DS18B20;
Also I want to use integrated SD-card and Bluetooth or WiFi.

But because ports-connections at this board are limited, I asking for some help with it:
1) How it's better to connect 4xI2C modules (not very fast, each have it's own different address) to board IO17-18 - by serial wire (just solder several cables to each after another like old IDE cables) or use something like multiplexer TCA9548?
2) Ho to achieve max SPI speed on P2-SPI IO19,11,12,13 if SD-card is also connected to the IO10,11,12,13? Just don't use SD-card while using another fast SPI device on P2? Any other recommendations?
3) To which port connect many OneWire sensors like 2-3 temperature DS18B20? Take 1 IO line from UART1 port? Or use some additional adapter to I2C?

MicroController
Posts: 1735
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Many sensors connection to ESP32S3 board with limited ports

Postby MicroController » Tue Oct 03, 2023 2:45 pm

1) How it's better to connect 4xI2C modules... each have it's own different address
The I2C bus is intended to be used as a bus. There's no reason to use a multiplexer or anything like that if all slaves have different addresses. So yes, connect all your I2C slaves together to the same SDA and SCL signals and use only two pins to access dozens of devices if you want.
2) How to achieve max SPI speed ...? Just don't use SD-card while using another fast SPI device on P2? Any other recommendations?
Not sure I get what you mean. On the SPI bus, no more than one slave can be active at any time. Furthermore, SPI communication is done in 'transactions'; each transaction can encompass any length of data, each transaction makes exclusive use of the bus, and every transfer happens at the full speed of the bus.
The SPI driver will run 'concurrent' transactions with the same or different slaves on the same bus sequentially, and the bus can also be temporarily reserved for a specific slave via spi_device_acquire_bus(...).
3) To which port connect many OneWire sensors like 2-3 temperature DS18B20?
The RMT peripheral would be a good option, see e.g. https://github.com/DavidAntliff/esp32-ds18b20-example

DoDobro!
Posts: 14
Joined: Mon Oct 02, 2023 4:39 pm

Re: Many sensors connection to ESP32S3 board with limited ports

Postby DoDobro! » Tue Oct 03, 2023 4:21 pm

Thanks for answers!
1) OK.
2) I'm asking about SPI speed because SD-card-reader use IO10,11,12,13 and SPI-port use IO19,11,12,13 - so when NSS PIN is different, other CLK,MISO,MOSI PIN's is the same. If I will use "spi_device_acquire_bus(...)" and will not use SD-card-reader at this moment - it will not add any lags or slowing to SPI bus by SD-card-reader, it will not make any unnecessary packets clogging the SPI channel?
3) So for 1-Wire sensors I can use any 1 IO PIN from UART1-port of this board? Or you can recommend better option? Maybe some 1wire-to-I2C adapters?

DoDobro!
Posts: 14
Joined: Mon Oct 02, 2023 4:39 pm

Re: Many sensors connection to ESP32S3 board with limited ports

Postby DoDobro! » Wed Oct 04, 2023 6:04 am

It's strange that at this ESP32S3 board the SPI port use IO18 and UART1-USB port and 2*I2C ports uses the same IO17-18 - does it means that it's impossible to use SPI + UART/USB + I2C with this board simultaneously at 1 project?? board photo:
ESP32-S3 HMI 8M PSRAM 16M Flash 5'' 6.jpg
ESP32-S3 HMI 8M PSRAM 16M Flash 5'' 6.jpg (1.81 MiB) Viewed 1747 times

MicroController
Posts: 1735
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Many sensors connection to ESP32S3 board with limited ports

Postby MicroController » Fri Oct 06, 2023 6:51 pm

Oh, that board. Cheap as it is, I deem it pretty useless specifically for its lack of IO. It's hardly more than a "wireless" display.

Who is online

Users browsing this forum: No registered users and 49 guests