Can an esp32 have at the SAME time a wifi connection (AP or client) and some other local connection (like esp-now, BT or some other ESP to ESP wifi connection)?
My project is a 2 part thing.
Part 1 has an esp32 driving 2 stepper motors.
Part 2 has an esp32 driving a screen and buttons (UI).
I want part 1 and part 2 to "talk together" wirelesly.
I also want to be able to use wifi on part 1 in order to control it from a computer...
I moved your topic to a more appropriate forum category @brebisson.
The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.
In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.
I am assuming that this answer means that no, ESP32-now and wifi are not possible simultanously...
Thinking aloud here to see if this might work.
I can see 3 use cases for my system:
reminder: I have 2 ESP32 system.
"part 1" controls the motors, is not very accessible, has no screen/keyboards. But it is the system's brain
"part 2" is a "remote control" (RC) for part 1. has a 9 keys keyboard and a 128*64 oled screen
Fully standalone. Here brains and RC are "out in the woods", with no wifi around.
So, one of them (brains) would need to be a wifi AP, and the other (RC) a wifi client.
Extended system: a computer is being brought in the mix and will need to talk to the brain (for better control than what the RC can do). The previous setup still works with the computer connecting to the brain AP.
full config. Here the computer needs to be able to talk to the brain AND to a the internet through a local wifi...
The previously described system would not work as the computer can not log in 2 wifi at the same time
So both the brain and the RC would need to connect to the local wifi.
Which means a UI on my 9 key keybard to enter long passwords
Plus, what happen when the wifi disapears and we move back to state 1...
I guess some failsafe in case of no-connection...
It seems that it might work.. but I am not sure of the ergonomy...
I guess I will keep thinking about it.
The ESP32 has a single radio with a single antenna. This means it can do only one wireless thing at a time. I don't think Espressif has bothered to implement some kind of time-sharing mechanism that allows the radio module to rapidly switch between different applications and different frequencies.
Consider making this a WiFi access point. Have the other 'RC' ESP32 connect to it as a client. Also have the laptop that's occasionally brought in connect to that AP as a client. This would allow for the functionality that you desire, no?
True. But in Esp32 is quite capable in right hands. For example Shelly Plus devices make a local access point, communicate with cloud, run BLE gateway and work as wifi extender for other Shelly devices.
I don't know how capable Esp32-C3 single core chip is...
Except in one case. When the PC needs connection to the part1 AND an internet connection.
BTW, the system is a telescope. Part 1 controls the 2 movements and "follow" function of the telescope.
Part 2 is a manual RC for manual control.
The PC comes in if you want to do something more complex. This includes taking a picture using the telescope, using the internet to "find" where the telescope is pointing (plate solving), and then using this data to calibrate the telescope.
This also includes getting satelite positions and orbits, and then transmiting them to the scope for it to track said object.
In this case, the PC needs to talk to the scope AND the internet at the same time...
This means that the scope has to be wifi client...
But it can't be wifi client when there is no AP around and I would like to avoid having it swap on a regular basis...
The best would be if the system could be both wifi client and wifi AP at the same time. Is that possible?
Brain would be broadcasting it's status and presence.
RC could be sending commands back to brain
PC could also be sending command back to brain
Do you think that this is possible?
But then I need an "app" to handle it on the PC, I can't just create a quick website unless there is a way to do a webserver using BT...
You can have both station and access point, even multiple access points. Or like many smart devices do, start with station mode and if no access point found, make access point.
Also bluetooth and wifi can be done, in esp32 arduino library there is example:
WiFiBlueToothSwitch.ino
I wouldn't choose wifi-bluetooth as my first choice.
Maybe in that case plug a WiFi dongle into the laptop so you have 2 WiFi connections on it - one for the telescope stuff, one for internet.
Although your comment raises a question. Apparently, in the place where the 'brain' resides, there's WiFi with Internet connectivity. If that's the case, why not have all ESP devices register on that local WiFi?
Even that example above seems to do it, it has case STEP_AP_STA.
Anyway, the library is quite recent, I have not played with it yet. Before it needed WiFi.mode, but it has been changed now.
But as far as I can see, you start AP
WiFi.softAP(ssid, password);
and client
WiFi.begin(ssid, password);
Because it depends on the cases...
If I take my telescope out to a star party or something like that, I will not have wifi/internet. At this point, I will have less functionalities... and that is ok...
At other times, I will be close to home where there is full internet, and at that point I will want to use the extra functionalities, if possible without hassle of changing parameters, especially the on brain which will not have any UI...