Android & iOS scan network for Raspberry Pi? - android

I want my Android and iOS (Swift to be specific) apps to connect to the Raspberry Pi in the network. Of course I can set a fix IP for the Pi and hardcode the IP to the apps, but I would like to know how to do it more dynamically.
What do I need to do on both sides to allow the apps to discover the Pi?

If you are connected over Wifi(Access Point) then you can discover devices using SSDP protocol.which does multicast at 1900 port and whoever has joined to particular group will receive and can respond back with information.It can be implemented both side App as well as Pi.

Related

Control Raspberry Pi with phone

I am new to Raspberry Pi. I wish to turn on/off a light and play some sounds on the Pi from my phone both Android and iPhone. It is a kids toy that I am prototyping.
I need the setup to be easy for any user to download the app and just connect to the Pi with little trouble. I dont want the Pi connected to the internet so no external api services.
I have search for tutorials but surprising nothing other than using a service.
Could anyone poin me in the right direct. I dont have a preference over bluetooth of wifi. Just one that is easy for a kid or parent to setup.
Thanks
You mentioned playing sounds, you need a beeper (if those sounds are more complicated, use a speaker). Also, you need those lights connected to GPIO (USB is also a viable option, by simply turning on/off the USB port).
Issuing a USB Hub class request (CLEAR_FEATURE PORT_POWER) to port 2 on the LAN9514 will > deactivate the USB output power switch.
There's an app for that:
https://github.com/codazoda/hub-ctrl.c
This is a bit harder to setup, but you don't need any soldering with this. Then, you need to setup an AP for the kids to connect to the Raspberry Pi's website (should be a website, app is harder to make). Also why you don't want the Raspberry Pi to connect to the internet?
Are the lights you want to turn on/off wired to the Raspberry Pi (for example via GPIO)?
You need to install one of the open source automation software (like OpenHAB or Home Assistant, etc.). Disable port forwarding to the Raspberry Pi (usually you need to do this port forwarding, so here you don't need to do anything).
In this case, the IP is a local IP, and you get local access only.
Then probably you need is already implemented by someone from the community, or you need to develop a simple script to achieve what you want.

How to establish connection between raspberry pi and android?

I need to sent my sensor data's to android device and i need to control actuators from my Android
Raspberry pi 3 have embedded wifi module, so you can easily connect it with android via bluetooth, wifi direct or wifi hotspot. If you have a older version of raspberry you have to connect it by lan cable and to write a service on raspberry which will receive the data from android client. Also you can use side services to sync the data between your phone and IOT device, for example you can use google drive or mail.

Connecting a Raspberry-Pi to Android phone wirelessly

I am trying to wirelessly connect my android phone to a Raspberry-Pi, so I can then make a controller app to interact with the RPi.
I have just bought a dongle, as I was thinking of using Wifi-Direct. However this doesn't look as simple as I originally thought.
There's not much information out there on how to do this, and I am completely new to RPis.
I have found the odd tutorial like this: https://www.youtube.com/watch?v=6GPv8TfZqe4
But it seems overly complicated and I am not sure if they applicable to my dongle.
I am thinking there must be a more simple way to do this(e.g. through wpa_gui on Raspbian)
Any suggestions on how I could achieve this?
You can try:
SSH to raspberry Pi with given credentials (if both devices are connected to the network... but that may not always be doable)
Setup web API/app on RPi and use it via browser on Android (like https://github.com/NeonHorizon/berryio )
Use Bluetooth UART: Adafruit has a full blown Bluetooth UART board, and Chinese make many slave (or master) UART serial boards. This way you could open a serial connection from the phone - and with luck you would get the terminal which by default is cloned to UART in RPi (or it would get your script running on Pi and handling incoming UART messages).

Peer-Peer communication using wi-fi in android

I want to send a message from one android device to another through Wi-Fi.
I have two android devices , and Portable wifi Hotspot is enabled on both. I developed an application which displays a list of availabe wifi devices , and both of the devices lists each other.
Now I want to connect both and send a text from one device to another. What I know is that wifi transmitters transmit a beacon frame , which contains SSID , BSSID etc.
What should I do ? Should I apply a socket operation , but I don't have IP address.
I haven't done this so I can't provide code, but the answer is to use wifi- direct. http://developer.android.com/guide/topics/connectivity/wifip2p.html. That allows you to discover devices on wifi with you, then send data to them via normal sockets.
There is a wifi-direct sample app with the SDK.
Samsung recently released a simple API intended to make P2P apps easier to build - http://developer.samsung.com/chord
It only works on Android 4.0 and up, but it appears that is also the case with Wi-Fi Direct.

Android - modes of connectivity, device identification and device inter-communication?

Can someone explain a couple of very simple concepts to me - I'm interested in mobile devices running android and how they are identified over networks. Some scenarios:
Device is connected over WiFi - presumably the device has a standard IP address as with any host and can communicate with any other android host over TCP/IP (assuming it knows the participating device's IP?
Device is connected over bluetooth - how are devices identified in this case?
Device is connected over mobile operator's network - this is the one I'm interested in and confused by - is there anyway for two or more devices to discover each other and communicate via the mobile operator's network? How does a device communicate with a backend server in this scenario? In other words, how do apps and devices communicate when not connected to a WiFi network?
Thanks for any advice..
I'm only sure about the bluetooth thing, so i only answer this part:
The Bluetooth interface on your device has an MAC adresse. So while communicationg over Bluetooth you can assume that this MAC adresse is a unique identifier for a specific device. You can also reach other devices by establishing a connection over this MAC adress- However, to get this mac adress in the first place, you have to know it from somwhere, or you have to search for other bluetooth devices in the reachabla area before.
WiFi and 3g both attach the [mobile] device to the internet so it can make internet connections. 3G assigns a publicly addressable IP to the device, so one could, presumably open a server socket and listen for connections. The client would have to know the mobile IP, which may change quite frequently.
Bluetooth is more geared toward close-proximity. Devices in the vicinity can be connected to, after you have paired with them, which requires the cooperation of both devices which are to communicate.
If the goal is to produce an application which connects to nearby devices, I can think of the following ideas:
3g: all devices running the client register their position with a central database server. If the server detects that two clients are in close proximity, let them know so they can connect through the internet or through the server
WiFi: you could use the same idea as 3g, or use broadcast/multicast packets to broadcast your presence. Other apps can listen for those broadcasts and discover which other devices are near.
Bluetooth: A little trickier, as a device must be placed into discoverable mode in order for others to "see it". Discoverable mode is a temporary state and only lasts about 30 seconds (at a time).

Categories

Resources