Interfacing Arduino with esp32 to send data to MQTT

Hello all,
I am doing a thesis project in which there are two sensors namely: EEG and EMG. Both these sensors are generating numeric values which will be in a file format (e.g. .csv). I want to use Arduino to receive this data and then send this data to the ESP32 which should transmit the data to a MQTT broker. I am finding it hard to decide whether the Arduino will read this data and send the data to ESP32 or should I only use ESP32 to receive and transmit the data to the MQTT protocol?
Any help or guidance will be obliged. Thank you.

Surely the latter. I’m not familiar with ESP32, but it is just a matter of finding one with sufficient i/o capability. My Heltec development board does, and I’m sure there will be others, and they may even be more suitable.

There are many different boards with ESP32 and others that have WiFi capability. e.g., from Arduino

https://store.arduino.cc/arduino-nano-33-iot

https://store.arduino.cc/arduino-mkr-wifi-1010

There are also third parties like Adafruit that have Arduino compatible boards with WiFi. As Nick said you need to figure out what I/O and peripherals (SPI, IIC, ADCs, …) you need.

When you picked a board check out the board support and documentation before you buy. If you post a link to your board of choice people here can tell you whether they worked with it already.

Thank you for the reply.

The I/O would be just reading the data from the PC as dummy datasets would be used. But if you ask for real time application, then an Arduino based sensors would be integrated with the Wifi Module (e.g. ESP32) which would then transmit the data to the Broker.

Are you saying you want to use the ESP32 to send data from your PC to a MQTT broker?

You can do this directly from your PC. No need for an ESP32 or Arduino in that case.

The main question is that I have to integrate a hardware module to the EEG and EMG sensor which are built on Arduino. Many of research papers suggest to use ESP32 to transfer data to the MQTT and in my project thesis it is necessary to integrate these sensors to some kind of a hardware to send the data wirelessly to the MQTT broker.
That’s why my main query is that, for real time application what can be a solution to send this numeric data to MQTT broker and what hardware can I use to integrate with the sensors? And If I use Arduino and ESP32 together, will it be easy or it would be more work? Or if I could only use ESP32 to transfer data wirelessly to the broker?

Just use the ESP32.

If the sensors are 5V you’ll need to level shift them.

If you use an Uno to communicate with a ESP32, you’ll need to level shift the communications.

Do you have a link for the datasheets of these sensors?

Unfortunately, I do not have data sheets for these sensors but there are available datasets for these sensors like on gumpy.org and MNE which is a library for python and also on BCI competition IV, which I am thinking to use for initial transmission of data from ESP32 to MQTT.

Than get yourself an ESP32 board or one of the boards I suggested in #3 and work on the MQTT stuff. If you later learn another board would be better suited it is easy to transfer your knowledge. I have MQTT running on different boards and there are only minor differences. Most of the complicated stuff is handled by the libraries and they have similar function calls. Some are a bit different but nothing to worry about.

To connect Uno to ESP32 check out my tutorial on Arduino to Arduino/PC
It has circuits and sketches.
However it is not very fast being a serial connection so you may have problems if you are trying to send realtime ECG data.
Check out my High Speed, Long Duration Datalogging project
which would let you save data to an SD card and then transfer it later.