Rishi Varasada
Posts: 4
Joined: Fri Jun 03, 2016 10:03 am

WiFi Direct

Fri Jun 03, 2016 11:14 am

Hi all,
I have just bought a raspberry pi 3, i have read the configuration of Raspberry pi 3 model, it has built in support of WiFi and WiFi direct both. And I have also buy a ESP8266 to build a wireless connection with raspberry pi 3.

But I have to connect ESP8266 by using of WiFi-direct protocol with raspberry pi 3 model.

I have searched on google but i cant get any proper solution, so please can any one help with this?

DirkS
Posts: 10086
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: WiFi Direct

Fri Jun 03, 2016 12:20 pm

AFAIK the ESP8266 only supports Station and AP mode, not Wifi-Direct.
To communicate directly between them you would have to set up the Pi or the ESP as an AP

User avatar
Cancelor
Posts: 759
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: WiFi Direct

Fri Jun 03, 2016 12:37 pm

Do you have the RPi connected to the internet? If so, is this connection WiFi or wired?

To have the RPi and the ESP connect directly to each other then one of them will have to be set as an AP (access point) if I understand what you want to do.

The easiest one to set as an AP is the ESP but if you can find a good tutorial then I think the RPi would be best as the AP. At the moment you might have one RPi and one ESP but it's quite possible you will get more ESPs or other devices.

Are you using Rasbian on the RPi? If so watch out for older tutorials that don't work anymore.
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

Rishi Varasada
Posts: 4
Joined: Fri Jun 03, 2016 10:03 am

Re: WiFi Direct

Fri Jun 03, 2016 1:22 pm

Thanks DrikS and Cancelor for quick response. Let me explain you bit more about my scenario....

I am building home automation system. I am planning to use RPi as main controller which will be connected to more than one ESP (or similar option) and even Android mobile phones (again can be more than one). Mobile phone will send command which needs to be executed (i.e. light on/off) to RPi. RPi then sends that command to a particular ESP for triggering relay.

My RPi needs to be connected to internet at the same time so that I can manage all device status on cloud.

I have two options:
1) Connect RPi with Ethernet cable for internet and make RPi as wifi hotspot for communicating between ESPs.
2) Connect RPi to internet with Wifi (some other router in my home). In this case, I would have to use Wifi Direct because AFAIK, if I use Wifi direct I can keep my internet connection using Wifi active and talk to ESP over wifi direct at the same time.

If anyone could suggest a way out it would be great. I am also OK to replace ESP8266 with other option capable of communicating over Wifi Direct.

Many Thanks in advance....

mthomason
Posts: 113
Joined: Sun Apr 24, 2016 12:28 pm

Re: WiFi Direct

Fri Jun 03, 2016 1:35 pm

How about option C:

Set up one ESP8266 as the central AP
Connect all the other ESP8266s and the Pi as WiFi clients to that.
Connect the Pi to the internet with ethernet

That way you can happily reboot the Pi without your internet WiFi network going down, too.

DirkS
Posts: 10086
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: WiFi Direct

Fri Jun 03, 2016 1:40 pm

Rishi Varasada wrote:I have two options:
1) Connect RPi with Ethernet cable for internet and make RPi as wifi hotspot for communicating between ESPs.
2) Connect RPi to internet with Wifi (some other router in my home). In this case, I would have to use Wifi Direct because AFAIK, if I use Wifi direct I can keep my internet connection using Wifi active and talk to ESP over wifi direct at the same time.
I can't see the need for wifi direct.
Just connect everything to your home AP / router (wired or wireless) and you're done...

For messaging between devices I would suggest you have a look at Mosquitto.

Rishi Varasada
Posts: 4
Joined: Fri Jun 03, 2016 10:03 am

Re: WiFi Direct

Fri Jun 03, 2016 2:10 pm

Thanks DrikS...

I did thought of that option. But I may not have complete control over, internet router (i.e. customer may change SSID/password anytime). In this case I will have to change wifi credential to all RPi/ESPs everytime (not worried about android phones because they will be owned by customer and they manage connection to internet router).

Also, those bunch of ESPs would show up on internet router. Customer may not want to see that junk and also it can be blocked from main router.

If I connect RPi to all ESPs over separate Wifi Direct protocol, they can still be in operation even in absence of internet router. And also when RPi is connected to internet over Wifi.

As I said, I am ok to replace ESP8266 with other suitable option with Wifi Direct.

I know it's asking for too much. But kindly let me know if you see any options. Because I googled too much but could find any example around this.

P.S.: I would prefer 2nd scenario from my earlier post because my client would not have to do cabling to connect RPi to internet. Also, they will have flexibility to keep RPi any where in the room.

User avatar
Cancelor
Posts: 759
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: WiFi Direct

Fri Jun 03, 2016 2:58 pm

DirkS wrote:
Rishi Varasada wrote:I have two options:
1) Connect RPi with Ethernet cable for internet and make RPi as wifi hotspot for communicating between ESPs.
2) Connect RPi to internet with Wifi (some other router in my home). In this case, I would have to use Wifi Direct because AFAIK, if I use Wifi direct I can keep my internet connection using Wifi active and talk to ESP over wifi direct at the same time.
I can't see the need for wifi direct.
Just connect everything to your home AP / router (wired or wireless) and you're done...

For messaging between devices I would suggest you have a look at Mosquitto.
I would 100% agree with this..... but then you went and mentioned the c word (customer) :lol:

I think the best advice I can give at this moment is forget WiFi-direct. It's confusing things and drawing you away from the best solution.
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

DirkS
Posts: 10086
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: WiFi Direct

Fri Jun 03, 2016 4:41 pm

You could use the Pi3B with an additional USB wifi dongle.
Use one wifi device in the Pi for AP function and the other to connect to the Internet.
You don't need to set it up as a router; the ESPs only need access to the Pi.

Potential problem is that there is a limit to the number of clients that most wifi AP drivers can handle.
ISTR that the maximum number of clients for the built-in wifi adapter in the Pi3B is 6.
I don't know the exact number for USB dongles. IIRC there was a post from someone here on the forum who had checked the max number for some of the popular dongles.

Rishi Varasada
Posts: 4
Joined: Fri Jun 03, 2016 10:03 am

Re: WiFi Direct

Sat Jun 04, 2016 6:14 am

Many Thanks DirkS and Cancelor for your comments and spending time on my problem....

I would go for suggestion by "DirkS" of using separate wifi dongal and using ethernet from options 1.

Would keep my research on Wifi Direct going in free time. Will update forum if I get something, in case somebody is interested.

felipeap
Posts: 2
Joined: Wed Jun 14, 2017 5:57 pm

Re: WiFi Direct

Wed Jun 14, 2017 5:58 pm

Hi Rishi,

I'm facing the exact same problem as you were. What was your solution?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12521
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: WiFi Direct

Wed Jun 14, 2017 11:35 pm

rishy has not posted here for over a year....

User avatar
jadro
Posts: 429
Joined: Sun Oct 02, 2016 1:20 pm
Location: Croatia

Re: WiFi Direct

Thu Jun 15, 2017 10:27 am

have you try search doing this with mqtt? i have done this with rpi3 and nodemcu esp8266 over mqtt protocol.
Jadro
Oracle backend database developer
SmartHome IoT & Microprocessor enthusiast and hobbyist

User avatar
Cancelor
Posts: 759
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: WiFi Direct

Thu Jun 15, 2017 1:07 pm

Yup, use your home router as the AP (Access Point) you then have all dives on the same network and don't need to worry about connecting them.

RPi + MQTT + NodeRed + esp8266 is a brilliant combination and works very well.

Set up the RPi first and get it working then use the RPi as the MQTT broker for the esp8266.

https://www.raspberrypi.org/learning/ge ... -node-red/
https://nodered.org/docs/hardware/raspberrypi
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

Return to “General discussion”