Can you talk to a Pi with a PiUART cable and a mobile phone?


#1

OK, so title says it all really.

I have a project in mind where I want to be able to communicate with a Pi (or Zero) via a cable and an Android mobile phone.

Will this Adafruit cable work ?

https://shop.pimoroni.com/products/adafruit-piuart-usb-console-and-power-add-on-for-raspberry-pi

I think I may have to tinker with dhcpcd.conf on the Pi by adding something like:

interface usb0
static ip_address=192.168.11.2/24

And then open up a Terminal Emulator session.

Anyone got any ideas or pointers.

Cheers,

Simon.


#2

Interesting question :)

Just out of interest what are you trying to achieve with the connection?


#3

I’m thinking of attaching a couple of pHATs to a messenger bag, a pHAT-Bag if you like.

If I want to communicate with the boards, i.e. to run a different Python script, I need to be able to talk to the Pi.

A mobile phone is the easiest device to hand to do this with.

I know that I can connect both the Pi and the phone to a WiFi network and SSH into th Pi, but this process falls down if I am ever using a WiFi network the Pi has no knowledge of (can’t access the Pi to tell it to connect to the new network).

If I can connect to my SheevalPlug via the JTAG port and talk to it over the serial connection, then a similar process should be possible with the Pi.

?? Maybe ??


#4

OK, bought the cable anyway.

It can go and live with all the other cables if this doesn’t work out.

I’ll post my findings if I have any !

Any ideas still appreciated though…


#5

Not though about networking over usb to allow you to configure a connection?

Also have a look at https://github.com/heeed/PiSpot
Its something I was playing around with ages ago for having the Pi appear as a hotspot which would then let you connect to reconfigure the WiFi to use another AP if required. It should work on the zero.

hmmm…may have to have a tinker later


#6

Thanks for the reply.

This is one of those ideas that has been bouncing around my head for a while, and now I have a bit of tinkering time to fill.

Last time I messed with this I seem to recall that connecting via USB works with a computer, but not a phone.

I can definitely revisit this process though, as it is entirely possible that I cocked something up.

I like the PiSpot approach and is something that I can definitely implement.

I still come back to my original concern though; what about when there is no network to connect through ?

(Maybe I just like the simplicity of an old-fashioned cable.)

Cheers,

Simon.


#7

The basic idea behind PiSpot is for it to start upon boot, look for any known AP and then try to connect in sequence. If none were present or failed to connect it would then start an AP up itself allowing you to connect to it that way.

Did away with the need for cables etc.


#8

Thanks,

I’ll take a look at it all in a bit.

Cheers for the replies,

Simon.


#9

Hi,

I seem to have ended up in dependency hell.

And, locked myself out.

:-)

simon@phats:~/git/PiSpot$ sudo bash install_pispot.sh
[sudo] password for simon:

First, lets see if the req_files/isc-dhcp-server_4.2.2.dfsg.1-5+deb70u6_armhf.deb packages are installed…

dpkg-query: no packages found matching req_files/isc-dhcp-server_4.2.2.dfsg.1-5+deb70u6_armhf.deb
req_files/isc-dhcp-server_4.2.2.dfsg.1-5+deb70u6_armhf.deb is not installed…will install now

req_files/isc-dhcp-server_4.2.2.dfsg.1-5+deb70u6_armhf.deb
Installing locally
(Reading database … 150519 files and directories currently installed.)
Preparing to unpack …/isc-dhcp-server_4.2.2.dfsg.1-5+deb70u6_armhf.deb …
Unpacking isc-dhcp-server (4.2.2.dfsg.1-5+deb70u6) over (4.2.2.dfsg.1-5+deb70u6) …
> dpkg: dependency problems prevent configuration of isc-dhcp-server:
> isc-dhcp-server depends on isc-dhcp-common (= 4.2.2.dfsg.1-5+deb70u6); however:
> Version of isc-dhcp-common on system is 4.3.5-3+deb9u1.

> dpkg: error processing package isc-dhcp-server (–install):
> dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.6.1-2) …
Processing triggers for systemd (232-25+deb9u4) …
> Errors were encountered while processing:
> isc-dhcp-server
cp: cannot stat ‘/etc/default/isc-dhcp-server’: No such file or directory
sed: can’t read /etc/default/isc-dhcp-server: No such file or directory
sed: can’t read /etc/default/isc-dhcp-server: No such file or directory
Setting up autostart of pispot
Connection to 192.168.1.65 closed by remote host.
Connection to 192.168.1.65 closed.
simon@chromebook:~$ ssh phats
ssh: connect to host 192.168.1.65 port 22: No route to host

I can pull the SD card tomorrow and try and repair.

Or at least try and get isc-dhcp-server up and working.

It looks good though, and I’ll persevere in getting it up and running.

Thanks,

Simon.


#10

Evening,

Didn’t manage to get the dependencies fixed, but, I managed to get the WiFi back up and running.

PiSpot had addded lines to the etc/network/interfaces file.

I think they were coming via the /boot/ssid.txt or the /boot/hotspot.txt configs.

Removing them back to default (below) got the Pi back online.

nano /etc/network/interfaces

source-directory /etc/network/interfaces.d

There was already a static IP set, as I use SSH keys and a SSH-Config file to connect to the Pi.

nano /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.1.65/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254
static domain_search=

interface wlan0
static ip_address=192.168.1.65/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254
static domain_search=

Still can’t seem to connect to the Zero without going in through WiFi and ssh.

Going to keep on trying…

Simon.