Go Down

Topic: Simultaneous two way communication between two Arduino IoT 33 Nanos (Read 98 times) previous topic - next topic

eschoenawa

Hello guys,
I want to create a prototype system for exchanging personal info when an accident with two (potentially more if feasable) parties occurs. For this I want to utilize the new Arduino IoT 33 Nanos.

On a crash event (IMU-Acceleration-Spike) both devices should send their data to the other device. Now as I understand it BLE has one device that has characteristics, that can be read and written to by the other device. In my use case both devices have to fill both roles (write to and be written to). Is that possible with the ArduinoBLE library?

I know that when using the ESP32 (I've had a similar project on that microcontroller a few months back) you can't scan and advertise at the same time. I'd have to negotiate which esp receives first and which sends and afterwards switch roles.

So basically my question is can the Arduino IoT 33 Nano be both BLE sender and receiver at the same time? And if not can I use some other way of making both devices exchange information simultaneously or are there existing solutions for negotiating which device sends first?

Robin2

On a crash event (IMU-Acceleration-Spike) both devices should send their data to the other device.
I won't be buying one of those. I would like to make up my own story about my role in the crash.

Are you referring to two devices that are aware of each other's presence before the crash or do you envisage a situation in which two machines that are complete strangers suddenly become aware of each other after the crash?

If the latter it seems to me that both need to send out enquiry messages at intervals and see if they get a response. After all, there may not be any other device present. (By the way I am not familiar with the details of BLE but I presume it can switch from sending to listening).

...R

PS. I am assuming when you say "simultaneous" that you really mean "within the first minute after the crash"
Two or three hours spent thinking and reading documentation solves most programming problems.

eschoenawa

Are you referring to two devices that are aware of each other's presence before the crash or do you envisage a situation in which two machines that are complete strangers suddenly become aware of each other after the crash?
The latter.

If the latter it seems to me that both need to send out enquiry messages at intervals and see if they get a response. After all, there may not be any other device present.
Yes, BLE Advertising would take care of that.

(By the way I am not familiar with the details of BLE but I presume it can switch from sending to listening).
BLE has a peripheral device that offers data, kinda like a bulletin board, and central devices, that read that data. The peripheral device sends out the advertisements and can be discovered with them (More detailed info here: https://www.arduino.cc/en/Reference/ArduinoBLE for anyone interested). So far I've not found info whether or not a device can be both at the same time, I know they can switch from "sending" to "listening". I was just wondering if I can avoid the switching and send / receive simultaneously.

PS. I am assuming when you say "simultaneous" that you really mean "within the first minute after the crash"
I'd prefer to be quicker than a minute and aim more for the <10, maybe <5 seconds territory.

Robin2

I'd prefer to be quicker than a minute and aim more for the <10, maybe <5 seconds territory.
In computer terms 10 seconds is a very long way from simultaneous.

I think an important question is whether the advertising device can tell that its message has been received? If not then I think your system will be difficult to implement.

For the rest of this I'm assuming that the advertiser CAN detect when its message is received and when it does the connection can be consummated.

To figure out the timing it seems to me you need answers to the timings in this sequence

  • After a shock is detected how long before the BLE device could start advertising.
  • What is the time interval between advertisement transmissions.
  • How long after a shock can a BLE device begin listening for advertisments
  • Supposing that you "know" that device A will start advertising as soon as possible, how long must device B listen for to be certain of de
tecting the advertisement.

Now comes the interesting challenge.
  • You need a system that chooses at random whether a device begins listening or begins advertising,
  • The device that starts advertising must stop (and switch to listening) after an amount of time if its message is not detected. This is most likely because {A} there is not other device or {B} the other device was also advertising

To be honest I think a system like this would be easy-peasy to implement using simple nRF24L01+ modules - as long as they all use the same channel (frequency), dataRate and ID.

...R
Simple nRF24L01+ Tutorial
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up