Raspberry Pi sticky keypresses

Just a quickie, but I hope it is useful to someone …

I’ve had an occasional fault with my Raspberry Pi for a while: just occasionally, keypresses would ‘stick’. That is: even though I’d released a key, the Pi believed it was still held down.

This was usually only mildly annoying, but would promote itself to bloody irritating on occasion. I was often holding the delete key down to delete large chunks of code, but the editor would continue to delete code even after I’d released the key.

To fix it, I’d just press any other key and it would release the stuck key and register the new one as normal.

Initially I just thought this was an issue with the RISC OS port, but later discovered it also affected other installs – so it was a problem with hardware rather than software. I also discovered there was a higher chance of it happening if I was moving the mouse at the same time as using the keyboard.

Long story short: it’s a power-supply issue. I was using a 5 volt DC adaptor, in the form of a mobile phone charger. It is rated to supply 1 amp of current at 5 volts, but that still wasn’t quite enough with my particular combination of keyboard and mouse. So, occasionally the power requirement for all devices wasn’t quite being met, which meant that the “key-up” messages from the USB keyboard weren’t always being received.

My solution was to buy a powered USB Hub, and drive my keyboard and mouse from that. The power supply for the hub is rated at 3 amps. I’m using one of the sockets in the hub to power the Pi, then a USB cable from one of the USB sockets on the Pi to the “host” port on the hub deals with the data. Keyboard and mouse connect to the hub, rather than directly to the Pi.


And now it works flawlessly! So I just thought I’d mention it, in case anyone else is Googling for this problem.