1

I'm working on connecting a Raspberry Pi Zero W to an android device and having some issues. I think I am very close to getting it to work, but perhaps there is some small error.

So I followed the answer in this post by @Ingo Setting up Wifi direct (wifi p2p) and DHCP server and I get some differences in my results. I am able to set everything up correctly; the pi and the android are able to see each other over wifi direct, but when I try to connect to the android from my pi using pi ~$ wpa_cli -ip2p-dev-wlan0 p2p_connect a2:91:69:b2:91:a9 pbc, I simply get the output "FAIL".

If I initiate connection to the raspberry pi on the android (I get the pin window first and I hit decline since I don't know the pin), the pi is listed as invited and I then get OK when I execute the above command. After this, the pbc accept connection window pops up and I accept but nothing changes, the pi is still listed as invited.

Can anyone help me with this? Also is there a way to see a more verbose log of what's happening in this command so I can have a better idea of what's going on? simply FAIL is not very helpful. wpa_cli doesn't seem to have a verbose option to my knowledge.

Thanks!!

  • I'm just busy with another project but I will look at your problem afterwards. Please be patient a bit. – Ingo Sep 26 at 9:12
  • 1
    All good friend! Thanks for responding to this, I was hoping to speak to you about it but I don't have enough reputation in this community to comment on posts. Take your time, and good luck with whatever you're working on! – Dyskord Sep 26 at 17:23
2

Issues with the frequency band (2.4 GHz vs. 5 GHz) should not exist. As far as I know the Raspberry Pi Zero W only supports the 2.4 GHz band, but I'm not sure. If in doubt append the frequency to the connection command, e.g.

rpi ~$ wpa_cli -ip2p-dev-wlan0 p2p_connect 86:cf:bf:8e:f1:06 pbc  freq=2412

It can be that the config_methods are not correct negotiated. You can specify them in /etc/wpa_supplicant/wpa_supplicant-wlan0.conf. Setting this option could help:

config_methods=virtual_push_button

For troubleshooting you can run wpa_supplicant in the foreground. Then you get messages what's going on.

I have written a complete revised answer at Connect Android smartphone with Wi-Fi Direct to a Raspberry Pi that covers all these issues. Please have a look at it and check your setup, in particular the settings in wpa_supplicant.conf.

| improve this answer | |
  • You are a blessing. I haven't had a chance to work on it yet and confirm a fix because of other work, but I will work on it this weekend and edit this comment with my results. I'm also gonna write a config script for the pi zero w and some code to automate connection and sending of data so that others that come after me have an easier time getting this set up. Thank you so much Ingo and Seamus! – Dyskord Oct 2 at 23:38
  • Update, I was able to get it working. I created a config shell script that automates the setup and put it on github at github.com/MrStashley/Android-RasPi-WifiP2P-Communication. I'm also gonna write some code for automating the connection and creating a tcp socket using python and some terminal command libraries. My ultimate goal is to make it so that the user of the pi wouldn't have to ssh into the pi at all to achieve the connection. Is there a way that I can make it listen for invitations and automatically connect once it receives one? Ingo & @Seamus also lmk if you have any ideas! – Dyskord Oct 4 at 23:06
  • @Dyskord You should ask a new question. – Ingo Oct 5 at 7:44
  • good idea. I made a new question here: raspberrypi.stackexchange.com/questions/117718/… – Dyskord Oct 18 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.