Raspberry Pi Zero inside a Handy Tech Active Star 40 braille display

Raspberry Pi Zero inside a Handy Tech Active Star 40 braille display

I placed a Raspberry Pi Zero, Bluetooth whistle and cable inside my new Handy Tech Active Star 40 braille display. The built-in USB port provides power. The result was a self-sufficient monitorless computer on ARM with the Linux operating system, equipped with a keyboard and a Braille display. You can charge / power it via USB, incl. from a power bank or solar charger. Therefore, he can do without the mains not for several hours, but for several days.

Raspberry Pi Zero inside a Handy Tech Active Star 40 braille display

Dimensional differentiation of braille displays

First of all, they differ in line length. Devices with 60 or more familiarity are good when working with a desktop computer, 40 are convenient for carrying along with a laptop. Now there are also braille displays connected to smartphones and tablets, with a line length of 14 or 18 characters.

In the past, braille displays were quite massive. The 40-character, for example, had the same dimensions and weight as a 13-inch laptop. Now, with the same number of familiarity, they are miniature enough so that you can put the display in front of the laptop, and not the laptop on the display.

This is certainly better, but it's still not very convenient to hold two separate devices on your lap. When working at a desk, there are no complaints, but it is worth remembering that a laptop is called a laptop in another way, and trying to justify its name, as it turns out that a miniature 40-character display is even less convenient.

So the author waited for the release of the long-promised new model in the Handy Tech Star series. Back in 2002, the previous model Handy Tech Braille Star 40 was released, where the body area is enough to put a laptop on top. And if it does not fit, a retractable stand is provided. Now this model has been replaced by Active Star 40, which is practically the same, but with upgraded electronics.

Raspberry Pi Zero inside a Handy Tech Active Star 40 braille display

And the retractable stand remained:

Raspberry Pi Zero inside a Handy Tech Active Star 40 braille display

But the most convenient thing about the novelty is a recess about the size of a smartphone (see KDPV). It opens when the platform is shifted back. It turned out to be inconvenient to keep a smartphone there, but one must somehow use the empty compartment, inside which even a power outlet is provided.

The first thing the author came up with was to put the Raspberry Pi there, but when the display was purchased, it turned out that the stand that closed the compartment did not move with the “raspberry”. Now, if the board was only 3 mm thinner ...

But a colleague talked about the release of the Raspberry Pi Zero, which turned out to be so tiny that two of them would fit in the bay ... or perhaps even three. It was immediately ordered along with a 64 GB memory card, Bluetooth, a whistle and a Micro USB cable. A few days later, all this arrived, and sighted friends helped the author prepare the map. Everything immediately worked as it should.

What was done for this

On the back of the Handy Tech Active Star 40 are two USB ports for devices such as keyboards. Compact keyboard with magnetic attachment included. When the keyboard is connected, and the display itself works via Bluetooth, the computer additionally recognizes it as a Bluetooth keyboard.

Thus, if a Bluetooth whistle is connected to a Raspberry Pi Zero placed in a smartphone compartment, it will be able to communicate with a braille display via Bluetooth using BRLTTY, and if you also connect a keyboard to the display, the “raspberry” will work with it too.

But that's not all. Raspberry itself, in turn, can access the Internet via Bluetooth PAN from any device that supports it. The author set up his smartphone and computers at home and at work accordingly, but in the future he plans to adapt another "raspberry" for this - a classic, not Zero, connected to Ethernet and another Bluetooth "whistle".

BlueZ5 and PAN

PAN configuration method using bluez turned out to be invisible. The author found a Pyhton script bt-pan (see below) that allows you to configure PAN without a GUI.

With it, you can configure both the server and the client. Having received the appropriate command via D-Bus while working in client mode, it creates a new network device bnep0 immediately after establishing a connection with the server. Typically, DHCP is used to assign an IP address to this interface. In server mode, BlueZ requires the name of a bridge device, to which it can add a slave device to connect each of the clients. Configuring an address for the bridge device and running a DHCP server plus IP masquerading on the bridge is usually all that's required.

Bluetooth PAN Access Point with Systemd

The author used systemd-networkd to configure the bridge:

FILE /etc/systemd/network/pan.netdev

[NetDev]
Name=pan
Kind=bridge
ForwardDelaySec=0

FILE /etc/systemd/network/pan.network

[Match]
Name=pan

[Network]
Address=0.0.0.0/24
DHCPServer=yes
IPMasquerade=yes

Now we need to get BlueZ to configure the NAP profile. It turned out that BlueZ 5.36 regular utilities cannot do this. If the author is wrong, correct him: mlang (knows how to move his ears) blind (sometimes access and quantum) guru

But he found blog post и python script to make the necessary D-Bus calls.

For convenience, the author used the Systemd service to run the script and check if dependencies are resolved.

FILE /etc/systemd/system/pan.service

[Unit]
Description=Bluetooth Personal Area Network
After=bluetooth.service systemd-networkd.service
Requires=systemd-networkd.service
PartOf=bluetooth.service

[Service]
Type=notify
ExecStart=/usr/local/sbin/pan

[Install]
WantedBy=bluetooth.target

FILE /usr/local/sbin/pan

#!/bin/sh
# Ugly hack to work around #787480
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

exec /usr/local/sbin/bt-pan --systemd --debug server pan

The second file would not be needed if Debian had support for IPMasquerade= (see below). #787480).

After executing the commands systemctl daemon-reload и systemctl restart systemd-networkd you can start Bluetooth PAN with the command systemctl start pan

Bluetooth PAN client using Systemd

The client side is also easy to configure using Systemd.

FILE /etc/systemd/network/pan-client.network

[Match]
Name=bnep*

[Network]
DHCP=yes

FILE /etc/systemd/system/[email protected]

[Unit]
Description=Bluetooth Personal Area Network client

[Service]
Type=notify
ExecStart=/usr/local/sbin/bt-pan --debug --systemd client %I --wait

Now, after reloading the configuration, you can connect to the specified Bluetooth access point like this:

systemctl start pan@00:11:22:33:44:55

Pairing using the command line

Of course, the configuration of the server and clients must be done after pairing them via Bluetooth. On the server, you need to run bluetoothctl and give it commands:

power on
agent on
default-agent
scan on
scan off
pair XX:XX:XX:XX:XX:XX
trust XX:XX:XX:XX:XX:XX

After starting the scan, wait a few seconds until the device you need appears in the list. Write down its address and use it with the pair command and, if necessary, with the trust command.

From the client side, you need to do the same, but the trust command will not be needed for sure. The server needs it to accept a NAP profile connection without manual confirmation by the user.

The author is not sure that this is the optimal sequence of commands. Perhaps all it takes is pairing the client with the server and running the trust command on the server, but he hasn't tried that yet.

Enabling the Bluetooth HID Profile

It is required that the "raspberry" recognize the keyboard connected to the Braille display by a wire, and forwarded by the display itself via Bluetooth. Do the same, but instead of agent on gotta give a command agent KeyboardOnly and bluetoothctl will find a device with a HID profile.

But configuring Bluetooth via the command line is tricky.

Although the author managed to configure everything, he understands that configuring BlueZ through the command line is inconvenient. At first, he thought that agents were needed only for entering PIN codes, but it turned out, for example, that to enable the HID profile, you need to type "agent KeyboardOnly". Surprisingly, to start Bluetooth PAN, you need to climb through the repositories in search of the right script. He remembers that in the previous version of BlueZ there was a ready-made tool for this. pledge - where is he doing in BlueZ 5? Suddenly, a new solution appeared, unknown to the author, but lying on the surface?

Performance

The data transfer rate was about 120 kbps, which is quite enough. The 1GHz ARM processor is very fast for a command line interface. The author still plans to use mainly ssh and emacs on the device.

Console fonts and screen resolution

The default screen resolution used by the framebuffer on the Raspberry Pi Zero is rather odd: fbset reports it as 656x416 pixels (no monitor connected, of course). With the console font 8x16, we got 82 characters per line and 26 lines.

Working with a 40-character braille display in this mode is inconvenient. Also, the author would like Unicode characters to be displayed in Braille. Luckily, Linux supports 512 characters, and most console fonts have 256 characters. With console-setup, you can use two 256-character fonts together. The author added the following lines to the /etc/default/console-setup file:

SCREEN_WIDTH=80
SCREEN_HEIGHT=25
FONT="Lat15-Terminus16.psf.gz brl-16x8.psf"

Note: To make the brl-16x8.psf font available, you need to install console-braille.

What's next?

The braille display has a 3,5 mm jack, but the author does not know of adapters for picking up audio from Mini-HDMI. The author was unable to use the sound card built into the "raspberry" (strange, the translator was sure that Zero does not have one, but there are ways to output sound by PWM to the GPIO). He plans to use a USB-OTG hub and connect an external card and output sound to the speaker built into the Braille display. For some reason, two external cards did not work, now he is looking for a similar device on a different chipset.

It’s also inconvenient to manually turn off the “raspberry”, wait a few seconds and turn off the braille display. And all because when it is turned off, it removes power from the connector in the compartment. The author plans to place a small buffer battery in the compartment and, via GPIO, inform the “raspberry” about turning off the display so that it starts shutting down. Such is the UPS in miniature.

System Image

If you have the same braille display and would like to do the same with it, the author is happy to provide a ready-made system image (based on Raspbian Stretch). Write to him about it at the address above. If there are enough people interested, it is even possible to release kits that include everything necessary for such a remake.

Acknowledgements

Thanks to Dave Mielke for proofreading the text.

Thanks to Simon Kainz for the photo illustrations.

Thanks to colleagues at Graz University of Technology for quickly introducing the author to the world of Raspberry Pi.

PS First tweet the author on this topic (does not open - translator) was made just five days before the publication of the original of this article, and we can assume that, with the exception of problems with sound, the task has been practically solved. By the way, the author edited the final version of the text from the “self-sufficient Braille display” he made, connecting it via SSH to his home computer.

Source: habr.com

Add a comment