Hello everyone,
I'm working on a project in which I'm trying to send data from a sensor (an HC-SR04 ultrasound sensor) to an Arduino Uno (hereafter called "Arduino 1") and then process this data with Matlab software to represent it.
To make it wireless, I came up with the idea of pairing them with Bluetooth modules.
Before purchasing the Bluetooth modules, I did a preliminary analysis of Bluetooth technology. Since I also want to use a second Arduino Uno (hereafter called "Arduino 2") to drive some motors, I realized that if I wanted to pair more than one Bluetooth module simultaneously and seamlessly, I needed the modules I purchased to have at least Bluetooth version 5.2.
I searched around and finally bought the HM-20 Bluetooth modules, which have Bluetooth 5.3, so I shouldn't have any problems.
So I managed to pair the HM-20 module of "Arduino 1" with the Matlab software. This way, Matlab was receiving data from the HC-SR04 sensor every 100ms or less and representing it in 3D.
The problem arose when, approximately 28 to 30 seconds after establishing the connection, the HM-20 module decided to automatically disconnect.
I've been looking for a solution for a few days now, and honestly, I haven't made much progress.
I'll share the latest thing I tried in case it helps:
-
Since this is an application I want to use in "real time" (i.e., with data transmission less than 200 ms), I can't afford to pair it after it's unpaired. Pairing it again takes 1.5 seconds and slows down the rendering. If I later want to implement it with some real-time control, it's useless.
-
I've tried sending a message every second from Matlab to the HM-20 module so it detects a connection and doesn't disconnect. But even though the module detects the Matlab message, it keeps disconnecting.
The firmware version for the HM-20 module is "HMSoft V109."
It looks like I need to configure some parameter for the HM-20 module, and I've been looking at the manufacturer's datasheet ("https://www.deshide.com/product-details_HM-20.html") but can't figure it out.
I'm still investigating.
Thank you very much in advance for your time and help. I sincerely appreciate any assistance.