Sunday, November 22, 2020

Continuing with the Kiosk project

It is fairly interesting that just as with other "things" that I have equipped my house with, this Kiosk and other IoT gadgetry proved to be of relevance not just for my geek person, but for my family as well. For example my wife likes to keep track of the vacuum cleaner progress. Having its map and progress show up automatically when it starts cleaning, proved to be quite useful in this sense:

The bigger picture

It seems obvious that the home environment will become increasingly digital as we progress into the future. Judging by the trend so far, we can see that there is a whole new dimension of possibilities, as homes evolve into having automation and smart features as part of its fabric.

It is not just about having multiple devices doing different things in a semi-automated fashion or not, but to combine technology to behave as if it would be some kind of smart entity that manages the house and addresses the needs and comfort of its occupants.

This is how I see it, and what we have been achieving so far are iterations that will ultimately drive us there. It is very likely that one day, most physical and routine household tasks can be replaced by either general purpose robots or more specialized machines that will be an integral part of the house. Some of this is already a common reality (e.g. robots that vacuum the floor), but for multiple other tasks there is not yet a technological response. It is the case of cleaning (of other dimensions of) the rooms, cooking food, taking care of the laundry end-to-end, organizing supplies, gardening, etc.

To cover for it, progress will need to overcome the challenges of letting machine implemented household functions be achievable in a cost effective manner (accessible for an ordinary consumer). Also, the full experience will only be truly present once we combine all of this with AI. 

AI is the "monster" that for the less watchful mind may seem like a fictional concept everyone is talking about, but for everyone else is something as real as the Internet, wireless communications and any other technology.

The relationship between users and technology have always been a mixed bag between adaptation, frustration, acknowledging the potential, profiting from it, and panic after it becomes a dependable asset that decides to fail.

The adaptation requires time, and not always the users will be willing to spend the time. Also it requires the cognitive and emotional engagement, which may not always be present.

While digital technology has the potential to be programmed to do much of what is physically possible, on the other hand to actually program it, as most of us know, is not an easy task. There is a large asymmetry between the potential of a computer, and the availability of knowledge in the users, that allows to take advantage of that potential. Basically most of us don't know how to tell a computer what we would like it to do. The translation of an idea into code which in turn allows the computer to provide the result the user is expecting, is a complex process for most people, and that is part of why a software developer is such a special role these days. 

While populating a house with devices and sensors, and connecting these together and building automations may seem like a very cool idea, soon a regular user will be experiencing the same challenge as since the beginning of the computer age - telling the machine what to do.

That is where AI or machine learning will come into play and be a "perfect match" in this context: one scenario is the user being able to explain the system - in natural language - what he wants the system to do. The user could describe automations of whatever complexity, and the system would execute these exactly as explained. In another scenario, the AI would be constantly sensing the interactions of the user with the house, ultimately performing optimal actions based on the user routines. For example after perceiving that the user would frequently return after leaving the house because of something having been forgoten, it could learn from it and remind the user before leaving the house the next day.

While this and more advanced manifestations of AI are scientifically in the realm of what is possible today,  on the other hand is still a far cry from being at the reach of consumers, given the scale of computational power required for it to begin to be achievable.

With some confidence, the obstacle in further disseminating AI technologies today, is in making the required scale of computation power condensed into a physical size and cost in line with other consumer devices. Once that becomes a reality, AI will most certainly acquire a very real presence in the lives of users.

Back to the Kiosk

Returning to the topic of the day, I have decided to do a rather exhaustive improvement of the kiosk. 

I was surprised by the fact that after many months of waiting (and loss of hope), the resistive touch panel for the display actually arrived. Having been ordered just before the initial hit of the pandemic, pretty much every service stopped for a while, and here it was no exception.

The panel corresponded to what I was expecting. The dimensions were correct:

And it came with adhesive, the eGalax USB controller needed for it to be used with the host system, and a USB cable:

Installing the touch panel was a simple process of putting the adhesive and placing the panel properly aligned and with the sensor surface facing outwards (easily identifiable for its mate texture).

The actual orientation in respect to the screen would not be critical (i.e. with the connector at the top or bottom of the screen), as during the calibration process this would get matched with the screen. I decided to orient it so that the connector would be closer to where the control board would be mounted.


However I realized that the Android HDMI dongle I was using wouldn't do the cut.

The problem was that the version of the linux kernel it was based on, didn't have the modules needed for the eGalax touch panel controllers compiled.

The most obvious reaction could be of why not recompile that version of the kernel and flash a new firmware image with that version. However that is where the challenge would begin: first make sure the new kernel would contain the same modules and settings as the previous one. And secondly, understand how the firmware image could be packed so that it could be successfully flashed into the device using the original Mediatek flashing tools.

Instead of that, I decided to flash the device with a pre-built Ubuntu linux image that was available for this device. A pretty old distribution by the way (Ubuntu 13.04). But still I tried it, but the results were poor. While the eGalax touch panel did work, the performance of the device was pretty low due to the absence of drivers for the 2D acceleration.

With this approach becoming a bit of a dead end, I looked for something else that I could alternatively use as compute module for this device. That is where I found the Raspberry Pi 3 that my daughter no longer needed (as I later bought her a fully fledged PC), and considered it as an alternative. Using a recent OS and software would certainly not be a challenge, as even this version of the Pi is still well supported and up to date Raspbian (and other distros) releases are available.

I turned to performing the mechanical adjustments needed to fit the Raspberry Pi board, and ended up with a slightly more busy space inside the kiosk, but nothing that would otherwise be a problem:


I reused the hardware watchdog timer (the brown board at the left of the Pi), as it would be useful to maximize the availability of the Kiosk without user intervention.

A few adjustments here and there (had to configure Chromium to start full screen, but this was much less of a challenge than in Android), and it was up and running, and performing quite well (a bit better than the Android HDMI dongle with the original firmware):

With the advantage  that now the entire panoply of linux software (compiled for ARM) can be added to the kiosk, making it a much more versatile device.

For calibrating the screen, I first started by performing the process from a Windows host connected to the screen and the touch panel controller, but later I found that a tool bundled with this package could be used:

The archive can be unpacked to a directory, and it is just a matter of running two commands:

First, go to the folder with the executable built for the ARM architecture:

$ cd eGTouch_v2.5.9321.L-ma/eGTouchARMhf/eGTouchARMhfwithX

Then execute the daemon with sudo:

$ sudo ./eGTouchD

And finally, run eCalib from a terminal running on the X display.

A full screen interface will appear, allowing to calibrate the panel by touching multiple points across the screen. Once finished, the calibration data is stored in the panel controller itself.

I later had a problem with the power supply of the Kiosk. Eventually due to the quality of the capacitors, stress pattern, age or a combination of these, pretty much every electrolytic capacitor failed in this power supply. I first had a failure of the main hot side electrolytic capacitory some time ago. I replaced it and the PSU seemed to work normally. Later I started noticing some flickering of the screen but did not give much importance. More recently the kiosk would not start at all, and that is where upon opening it, I noticed that all of the cold side electrolytics had a bulge and some where already venting the electrolyte through the top. 

I removed these, and all measured a capacitance way off from the nominal value. 

As such, replaced these, and the power supply was back to life and operating normally. The Raspberry Pi would no longer complain of low voltage (as it would occasionally before complete failure) and the display would not flicker anymore.

No comments: