Here
I am continuing my very slow paced building of a Raspberry Pi Zero
based camera. After experimenting with raspberry-desktop file
exchanging I’ve now took some time experimenting with remote
controlling options. I’ll eventually have to wire to the Raspberry
some, at least minimal, physical interface, but remote control,
trough a Android smart-phone, could be a viable solution
to avoid a too
complex hardware interface.
The
ready-made solution: Raspicam Remote
The
first solution I found in Android Play store has been Raspicam
Remote.
Raspicam is a quite simple application providing a simple but
complete user interface and connecting to the Raspberry Pi using
Wi-Fi and SSH.
Unfortunately
Raspicam doesn’t work on my old phone (Jelly bean) but it works
fine in my much newer tablet. I understand you can’t keep backwards
compatibility with everything. Other solutions are available but they
look more suited for remote surveillance than camera interface.
The
mostly Do-it-yourself solution: BlueDot
Interfacing
to the Raspberry trough Wi-Fi offers clear advantages a specially in
terms of connection speed but also poses some disadvantage.
Setting-up a Wi-Fi connection might be trivial while at home where is
available an already configured access point but it’s not the same
while outside. Connecting the Raspberry with a smart-phone using
Wi-Fi means configuring
one of them to act as access-point, its not difficult but it might
become tricky. Also on the power consumption aspect must be kept in
consideration especially for the device acting as access-point.
Bluetooth
overcomes both set-up and power consumption problems in exchange, of
course, for transfer speed and connection range.
Here
comes to play BlueDot:
a simple looking Android application
that together with a easy to use Python library
allows a unidirectional Bluetooth communication between smart-phone
and a Raspberry device.
Installing
BlueDot means, on the Android side, just installing the BlueDot
application from Android Play Store. On the Raspberry side some
Python library is necessary. Since I’m quite new to Python and have
no backward compatibility problems I’ve choose to use exclusively
Python 3.
sudo apt-get install python3-picamerasudo apt-get install python3-dbussudo apt-get install python3-pipsudo pip3 install bluedot
Once
everything has been installed the Raspberry and the phone must be
paired in order to communicate freely over Bluetooth. I followed this
tutorial and used the bluetoothctl
command.
sudo bluetoothctl
this
command has its own command line interface: the commands ...
agent ondefault-agent
enable
the pairing agent, then the command …
scan on
start
scanning for available devices. Once the my phone has been listed …
pair <device-id>
start
the pairing procedure.
When
all preliminary operations have been completed I verified BlueDot was
working by starting the simple demo Python scripts available
at BlueDot site. Among the already povided BlueDot demos one
is dedicated to taking a photo at the press of application “blue
dot”.
Sending
back photos using Bluetooth
BlueDot
is a one-way-only communication system, so I thought on I the
raspberry could send back photos to cell-phone. The file transfer
protocol over Bluetooth most commonly used is called OBEX FTP, back
some year ago, when most phones didn't have wireless support, it was
more common having to deal with it. Now it’s almost forgotten but
still supported both from Linux and Android phones.
OBEX
FTP is installed on Raspbian with the following command
sudo apt-get install obexftp bluetooth
As
install completed I’ve been able to interrogate my, already paired,
phone for available Bluetooth services.
sudo sdptool browse <device-id>
Among
the available services I took note of the channel number (12 in my
case) of “OBEX push service” the one allows receiving files like
a message. After some searching on the Internet I eventually came to
the right command to send a file:
obexftp --nopath --noconn --uuid none –bluetooth <device-id> --channel <channel> -p <file>
File
transfer is quite slow, even slower than I used to remember, so is
not fit as main file transfer mean but it could be enough to get a
preview from a display-less camera.
No comments :
Post a Comment