Close

Kivy Pie

A project log for Raspberry Pi Glucometer

A programmable glucometer powered by a Raspberry Pi Zero

jonathan-buchananJonathan Buchanan 07/27/2016 at 23:200 Comments

The project has developed to the point where it is time to pick an operating system. Since I want more than a terminal program for my meter software, I need a GUI. Since I don't want any window manager or extra clutter, I don't want to start X every time the meter boots.

One of the major attraction of using Kivy, one of the many python GUI toolkits, is that it can run by itself without a window manager. While doing some browsing I came across KivyPie, a custom install of pipaOS specially for developing Kivy software.

On Kivy Pie's website it says this:

"To make the installation steps simple to Kivy developers. KivyPie integrates all software needed and boots directly on the Raspberry PI, no extra configuration is needed. pipaOS is a minimalist Raspbian OS version."

That sounded pretty good to me, so I flashed it to an sd card and booted it on one of the growing number of raspberry pi's sitting around my house.

I have this PiTFT by adafruit. It is a simple framebuffer device and requires a custom kernel to run. Fortunately pipaOS is based on Raspbian, so I only had to follow the instructions under DIY install script to get kernel support for the screen.

Another major problem loomed, however. Kivy is designed to use the raspberry pi's GPU, puny as it is. The PiTFT cannot by used with the GPU. The workaround is to use a program called rpi-fbcp that allows any program to output it's display to the hdmi port and then copy it to the PiTFT screen. An inelegant solution to be sure, and it does slow everything down.

Next, I had to get the coordinates of the touchscreen to match the actual display on the screen. I followed the instructions on this question's answer and that seemed to work well.

After that I promptly tested it out by starting up a kivy port of flappy bird

That seemed to work well, but I wanted it rotated so the buttons would be on the bottom, and it would be more consistent with traditional meters.

First I tried rotating the screen in /boot/config.txt, but that confused kivy. Eventually I found the appropriate settings in kivy's config file.

After that I played around with kivy and made a mockup of the menu screen on the meter.

Discussions