1

i want to connect my android mobile with raspberry pi so that i can send some data from pi to mobile through UDP sockets and vice versa. This is because i want to use android screen as remote control , some rPI data display and live video view of pi camera output from android web browser. i am interested to use wifi connection but without using any access point/wireless router in between i.e i want to create a peer to peer wifi adhoc network. in home with access network this will work , but its not possible to have wireless network or carry wireless router where ever the pi go.

for prototyping purpose i tried creating Adhoc wifi network in windows vista but my mobile didnt detect the wifi possibly because the frequency of the wifi network cant be recognised by android. i tried wifi direct feature of my galaxy Note2 (android jelly bean) but i seems to work with only samsung specific phones. it didnt work with nexus 4 neither with windows vista.

so i am quite sure that none of the above technique will work with raspbian OS.

any idea how to achieve my requirements. if connecting raspberry pi with android by USB to microUSB cable will solve the purpose , please let me know how.

Thanks agoswami

2
  • I'm guess you're trying to establish Ad-hoc network between your mobile phone and Raspberry Pi which had USB Wireless network adapter and connect to Raspberry Pi web interface, correct? Aug 26, 2013 at 10:56
  • 1
    You can also use hostapd to turn the pi into its own AP, if your wifi adapter support master mode. This means you get an AP, but it's not "in between", just "inside". Not much CPU needed, but the wifi card will use more power to advertise itself.
    – M Noit
    Aug 26, 2013 at 12:12

5 Answers 5

2

AP on the Pi

WiFi Direct only works on a few very limited phone models (Galaxy S III etc). And Ad Hoc mode support is even more limited and seems to only work on a rooted phone.

But it's not correct that "its not possible to have wireless network or carry wireless router where ever the pi go." You can do that by making Pi itself an AP. Here is a tuturial of how to implement it.

Edit: Just noticed @MNoit made a similar comment yesterday.

0

First of all you have to be sure your wireless adapter support master or AP mode to work as Ad-hoc. To check in linux you can use modinfo command.

modinfo <your_wireles_driver_module> | grep 'depend'

If you see 'mac80211' in depends line, kernel driver is supported for AP mode. Then install 'hostpad' to create Ad-hoc Wifi network.

sudo  apt-get update && sudo apt-get install hostapd

Configure hostapd config file which is /etc/hostapd/hostapd.conf

Sample config should look like below.

interface=wlan0 # Please change as your wireless device name
driver=nl80211  # driver to use, nl80211 works in most cases
ssid=YOUR_SSID
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=YOUR_WPA_KEY
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Start hostapd with that command.

/etc/init.d/hostapd restart

To connect to Ad-hoc you have to install DHCP service to linux machine. You can use dnsmasq as DHCP server. To install dnsmasq

sudo apt-get install dnsmasq

Just append the following to the /etc/dnsmasq.conf

no-resolv
interface=wlan0
dhcp-range=10.0.0.3,10.0.0.20,12h  # Assume your linux has 10.0.0.1 IP address.

Restart DNSMASQ with that command.

/etc/init.d/dnsmasq restart

Now you can try connect to your wireless AP, than try connect via your mobile web browser.

Source link : http://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/

0

Sure it's WIFI Direct.

Both android and RespberryPi would work under WIFI Direct.

Someone has archived this:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=31596

This Guide could also be useful:
http://dishingtech.blogspot.jp/2012/01/realtek-wi-fi-direct-programming-guide.html

0

I would follow the below steps to make it possible.

  1. Decide what is that I want to do with the mobile. Let's say I want to play music.
  2. With Web Frameworks like Flask/Pyramid/Django on python I would create micro services and create ReST API's
  3. I will have an API which will query the list of all songs available on my Raspberry Pi which will be a part of some file/sqlite.db
  4. Create endpoints which will accept the list of songs and play them in raspberry (POST)
  5. Same way I will write an endpoint which accepts list of songs and delete them.
  6. In Raspberry Pi I will write a script to pick up files with formats mp3/mp4 etc and update database once or twice a day.

Option - 1 Make use of Kivy Python to create an android/iOS app. You can make use of any language you like

Option - 2 Make use of yowsup module and give Raspberry a whatsapp interface. Make the script to run for ever (as long as Raspberry is alive.). Now based on your request message on your whatsapp call the endpoints which you have already written. Happy coding..

0

We have project which control car through wifi Please come http://engineer2you.blogspot.com/2016/10/raspberry-pi-remote-control-car-camera.html?m=1

Hope it can help you to find answer your own

1

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