Changes

PS2Mouse

3,952 bytes added, 20:39, 28 April 2016
/* Parts List */
The following project describes how to construct an AMX compatible PS/2 and USB Mouse adapter for the Amstrad CPC. I’ve never actually owned an [[AMX Mouse|AMX mouse]], in fact I’ve never even seen one other than in pictures. Back in the 80s I had no need for one, but with GUIs like [[FutureOS ]] and [[SymbOS ]] now available, I decided it was time to get my own…or own… or at least build an equivalent. Like other projects that I’ve shared in the community, I’ve tried to keep this project as simple as possible to construct and as cheap as possible to build, otherwise it scares people from trying to build it for themselves. That said, you will need to be proficient at soldering and possibly need to produce your own PCB, if you wish for want your end product to look like the one above. I have also supplied a single sided layout, to make it easier for those of us who like to produce our own PCBs. While designing the circuit, I realised that most modern mice have a scroll wheel which wasn’t available back then on the AMX. As the CPC has a few inputs spare on the port (Joy2), I decided to make them accessible by binding them to the Joy2 up and down signals. Although this isn’t strictly AMX compatible, I thought the people at [[SymbOS ]] or [[FutureOS]], might like to take advantage of them, so consider this adapter is AMX+ compatible. However, due to the joystick ports being split on the CPC Plus series, the scroll wheel feature will only work on standard CPCs unless you create a jumper lead to recombine the two ports again on the Plus.
== Warning / Disclaimer ==
Although I have taken the utmost care preparing this documentation, I do not guarantee that it is error free and I accept no responsibility for damage to anyone’s CPC, Mouse or other personal equipment or injury inflicted on you or others.
 
== The Circuit ==
{|{{Prettytable|width: 700px; font-size: 2em;}}
|''Component''||''Quantity''||''Price''||''Total''
|-
|PIC16F84A-04P||1||2.40€||2.40€
|-
|4 MHz Ceramic Resonator||1||0.10€||0.10€
|-
|74LS240||1||0.27€||0.27€
|-
|2N3904||2||0.04€||0.08€
|-
|100µf 16V Electrolytic Capacitor||1||0.04€||0.04€
|-
|100nf Ceramic Capacitor||1||0.03€||0.03€
|-
|10K 1/4W ¼W Resistor||3||0.05€||0.15€4
|-
|4K7 1/4W ¼W Resistor||3||0.05€||0.15€
|-
|470ohm 1/4W 470Ω ¼W Resistor||1||0.05€||0.05€
|-
|3mm LED Green||1||0.07€||0.07€
|-
|18 Pole IC Socket||1||0.04€||0.04€
|-
|20 Pole IC Socket||1||0.04€||0.04€
|-
|9 Pole D-Sub Connector 90°||1||0.24€||0.24€
|-
|6 Pole Mini DIN Socket||1||0.53€||0.53€
|-
|2 Pole DIP Switch||1||0.23€||0.23€
|-
|5V Power Socket||1||0.12€||0.12€
|-
|5V Power Plug||1||0.58€||0.58€
|-
|160x100x1160×100×1.5mm 35µ Single Sided photo-resist PCB||1||1.70€||1.70€|-|||||||6.82€
|-
|}
 
[https://secure.reichelt.de/?;ACTION=20;LA=5011;AWKID=241782;PROVID=2084 Shopping cart with all parts for Reichelt Elektronik (Germany)]
== The Firmware ==
The board presented here measures just 38mm x 60mm and should cause absolutely no stress to the CPCs connector. As well as that, remember that there are connectors left and right of the joystick port that you might want to use simultaneously, the layout here has been designed to keep both the sound socket and tape port free.
A note to beginners: When soldering the parts to the board, always solder the most heat resistant parts first and leave the sensitive ones to last, this avoids destroying a successfully soldered transistor while trying to solder a resistor that’s right beside it. Also, although you may notice that I have soldered the 74LS240 into place, I wouldn’t advise beginners to try this, you will destroy it. Splash out on the extra 4 cents it costs for a suitable socket. If you’re an absolute beginner, there are even sockets available for transistors, but the spacing on this layout probably isn’t correct for them. Also remember that there are wire bridges under each of the ICs! These are really difficult to assemble, if the socket or IC is already soldered into place!
The 9 way Sub-D connector usually has two small bolts protruding left and right of the connector, if you remove these, the metal surround will fall off. I used some superglue to re-attach the metal part. It will work without the metal surround, but this will cause the circuit to bend the CPCs joystick pins over time, so I would recommend you do the same. I also added two M3 screws to hold the Sub-D connector to the PCB, this takes the stress off the pins below the connector, which could otherwise develop cracks in the solder over time as well.
If you intend only using USB mice with the device, it may make more sense to use a USB socket instead of the PS/2 socket plus adapter. I may add the have now added a pure USB version layout for below, the finished device looks like this at a later stage if requested.:
 [[Image:USBMouse.jpg|360px|center]]  The USB version has just one jumper to enable / disable the scroll wheel, the Auto-detect is always active. == Using The Mouse Adapter ==
There are two switches on the PCB, the inner one (beside the power socket), should in most cases be left in the OFF position. This is the Auto-detect position. The firmware will auto-detect which type of mouse is connected and initialise it as required, if however you have a mouse which is not being recognised correctly (Error lamp flashes or incorrect output), switching this switch ON will tell the PIC not to auto-detect and to assume a type 00 mouse (standard mouse with no scroll wheel or extra buttons) and may allow you to continue using the mouse. The position of this switch should be chosen before power is applied. In some cases, although you have chosen auto-detect, the PIC may recognise that the mouse is incompatible and dis-enable the scroll wheel although one is present, the mouse should however continue to work as a non-scroll wheel mouse.
The second switch is for turning the scroll wheel signals on and off. Switching this switch ON allows the PIC to pass the scroll wheel movements on to the CPC. If a correctly recognised scroll wheel mouse is connected and this switch in ON, movement to the scroll-wheel will cause a “5” (Joy2 UPDown) for each roll upwards and a “6” (Joy2 DOWNUp) for each scroll downwards, this may have negative effects with software which has assigned these characters to other functions, so for this reason I chose to include the option to block it. This switch can be used at any time without resetting.
The 5V power lead that usually goes to the CPC should be connected directly to the Adapter PCB, the fly-lead is then plugged into the CPC. When the power is applied, the PIC will try to recognise and initialise the mouse. If recognition and initialisation is successful, the LED will blink once for approximately one second. After this any movement of the mouse will make the LED blink. If the mouse fails to initialise (there may be incompatible ones out there or it may just be broken) the LED will flash continuously in one second intervals.
 
== Mapping to Joystick Signals ==
 
Row9.Bit0 Joy1up LOW when mouse moved up
Row9.Bit1 Joy1down LOW when mouse moved down
Row9.Bit2 Joy1left LOW when mouse moved left
Row9.Bit3 Joy1right LOW when mouse moved right
Row9.Bit5 Joy1fire1 LOW when Right mouse button pressed
Row9.Bit4 Joy1fire2 LOW when Left mouse button pressed
Row9.Bit6 Joy1fire3 LOW when Middle mouse button pressed
Row6.Bit0 Joy2up LOW when mouse wheel turned towards user (standard CPC only)
Row6.Bit1 Joy2down LOW when mouse wheel turned towards screen (standard CPC only)
== Testing The Mouse ==
[[Image:PS2Mouse_PS2.png|360px|centre]]
 
== Compatibility ==
[[File:PS2Mouse_Layout.pdf]] - PCB Track Layoutfor PS/2 version with option switches
[[File:PS2Mouse_Components.pdf]] - PCB Component Layout
 
[[File:USBMouse_Layout.pdf]] - PCB Track Layout for USB version
[[File:CPC_PS2_Mouse_V10.HEX]] - Firmware V1.0
 
[[File:CPC_PS2_Mouse_V1.01.hex]] - Firmware V1.01 (Use this version for single DIP switch version)
[[File:JDM_16F84.pdf]] - PCB Track Layout for the PIC Programmer
 
== Wireless Internal Version ==
 
Using the exact same circuit as above, I decided to create an internal wireless mouse for my 6128. The wireless PS/2 mouse receiver I've used is a Logitech C-RA1 seen here in it's original state, which can often be found for a reasonable price at your local flea-market or on your favourite online auction site, but any wireless PS/2 mouse and receiver should work.
 
 
[[Image:originallogi.jpg|360px|centre]]
 
 
The circuit remains the same, except for the fact that I didn't solder any sockets on to the PCB, but added fly-leads for the power, LED, PS/2 and Joystick port connections. I used flat cable for the joystick port connects, so that it can easily be routed below the CPCs mainboard. After removing the receiver circuit board from it's housing and removing the PS/2 lead, I connected the PS/2 wires directly from the receiver board to the adapter PCB and mounted the adapter PCB inverted on top of the receiver.
 
 
[[Image:InternalMouse1.jpg|360px|centre]]
 
 
Unfortunately this particular model of wireless mouse has a relatively large receiver board, due to the receiver also having been used for the Logitech wireless mouse and keyboard combo. Despite this, there's room inside the 6128 to house everything, but you may notice I needed to relocate the earth strap from the mainboard to the drive bracket in order to make space. Alternative receivers might fit better however. The flat cable is routed below the mainboard and soldered directly to the contacts below the joystick port socket.
 
 
[[Image:InternalMouse2.jpg|360px|centre]]
 
 
At the rear of the CPC I added a power switch for when I don't intend using the mouse. I took the required 5V from the lead going to the disc drive. Any of the two black wires is ground, the orange wire is 5V. To avoid drilling even more holes in the original housing, I used a 3mm LED filed down a little and wedged it between the cooling grill at the top edge. Then all that was left to do was put everything back together and my 6128 was fitted out with a wireless AMX compatible mouse.
 
 
[[Image:InternalMouse3.jpg|360px|centre]]
 
 
== Compatible Software ==
 
 
All software, that supports the original AMX mouse is compatible with this device, these include:
 
 
[[The_Advanced_OCP_Art_Studio|The Advanced OCP Art Studio]]
 
[[AMX_Art|AMX Art]]
 
[[SymbOS]]
 
[[FutureOS]]
 
== Further Info ==
Version 1.0 of the Firmware is here. This version adds Plug & Play functionality, auto-detection for the type of mouse and includes some slight tuning to improve the mouse reaction time. The schematic and layout have not been changed.
 
Update: A minor change to the Schematic has been made to add a 10K pull-up resistor to the OE inputs of the 74LS240. This addition should make the circuit more robust in the very unlikely event of the adapter being used in conjunction with other hardware attached to the Mouse port either internally or externally. Should you already have built the adapter, there's is no need to add this extra component unless you are experiencing problems with the reliability of the adapter. The layout and component placement files have been updated to reflect this change.
If you have any further questions regarding this project, please contact me through the Wiki Forum.
Bryce.
 
[[Category:Input Device]] [[Category:Peripherals]] [[Category:DIY]]
897
edits