User avatar
HermannSW
Posts: 1898
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Smartphone as terminal for Pi Zero(!)

Tue Oct 24, 2017 6:13 pm

I thought on being able to work with Raspberry Pi Zero (not the ZeroW) when not having a laptop, eg. on the train. Typically smartphone is still there. It shuould do:
  • provide wireless AP
  • display for ssh session into Pi Zero
  • keyboard
First I did that with a ZeroW, and then realized that just inserting a USB Wifi dongle to Pi Zero provides the same solution for Pi Zero. Here you see minimal Pi Zero setup (sorry for unsharp photo, below will be better):
Image

Left you see Pi Zero, powered by Lipo on pins 04 (5V) and 06 (GND), and Wifi USB dongle connected. That is minimal and all that is needed.

Right you see the Wireless access point screen of my Android smartphone. At bottom you see that two devices are connected. That is only needed once. After starting wireless AP and Pi Zero I don't know which IP addresses both will get. Therefore I connect to the wireless AP once with my laptop. On my laptop "ifconfig" tells me the IP address I got from wireless AP (192.168.43.240). Then I do a scan of the subnet by:

Code: Select all

$ nmap -sn 192.168.43.240/24

Starting Nmap 5.51 ( http://nmap.org ) at 2017-10-24 19:08 CEST
Nmap scan report for 192.168.43.1
Host is up (0.0019s latency).
Nmap scan report for 192.168.43.113
Host is up (0.0077s latency).
Nmap scan report for 192.168.43.240
Host is up (0.00039s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned in 3.35 seconds
$ 
So now I know that Pi Zero got 192.168.43.113 IP address. I did many tests and wireless AP as well as the Pi Zero kept those IP adresses, so the laptop is not needed anymore.

On the Pi Zero this is my WPA config file:

Code: Select all

[email protected]:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="HUAWEI Y360-U61_8621"
psk="secret"
}

network={
ssid="FRITZ!Box 6360 Cable"
psk="verysecret"
}

network={
ssid="MyESP32AP"
psk="testpassword"
}
[email protected]:~ $ 
In prepending the Huawei smartphone data before my home router will connect the Pi Zero to smartphone when AP is enabled, and to home network otherwise (of course only with connected Wifi dongle).

Next I started a SSH client on Android (I use JuiceSSH) and connected to Pi Zero IP address, logged in as "pi" user and executed some commands:
Image

So this is the most minimal setup.
Next I used my gstreamer debugging device (see this posting) and did the same. After login I started a gstreamer pipeline using v4l2 driver for the Raspberry camera and streamed to framebuffer device=/dev/fb2:
Image

This is the result, streaming video on /dev/fb2 display:
Image

Summary:
Whatever you want to do with Pi Zero, if you don't have a laptop, then your smartphone is sufficient.
AND of course the Pi Zero gets internet access through your smartphone as well.
Depending on your data tariff you may even install new packages on Pi Zero, ...

Hermann.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

User avatar
HermannSW
Posts: 1898
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Smartphone as terminal for Pi Zero(!)

Wed Oct 25, 2017 8:42 am

This morning I worked on a Raspberry Pi Zero via Android phone in train:
Image

In the bus I took a picture via "raspistill -o test.jpg":
Image

(Free) JuiceSSH app is not able to scp the file to the Android phone.
I found and installed (free) AndFTP app, which can do scp, and that is how I got the taken photo off the Pi Zero.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

starfox01
Posts: 4
Joined: Mon Oct 23, 2017 1:16 pm

Re: Smartphone as terminal for Pi Zero(!)

Wed Oct 25, 2017 4:11 pm

haha, this is great! Just a heads up, You can also use usb tethering instead of a wireless dongle...But, why use wires when you can go wireless :lol:
Oh, just so you know: Any device (iphone 2, anyone?) will work, just as long as you can connect to a wireless network (or tether) on it...AND as long as you can an ssh client or vnc...heh. Hmm, now if only we had somebody make a cluster using this setup lol
Linux is an operating system, OS/2 is half an operating system, Windows is a shell, Mac is Macintrash, and DOS is a boot partition virus.

User avatar
HermannSW
Posts: 1898
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Smartphone as terminal for Pi Zero(!)

Thu Oct 26, 2017 4:38 pm

> But, why use wires when you can go wireless
>
I just installed Android debugger on Raspberry Pi Zero,
Image

but there seems to be no way to get that running wirelessly on a non-rooted Android phone.

On the other hand I tried to get smartphone as terminal for Pi Zero without USB Wifi dongle, just with a USB cable and USB OTG configuration
http://blog.gbaman.info/?p=791

But I was not able to resolve the Catch-22 I did encounter:
  • Pi Zero needs DHCP server running "on the other side" when booting, so needs to be started 2nd
  • Android does not let me enable USB tethering when started before Raspberry
USB OTG access to internet with Raspberry Pi Zero connected to laptop (started 1st) works without issues ...

<riddle>Can you break the Catch-22 and get Pi Zero over USB cable to Android smartphone configured?</riddle>

Hermann.
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

starfox01
Posts: 4
Joined: Mon Oct 23, 2017 1:16 pm

Re: Smartphone as terminal for Pi Zero(!)

Fri Oct 27, 2017 1:00 am

Hmm, Personally I would not know how to connect it over a wireless connection lol, I fried my dongle long before I knew how to do this kind of stuff :shock:
But, I would assume that the process is simply activating tethering on your phone, having your rpi auto connect (wicd will automagically do this, but I'm aware that many dont have wicd so the connection process will be different), simply find the raspberry pi's ip (strangely setting a static ip on the pi if it gets internet causes some wierd things...happens to me over usb tether...) and fire up vnc/ssh...

When I fire up my rpi (using my old nook HD as a screen), I fire up the pi while in the tethering screen and wait until the option to enable usb tether is available, however wicd will auto connect at any time for me (force of habit, though)... As for the issue with android, what version of it are you running on your device?

My suggestion: Try using wicd
Linux is an operating system, OS/2 is half an operating system, Windows is a shell, Mac is Macintrash, and DOS is a boot partition virus.

User avatar
HermannSW
Posts: 1898
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Smartphone as terminal for Pi Zero(!)

Wed Nov 15, 2017 2:49 pm

> But, I would assume that the process is simply activating tethering on your phone, having your rpi auto connect
> (wicd will automagically do this, but I'm aware that many dont have wicd so the connection process will be different),
>
that is what Raspberry Pi does automatically, no wicd needed.
Just adding needed SSIDs to /etc/wpa_supplicant/wpa_supplicant.conf is all that is needed.

> simply find the raspberry pi's ip (strangely setting a static ip on the pi if it gets internet causes some wierd things...
> happens to me over usb tether...) and fire up vnc/ssh...
>
As described in initial posting I used "nmap -sn AP-IP/24" for that once on laptop.
But there is an even simpler method without need for laptop at all:
Just click on mac address in Android WiFi tethering screen, that shows a popup with IP address
(see left part of screnshot below):
https://twitter.com/HermannSW/status/928754255284064258

> My suggestion: Try using wicd
>
As said, not needed, see initial posting in this thread.

Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

DarrenHill
Posts: 245
Joined: Fri Oct 03, 2014 3:03 pm

Re: Smartphone as terminal for Pi Zero(!)

Mon Nov 20, 2017 11:19 am

You can also dispense with the laptop completely - install a network tool like Fing on the Android device (or iOS, there's an Apple app version too) and you can use that to see what devices are on the network the tablet is connected to (in this case the AP of the Zero) and what the IP address etc is for each of them. You can then use it to access things in exactly the same way that you describe above.

Return to “Networking and servers”