When Sabina approached us and asked us for a string-cheap kiosk for the Casa Martini museum near Turin (Italy) with a touch interface and a big monitor for video, we came up with 2 ideas:
- using a tablet as a touch input device, and which talks with a small server that controls the big screen
- a tablet that, beside being the touch input device, will play video on an external monitor via HDMI port
Those were to us the cheapes and best solutions. One Android tablet and maybe a Raspberry mini PC to drive the external monitor.
The best one was the second: fewer components. we searched far and wide for a big Android tablet (as per specs) with a USB for power input and a mini HDMI for the external monitor.
We soon realized that there weren’t many tablets over 12” with such specs, actually there was just one: the Hannspree HansPad 13.3 Oxygen. It looked perfect.
So we bought it and unfortunately we soon found out that, by design, if you connect an external monitor to the mini HDMI, the internal touch display switches off (but, curiously, the touch still works). We sent it back to Amazon for a refund.
So we had just one solution: Android + Raspberry. And how would they talk to each other?
We found two easy ways.. one was via wifi, and in this case one of the two devices should act as access point, or via USB cable.
THe first solution looked feasable. And it is feasable. OF course any Android can act as a hot spot. But we should take into account the rebooting of the tablet (be it accidental or wanted).
To set up again the hot spot, we should have used an app like Tasker, or write a system module.
Unfortunately Takser cannot configure an hot spot unless it runs on a rooted device.
And for such a little project, with a small budget, it was unpractical for us to write a system module for Android.
The other alternative was to make the Raspberry act as a hotspot. But, if we remember correctly, upon reboot it activates with a default password or something like that, and this is very dangerous: anyone can try to connect to the Raspberry after a reboot (and maybe yank the power cord and replug it to make it happen). Too risky for a public kiosk.
After many hours of thinking we came up with the last idea: connect the two with a USB cable: an Android with a couple of usb sockets (one for power, one to talk to a Raspberry), and a Rapsberry configured as a slave OTG device. It can be done, one tutorial for OTG is here questa guida) but als here the solution didn’t seem robust enough.
And moreover, very few Android tables have 2 usb ports. And connecting to a OTG device on Android is.. well.. it’s Android.
In the end (real this is the end) we ended up using TWO Raspberry. One shows the user interface on an external touch monitor and it controls a second Raspberry, which drives an external monitor that shows a veide. They are connected one to the other via a simple USB cable.
The two Raspberries are configured via ethernet-over-USB, and the second one has a small daemon that ensures that, after a reboot, the
usb0 interfaces comes up correctly.
The full configuration is here
To show the video we bought an excellent software for digital signage, info-beamer. Very nice, programmable in LUA.
And the nice thing is that, in the examples that come with the software, there is precisely what we need.
On the external monitor we need a video that plays in loop forever, and when the info-beamer receives a command (via UDP) will play another video file. The file name is sent along the command via USB, and the video files are preloaded on the PiZero.
Using Info-beamer, we didn’t have to write a single line of code for the server. And besides, it’s very fast even on a PiZero.
On the main Raspberry (a Raspberry Pi3B) we wrote a simple PHP app that shows the web interface, and drives the second Raspberry sending some UDP commands, as per info-beamer specs.
We decided to send the commands from PHP, but we could have done it directly from the web page via Ajax). Any way it’s very fast.