Raspberry PI Qt Information Kiosk

Qt information kiosk using a Raspberry PI and official touch display. This application demonstrates how to write a full screen Qt Creator C++ application for the Raspberry PI. A simple shopping mall touchscreen information kiosk is built in Qt Creator for this example project.

The image below shows the Raspberry PI Qt information kiosk application running on a touch display.

Qt Information Kiosk

Qt Information Kiosk

When one of the information buttons is touched, the corresponding information screen is displayed with a back button for returning to the main screen. An example of one of the information screens is shown below.

Raspberry PI Kiosk Screen

Raspberry PI Kiosk Screen

Although the 7 inch touch display is rather small for a shopping mall kiosk, the application is a starting point for similar projects. It also serves as a nice demonstration that is not too bulky to carry around.

Raspberry PI Qt Application Development

The application was developed on a Raspberry PI 3 using a normal computer LCD screen. Using a big screen makes layout of the application windows in Qt Creator easier. The application was then tested on a Raspberry PI 2 connected to an official Raspberry PI touch display.

All the necessary software development tools are available for installation on Raspbian Linux. A C++ compiler, Qt Creator and Qt libraries must be installed in order to start Qt development.

Creating the Raspberry PI Qt Information Kiosk Application

All the steps needed to create this project are explained on the Raspberry PI Qt Information Kiosk project page on the Starting Electronics website. Here you will be able to download all the source code for the project and see how to create the project from scratch.

Although this project is just a demo of how to write a full screen touch application for the Raspberry PI, it can be used as a starting point for many other applications. Use the source code and project instructions to build your own Qt C++ applications – enjoy!

 

How to Connect a Raspberry PI Touchscreen Display

The new official Raspberry PI touchscreen 7 inch display is now available and connects directly to a Raspberry PI board using a flat ribbon cable and power wires that are supplied with the display.

Raspberry PI Touchscreen Display Running Raspbian

Raspberry PI Touchscreen Display Running Raspbian

 

 

 

 

 

 

 

 

Touchscreen Power

The screen operates from a 5V supply and can be powered from the Raspberry PI header pins using the supplied wires. The screen can also be powered from its own external 5V power supply and has a micro USB connector identical to the one used to supply power to Raspberry PI boards. If a separate power supply is used to power the screen, it must be rated at 500mA or more.

Mounting a Raspberry PI Board on the Touchscreen

Terminal posts are provided at the back of the touchscreen that hold the touchscreen circuit board in place. A raspberry PI board can be mounted on the back of the touchscreen by attaching it with the four screws that are supplied with the screen to the terminal posts.

The image below shows a Raspberry PI 2 model B attached to the back of a Raspberry PI touchscreen.

Raspberry PI Board Mounted on Raspberry PI Touchscreen

Raspberry PI Board Mounted on the Back of the Touchscreen

Connecting a Raspberry PI to the Raspberry PI Touchscreen

It is important to make the connections between the Raspberry PI board and touchscreen correctly, especially the power to the screen when it is tapped from the header of the Raspberry PI board.

A flat ribbon cable is supplied with the screen for making a data connection between the raspberry PI board and screen. Jumper wires are supplied with the board for connecting 5V and GND from the Raspberry PI header pins to the touchscreen to supply power to the screen.

Full connection details including photos and a video can be found in the article on how to connect the official 7″ LCD Raspberry PI touchscreen to a Raspberry PI board.

Raspberry PI Touchscreen Connections

Raspberry PI Touchscreen Connections

 

Auto Start a Desktop Application on the Rapberry PI

In the article on ten things to do after after buying a Raspberry PI, item number 9 shows how to automatically start an application at boot time when booting to the command prompt. This blog article will now show how to auto start an application when booting into the desktop of the Raspbian operating system running on the PI. It also shows how to auto run a command line application or shell script in a terminal window on the desktop.

NOTE: This is one way to auto start applications, but not the only way. There are other methods to do the same thing.

Auto Starting a Raspberry PI Desktop Application

The Setup

Some folders (directories) and a file need to be created as described here. How to do this is explained below the description.

  1. First create a folder called lxsession in the hidden folder called .config in the home directory.
  2. Now create a folder called LXDE-pi (name the folder LXDE in older Raspbian versions) in the lxsession folder.
  3. Finally create a text file called autostart in the lxsession folder.

You should end up with:

/home/pi/.config/lxsession/LXDE-pi/autostart

Or on older Raspbian versions:

/home/pi/.config/lxsession/LXDE/autostart

Starting the Application Automatically

To start the application automatically, edit the autostart text file that you created above and add the application name that you want to start preceded by the @ symbol. For example, to auto start the calculator application (called galculator) the contents of your autostart file would look like this:

@galculator

The next time that you start the desktop, the calculator application will automatically start.

If you write your own application that does not appear in the Linux PATH, then you will need to specify the path to the application, e.g. for an application in the home directory:

@~/myapp

or

@/home/pi/myapp

How to Do the Setup from the Desktop

To do the above steps on the desktop, start the file manager and then press Ctrl + H to show the hidden files and folders. Double-click the .config folder to open it. Right-click in the folder and use the pop-up menu to create the lxsession folder. Open the lxsession folder, right-click again and create the LXDE-pi folder. Open the LXDE-pi folder, right-click again and create the autostart text file. Double-clicking the autostart file will open it in the text editor. Add your application name to the file and save — don’t forget the preceding @ symbol as described above. Press Ctrl + H again any time that you want to hide the hidden files and folders in the file manager (Hidden files and folders have a period or dot (.) in front of their names in Linux. Ctrl + H toggles between hiding and showing these files in the file manager).

How to Do the Setup from the Command Line

On the command line in the pi home directory, enter:

mkdir -p .config/lxsession/LXDE-pi
nano .config/lxsession/LXDE-pi/autostart

Now enter the application that you want to automatically start, then save the file and exit (don’t forget the preceding @ symbol), e.g.:

@galculator

Save the file in nano:

Ctrl + o

Exit nano:

Ctrl + x

Auto Starting a Raspberry PI Command Line Application on the Desktop

To start a command line application in a terminal window on the desktop, you will need to do the above steps to auto start the terminal window called lxterminal. In the auto start file, add the following line:

@lxterminal

To run a command line application in the terminal, it is necessary to use the same method that was used in the article ten things to do after after buying a Raspberry PI, item number 9. And that is…

Open the hidden file .bashrc found in the home directory and add the name of the application or script that you want to run. For example, to run the top command line application, the end of your .bashrc file will look like this:

...
# existing text in .bashrc file ...
...
    . /etc/bash_completion
fi
top

This will run top in a terminal window the next time that you start the desktop.

To run a custom script in the terminal window on the desktop, insert the path to the script and the script name. E.g. for a script called myscript.sh found in the home directory:

...
# existing text in .bashrc file ...
...
    . /etc/bash_completion
fi
~/myscript.sh

 

Raspberry PI – Updating Raspbian Software Packages and Firmware

After installing the Raspbian operating system on a Raspberry PI board SD card, the firmware and Raspbian software should be upgraded to the latest versions.

Upgrades also need to be done from time to time to make sure that your PI software contains the latest bug fixes and improvements.

Upgrading the Firmware

The firmware upgrade updates the Broadcom firmware / bootloader software for the Raspberry PIs Broadcom processor chip (technically SoC — System on a Chip).

To upgrade the firmware, enter this command on the command line:

sudo rpi-update

You will then need to reboot the PI for the changes to be loaded:

sudo shutdown -r now

The firmware resides on the SD card with the operating system.

Upgrading the Software Packages

To upgrade the actual Raspbian operating system, first the list of updates must be obtained by running this command from the command line:

sudo apt-get update

Now the actual updates must be installed by running:

sudo apt-get upgrade

Further, if updates require new packages to be added or existing packages to be removed, the following command will do this:

sudo apt-get dist-upgrade

The dist-upgrade command will not update the software to the latest distribution but allows addition and removal of packages, whereas upgrade only upgrades packages to the newest version. Most of the time using just the apt-get upgrade command will be fine, however, see the resources below for a better understanding on when each one is needed.

The apt-get commands above apply to any Debian Linux based operating system, not just Raspbian. These commands can be used on Debian, Ubuntu desktop, Linux Mint, Ubuntu Server, etc.

Resources

The following resources describe the differences between apt-get upgrade and apt-get dist-upgrade better, as well as provide a reference for other apt-get commands.

  1. Differences between upgrade and dist-upgrade
  2. Updating from the command line
  3. Ubuntu apt-get howto