The SevenSeg Controller Module
This program is developed by Felix Kopp and Armin Weigold in the context of a university research project.
Read the Wiki for more information.
What is it?
The SevenSeg Controller is a Linux kernel module built for the Raspberry Pi. Its sole purpose is to display a number between 0 and 9 on a seven segment display connected to the Raspberry's GPIO pins.
How do I install it?
TL;DR
There is a full install script specifically designed for Raspbian that worries about all the needed stuff for you. Just copy the command below and paste it into you running shell:
bash <(curl -s https://mygit.th-deg.de/fk16790/SevenSegController/raw/master/install.sh)
Manual installation
The only two reasons you would want to follow these steps are either if the install script didn't work for some reason, or you want to learn what's going on under the hood.
If you want to build this module, you should have hooked up your seven segment display to the Raspberry's GPIO pins as described in Wiring. If everything is set up, you can proceed with these steps.
-
Get your current Linux headers and build tools. Depending on what system you are using, you should be able to install these packages with your package manager. Example for Raspbian:
root@raspberry:~# apt-get -y install raspberrypi-kernel-headers build-essentials
If you are running something other than Raspbian, you most probably know what you're doing and are able to install these packages on your own.
-
Download the package. The recommended way of doing this is to clone this repository into your local directory. You will need to have
git
installed, but this is already the case on a default Raspbian installation.root@raspberrypi:~# git clone https://mygit.th-deg.de/fk16790/SevenSegController.git
-
Build the module. If you successfully extracted the package, you can change into the project's root directory and compile it with make:
root@raspberry:~# cd SevenSegController root@raspberry:~/SevenSegController# make root@raspberry:~/SevenSegController# make clean # This step is optional
-
Load the module into the kernel. Now, you just have to type
insmod sevenseg.ko
to load the module.
Easy, isn't it?
How do I use it?
If you have correctly hooked up your seven segment display to your Raspberry Pi
as described in WIRING.md and successfully
loaded the module as explained above, you can display a number by writing its
ASCII character (not the raw number!) into /dev/sevenseg
, for example:
root@raspberry:~# echo 3 >> /dev/sevenseg
This will display the number three. If you want to clear the display, just type
root@raspberry:~# echo '' >> /dev/sevenseg
or any number that is not between 0x0 and 0xF (inclusively), and the display will turn off again.