Connecting two MCUs by using Bluetooth

Hello everyone,

I am pretty new in this sensors world.
I have an ESP32S3 and nRF52840 Sense. I want to send data from nRF52840 to ESP32S3 by using Bluetooth. I read a few documents but I did not get it properly. How do you do it exactly?
I would be so happy if anyone would help.

Did this one help? https://www.youtube.com/watch?v=CPi44L0uzmo

Hello liaifat,

Thanks for answering.
Well yeah I watched that one too. But I dont know if I have to use nrf Connect SDK.
I used this code below to make ESP32S3 a server and connected to my nRF Connect application on my phone and saw the message “Hello World”.
I want to get this kind of messages on my ESP32S3 from nRF52840. But I do not know how.

//Server Code

#include <BLEDevice.h>

#include <BLEUtils.h>

#include <BLEServer.h>

#define SERVICE_UUID “4fafc201-1fb5-459e-8fcc-c5c9c331914b”

#define CHARACTERISTIC_UUID “beb5483e-36e1-4688-b7f5-ea07361b26a8”

void setup() {

Serial.begin(115200);

Serial.println(“Starting BLE work!”);

BLEDevice::init(“XIAO_nRF52840”);

BLEServer *pServer = BLEDevice::createServer();

BLEService *pService = pServer->createService(SERVICE_UUID);

BLECharacteristic *pCharacteristic = pService->createCharacteristic(

                                     CHARACTERISTIC_UUID,

                                     BLECharacteristic::PROPERTY_READ |

                                     BLECharacteristic::PROPERTY_WRITE

                                   );

pCharacteristic->setValue(“Hello World”);

pService->start();

// BLEAdvertising *pAdvertising = pServer->getAdvertising(); // this still is working for backward compatibility

BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();

pAdvertising->addServiceUUID(SERVICE_UUID);

pAdvertising->setScanResponse(true);

pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue

pAdvertising->setMinPreferred(0x12);

BLEDevice::startAdvertising();

Serial.println(“Characteristic defined! Now you can read it in your phone!”);

}

void loop() {

// put your main code here, to run repeatedly:

delay(2000);

}

I would say get two of the same device XIAO ESP32C3 or XIAO ESP32S3 and try ESPNow
you are always going to have a little difficulty getting those two devices to work because one is a Nordic chip and one is a Expressive chip… different manufacturers… theoredically it would not make a difference… but for safety

Then look as the built in ESPNow Master to Slave sketch

Hello cgwaltney,

Thanks for replying.
Those two chips’ proper names are Seeed Studio XIAO nRF52840 Sense and Seeed Studio XIAO ESP32S3. I wrote them to make it clear. And you are right about their manufacturers. I have no idea why they would not work together properly since they both have BLE support.
What you suggested would work of course but what I need is getting IMU sensor data from nRF52840 and just transmitting it to the ESP32S3. I tried RX TX way as well but couldn’t make them work.

Any help would be appreciated.

ESPNow is expressive technology it is on top Bluetooth… understand with IMU… maybe try with grove IMU and Two XIAO ESP and then get that working then try to migrate over…

Thanks for your advices.
I used RX TX connection what the user msfujino shared in this topic. And it works perfectly. I dont know how this works with those codes but not with Serial and Serial1 connections.

Hi there, If I may,
Using Bluetooth is a very good idea, It make the connection and exchange of data possible, While being Device agnostic.
One is a central (scanning) for advertisers (peripherals) with data to share. It does not matter what device or MCU you use.
Arduino,IDE ArduinoBLE, Or Bluefruit.
All allow the same basic connections and exchanges.
Start with the examples, they advise and others are recommending :+1:
No need to Go full on SDK…yet!
Nrf-connect is for testing and can also do both (server) & (Client)
So Central or peripheral.
Any device to anydevice…mcu’ supporting BLE.
HtH
GL :slight_smile: PJ

Hi there,
I stand by the statements made about this example being exemplary.
Xiao to Xiao via BLE
Check it out for the STARTING point, add some If defines for ESP32 vs. Nrf52 vs. AVR
If you put in the work , you can make this work on ESP32C3 as well.

:ninja:
https://forum.seeedstudio.com/t/attitude-monitor-using-peripheral-xiao-ble-sence-and-central-xiao-ble-with-mbed-2-7-2-and-arduinoble/266488
HTH
GL :slight_smile: PJ

1 Like

Hey PJ,

Sorry for late answer.
Thanks for your effort about giving many ideas. Those look complicated to me for now but I will try to understand them.
So you suggest using Bluetooth instead of RX TX, right?

Have a nice day.