Comunication Wireless before 3 Arduino nano 33 IoT

Hello, everyone,
over time I have gained some small experience with Arduino Uno and now I would like to try the Arduino nano 33 IoT board.
I would like to make 3 Arduino nano communicate with each other like this:
2 Arduino take some data from a sensor and send it to a third Arduino which when these values change, activates a relay.
Which communication do you think I can use? BT, WiFi, other?
I've looked for examples on the internet, but as it's a new board there's very little to be found.
Thanks for any answers or suggestions.
As I go forward I will update the post for future interested parties.

That depends.

Before we begin, please call it BLE. BLE and Bluetooth Classic are not compatible. The Arduino Nano 33 IoT supports BLE. It has been converted by a few people in the forum to Bluetooth Classic but that is for advanced adventurers.

BLE is your best choice when you want to make this low power. It will come at the cost of bandwidth and distance.

If you have a network and all components are powered by wire you can use WiFi.

If you just want to do this for learning new things, I recommend you try both.

With BLE I recommend you look at the ArduinoBLE library examples. Start with a peripheral example and a generic BLE app on your smartphone.

With WiFi you have a choice of protocols. If you want to learn something that scales look into MQTT. You will need a MQTT broker. Most makers use a Raspberry Pi. You can probably run this on a local PC as well and if you fancy you can use cloud services.

If you provide some more details of what direction you would like to take this, I can give you some more specific answers.

1 Like

How far apart are the three devices? Why do you need three? What is the sensor?

1 Like

Hello everyone and thank you for your availability.
Reading your comments I would like to use BLE (sorry for calling it BT).
The boards are three because:
2 Arduino nano 33 IoT boards are used to detect movement variations through the accelerometer inside them. In case of a movement variation (for example you can put each of the two boards on some doors in your house and they will be powered by a 7.4V lithium battery) the board concerned will communicate the variation to the third board that will act as a central node.
The third board will activate a relay that can be connected to a light, for example.
I hope I have been clear enough.

BLE might work if you only have two devices communicating with each other (point-to-point topology). At the expense of power consumption, WIFI is more suited for a networked topology where any device can talk to any other device.

1 Like

Unless you do some serious power management, WiFi is not a good option in that case. It may be possible if you have few events during the day and only connect when an event happens. This would add a long delay.

BLE is not very good at penetrating walls. If you already have two boards run some tests in your house and see whether you get good connections.

I recommend you start with the ArduinoBLE library examples e.g.,

File -> Examples -> ArduinoBLE -> Peripheral -> BatteryMonitor

just compile and load it to your Arduino. Open the Serial Monitor and use an app on your smartphone to connect. I use BLE Scanner on iOS. I believe it is available on Android as well. If not there are many other generic BLE apps. Try a few.
Looks at the services and characteristics, UUIDs. Compare the data you see with the source code.

The ArduinoBLE reference is also very useful.

@hzrnbgy Theoretically a central can connect to multiple peripherals. The datasheets also suggest this should work. I did some simple test last year and the Arduino Nano 33 IoT could connect to at least two peripheral devices. The Arduino Nano 33 BLE did not support that.
I have more BLE capable boards now. Maybe I can test this again.

1 Like

According to here, BLE supports multiple point-to-point connections


But I can only imagine the code required to make it work this way, as opposed to just using WIFI

1 Like

As far as wall penetration is concerned, there is no problem because I did a test and the communication still works fine.
The real problem is that the examples I find (BLE or WiFi) from which I want to start are always with telephone (BLE) or connection to the PC or database (WiFi).
The batteries I want to use are 2x 18650 2000mAh 7.4V. This way I don't have the classic LiPo problems (lower threshold voltage and possible swelling due to incorrect recharging).
The connection between the devices should be automatic because when one board goes down (the two boards at the port or the star centre (the third arduino board that acts as a central node receiving data from the other two)) I don't want to disassemble everything to connect the system again.
I found how to read the accelerometer data, but I can't connect the three boards. :sweat:

Get the WIFI connectivity running first, then it gets easy talking to one another after WIFI is established in all three devices. Find example with the IoT board about connecting to WIFI

You mean an example like this?

This is correct. Once it's connected to your WIFI network, you can try ping it from your computer. Do that first for all of your IoT boards...

If that is successful, then its a matter of coding the part where each Arduino "talks" to each other

That is OK. A BLE peripheral devices will need to work with your phone and a generic BLE app. There will be no changes needed to use the peripheral device with another Arduino as central.

The connection is handled by the central. The peripheral will just wait for centrals to connect. If the central disconnects, it will allow a new connection.
As for the central device, that is up to you. You will write the code that will connect to the peripheral. When your sketch detects that the peripheral is gone, you simply start scanning again and when you find a peripheral device you connect again.

You should think about the interface for the sensor independent of how the data is generated. Hide the implementation behind the interface. e.g., do not send accelerometer data. Instead have a service with a characteristic that describes the high-level function e.g., door open/closed/locked ... If in the future you find a better way to sense these states e.g., with lasers you should not need to change the service and characteristic. Your sensor should just connect to the new "laser sensor" and continue to work without modifications.

@hzrnbgy I run my test again and connected a Nano 33 IoT based central to 6 peripheral devices. I run out of micro USB cable and power sources.

Good to know. Personally, I'm not a fan of BLE in general. The amount of lag it introduces makes my BLE-based headphone unusable for watching video or playing computer games. My older classic BT based headset does not have this issue.

BLE does not support audio. BLE was designed for small sensors and not as replacement for Bluetooth Classic. I would suspect your headphone still use Bluetooth Classic for audio and maybe use BLE for some control functions.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.