What's the best method of communication for my project

Posts: 4
Joined: Thu Aug 16, 2018 6:38 pm

What's the best method of communication for my project

Postby meretrix » Thu Aug 16, 2018 6:47 pm

I have a problem I need input on. I have a simple project that (will) use 2 esp32 modules to control some things. There is a MASTER esp32 that has some physical buttons and a SLAVE esp32 that just displays info. The info is two integers of positive values less than 100. The master needs to send this data that changes to the slave. That's phase 1 and I think I could do that with either BLE or Wifi SoftAP.

Phase2 is the same as phase 1 except that I now need to use a cell phone to interact with the master. I'll add some additional virtual buttons to the MASTER and still have that send to the slave. This begs the question if I go with Wifi SoftAP can you use BLE simulataniously? If I go BLE can I connect to the master with my phone and have the slave also connect to the master simulatniously?

Conditions: There is NO internet or routers or any other signals around these esp32's. There is nothing for them to connect to internet wise or server wise etc.

Can I get some guidance from the experts here especially if you can link an example sketch somewhere. Thank you in advance.

User avatar
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: What's the best method of communication for my project

Postby kolban » Fri Aug 17, 2018 4:43 am

If there were some challenges in connecting an ESP32 using both WiFi and BLE at the same time, based on your story, you could choose one of those technologies and use it for all your communications. For example, if you choose WiFi between your phone and master, then you could use WiFi between master and client. If you choose to use BLE between your phone and master, then you could use BLE between master and client.

I'm always trying to look behind a technical question posted to the forums. What I'm interested in is the nature of the project. What is the goal? What are the requirements? For example, in the story you said you have two ESP32s talking together ... but you didn't say how far apart they were? For example, are they on the same PCB in which case UART, I2C, SPI and even GPIO become candidates.

Are they even within BLE range of each other? I understand that BLE has a shorter range than WiFi.

Are there other considerations? Security, power consumption ... more?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Posts: 4
Joined: Thu Aug 16, 2018 6:38 pm

Re: What's the best method of communication for my project

Postby meretrix » Fri Aug 17, 2018 1:54 pm

Thank you for your response. I should have been more detailed in my initial post. Let me try to rectify that here:

I'm making a custom game and display for my friends/family/kids. It's something that already works using Arduino Mega's but there are two problems with it currently. 1) I haven't tried to use the megas to add Bluetooth modules and get that working. It currently works perfect via NRF24L01 modules without phone interaction of course. I figure if I want to add Bluetooth it makes sense to go with an all in one unit like the esp32. 2) The footprint of the megas is large. I think I'd like to design and print a few shields and see if there is a market for this game. If there is my cost of printing these shield will be significantly less if I use an ESP. This is due to not only the size of the shield itself but also the integration of BLE and WiFi already on the esp32.

Now I'll outline further details of the project. The esp32's will be around 25-30 feet apart with no obstructions in between them. They are both able to be dual powered either via wall wart or via usb batter pack. The power requirements are already figured out and are quite low. There is not a real security concern; however, I could see a point in time if I get several of these games in close proximity of each other I'd need to make sure they were all on their own "channels" etc so there is no cross talk.

This all is starting on breadboards at this point and we will see if I can make it work that way. I have googled extensively on 2-3 questions I can't find the answers to.
1) Can esp32 operate with 1 BLE master and 2 slaves connected at the same time? In this case a phone and the other esp. If so can I find an example code of that somewhere?
2) Can esp32 operate simultaneously with 1 BLE connection (phone in this case) and 1 WiFi connection (the other esp32).
3) If neither of the above really work, how can I accomplish what I need? I'm not familiar with BLE or Bluetooth enough to answer those questions and this is my first esp32 project. I'm almost going to copy my arduino project over and see how it goes.

I hope that makes sense. Please write back some more and we can discuss it further. I also hope others chime in with their thoughts and examples. Have a good day.

Who is online

Users browsing this forum: Baidu [Spider] and 63 guests