Raspberry PI Touchscreen Kiosk

A Raspberry PI touchscreen kiosk project GUI application using GTK+ 3 and Glade. A full-screen information kiosk application written in C for the Raspberry PI.

Raspberry PI Touchscreen Kiosk

Raspberry PI Touchscreen Kiosk

Raspberry PI Touchscreen Kiosk Details

This Raspberry PI touchscreen kiosk project is a demo application that shows a simple mall with four shops. An official Raspberry PI touchscreen is used as an information kiosk. When any button on the screen is touched, information for the corresponding page is displayed.

An example of one of the information screens for a shop is shown in the image below.

Raspberry Pi Kiosk Info Screen

Raspberry Pi Kiosk Info Screen

GTK+ 3 and Glade 3 Raspberry Pi Project

GTK is a toolkit that is used to create windows and widgets such as buttons, images and text boxes. Glade is a user interface design application that allows windows to be designed and laid out graphically. It is used to design the GUI of the application.

The Application is written in the C programming language. GTK functions are called in the C code to draw the windows and widgets designed in Glade and to attach callback functions to window events such as button presses.

Application Details and Code

The project is built from a set of GTK template files that make it easy to start a new GTK / Glade GUI application. Full code and project details can be found in the Raspberry PI Information Kiosk project on the Starting Electronics website.

The code and example project can help you to start your own Raspberry PI GUI application development if you are building an information kiosk or similar application.

Go to the Raspberry PI Kiosk Page →

Floating Point Numbers don’t Print with sprintf in Atmel Studio AVR C

When writing C program code for 8-bit Atmel AVR microcontrollers and using Atmel Studio, functions such as printf() and sprintf() do not print floating point numbers of type float. Instead of printing a float to a string or standard output, a question mark is printed.

Question Mark is Printed from the sprintf Function Instead of Float Number

The image below shows the output from the serial port of an AVR microcontroller that printed a floating point number to a string using the sprintf() function. The string was then sent to a terminal program running on a PC. The C program was built in Atmel Studio 7 using the default project settings. As can be seen, floating point numbers don’t print with sprintf, but a question mark is printed instead of the expected number.

Floating Point Numbers don't Print with sprintf in Atmel Studio AVR C

Floating Point Numbers don’t Print with sprintf in Atmel Studio AVR C

Cause of the float Printing Problem

The problem occurs because Atmel Studio 7 uses the minimal version of the function that all the printf family of functions rely on. Using the minimal function reduces code size of the printf family of functions which is desirable when using microcontrollers, especially the smaller 8-bit AVR microcontrollers that have small amounts of memory. Floating point numbers are not supported by the minimal function, causing the question mark to be printed instead of the floating point number.

Printing float Numbers with sprintf using AVRs and Atmel Studio

To fix the floating point printing problem, the full function that the printf family uses must be linked into the program instead of the minimal function. The article on how to print floating point numbers in AVR C code with Atmel Studio 7 shows how to include the full function by changing linker settings in Atmel Studio.

After changing setting in Atmel Studio, the sprintf function works properly and prints the floating point number to the terminal as shown in the image below.

Printing float Numbers with an AVR Microcontroller using sprintf

Printing float Numbers with an AVR Microcontroller using sprintf