PS/2 keyboard & mouse to Archimedes adapter MK II

Arc/RPCs, peripherals, RISCOS operating system & ARM kit eg GP2x, BeagleBoard
Post Reply
User avatar
IanB
Posts: 376
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

PS/2 keyboard & mouse to Archimedes adapter MK II

Post by IanB » Sun Mar 15, 2015 8:04 pm

A couple of years ago I posted about a PS/2 mouse and keyboard to Archimedes/A5000 adapter I'd designed using a PIC microcontroller although I didn't include any construction details.

Recently I needed to build a couple more of them and I noticed a PIC project board on ebay which would make an ideal platform for the adapter so I converted it to that board and here are the instructions on how to build one:
(This adapter is not suitable for the Risc PC but I am working on a quadrature mouse adapter for the BBC micro using the same board and that would also work on a Risc PC)

First get the following from ebay:
1. PIC board:
I actually used this incomplete one as I already had the PICs and 20Mhz crystals:
http://www.ebay.co.uk/itm/Microchip-Pic ... 1808854225
This one has the PIC and crystal fitted although it also has headers fitted to the pads:
http://www.ebay.co.uk/itm/Microchip-PIC ... 1875969279

2. PS/2 extension cables (You need 2) e.g:
http://www.ebay.co.uk/itm/1-8m-6ft-PS-2 ... 0181396341
(This is not the lead I used so cable colours in the photos will almost certainly be different to the above)

3. Case:
http://www.ebay.co.uk/itm/PLASTIC-BOX-E ... 0893383579

Construction:
1. First the board needs some slight modification.
Remove the 5V regulator U2 and Diode D1 and fit a wire link between the holes of the two removed components closest to the edge connector (See photos for detail)
After this change, the pad marked 12v will now be connected to 5v instead.
This means there will be 3 pads connected to 0v (GND) and 3 pads connected to 5v so all cables can be connected without sharing pads.

2. Connect jumper wires between the following pads:
A2 and B1
B2 and B6

3. Cut the cables in half, discard one of the ends with a PS/2 plug and trim the remaining 3 half cables to length.
I used approx 75cm for the plug cable and 25cm for the two socket cables.
Remove about 4-5cm of the outer insulation from the cables to reveal the wires and work out which colour goes to which pin.

4.On the Archimedes plug cable:
Pin 4 to pad 2 of the ICSP header (+5v)
Pin 3 to pad 3 of the ICSP header (0v)
Pin 5 to pad A3 (Arc serial in)
Pin 1 to pad A4 (Arc reset)
Pin 6 to pad B7 (Arc serial out)

cut off the unused wires

If you intend to use the adapter with an early A3x0 or A4x0 machine then you might want to connect the pin 4 cable above to pad 2 via a small 2 Amp fuse. (These early machines didn't have a fuse in the keyboard power line and a short circuit would melt the cable!) Later A4x0/1 machines and subsequent designs had a fuse.

5. On the mouse socket cable:
Pin 4 to pad +12v (actually +5v after mod above)
Pin 3 to pad GND (next to B7)
Pin 1 to pad B0 (Mouse data)
Pin 5 to pad B5 (Mouse clock)

cut off the unused wires

6. On the keyboard socket cable:
Pin 4 to pad +5v
Pin 3 to pad GND (next to +5v)
Pin 1 to pad B3 (Keyboard Data)
Pin 5 to pad B4 (Keyboard Clock)

again cut off the unused wires

Testing:
First thing to do is to check for any short circuit between 0v and 5v (pins 5 and 14 of the PIC socket)
Then plug the board into the Archimedes without the PIC fitted and check for 0v on Pin 5 and +5v on pin 14 of the PIC socket.
If these tests go OK, fit a PIC16F628A programmed with the attached code below, connect your PS/2 keyboard and mouse or KVM and power up the Archimedes and see if the keyboard and mouse work.

If you have problems, first check that you haven't swapped the keyboard and mouse connectors.
Then check your wiring matches the attached diagram.
Two of the unused pads can be used to diagnose any protocol problems:
Normally A0 and A1 are at 0v but if a protocol error occurs, they will go to +5v so you could connect leds and resistors to indicate this.
A0 at +5v means a PS/2 keyboard error
A1 at +5v means a PS/2 mouse error
both A0 and A1 at +5v means an Archimedes error

If it tests OK you can fit it in the case:
First cut 3 slots in the case to pass the cables. These should be slightly less than the diameter of the cable so that the lid grips them when fitted. I also used cable ties to prevent the cables from being pulled out. If the cables are too loose, use hot melt glue to secure them.

Usage:
You need a 3 button PS/2 mouse or two button with scroll wheel to act as the third button.
The PS/2 keyboard is quite different from a standard Archimedes keyboard so it operates in 3 different modes depending on usage.

1. "Normal" mode
In this mode all keys on a normal UK PS/2 keyboard produce the correct characters on the Archimedes when pressed. This is achieved using special translation code that changes the actual key or shifted key you press into the one required for an Archimedes keyboard

2. "Game" mode
No translation is done in this mode and the physical position of the key gives the same result as an Archimedes keyboard. Among other things, this means that caps lock and ctrl are swapped.

3. "Partial" mode
Some keys are moved to their translated position such as caps lock and ctrl but none of the special shifted/unshifed translation is done.

To switch between these modes, press either of the two special "windows" keys and "N", "G" or "P" as appropriate.
To force a hardware reset, press either of the windows keys and the BREAK key
If your PS/2 keyboard doesn't have windows keys, hold down the right ALT and CTRL keys instead.
If you fit a jumper to the "reset" header on the board, the converter will startup in game mode instead of normal mode.

PIC programming
You have to program a PIC16F628A with the attached code.
If you don't have a PIC programmer there are some really cheap programmers on ebay for around £5 to £7
I wouldn't recommend them if you intend to do any serious work with PICs but they are just about adequate for doing occasional programming.
e.g.
http://www.ebay.co.uk/itm/USB-PIC-Autom ... 1320977878
The software for it is here: http://buyhere22.com/components/k150/
You may need to replace/reprogram the PIC16F628A on the programmer itself with the hex version included in the software to get it fully functional.
Attachments
1-Closeup.jpg
2-Case.jpg
3-Finished.jpg
PIC16F628A PS2 Circuit MK II.png
ARC2PS2-v0-16.zip
(158.43 KiB) Downloaded 155 times

sirbod
Posts: 980
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by sirbod » Mon Mar 16, 2015 11:15 am

That's really useful. I don't suppose you fancy making them to order for a premium as not many people either have the time/skills or PIC programmer required.

I need four :wink:

Prime
Posts: 2717
Joined: Sun May 31, 2009 11:52 pm
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by Prime » Mon Mar 16, 2015 11:28 am

Any chance of posting the source code as well as the hex file, would make it easier to port to other micros.

Cheers.

Phill.

jmellidg
Posts: 2
Joined: Thu Jan 07, 2016 2:45 pm
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by jmellidg » Tue Feb 16, 2016 11:00 am

Hi, thank you very much for the post, Works great!! Greatings from Spain

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 8:19 am
Location: FRANCE

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by Zarchos » Tue Feb 16, 2016 11:21 am

If sbdy had the time and the will to build and sell some, I'd be interested to buy in buying a dozen, depending on the price.
Last edited by Zarchos on Tue Feb 16, 2016 2:03 pm, edited 1 time in total.

JonC
Posts: 722
Joined: Wed May 14, 2014 9:19 pm
Location: Wakefield
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by JonC » Tue Feb 16, 2016 1:22 pm

Zarchos wrote:If sbdy had the time and the will to build and sell some, I'd be interested to buy a dozen, depending on the price.
It cost me about £26 for two (not including the PIC Programmer), and that's unassembled. That should give a rough idea of the cost.

I recon the hardest part of the assembly will be figuring out which wire colours are connected to which pins on the cable. :lol:
Jon
Image

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 8:19 am
Location: FRANCE

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by Zarchos » Tue Feb 16, 2016 2:10 pm

Prime wrote:Any chance of posting the source code as well as the hex file, would make it easier to port to other micros.

Cheers.

Phill.
Seconded, having some knowledge of how a PIC works is on my 'to do before dying' list ;-)

I think it would be great to tell Charlie about this project : it could be available on his Qube RISC OS projects page.

User avatar
IanB
Posts: 376
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by IanB » Sun Feb 21, 2016 7:11 pm

Prime wrote:Any chance of posting the source code as well as the hex file, would make it easier to port to other micros.
Zarchos wrote:Seconded, having some knowledge of how a PIC works is on my 'to do before dying' list ;-)
It seems to be pretty stable now so here's the source:
Source-arc2ps2v0-16.zip
(9.2 KiB) Downloaded 155 times

User avatar
1024MAK
Posts: 8762
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by 1024MAK » Mon Feb 22, 2016 7:59 am

8) =D>

Thanks :D

Mark

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 8:19 am
Location: FRANCE

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by Zarchos » Mon Feb 22, 2016 8:35 am

IanB wrote:
Prime wrote:Any chance of posting the source code as well as the hex file, would make it easier to port to other micros.
Zarchos wrote:Seconded, having some knowledge of how a PIC works is on my 'to do before dying' list ;-)
It seems to be pretty stable now so here's the source:
Source-arc2ps2v0-16.zip
Seconded !

Thanks a lot, something else to learn it's really great.

olivierb
Posts: 1
Joined: Sun May 01, 2016 7:17 pm
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by olivierb » Tue May 10, 2016 1:57 pm

Hello,

I just wanted to thank you for sharing your design. Las week, I built the adapter and I was able to revive my A4000.

Cheers,

User avatar
paulv
Posts: 3854
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by paulv » Thu May 19, 2016 8:16 am

Just a cautionary note, the PIC programmers based on the Prolific 2303HX or 2303HXA are not supported on Windows 8.1 or 10...

Paul

User avatar
vectorlight
Posts: 189
Joined: Sun Apr 10, 2016 12:23 pm
Location: UK
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by vectorlight » Fri Apr 28, 2017 5:50 am

I'd like to give this a go as CJE have lost all their stock of keyboard/ps2 adaptors :oops: , but the main board on ebay has sold out. Any idea where to get an alternative from?
3D Printing and Acorn A3010 Owner!

User avatar
vectorlight
Posts: 189
Joined: Sun Apr 10, 2016 12:23 pm
Location: UK
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by vectorlight » Fri Apr 28, 2017 9:49 am

Ignore my request, I asked the ebay seller and he has relisted them for me :D
3D Printing and Acorn A3010 Owner!

User avatar
vectorlight
Posts: 189
Joined: Sun Apr 10, 2016 12:23 pm
Location: UK
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by vectorlight » Thu May 18, 2017 1:41 pm

Can anyone recommend a cheap but reliable PIC programmer? I grabbed this from ebay only for it to refuse to work correctly. (It'll be going back to the seller). Something that works on Win 10 would be perfect :D :

http://www.ebay.co.uk/itm/232306834954? ... EBIDX%3AIT
3D Printing and Acorn A3010 Owner!

User avatar
1024MAK
Posts: 8762
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by 1024MAK » Thu May 18, 2017 6:30 pm

I use the PICkit 2, an earlier version of the current PICkit 3 available direct from Microchip https://www.microchipdirect.com/Product ... s=PG164130.

The modern PIC microcontroller chips can be programmed in circuit if there is a programming header. If not, it's not hard to solder the required connector, and a turned pin DIL socket to some stripboard or matrix board.

Mark

User avatar
vectorlight
Posts: 189
Joined: Sun Apr 10, 2016 12:23 pm
Location: UK
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by vectorlight » Thu May 18, 2017 7:03 pm

Thanks Mark :D

I've just realised that my regular eprom programmer can also do PIC, something I never new, so will try that now. :D
3D Printing and Acorn A3010 Owner!

aotta
Posts: 161
Joined: Fri May 26, 2017 8:57 am
Location: Italy
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by aotta » Fri May 26, 2017 10:20 am

Very interesting DIY! i ordered weeks ago the hw needed, spent yesterday night to follow your tutorial and, at dawn time, ready to test my works....
But... A3000 has 9 pin minidin connector? :shock: :roll:
Before wiring all 9 wires from alternative mouse point at lk4 to the unused serial port D9 socket... i wonder it this project will work for my Archi (i mean, only as ps2 mice adaptor..).... anyone tested it with a 30x0 ones?

User avatar
danielj
Posts: 7235
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by danielj » Fri May 26, 2017 11:11 am

This isn't for the A3000/A30x0 machines, it's for the archimedes/A5000 :(
There are a few options for the A3000/A30x0/A4000/RiscPC for mice? Many PS/2 mice can be fitted to an archimedes... This one, for example:

https://www.ballicom.co.uk/-ms-04-ps2-.p886897.html

It does need some surgery though:
viewtopic.php?t=6869

RS components sell a ready-wired 9-pin minidin lead (bit pricey in itself at around £8 or so, but you can build a mouse for about £10-£12)

d.

aotta
Posts: 161
Joined: Fri May 26, 2017 8:57 am
Location: Italy
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by aotta » Fri May 26, 2017 2:11 pm

Thank you.. maybe one day i will get an A5000... for testing this adaptor! :)

In the meanwhile... i'll start modding my ps2 mice as suggested in the post you reported.

aotta
Posts: 161
Joined: Fri May 26, 2017 8:57 am
Location: Italy
Contact:

Re: PS/2 keyboard & mouse to Archimedes adapter MK II

Post by aotta » Tue Jun 06, 2017 7:59 am

If someone interested.... I used the board bought for this adapter, to make.... a USB to Mini DIN 9 (Archie's one) adapter for my A3000!
Very simple after all.... i follow one of the tutorials for the Amiga adapter (i found on the net the tutorial by Henryk Richter.. it works fine for me), but soldered the mini din cable following the A3000 pinout... ;)

update (13/6/2017): for using Amiga mouse too (and the usb & ps/2 adaptor for Amiga i have) i added also a DB9 port near the original mini Din 9, and used the Amiga pinout in wiring to the alternative mouse points on A3000 pcb... this is the results! :)
Attachments
DB9 port added.jpg
Alternative Mouse wiring.jpg

Post Reply