4

I've started to make a web app that's used to communicate with the Pi (access through local ip). The Pi is used as an automate machine. It launch/control motors depending on sensors, etc.

I can work easy in my development space, I access the Pi through local LAN. But now I need to port this into the production place (a garage with no internet access lost deep into space).

I did set an ad-hoc wifi network from the Pi. But then I got the problem that current Android tablet ignore the ad-hoc networks if they are not rooted. I need this Pi to be accessible by most Android phone so it can control the process.

Have you found a way to connect the Pi via an IP in a no-internet environment ?

Or said differently : how to access Pi through ssh with a tablet/phone & without a router connected to the internet ?

  • Also, do you know if Apple tablet/phone can connect to ad-hoc network ? – DColl Feb 8 '14 at 21:36
  • Is there a reason why having a router dedicated to the Pi is not an option? Of course this is an added component but a relatively inexpensive one. – Dan Nixon Feb 8 '14 at 21:57
  • I would prefer to have the Pi "act as the router". Keep it simple principle ^^ – DColl Feb 8 '14 at 22:04
  • conversation is everything ! thanks, you gave me the answer i needed ^^ – DColl Feb 9 '14 at 1:50
2

I have the same application where I needed to be able to go into various customer locations and run a wireless demo. I have a control GUI served up by the Pi acting as a webserver with Apache. Using a headless set up for the Pi means I can't log onto their networks to get access. So I set the Pi up as an access point with DHCP. Now, I can plug it in anywhere, and it automatically broadcasts the SSID. Any other nearby device (phone, tablet or PC) can join the SSID network (and enter a password, if you set it up with password protection) and then access the Pi's webpages. There are a few tutorials on making the Pi an Access Point with DHCP. For me, it worked cleanly the first time.

1

The solution was the same, but in a different way. What I do is setup a wireless access point. It's simply not connected to the web, but I can manage to access it's LAN and Android device accept to connect to it.

I followed the Adafruit access point tutorial to do so

This link was also pretty useful correction of /etc/default/ifplugd

0

There is a more reliable way: Use USB Tethering instead of WiFi on your android phone. Depending on what exactly you're planning to do, it might get complicated though.

The advantage of USB tethering over WiFi is: no configuration of WiFi SSID/password is needed, which is especially difficult on the Pi if you don't have a keyboard and HDMI screen with you. Just plug-in the USB cable, go to Settings-Tethering and enable "USB Tethering". This works without a SIM card in your phone.

The android phone usually gets the IP 192.168.42.129 and the connected device (your Raspberry Pi) will get a some IP assigned by its DHCP. You might need to use nmap to find the IP address of your Pi: nmap -p 22 192.168.42.1-255 | grep -B3 -A1 open

Once you have the IP of your Pi, you could easily connect to its sshd using your android phone and a ssh client (i.e. an ssh app from the Google Play Store).

On the Pi, the network interface created by the USB tethering will have the name usb0

USB tethering has also 1 disadvantage: you can only connect 2 devices with each other. So if you want to connect your laptop to the same LAN, it becomes tricky:

On android (tested with v5.1) you can enable both, USB tethering and a WiFi hotspot at the same time. Just enable both switches in Settings-Tethering. However, you will end up with 2 different LAN networks. i.e. 192.168.42.* and 192.168.43.* -- devices on each of these LAN will not be able to talk to each other, but only to their gateway (your android phone).

I have a chroot Linux installed on my android (Linux Deploy freely available in the Google Play Store, these days you might be able to make it run without a rooted android using p-root). So I can easily connect to the Linux-Deploy-ssh on my android from my laptop (using the WiFi hotspot) and from that ssh session, I can login to the Pi via its sshd again.

Using my laptop and 2 ssh connections, I can now make changes to the Pi's config, deploy code and update software etc. It's a bit involved, but it works fine.

In my experience, USB tethering is more reliable than WiFi, especially for devices that are supposed to run forever. Also, there is pretty much no latency compared to an overloaded WiFi environment.

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.