hi,
I am so happy with pikeyd. I got all buttons connected on two MCP23017, it works perfect! Thank you
I like to do two more thing, I hope some one can help me out.
- shutdown or reboot raspberry pi by pressing more than two buttons together.
- call "ESCAPE" key by pressing more than two buttons together (just in case)
thanks in advance
Re: Universal GPIO keyboard daemon
If you have some gpio free you can use them by connection 2 or more button in series with one gpio... I'm doing this in my cabinet for exiting the emulator... For shutting down the rpi you need a script thath check continuosly for 3 pressed button, maybe for 2 seconds before shutting down...
Download GamePi OS: www.raspberrygaming.tk
Re: Universal GPIO keyboard daemon
i want to make a portable gaming pi with raspbian
i do you recommend this buttons or no
http://ram-e-shop.com/oscmax/catalog/pr ... ts_id=1181
and what i will need to connect it to my pi and
i want to use the buttons to make xyab l1l2 r1r2 start select reset
and what is the pins i will need
can i use this analog stick like a joystick
http://www.adafruit.com/products/245
and how to connect the analog stick to the pins
and how to program it
i do you recommend this buttons or no
http://ram-e-shop.com/oscmax/catalog/pr ... ts_id=1181
and what i will need to connect it to my pi and
i want to use the buttons to make xyab l1l2 r1r2 start select reset
and what is the pins i will need
can i use this analog stick like a joystick
http://www.adafruit.com/products/245
and how to connect the analog stick to the pins
and how to program it
Re: Universal GPIO keyboard daemon
Those buttons should work nicely, now how many buttons do you need? Because I believe you've said you'd want 11 buttons. If that is correct the. You shouldn't have to much issue with that as there are plenty of GPIO pin on the Pi.
But the joystick is different. It doesn't work like the buttons do. The joystick has 2 pins, left/right and up/down. And that means that to work out which direction your moving you'd have to read the voltage coming into 2 pins instead of wether they Are high or low as this joystick works through variable resistors instead of good old completed/Incompleted circuits.
So, in short, the buttons will be easy, the joystick, could be quite hard. If you we're to use 4 buttons as a D-Pad instead it would definitely work.
But the joystick is different. It doesn't work like the buttons do. The joystick has 2 pins, left/right and up/down. And that means that to work out which direction your moving you'd have to read the voltage coming into 2 pins instead of wether they Are high or low as this joystick works through variable resistors instead of good old completed/Incompleted circuits.
So, in short, the buttons will be easy, the joystick, could be quite hard. If you we're to use 4 buttons as a D-Pad instead it would definitely work.
Re: Universal GPIO keyboard daemon
ok i will use 4 buttons as a D-Padbushrat wrote:Those buttons should work nicely, now how many buttons do you need? Because I believe you've said you'd want 11 buttons. If that is correct the. You shouldn't have to much issue with that as there are plenty of GPIO pin on the Pi.
But the joystick is different. It doesn't work like the buttons do. The joystick has 2 pins, left/right and up/down. And that means that to work out which direction your moving you'd have to read the voltage coming into 2 pins instead of wether they Are high or low as this joystick works through variable resistors instead of good old completed/Incompleted circuits.
So, in short, the buttons will be easy, the joystick, could be quite hard. If you we're to use 4 buttons as a D-Pad instead it would definitely work.
but what i will need to connect it to the pi like a resistors or what and what is the pins i will need i mean is it ground and what
if i will use 4 buttons as a D-Pad i will need 15 button so 15 pin
now my big problems
how to program it
and i will use a wireless keyboard with a touchpad can i use it with the buttons
and how to cover the buttons ?
thanks
Re: Universal GPIO keyboard daemon
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:
1) Directly connected GPIO switches seem to be working fine.
2) Switches can now be connected in a matrix format and basic testing shows this as working.
3) You can now configure the internal PULL resistors so you only need to switch to ground and the pin can otherwise be left floating. This is for both direct and matrix driven switches.
4) Pins can be defined within pikeyd.conf in any format that makes sense to you, check out the comments in the default pikeyd.conf file for more information.
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.
2) Forced key repeat needs to be updated which is what I will work on now.
If anyone is interested in giving success/fail feedback on this code tree it will be appreciated.
- Dave.
What I have tested as working with this is:
1) Directly connected GPIO switches seem to be working fine.
2) Switches can now be connected in a matrix format and basic testing shows this as working.
3) You can now configure the internal PULL resistors so you only need to switch to ground and the pin can otherwise be left floating. This is for both direct and matrix driven switches.
4) Pins can be defined within pikeyd.conf in any format that makes sense to you, check out the comments in the default pikeyd.conf file for more information.
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.
2) Forced key repeat needs to be updated which is what I will work on now.
If anyone is interested in giving success/fail feedback on this code tree it will be appreciated.
- Dave.
Re: Universal GPIO keyboard daemon
Regarding the buttons:nexusrex wrote:ok i will use 4 buttons as a D-Pad
but what i will need to connect it to the pi like a resistors or what and what is the pins i will need i mean is it ground and what
if i will use 4 buttons as a D-Pad i will need 15 button so 15 pin
now my big problems
how to program it
and i will use a wireless keyboard with a touchpad can i use it with the buttons
and how to cover the buttons ?
thanks
Get buttons with a longer head on them, either 9mm or longer depending on how thick your panel is going to be. Mount them on a bit of PCB/verriboard and then drill holes though the panel and mount the PCB so there is enough switch head poking though the panel to de-press them.
Using tactile switches for the joystick will give you a console style control, but this from RAM might work better as a joystick. It has got pull-up resistors built in which you could work around with the design.
Connecting to RPi:
The code I have just posted uses the internal pull-up resistors within the GPIO, so you can just connect one side of each switch directly to a GPIO Pin and the other side straight to a Ground pin. You don't need any extra external hardware/resistors/etc.
Other option is to use mmoller's code and use the schematics on the first page of this thread, or included within the GitHub tree to wire it up. Everything is just seen as a switch by the RPi, so that schematic holds true for each button and each switch on the joystick.
Programming the RPi:
Once setup and running you shouldn't need a keyboard and everything should be manageable though the controls via a MAME frontend (AdvanceMENU as an example).
If you want a keyboard, you will not need a mouse as for MAME you don't run X11 and everything is manageable from the command line. A wireless mouse would be excessive but if you want it go for it. A bluetooth solution with a dongle in the RPi USB port is a good idea.
What I am going to do with my cabinet is set it up as a Wireless access point with a USB WiFi dongle and then connect to it via SSH. Depends on how experienced you are with Linux. I will also mount the RPi so I can open the back panel on the cabinet and have direct access to the USB port to plug in a keyboard should the need arise.
The pikeyd sevice works fine with a keyboard also connected to the RPi. Input from both is combined by the Linux kernel before sending it to MAME.
Hope that helps a little.
- Dave.
Re: Universal GPIO keyboard daemon
how many buttons can you wire up without ics?
Re: Universal GPIO keyboard daemon
The total number of buttons can be increased if you use a switch matrix (pressing a button shorts two GPIOs together) instead of single-button-per-GPIO where you pull the GPIO to ground, as I believe is done now. You would have to scan the matrix in sequence, driving some GPIOs and sensing the others.
The R-Pi (rev.2) can have up to 21 GPIO pins available, so you could have a 10x11 matrix, that is 110 keys.
If you use UART, SPI, and I2C you have 8 GPIO on the P1 header. If you use only UART, then 15 GPIO are available on P1.
If you don't use SPI, I2C, or UART, then there are 17 GPIO pins on the P1 header. On the currently produced (revision 2) RPi board, there are also another 4 GPIO available on the less-often-used P5, bringing the total up to 21 pins. P5 is not stuffed at the factory so this requires soldering in another header. See also http://elinux.org/RPi_Low-level_periphe ... .28GPIO.29
The R-Pi (rev.2) can have up to 21 GPIO pins available, so you could have a 10x11 matrix, that is 110 keys.
If you use UART, SPI, and I2C you have 8 GPIO on the P1 header. If you use only UART, then 15 GPIO are available on P1.
If you don't use SPI, I2C, or UART, then there are 17 GPIO pins on the P1 header. On the currently produced (revision 2) RPi board, there are also another 4 GPIO available on the less-often-used P5, bringing the total up to 21 pins. P5 is not stuffed at the factory so this requires soldering in another header. See also http://elinux.org/RPi_Low-level_periphe ... .28GPIO.29
Re: Universal GPIO keyboard daemon
so should i -for example- wire gpio 7 to gpio 8 or gpio 7 to gnd?
Re: Universal GPIO keyboard daemon
Sorry noob,noob wrote:so should i -for example- wire gpio 7 to gpio 8 or gpio 7 to gnd?
What are you trying to achieve?
- Dave.
Re: Universal GPIO keyboard daemon
Is it possible to use a MCP23S17 with SPI instead of I2C?
Or is it a big thing to add support of MCP23S17 so the code?
Or is it a big thing to add support of MCP23S17 so the code?
Re: Universal GPIO keyboard daemon
No it wouldn't be hard, but why?zecole wrote:Is it possible to use a MCP23S17 with SPI instead of I2C?
Or is it a big thing to add support of MCP23S17 so the code?
Just use a MCP23017 as it is currently working, I don't see any benefit for going to a SPI bus over I2C for this application or adding the complexity to the code base to support I2C.
- Dave.
Re: Universal GPIO keyboard daemon
Okay thank your for your reply.
Is just found the MCP23S17 to buy last week thats the reason why i ask for support of the MCP23S17.
But yesterday i found a Store in Germany were i can buy the MCP23017 so i ordered it.
By the way nice job i used the deamon already with just the GPIO ports but now i need more inputs.
Thanks for that
Is just found the MCP23S17 to buy last week thats the reason why i ask for support of the MCP23S17.
But yesterday i found a Store in Germany were i can buy the MCP23017 so i ordered it.
By the way nice job i used the deamon already with just the GPIO ports but now i need more inputs.
Thanks for that
Re: Universal GPIO keyboard daemon
zecole,
That is good. I was assuming that you were coming at it from SPI being faster, rather than just stock availability.
I will have an update to my code base pushed up in the next couple of days, however I would be very surprised if expander's will work with my code base anymore. I might try at some stage and retro fit them back in, but I really don't see any need for them when you should be able to run more than enough buttons in a matrix for any MAME/MESS application.
I have however decided to not use the RPi in the cabinet I am building now, but will finish the code base as I am using it as a test platform.
- Dave.
That is good. I was assuming that you were coming at it from SPI being faster, rather than just stock availability.
I will have an update to my code base pushed up in the next couple of days, however I would be very surprised if expander's will work with my code base anymore. I might try at some stage and retro fit them back in, but I really don't see any need for them when you should be able to run more than enough buttons in a matrix for any MAME/MESS application.
I have however decided to not use the RPi in the cabinet I am building now, but will finish the code base as I am using it as a test platform.
- Dave.
Re: Universal GPIO keyboard daemon
I'm trying to develop a modified version of this utility that translates keystrokes, I can get it to compile and run ok but it's not finding the /dev/uinput device. If I try and run 'sudo modprobe uinput' then i get the following error:
Does anyone have any insights as to why this isn't working? I'm running 3.1.9+ and I can see uinput in /dev but I'm also doing initial development under qemu...that shouldn't make a difference, should it?
Code: Select all
ERROR: could not insert 'uinput': Exec format error
Re: Universal GPIO keyboard daemon
Actually it could make a difference, uinput is a module that interfaces with hardware and your "hardware" is Qemu, so that could very much be the issue.Myndale wrote:I'm trying to develop a modified version of this utility that translates keystrokes, I can get it to compile and run ok but it's not finding the /dev/uinput device. If I try and run 'sudo modprobe uinput' then i get the following error:
Does anyone have any insights as to why this isn't working? I'm running 3.1.9+ and I can see uinput in /dev but I'm also doing initial development under qemu...that shouldn't make a difference, should it?Code: Select all
ERROR: could not insert 'uinput': Exec format error
It might make sense to use a Pi directly. Your other option is to post a topic asking for testers of you program, I'm sure someone would love to

Re: Universal GPIO keyboard daemon
Hi all, I like to use pikeyd to emulate keyboardstrokes for a controlprogram (Jivelite) for a Squeezebox player. I installed the initial version and it works great with buttons. On the first page someone told that he has got it working with a Rotary encoder. But he did not respond to the question to post the code he used.
Does anyone know how I can alter the code and how to wire the encoder?
I can do this in Python, but the deamon is realy great to work with Jivelite.
Cheers, Kees
Does anyone know how I can alter the code and how to wire the encoder?
I can do this in Python, but the deamon is realy great to work with Jivelite.
Cheers, Kees
-
- Posts: 5
- Joined: Tue Dec 24, 2013 4:51 pm
Re: Universal GPIO keyboard daemon
I see what you made and I wonder if you can help me, I do the same thing recent days for a gpio key control, I use input.h and the check part works well, but for input_report_key function I get nothing in wherever I press the key. It drives me crazy and I do know nothing about It, thank you very much. 

Re: Universal GPIO keyboard daemon
Hello mmoller2k,
i am currently looking into installing the daemon. My keypad has 2 daisy - chained shift registers (SN74HC165N) (Means 2 8 bit banks). The thing is, that the shift register has no address. How can i set them up ? The board is technically compatible with SPI, but i want them left open for other devices (like an rtc) and the GPIO itself is fast enough. My question is :
How do i setup the board ?
I looked into the MCP23S17 datasheet and this chip can be controlled like my chips, so i'm thinking about having the daemon think, the board has an MCP23S17.
i am currently looking into installing the daemon. My keypad has 2 daisy - chained shift registers (SN74HC165N) (Means 2 8 bit banks). The thing is, that the shift register has no address. How can i set them up ? The board is technically compatible with SPI, but i want them left open for other devices (like an rtc) and the GPIO itself is fast enough. My question is :
How do i setup the board ?
I looked into the MCP23S17 datasheet and this chip can be controlled like my chips, so i'm thinking about having the daemon think, the board has an MCP23S17.
Re: Universal GPIO keyboard daemon
Someone can tell me how pikeyd can emulate up an down arrow with a rotary encoder? i can't find anything about that.
-
- Posts: 14
- Joined: Fri Jan 31, 2014 12:18 am
Re: Universal GPIO keyboard daemon
Just have a quick question. My hardware consists of an Adafruit Mini Pitft display which makes use of the spi pins on the GPIO. If I installed this would it mess with the lcd functions if I for example removed the GPIO binds on the pkeyd.config?
-
- Posts: 14
- Joined: Fri Jan 31, 2014 12:18 am
Re: Universal GPIO keyboard daemon
Okay so got the pikeyd up and running no problems whatsoever with the displays. Now i need to bind file copy (ctrl+c), paste (ctrl+v), file delete and shutdown to 4 gpios. I opened input.h and i found there key_copy, key_paste, key_shutdown and key_filedelete. I edited the pikeyd.conf and bound them to the gpios but it didnt work. Before i did that i assigned numbers to the gpios and it worked. Anyone encountered this problem?
Re: Universal GPIO keyboard daemon
Hi Dave,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:
1) Directly connected GPIO switches seem to be working fine.
2) Switches can now be connected in a matrix format and basic testing shows this as working.
3) You can now configure the internal PULL resistors so you only need to switch to ground and the pin can otherwise be left floating. This is for both direct and matrix driven switches.
4) Pins can be defined within pikeyd.conf in any format that makes sense to you, check out the comments in the default pikeyd.conf file for more information.
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.
2) Forced key repeat needs to be updated which is what I will work on now.
If anyone is interested in giving success/fail feedback on this code tree it will be appreciated.
- Dave.
Your source code is so impressive!
I would like to use that rather than the mmoller2k version because I have some 3x4 matrix keyboard.
I am able to build the mmoller2k version but when I try to build yours, the compiler cannot find the gpio.h
"config.c:37:18: fatal error: gpio.h: No such file or directory"
I believe I missed to install some packages but I dont know what.
I know that you can help me and we can solve this problem soon.
The OS is Raspbmc 3.10.24 #2 PREEMPT however I tried
raspbian 7.0 "wheezy" kernel 3.6.11 #1 PREEMPT
Thanks for any help!
cheers,
Tamas
-
- Posts: 3
- Joined: Sat Mar 01, 2014 4:33 am
Re: Universal GPIO keyboard daemon
I tried setting my keyboard to "raw" in both advmame.rc and advmenu.rc and I disconnected my keyboard. In addition, I added the -multikeyboard argument to AdvMAME. No luck. Works fine in the console but not in AdvMAME...bushrat wrote:Just thought I'd let people know, you don't need to disconnect your keyboard to get AdvMAME working, all you need to is change the device_keyboard attribute towards the top of the advmame.rc (or advmenu.rc) from auto to raw, works perfectly for me.
Any pointers? this is driving me CRAZY!