QL Keyboard to PS/2

Nagging hardware related question? Post here!
Maskenlos
Over Heated PSU
Posts: 138
Joined: Sat Nov 03, 2018 12:14 pm

QL Keyboard to PS/2

Post by Maskenlos »

Hi all,

just want to share with you my latest small project. Its a Keyboard converter to attach the QL matrix keyboard to a PS/2 device, in my case to a Qzero.
QL2PS2.jpg
It is based on an Atmega 328P. What has been achieved:

- Support all keys of QL Keyboard (of course, this was the aim)
- Support all key combinations together with ALT, Shift and CTRL, like CTRL + C and ALT + Q (e.g. to Hotkey QD). This was a question here: viewtopic.php?f=2&t=4012
- Supports two keys together e.g. A+B and also together with CTRL, ALT and Shift.
- UK and Ger QL keyboard layout
- Capslock LED

Ignore the bad soldering of the SMD components, its manual soldered. Ribbon cable can be directly replaced with proper keyboard membrane connectors.

I would really appreciate any comment, also any comment which special key combination should be tested or implemented to improve the use case.

Great thanks to Peter for designing the layout.

Cheers,

Stephan


User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: QL Keyboard to PS/2

Post by Peter »

Fantastic! Good to hear you got so much working already. :D

I have heard that someone built a Q68 into a QL case, and then used a QL matrix to USB converter plus a USB to PS/2 converter. Your project makes that so much easier and nicer.

And you are welcome for the litlle PCB design, that effort was very small compared to your software development for the AVR. It's simply nicer than a breadboard and PCBs don't cost that much these days. Please do with it whatever you want, it is freeware from my side.

Can you give us a few words on the development environment you are using?

Which AVR pin are you using for the Capslock LED? Probably PB5 like the Arduino Nano?

On my new QL baseboard I have connected PB5 of the AVR to the QL's yellow power LED. Currently dimensioned for about 16 to 18 mA, can the AVR drive that?


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: QL Keyboard to PS/2

Post by tofro »

Maskenlos wrote: I would really appreciate any comment, also any comment which special key combination should be tested or implemented to improve the use case.
Great achievement - I was once tinkering with a similar device, but was losing interest and dropped it for lack of time.

The QL keyboard is (in typical Sinclair fashion) relatively dumb and can only detect a limited amount of key combinations properly (max. two "normal" keys pressed at the same time). The Shift, Ctrl and Alt keys are handled separately with diodes to be able to detect all three in conjunction with "normal" keys.

It looks like you've covered your bases if your device can do the same thing (2 "normal" keys combined with the modifier keys).

Just one caveat (and first a question): Does your interface generate "enhanced PS/2 scancodes" for combinations of keys pressed (like "PgUp" for <Shift>+<CursorUp>)?. If yes (and I wouldn't really recommend that because it would unnecessarily complicate things), you should be aware that early PC keyboard interfaces for the QL couldn't really decide on the proper mapping to these keys - some generated "<Shift><CursorUp>, some <Alt><CursorUp> - If not, you should be fine.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Ruptor
Gold Card
Posts: 418
Joined: Fri Dec 20, 2019 2:23 pm
Location: London

Re: QL Keyboard to PS/2

Post by Ruptor »

Maskenlos wrote:I would really appreciate any comment, also any comment which special key combination should be tested or implemented to improve the use case.
Nice job. A thought that is a bit late given you already have a PCB. If the ribbon holes lined up with the connectors on the QL you could use long pins and plug the board directly in to the QL eliminating the ribbon completely. I think there is plenty of room from the QL onboard connectors and the front of the QL case.


User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: QL Keyboard to PS/2

Post by Peter »

Ruptor wrote:A thought that is a bit late given you already have a PCB.
I have no problem to do some small changes to the PCB.
Ruptor wrote:If the ribbon holes lined up with the connectors on the QL you could use long pins and plug the board directly in to the QL eliminating the ribbon completely.
I do not understand what you mean. If the ribbon cable is removed, and connectors soldered instead, the QL matrix keyboard can directly plug in.
(This circuit does not connect to the QL mainboard but the QL matrix keyboard...)


User avatar
Ruptor
Gold Card
Posts: 418
Joined: Fri Dec 20, 2019 2:23 pm
Location: London

Re: QL Keyboard to PS/2

Post by Ruptor »

Peter wrote:I do not understand what you mean. If the ribbon cable is removed, and connectors soldered instead, the QL matrix keyboard can directly plug in.
(This circuit does not connect to the QL mainboard but the QL matrix keyboard...)
Sorry it is me that doesn't understand. Why would anybody want to connect a QL keyboard to something else? I can understand a QL main board matrix keyboard replaced by a PS/2 keyboard or USB Keyboard. Your board looks like it could do just that and solve the membrane problem and key debounce timing too.


Maskenlos
Over Heated PSU
Posts: 138
Joined: Sat Nov 03, 2018 12:14 pm

Re: QL Keyboard to PS/2

Post by Maskenlos »

One use case could be to build a Qzero or a Q68 into a QL housing.

What you mean has already been done some time before:

viewtopic.php?f=2&t=4012

Thanks to all for your comments, I will answer in more details later this evening.

Stephan


User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: QL Keyboard to PS/2

Post by Peter »

Ruptor wrote:Why would anybody want to connect a QL keyboard to something else?
Probably to make use of the QL case for modernized hardware. The QL case is a wonderful piece of industrial design, and a slight majority in a poll on this forum voted for it to be the target of major QL hardware developments. The QL keyboard is not very good, so I don't fully understand this either.
Ruptor wrote:I can understand a QL main board matrix keyboard replaced by a PS/2 keyboard or USB Keyboard. Your board looks like it could do just that and solve the membrane problem and key debounce timing too.
On the other hand, why would someone use the QL mainboard, if not with the QL case and keyboard? Would you place the QL mainboard into a different case and attach a PS/2 keyboard? Or even keep the QL case, detach the matrix keyboard and place a PS/2 keyboard beside it?

Either way, it is quite a technical challenge, and I'm prtetty impressed by Stephan's achievements. ;)


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL Keyboard to PS/2

Post by NormanDunbar »

Peter wrote:Currently dimensioned for about 16 to 18 mA, can the AVR drive that?
Hi Peter,

the ATmega328P has the following power limits:

* Per pin, 40 mA maximum, 20 mA typical and advised, but note port and board limits.
* Per individual port (PORTB, PORTC & PORTD) the limit is 100 mA each, maximum, but note board limits.
* Per ATmega328P in total (all pins/ports together) the limit is 200 mA maximum.

All of the above are source or sink -- the ATmega328P is symmetrical in this respect.

HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL Keyboard to PS/2

Post by NormanDunbar »

I was wondering, sort of, if it's necessary to run the ATmega328P at, I presume, 16 MHz? If you could run it at 8 MHz, then you can do away with the external oscillator thingy (or a crystal and 2 capacitors) and gain two extra GPIO pins -- Arduino doesn't use them given it's hard wirded at 16 MHz, but PB6 and PB7 would then be available for "other things" if necessary.

I "designed" a NormDuino some time back to run at 8 MHz, and still be able to be programmed with the Arduino IDE, details at http://qdosmsq.dunbar-it.co.uk/blog/201 ... readboard/ if anyone is interested. I have a couple running on breadboards for various tinkering "projects", but nothing special.

Oh, and by the way, the Arduino standard fuses are, I think, wrongly set for the Brown Out Detector! When running at 16 MHz, the lowest power advised in the data sheet is between 4.0V and 5.5V. The default BODLEVE2:0 fuses are set to reset at 2.7V which is way below minimum spec for 16 Mz. I think it needs to be set to 4.3V which is the next BOD setting up.

Default BODLEVEL2:0 are 101 for 2.7V. They should be 100 for 4.3V.

Just a thought.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply