Hi mmoller,
I visited your website and I saw the schematic ( https://github.com/mmoller2k/pikeyd/blo ... wiring.png ).
According to this schematic you are ORing the interrupts coming from MCP23017 and putting the signals directly into Raspy using a power source of 5V.
This interrupt signal could be harmful to the Raspy that supports 3.3V maximum for GPIO?
thanks
Re: Universal GPIO keyboard daemon
I also strugle, but that was expected as i'm a complete newby.
I download different Arcade versions like retropie and Piplay, but can't get te arcade controls working.
Also followed adafruit tutorial, but somehow did not have all or the same files.
Now i've downloaded piplay-0.8-beta5.img and also have a working mame rom game. I can play with keyboard but not with original arcade controls. I have set up the GPIO through resistors (10k and 1k) and also with 3.3v and ground.
I followed instructions like. http://www.newsdownload.co.uk/pages/RPi ... stick.html.
Now my GPIO 17, 23, 10,9, 25 and 7 is used. And the 3.3v and the GND.
Here I downloaded pikeyd and also placed it in /usr/local/bin/
In terminal I did sudo make, but after that still no working GPIO.
I also tried and modified rc.local.
/usr/local/bin/pikeyed -d
_IP=$ ect.
ect.ect
exit 0
I reboot the raspberry, but still no luck
Hope somebody have tips.
I also tried it without pullup resisorts just like adafruits tutorial.
I download different Arcade versions like retropie and Piplay, but can't get te arcade controls working.
Also followed adafruit tutorial, but somehow did not have all or the same files.
Now i've downloaded piplay-0.8-beta5.img and also have a working mame rom game. I can play with keyboard but not with original arcade controls. I have set up the GPIO through resistors (10k and 1k) and also with 3.3v and ground.
I followed instructions like. http://www.newsdownload.co.uk/pages/RPi ... stick.html.
Now my GPIO 17, 23, 10,9, 25 and 7 is used. And the 3.3v and the GND.
Here I downloaded pikeyd and also placed it in /usr/local/bin/
In terminal I did sudo make, but after that still no working GPIO.
I also tried and modified rc.local.
/usr/local/bin/pikeyed -d
_IP=$ ect.
ect.ect
exit 0
I reboot the raspberry, but still no luck

Hope somebody have tips.
I also tried it without pullup resisorts just like adafruits tutorial.
- DigitalLumberjack
- Posts: 336
- Joined: Thu May 22, 2014 8:55 am
- Location: France
- Contact: Website
Re: Universal GPIO keyboard daemon
Hi, I have had many issue too with gpio to keyboard tools so i used a gpio to joystick driver that works with all emulators like a charme. It could be a solution if you dont really need keyboard strokes. See https://github.com/digitalLumberjack/mk ... ystick_rpi and give it a try.
Re: Universal GPIO keyboard daemon
I have put together a complete tutorial which uses pikeyd.
http://phillystutorials.blogspot.com/20 ... rcade.html
Walks you through creating the arcade with advmame and pikeyd and includes instructions on how to wire up your GPIO.
http://phillystutorials.blogspot.com/20 ... rcade.html
Walks you through creating the arcade with advmame and pikeyd and includes instructions on how to wire up your GPIO.
- UsagiYojimbo
- Posts: 1
- Joined: Mon Aug 25, 2014 4:30 am
- Location: Debrecen, Hungary
- Contact: ICQ
Re: Universal GPIO keyboard daemon
Hi,DavidL wrote:I have just pushed some alpha pikeyd code back into GitHub under a "key_matrix" branch: https://github.com/Lencons/pikeyd
What I have tested as working with this is:
...
2) Switches can now be connected in a matrix format and basic testing shows this as working.
...
What isn't working is:
1) I have no idea if I/O Extenders are working and I would assume not as all my messing around with the code has bound to have broken them. But happy for someone to test it and prove me wrong or help fix it.
I have a project placing my Pi inside an old CD-player, to make an HTPC. I want to connect the CD-player's buttons and other controls to the Pi, so I was looking a way to do this. That's how i got here...
I made a schematic of all the components, and as the CD-player's buttons are in a matrix, i wanted to retain them in this way. Also to make the CD-player's LCD, IR sensor, and the RaspiLight work, I needed more GPIO pins, so i decided to use an I/O extender.
My question is, that is it possible to combine both your versions, so that the matrix capability will work on extenders?
Here's my "design", the keys are a 5×3 matrix:
(It does not show the INT signals connected, nor the RaspiLight.)

"I like my sugar with coffee and cream" (Beasty Boys - Intergalactic)
Re: Universal GPIO keyboard daemon
Thank you mmoller2k, it is working great on my project.


Re: Universal GPIO keyboard daemon
Hi - I've been scratching my head with this for a little while and have had a good look around the threads but wondered if I'm missing something obvious! I've followed the great step-bystep tutorial that PhillyNJ posted, but using the GitHub link to DavidL's code. My reason for using DavidL's version is that I'm not using an I/O Expander and just want to use the GPIO connections for Raspbmc control buttons - also it seems to suggest that the internal pull-ups are used in this branch, so a button can be wired directly between GPIO pin and GND. Anyway it all installed fine, and my files are below:
It seems to be very close to working in that there are no error messages and pikeyd is reporting the right amount of pins being polled, I just get no response when pressing the physical buttons. I'm checking by logging in via Putty, doing sudo pikeyd then pressing the buttons for a response. The only thing plugged into the pi's USB is a Microsoft IR receiver (hmm might unplug it but I do need both buttons and IR to work simultaneously).
My current feelings are that the problem possibly lies with:
- My board being a B+ and this needing something different/extra in the code
- The internal pullups need to be configured somewhere and I've missed it
- Something else simple that I've overlooked!
The physical buttons are connected to a paddle breakout board and I've double-checked the connections are sound and the pins are correct. I've read posts about the blacklist file but it isn't there.
Any help gratefully received.
Code: Select all
pi@raspbmc:~$ sudo nano /etc/pikeyd.conf
GNU nano 2.2.6 File: /etc/pikeyd.conf
#joy.cfg
#format:
# [keycode from /usr/include/linux/input.h] [whitespace] [GPIO pin no]
# Not limited to a single key. A GPIO press will emit all defined keys in order.
KEY_PLAYPAUSE 2
KEY_PLAYPAUSE 3
KEY_REWIND 4
KEY_FASTFORWARD 17
KEY_STOP 27
KEY_F20 22
KEY_F21 10
KEY_ESC 9
KEY_UP 11
KEY_ENTER 18
KEY_LEFT 23
KEY_DOWN 24
KEY_RIGHT 25
#define I/O expanders before using them
#XIO(tag) gpio_int_pin/chip_addr:register_no
#MCP23008 only has a single 8-bit bank
#XIO_M 17/0x20/MCP23008
#define an MCP23008 expander at address 0x20 with interrupt wired to GPIO-17
#MCP23017 has two 8-bit banks
#XIO_A 17/0x20/MCP23017A
#XIO_B 17/0x20/MCP23017B
#KEY_O XIO_M:1
#KEY_L XIO_M:2
#KEY_E XIO_A:6
#KEY_E XIO_B:6
Code: Select all
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
pi@raspbmc:~$ sudo pikeyd
Config file is /etc/pikeyd.conf
Polling 13 GPIO pin(s).
Found 0 I/O expander(s).
Ready.
Joystick init OK.
Press ^C to exit.
Code: Select all
pi@raspbmc:~$ sudo nano /etc/rc.local
GNU nano 2.2.6 File: /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/local/bin/pikeyd -d
exit 0
My current feelings are that the problem possibly lies with:
- My board being a B+ and this needing something different/extra in the code
- The internal pullups need to be configured somewhere and I've missed it
- Something else simple that I've overlooked!
The physical buttons are connected to a paddle breakout board and I've double-checked the connections are sound and the pins are correct. I've read posts about the blacklist file but it isn't there.
Any help gratefully received.
Re: Universal GPIO keyboard daemon
Oops just realised I didn't install the key_matrix branch which has the internal pullups bit in. Downloaded it and tried to make it but got the following:
Any ideas on the gpio.h error? Thanks!
Code: Select all
pi@raspbmc:~$ make -C pikeyd
make: Entering directory `/home/pi/pikeyd'
arm-linux-gnueabihf-gcc -O2 -Wstrict-prototypes -Wmissing-prototypes
-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include
-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/usr/incl
ude
-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2
/include-fixed
-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2
/include
-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2
/finclude -c config.c -o config.o
config.c:37:18: fatal error: gpio.h: No such file or directory
compilation terminated.
make: *** [config.o] Error 1
make: Leaving directory `/home/pi/pikeyd'
pi@raspbmc:~$
Any ideas on the gpio.h error? Thanks!
Re: Universal GPIO keyboard daemon
I get the same error. I'm not a programmer so I might be wrong, but I think this entire file is missing from DavidL's github repo. Maybe he forgot to upload it?MisterM wrote:Any ideas on the gpio.h error? Thanks!
Re: Universal GPIO keyboard daemon
Guys,
Let me fix that for you. Correct I will assume that the header file was not pushed back up into the repo.
There was also a bug I found in the code that I fixed since it was last pushed up.
If everyone can hold tight for a couple of days I will sort it out and provide an update.
- Dave.
Let me fix that for you. Correct I will assume that the header file was not pushed back up into the repo.
There was also a bug I found in the code that I fixed since it was last pushed up.
If everyone can hold tight for a couple of days I will sort it out and provide an update.
- Dave.
Re: Universal GPIO keyboard daemon
Thank you so much for looking into this. Take all the time you need :D
Re: Universal GPIO keyboard daemon
I have pushed all of the current code base into the master branch.
I haven't trying running it as yet but it does compile. It seems I was part way fixing how the daemonize code worked so potentially as long as you run it from the command line it should be good.
I will set the test bench up again in the next couple of days, but let me know if you find any issues and I will sort them out.
- Dave.
I haven't trying running it as yet but it does compile. It seems I was part way fixing how the daemonize code worked so potentially as long as you run it from the command line it should be good.
I will set the test bench up again in the next couple of days, but let me know if you find any issues and I will sort them out.
- Dave.
Re: Universal GPIO keyboard daemon
Now I get this:
Any ideas?
Code: Select all
pi@retropie ~/pikeyd $ make
arm-linux-gnueabihf-gcc -O2 -Wstrict-prototypes -Wmissing-prototypes -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/usr/include -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/include-fixed -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/include -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/finclude -c config.c -o config.o
config.c:60:1: error: expected identifier or ‘(’ before ‘<<’ token
config.c:70:1: error: expected identifier or ‘(’ before ‘==’ token
config.c:85:1: error: expected identifier or ‘(’ before ‘>>’ token
config.c:97:1: error: expected identifier or ‘(’ before ‘<<’ token
config.c:106:1: error: expected identifier or ‘(’ before ‘<<’ token
Makefile:23: recipe for target 'config.o' failed
make: *** [config.o] Error 1
Re: Universal GPIO keyboard daemon
Never mind. Seems to just be some errant text on your master branch. The key_matrix branch compiles fine.
Re: Universal GPIO keyboard daemon
I got everything compiled and tried to configure it for direct GPIO + ground controls, but I'm thinking I might be misunderstanding the conflig file instructions. I get this error
This is my pikeyd.conf:pi@retropie ~ $ sudo /usr/local/bin/pikeyd
Config file is /etc/pikeyd.conf
ERROR: /etc/pikeyd.conf line 1: GPIO04 pull resister not set, pin no set for input.
Code: Select all
PULL_UP GPIO04
PULL_UP GPIO14
PULL_UP GPIO15
PULL_UP GPIO17
PULL_UP GPIO18
PULL_UP GPIO27
PULL_UP GPIO22
PULL_UP GPIO23
PULL_UP GPIO24
PULL_UP GPIO10
PULL_UP GPIO09
PULL_UP GPIO25
KEY_UP 04
KEY_DOWN 17
KEY_LEFT 27
KEY_RIGHT 22
KEY_ENTER 25
KEY_ESC 24
KEY_C 10
KEY_X 09
KEY_1 14
KEY_2 23
KEY_3 15
KEY_4 18
Re: Universal GPIO keyboard daemon
Looks like I just needed to define the keys first and then the PULL_UP after that. It's all working now! Thank you both DavidL and mmoller2k!
Re: Universal GPIO keyboard daemon
I get an error saying module uinput is not found.
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.
Any ideas?
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.
Any ideas?

Re: Universal GPIO keyboard daemon
uinput is not a kernal module, it is part of the source code. This error is suggesting that you are missing either (or both) of uinput.c or uinput.h during the build process.daxdax wrote:I get an error saying module uinput is not found.
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.
Any ideas?
Check that you have the most recent (and complete) version of the master branch and it should compile cleanly.
If you are still getting errors, please post the the exact output you are getting and we can go from there.
- Dave.
Re: Universal GPIO keyboard daemon
Are you running a kernel other than the standard Raspbian one?daxdax wrote:I get an error saying module uinput is not found.
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.
The uinput driver should be available as a module. It exists on all my Pis
Code: Select all
root@raspi3:~# modinfo uinput
filename: /lib/modules/4.1.6+/kernel/drivers/input/misc/uinput.ko
version: 0.3
license: GPL
description: User level driver support for input subsystem
author: Aristeu Sergio Rozanski Filho
alias: devname:uinput
alias: char-major-10-223
srcversion: 033449FF7BD543FA6598FB0
depends:
intree: Y
vermagic: 4.1.6+ preempt mod_unload modversions ARMv6
Yes it isDavidL wrote:uinput is not a kernal module

The code in uinput.h interfaces with the module.
Re: Universal GPIO keyboard daemon
Well yeah true. I just assumed that it may have been in reference to an issue with the previous commit of code which didn't include the uinput.c/.h files.DavidL wrote:uinput is not a kernal module
Yes it is
The code in uinput.h interfaces with the module.
But OP does reference "module" in their request so possibly this is a kernel issue.
- Dave.
Re: Universal GPIO keyboard daemon
Hi all,
I had a quick (and hopefully) easy question regarding pikeyd.
I am looking into building a squeezelite player with jivelite showing the squeezebox UI on a 3.5 inch touchscreen. I can control squeezelite through the touchscreen but also was thinking of adding buttons to create shortcuts (e.g. directly go to artists, radio, spotify, etc.).
To be able to do that, I would need to have one button simulate multiple key strokes as in [home] + 3 * [arrow down] + 2 * [arrow right] + [enter].
Is it possible to configure pikeyd to accept a series of key strokes with one button press?
Thanks for your response.
Michielo
I had a quick (and hopefully) easy question regarding pikeyd.
I am looking into building a squeezelite player with jivelite showing the squeezebox UI on a 3.5 inch touchscreen. I can control squeezelite through the touchscreen but also was thinking of adding buttons to create shortcuts (e.g. directly go to artists, radio, spotify, etc.).
To be able to do that, I would need to have one button simulate multiple key strokes as in [home] + 3 * [arrow down] + 2 * [arrow right] + [enter].
Is it possible to configure pikeyd to accept a series of key strokes with one button press?
Thanks for your response.
Michielo
Re: Universal GPIO keyboard daemon
The current configuration functionality will not support assigning a string as output, but it won't be a significant change to the code to allow it.Michielo wrote:I would need to have one button simulate multiple key strokes as in [home] + 3 * [arrow down] + 2 * [arrow right] + [enter].
Is it possible to configure pikeyd to accept a series of key strokes with one button press?
- Dave.
Re: Universal GPIO keyboard daemon
Hi David,
Thanks for your response. Considering scripting is all very new to me, I'll probably need some help on this.
When I look at the files on GitHub, I see 2 files that have key definitions being Keydefs.c and pikeyd.conf.
I assume I need to configure the last one. I am going to use an MCP230017, so I will first need to define (assuming pin 17 is used - btw which numbering convention is this using? Board, chip, other?)
XIO_A 17/0x20/MCP23017A
XIO_B 17/0x20/MCP23017B
To assign entries to a key I probably want to look at the last section in pikeyd.conf,
KEY_E XIO_A:6
KEY_E XIO_B:6
If that is correct, how do I then define the string if for example I want to assign [KEY_LEFT+KEY_LEFT+KEY_UP+KEY_ENTER] to XIO_A:1?
Any leads on where I should start to reconfigure things would be highly appreciated.
Thanks
Thanks for your response. Considering scripting is all very new to me, I'll probably need some help on this.
When I look at the files on GitHub, I see 2 files that have key definitions being Keydefs.c and pikeyd.conf.
I assume I need to configure the last one. I am going to use an MCP230017, so I will first need to define (assuming pin 17 is used - btw which numbering convention is this using? Board, chip, other?)
XIO_A 17/0x20/MCP23017A
XIO_B 17/0x20/MCP23017B
To assign entries to a key I probably want to look at the last section in pikeyd.conf,
KEY_E XIO_A:6
KEY_E XIO_B:6
If that is correct, how do I then define the string if for example I want to assign [KEY_LEFT+KEY_LEFT+KEY_UP+KEY_ENTER] to XIO_A:1?
Any leads on where I should start to reconfigure things would be highly appreciated.
Thanks
Re: Universal GPIO keyboard daemon
Can you tell me how you modified the code for the rotary encoder, i want to use two of them in my projectConner Labs wrote:9 buttons and a rotary encoder all working nicely![]()
The rotary encoder is a Grayhill 62A22. I modified the code a bit to handle it.
thks