Creating a Wi-Fi local network with no Internet access in RaspberryPi3 - wifi

I need to create a wireless network with no Internet access with a Pi, because I need to communicate to it with an Android smartphone and a laptop, but being the RPi the highest step in the network hierarchy.
I've found -and tried- that I can do an adhoc network, but I am unable to connect to it with the smartphone. The other alternative is creating a Wi-Fi hotspot, with no NAT, but I don't really have a deep knowledge on networks so I'm really lost in which IP adresses I have to set.
I've followed this tutorial, and found it really useful. Could anyone tell me what should I modify from it to make it only local -apart from not doing the NAT?

The Rapsberry Pi 3 has built in Wi-Fi that can serve as an access point. Based on my experience, with the Pi acting as an access point, you should be able to connect to any device, be it Android or not.
The Pi will act as access point and serve as a DHCP daemon, assigning and handling IP addresses to any devices that connect to it. This will be a standalone network and will not be able to share an Internet connection unless you bridge it. Follow this tutorial up until the Internet sharing part:
https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
Also, it would be better to ask this in the Raspberry Pi stack exchange.

Related

Connet to Raspberry PI on Extender

So here's my setup. Our home wifi is Verizon, with a router in the living room connected to the incoming coax, with a wireless extender upstairs in my office and another extender in the basement, both of which are also connected to the coax network. All of this basic configuration works fine for our basic wireless needs (phone, laptops, tablets, etc.).
The issue I'm having is that I have a Raspberry PI connected wirelessly to the upstairs wifi extender that runs a small Postgres database that I use for my programming tinkering. If I'm connected on my laptop or PC to that extender, I can use PG Admin or remote desktop to connect to the rPI using its IP address. However, if I'm connected to the main router or the other extender, I can't access the rPI anymore - even pinging the IP address times out. I'm assuming this is because the extender the rPI is connected to is technically a different wifi network than the ones broadcast by the router or the other extender. I'm hopeful that maybe there's some way to configure this setup that I can access the rPI from my in-home network no matter which device I'm connected to, because it's all linked via the coax that runs through the house, but I'm not sure how to make that happen, but I don't have the knowledge in this specific area to know where to adjust my settings.
Anyone have any ideas? I feel like it could either be a simple fix or something that's totally impossible. Any help is appreciated.
The issue was that I had configured both extenders and the router to broadcast on the 2.4ghz and 5ghz bands (different SSID on the 2.4ghz band) for older devices that didn't seem to like the 5ghz netowkr. The rPI was connected to the 2.4ghz network, but my laptop was connected to the 5ghz one. Switching the rPI to use the 5ghz band (or plugging it in to the extender, or switching the laptop to use the 2.4ghz network) made it visible.

Identifying WiFi clients connected to ESP8266

I'd like to know that a specific device (phone/tablet) has joined my WiFi network created by ESP8266 microcontroller. It shouldn't require any installed apps on that phone/tablet, if possible, to simplify the whole setup.
So I think I need to somehow identify connected clients, and MAC is not an option because it is subject to change randomly on, say, Apple devices.
Maybe it's possible to collect host names of connected clients?
I know that Windows and Ubuntu clients send their host names when getting IP from DHCP server (see here). Also, it's possible to find such information on, say, home Wi-Fi router admin web page (i.e. host names, their IPs and MACs).
I'm running DHCP server on ESP8266, but I haven't found any API that allows to get peer host name (i.e. reverse DNS). Does ESP8266 support getting such information?

Real-time data from Raspberry Pi to iPhone

I recently have not much experiance about working with a raspberry.
I need to send real-time data from my Raspberry Pi 2 Model B to an iPhone. The Raspberry will get the internet connection via UMTS stick.
I thought about a websocket but I didn't find any information what websocket would be the best and how to config it.
So is there anyone who already has a solution about it?
Thank you!
WebSocket requires a WebSocket (WS) server or a webserver that understands the WebSocket protocol as defined by the IETF. So for a RPi to talk directly to your iPhone, one of the devices has to have a WS server... which is not likely.
There are a couple of possible alternatives (there are certainly others). You could send data from the RPi to an external server that hosts a WS-capable server which then forwards that data to your iPhone, either thru a native app or a web browser. The data is logically transmitted between the two devices, but physically sent using an external service to coordinate the two. Visit http://goo.gl/Utg0dU to see data exchanged between an RPi and an iPhone using web messaging (src available).
Another possible alternative is to use Bluetooth to send data directly from the RPi to the iPhone. Being a Java dude, I know you can run a JVM on the RPI and I know there's a Java bluetooth API, and obviously the iPhone supports bluetooth, so its definitely do-able with a JVM. A quick Google shows plenty of support for bluetooth on the RPi with other languages. So you're good with this approach too.
If the Raspberry Pi is connected to the Internet with a public IP Address (I guess it doesn't since it uses UMTS) then you can setup a TCP Listener where the iPhone will connect to. If it doesn't and you can do Port Forwarding (I guess you can't) then you can forward the TCP port to the Raspberry Pi. The above examples also work with an HTTP server.
If the iPhone is near the Raspberry Pi and you're writing an app for the iPhone you can use a Bluetooth transceiver on the Pi to communicate.
If you can't do any of this you may need a third server with a public IP where both devices will connect to and the server will relay all connections from one device to the other.
In general, it would help if you could describe a little bit better what you want to achieve and the network topology involved so we can provide more specific answers.

Wired connection from iPhone to Raspberry Pi

I would like to build an application on my iPhone that connects to my raspberry Pi. Because these are going to be in close proximity (next to each other), I'd like to use the wired connection (lightning port to USB) to communicate. Is this possible or must I use wireless technologies? My assumption is that wired would be better as it ensures a connection and would be faster, however, I am open to be corrected.
This is related to a hobbyist project where I want to access a raspberry pi sensor on my iphone. The sensor (and Pi) will be next to the iphone. I'm building a custom weird case to combine them.
Any thoughts much appreciated.
Thanks
Iain
For communication with peripheral devices (Raspberry Pi for example) you have several alternatives.
UART via 30-pin or lightning connector (MFi needed)
USB via 30-pin or lightning connector (MFi needed)
Quick start: Microchip's development kits. This module can prolong communication to RPi or you can try to implement the Accessory stack (and communication with authentification chip) to RPi itself.
FSK or similar modulated-audio communication via audio-jack (no MFi needed)
You would have to implement hardware FSK modem on the RPi side and a software one on the iOS side. It is a bit tricky but by no means impossible.
Of course you could implement software modem on the RPi side, too. But since RPi doesn't have audio input you would have to use an USB audio card or something. Or complicate your life trying to sample an analog pin fast enough.
User not really Jake made a quite impressive list of links on this topic here on SO.
Bluetooth as an External Accessory (MFi needed)
Quick start: RN-41/42-APL
Easy to use Bluetooth stack. Communication with authentification chip is handled by the BT module. Note that when communicating with iOS devices data troughput is not much better than when using BLE modules.
Bluetooth as a BLE module (no MFi needed)
Data troughput not much worse then the old BT. Implementing the communication might be a bit more tricky code-wise. This module seems interesting.
WiFi communication (no MFi needed)
WiFi might be a good choice. But for your device and iOS device to be able to find eachother you will need either static IP (for the server device) or minimal Zeroconf (Bonjour) implementation.
When using WiFi you can go either with infrastructure network (using external Access Point) or you could go with AdHoc (created by your device). Later seems promising but be careful - iOS7 & AdHoc network don't seem to work well together yet.
With WiFi you have many modules to choose from. A simpler to use would be a module like RN-XV WiFly Module. TCP stack is already implemented in the module - you can use simple UART communication. I'm not sure how to implement Zeroconf on this one.
Or there are raw WiFi modules like MRF24WG0MA/MB. They are stable and reliable and they can be used on home-etched PCB. Downside for RPi user would be that you would almost certainly need an PIC24 or something between the RPi and MRF24W. Microchip provides free TCP/IP stack for their microcontrollers and this stack includes Zeroconf.
And the easiest way: you could simply use a WiFi dongle (with RPi) for communication. Zeroconf should be easy enough to implement on the RPi - and it's not even needed at the begining if you are ok with assigning static IP to the RPi (if it acts as a server).
This is not possible without signing up for apples MFI program. You have to pay and sign a bunch of NDA's.
https://developer.apple.com/programs/mfi/
You can use other methods, like bluetooth and connection over the audio port.
While #RokJarc's answer is pretty complete, I've also had success with both wired (lightning to usb) and wireless connections using iOS's personal hotspot. Here are the steps:
For wired, on the Pi, install ipheth-utils:
sudo apt-get install ipheth-utils
And add an eth1 network interface by editing /etc/network/interfaces to include:
allow-hotplug eth1
iface eth1 inet manual
For wireless, make sure /etc/network/interfaces has a wireless network entry such as:
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
If you are using wpa_supplicant and add a network entry for the iPhone's hotspot in /etc/wpa_supplicant/wpa_supplicant.conf:
network={
ssid="Banana Phone"
psk="ring ring ring"
key_mgmt=WPA-PSK
id_str="banana"
priority=3
}
The ssid should be the name of the phone from Settings -> General -> About -> Name and the password should come from the personal hotspot screen.
Now start the personal hotspot on your phone. The pi should automatically connect when connected by a usb to lighting cable or using wifi. After connecting, the pi should be assigned an ip somewhere in 172.20.10.x. You can run ifconfig on the pi to figure out which one. (I believe that you should be able to define a static ip here but haven't messed around with that yet)
From there, you can connect another computer to the hotspot and ssh into the pi using the 172.20.10.x ip or even ssh directly from the phone.
In my personal testing, latency over lightning is consistently low and I've used this on both a Raspberry Pi Two and Raspberry Pi Zero for streaming realtime mjpeg video from two cameras to a VR headset. In this scheme, the network is a fairly small source of the 100ms or so latency. The experience is not Vive quality of course, but it is still usable and the iPhone + Pi combo provides lots of fun hacking opportunities
It's possible to do this with Mfi.You can run usbmuxd service on your Raspberry Pi. The usbmuxd will transfer the USB data into socket packets. Your iOS App also need to implement the same protocol to rx/tx the data from/to your Raspberry Pi.
David House has already made this work. https://github.com/davidahouse/PiTalk

Can't see another computer in WiFi

I am trying to do a little experiment and I'm getting pretty odd results that I can't explain. I came to my University with my friend, we both brought our laptops and we connected to the same WiFi. But from some reason, our computers couldn't communicate with each other. For example, I couldn't ping him, and I when I did an ARP Scan to find all the hosts on the LAN I didn't find him. He did the same. He couldn't ping me and he didn't find my laptop when he did an ARP scan. Yet, there were many other devices on the LAN that both of us could ping and that we both found in our ARP scan. The University may be big, but we sat just next to each other.
I know that the WiFi on the university may be complex, but yet I have no explanations of what is happening. We sit next to each other, connect to the same WiFi(same Access Point MAC), we both see many same devices in our LAN, yet we can't see each other. Anyone has any idea of what may be happening? Why can't we see/ping each other while we are on the same LAN?
Thanks! :)
The wireless access point probably has a security setting of "Wireless Isolation Within SSID" turned on. This function does exactly what you describe. It allows all authenticated users to see machines on the LAN, but not other wireless machines on the same access point.
Reconfigure your router and make some settings like this
LAN DHCP=Enable
Wireless Authentication type=WPA-PSK/WPA2-PSK
Encryption=AES
After this setting delete all Wireless network of router listed in your PC. And than connect, It will works. you can ping your both PC together.
Because you are connected to an infrastructure mode access point (99% of APs), in order to send packets to another device your laptop sends the packet to the AP (to the distribution system), and then the AP sends the packet to your friend (from the distribution system). You cannot connect 'directly' to your friend.
The AP can direct whether or not wireless clients can see each other - depending on the manufacturer this can be implemented in many different ways. You could talk to your system administrator about why/how this policy works.

Resources