English Amiga Board


Go Back   English Amiga Board > Support > support.Hardware > Hardware pics

 
 
Thread Tools
Old 30 October 2012, 11:13   #1
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
My Amiga PS/2 Mouse controller

For starters, I'd like to state that this is not entirely my own work, the base of the project was taken from here: http://atariamiga.free.fr/sourisps2_e.php who in turn took theirs from here: http://www.bneven.com/mouseps2.html


Okay, why did I look into starting this in the first place? well, my old amiga mice are crap now, aged to retirement, so I went on EBay and purchased a USB to Amiga mouse converter. Aparantly I never had any USB mice that were compatable, so I decided to make my own.

Since I have a large supply of Microsoft Opitcal Wheel Mice with that USB to PS/2 brick, I thought it would probably be easier to try and make a PS/2 interface, rather than trying to mess around with the vastly "Unique per mouse" USB protocals. I doubt anyone could make a truely universal USB mouse controller.

So off I went, starting reasearch on a PS2 mouse controller, and, found the above 2 mentioned sites, along with others, but this project seemed the most practical to me. As you can see, it utilises a PIC16F84, something I have used before.


Since the code I used was version 1.2, the version number of my first project is 1.3.

Mouse project 1.3
To create an interface for using a PS/2 Mouse on the Amiga. Also since the code existed, why not for the Atari ST too, even though I don't own one.

I started by simply building the 1.2 as defined in the project on a peice of strip board, no photos of this, sorry. Turns out that the original "Amiga/Atari Autodetect" circuit didn't work, so, I re-wrote the code to check pin A2 instead of B6, and added a switch between 5V and GND. Thats it.
my Tests on my Amiga showed that it seems to work fine, switching the switch causes the mouse to go all crazy, which would indicate it is in Atari mode.
Note: Switch needs to be set on powerup, it is not checked after the initial check.
the original v1.2 code also seems to include a 10 second startup delay, which made the device useless for entering the boot menu, a comparison to the original V1 software shows that this did not exist, so simply removing the delay results in win.

Here is everything you should need for project 1.3, including a photo of the end result.
Code header file
Code
Compiled file

Photo (its a big file, I won't kill your connection by forcing it to load here)
Note: if you file down the corner of the DB9F connector, it will fit in the mouse socket on the A600, and work fine.


Mouse Project 1.4
To intergrate a Joystick port onto the Mouse controller.

Research linked me to a Picture of a schematic diagram of a Joystick/Mouse Auto-switch, There's not much to say about it, just that it utilises a 74LS157 to switch between the 2 ports, and an 74LS00 to implement an RS latch to detect button presses and control the switch.

For my project, I did away with the 74LS00, intergrating the function into the PIC chip, therefore the Button 1 and Button 2 of the Joystick connect to Pins A3 and A4 on the PIC. I then monitor these lines during the wait delay in the mouse data transfer routine, switching to Joystick mode which simply changes the Logic state on pin B7, which connects to the 74LS157 control line. upon detecting a mouse press (any button) it then switchs back to Mouse mode.

NOTE: Since pins 6 and 9 of the Joystick port go through the PIC chip, they can no longer be used for a PotX and PotY function, only button2 and button3.

No photos, but here is the info.
Code header file (same as above)
Code
Compiled file



Mouse project 1.5
To put project 1.4 in an A1200

Not much changed from V1.4. Since it is inside an Amiga, it doesn't need to enter Atari mode, therefore I changed the function of pin A2 to be the middle mouse button on Joystick port in, even though its probably never used, and removed the check for an Atari. It's lazy, but works, and can easily be changed to use the Atari code if anyone wanted to.

Code header file (same as above)
Code
Compiled file

Photo of the back of my Amiga.
Photo inside the amiga with Shield
Photo inside the amiga without shield

As you can see, I cut away the side of the shield so it can comfortabbly stick out and still use the original mouse slot for the joystick port.

Last edited by bobingabout; 30 October 2012 at 11:57.
bobingabout is offline  
Old 30 October 2012, 11:41   #2
demolition
Unregistered User
demolition's Avatar
 
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 38
Posts: 3,736
Quote:
Originally Posted by bobingabout View Post
As you can see, I cut away the side of the shield so it can comfortabbly stick out and still use the original mouse slot for the joystick port.
Nice work and a very useful mod.

Why not use more of the space in the expansion port and put in a USB port as well? It would just be connected directly to the PS/2 port pins and would work with PS/2 capable mice. Just seems more elegant to be able to plug a USB mouse directly in the Amiga instead of having to use a USB-PS/2 adapter.
demolition is offline  
Old 30 October 2012, 11:52   #3
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Quote:
Originally Posted by demolition View Post
Nice work and a very useful mod.

Why not use more of the space in the expansion port and put in a USB port as well? It would just be connected directly to the PS/2 port pins and would work with PS/2 capable mice. Just seems more elegant to be able to plug a USB mouse directly in the Amiga instead of having to use a USB-PS/2 adapter.

Adding a USB port is quite possible, however, that would require actually havving a USB port to solder on there.
Also, as it is, it can also be mounted to nicely fill the width of the expansion bay, useful if it couldn't have been mounted in the existing mouse port's hole, which isn't possible on earlier A1200s.
and one more point, if I were to buy an Indivision, I still have enough room to mount the DVI port.

I'm not saying your argument is invalid, but, given these points, its probably best to just use the PS/2 USB adaptor that came with my mouse, since the controller is only compatable with PS/2 anyway.
bobingabout is offline  
Old 30 October 2012, 12:54   #4
demolition
Unregistered User
demolition's Avatar
 
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 38
Posts: 3,736
Quote:
Originally Posted by bobingabout View Post
and one more point, if I were to buy an Indivision, I still have enough room to mount the DVI port.

I'm not saying your argument is invalid, but, given these points, its probably best to just use the PS/2 USB adaptor that came with my mouse, since the controller is only compatable with PS/2 anyway.
Well, the Indivision argument is a very good one - I just always hated the PS/2 connector, and have broken pins in quite a lot of them..
demolition is offline  
Old 30 October 2012, 14:50   #5
cpiac64
Registered User
cpiac64's Avatar
 
Join Date: Apr 2010
Location: Italy
Posts: 887
i have tested first model v1.2 souris with a500 and a600 and work fine, but don't work on a1200, thanks for new versions
cpiac64 is offline  
Old 30 October 2012, 14:52   #6
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Quote:
Originally Posted by demolition View Post
I just always hated the PS/2 connector, and have broken pins in quite a lot of them..
Unfortunately, thats quite a common problem with any PS2 connector, the pins are all just that fragile...

Quote:
Originally Posted by cpiac64 View Post
i have tested first model v1.2 souris with a500 and a600 and work fine, but don't work on a1200, thanks for new versions
Because it didn't work with my A1200 either is why I started tinkering with it.

I'm going to build a few more of Project 1.3 and put them up on EBay at some point soon. If I get some interest in project 1.4 or 1.5, I could make some of those to request too.

the only reason why I'd make more to sell is because I had to buy quite a few PS/2 ports just to get hold of any in the first place, and same with PIC16F84s just so they didn't have a stupid high price per unit, so I have quite a few spare parts here. Also, I figure people would use them.

My PCB production availability is cheap and low quality single sided boards only, but I know most people don't even have access to that, if I were doing something truely commercial, I'd probably end up paying a proper PCB manufacturing company to make a batch.

Last edited by prowler; 30 October 2012 at 22:13. Reason: Back-to-back posts merged; please use multi-quote.
bobingabout is offline  
Old 30 October 2012, 21:40   #7
johnim
Amibay Mod/Staff

johnim's Avatar
 
Join Date: Jun 2010
Location: birmingham uk
Age: 42
Posts: 1,024
very nice work i have 2 of these

v2.1 made by mkl

http://www.students.tut.fi/~leinone3/ps2mhiiri627/
johnim is offline  
Old 31 October 2012, 13:07   #8
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Quote:
Originally Posted by johnim View Post
very nice work i have 2 of these
v2.1 made by mkl
http://www.students.tut.fi/~leinone3/ps2mhiiri627/
I did see this one when I was looking around, it was a little more difficult to build myself, which is why I chose the other project.
bobingabout is offline  
Old 31 October 2012, 13:31   #9
Methanoid
Retired Quartex Sysop
Methanoid's Avatar
 
Join Date: Sep 2001
Location: Roman Verulamium
Age: 52
Posts: 1,718
I like your design principles. I fully admit I am hopeless at electronics but it strikes me that the circuit could be a lot smaller (presumably if done on manufactured boards) - yours looks like a cut down (and I think better) version of the board sold on eBay at great cost (not currently but sold in Poland)

Are you going to offer yours for sale pre-assembled or was this a personal labour of love?
Methanoid is offline  
Old 31 October 2012, 15:44   #10
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Quote:
Originally Posted by Methanoid View Post
it strikes me that the circuit could be a lot smaller (presumably if done on manufactured boards)
If you're talking about the V1.5, the A1200 internal with joystick switch, then you are correct, the board could potentially be a lot smaller if it was manufactured by a modern machine, rather than hand etched on single sided board. Because of the chemical process I use, the tracks have to be fairly chunky to make sure they come out clean too, so the process I use does account for the size.


Quote:
Originally Posted by Methanoid View Post
Are you going to offer yours for sale pre-assembled or was this a personal labour of love?
I was going to build them then sell them. if you look at the V1.3(since you can see the underside), you can probably see that not only did I solder the board, but I then smoothed down all the solder joints to remove the sharp edges, then sprayed it with "Kontakt Chemie Plastik 70", an insulating coating that prevents corrosion.

Last edited by bobingabout; 31 October 2012 at 15:58.
bobingabout is offline  
Old 31 October 2012, 22:55   #11
Methanoid
Retired Quartex Sysop
Methanoid's Avatar
 
Join Date: Sep 2001
Location: Roman Verulamium
Age: 52
Posts: 1,718
Well, feel free to PM me if you decide to sell v1.5 and get some prices worked out. Looks great! My one suggestion for 1.6 would be to add USB connection (same signals as PS2) so you could use a MS Wheel Mouse without the green adapter. Additional cost would be pennies but so much tider. I do very much support your idea to leave space for Indivision connector too!
Methanoid is offline  
Old 04 November 2012, 01:36   #12
breech
Asking stupid questions
breech's Avatar
 
Join Date: Sep 2009
Location: Syd.Oz
Posts: 139
Great job but I think most of us are after a more future proof solution, and one that doesn't need an extra converter for USB. Ill buy a USB one for sure.

Is it possible to be able to adjust the X/Y polling so the mouse movement could be tweaked?
breech is offline  
Old 04 November 2012, 14:48   #13
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Quote:
Originally Posted by breech View Post
Great job but I think most of us are after a more future proof solution, and one that doesn't need an extra converter for USB. Ill buy a USB one for sure.

Is it possible to be able to adjust the X/Y polling so the mouse movement could be tweaked?
The problem with USB is that as it is, the mouse would need to be PS2 protocal compatable to work. if you want it to work with a USB mouse, you'd need to program in the USB protocol, which is often unique to each group of mice, meaning you'd need to program in dozons of protocols, or at the very least the protocal specific for a mouse you're going to use on it.

as for X/Y poling to change the mouse speed, this could possibly be done in the existing software by counting how many poles it has detected from the mouse, and only changing the Amiga pole state after it has reached a certain number.

So, changing the speed is possible, but would require reprogramming.
As there is currently no spare pins on the microcontroller, there would be no easy way to set it externally.
bobingabout is offline  
Old 30 November 2012, 12:50   #14
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Okay, I'm currently working on a new design for use with a real USB interface, however, for the moment, the "real USB" stuff isn't being worked on.

What I am working on instead is a new version of the code that should allow joystick port paralleling. In other words, you can connect the joystick to the same pins as the PIC chip mouse controller directly, without the need for the 74ls157 switch, or button pin passthrough. This has several advantages.
1. less components.
2. less PCB space.
3. no need to disconnect the existing 9pin D connector.
4. PotX and PotY should still work, since they're directly connected to the joystick port rather than being connected to the digital input pins of a PIC chip.

Point 3 isn't so much of an advantage for the Amiga 1200 with the easily removable headder, but it should allow it to work with ANY amiga, given enough modification, where the existing mouse port isn't so easily removable.


Also, specific to Breech's request: 3 jumper links(or switchs or whatever, since there's no PCB yet) to set a mouse speed divider. These have settings of 1, 2, 4, 8, 16, 32, 64 and 128. all jumpers open should be divide by 1, meaning no division at all, and therefore functioning as the original. but if you want to use your 1600dpi mouse on your amiga, set it to divide by 8, and it should be a fairly acceptable speed.

Note: To change the mouse speed requires a hardware reset of the PIC chip (unplug it and plug it back in again), the pins are currently read on startup, which calculates the divider. If requested, I could modify the code to include a software reset function, say... hold all 3 mouse buttons down or something?
bobingabout is offline  
Old 01 December 2012, 07:53   #15
breech
Asking stupid questions
breech's Avatar
 
Join Date: Sep 2009
Location: Syd.Oz
Posts: 139
Great news, looking forward to the final product.
breech is offline  
Old 15 December 2012, 05:57   #16
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 36
Posts: 2,566
This is a very nice mod. I really think you should file the part of the shield that you've cut though, that looks razor sharp.
Hewitson is offline  
Old 15 December 2012, 17:33   #17
bobingabout
Registered User
 
Join Date: Aug 2012
Location: England
Posts: 41
Quote:
Originally Posted by Hewitson View Post
This is a very nice mod. I really think you should file the part of the shield that you've cut though, that looks razor sharp.
Yes, I agree completely, Last time I went in there I shredded my thumb on it.

Anyway, I came here today to show you guys what i've been working on most recently.

warning: 1.24MB per file:
Photo of Mouse controler v1.7 Prototype, and 3 of USB Controller plug in module to the left.
Photo of the v1.7 prototype with a USBCON module plugged in.

Note: There are only sockets on this because it is a prototype. The final product will have the PIC soldered in, and either a USBCON board soldered in, or holes for the possibly to add one in the future.

On the rear you have a PS2 port wired to the PIC for PS2 mice. A USB port wired to the USBCON Module pins, with jumpers to also wire it to the PIC's pins for PS2. note: Don't have both the jumpers and USBCON module installed simultaniously. A reset button, and 3 "Piano key" DIL switchs for the mouse speed divider.

other things to note on the board are the Jumper links, already mentioned, the socket/holes for the USBCON board, already mentioned, and 2 10pin headders. These are connected in parallel to the PIC chip's B port, and serve as a Joystick in and Mouse out connector. They're both Identicle, doesn't matter which you connect to the Amiga, or to the DB9M connector on the Amiga.

As it stands, Software is up to version 1.7.2. There was a problem with v1.7 with the reset button not resetting the mouse, causing it to stop working basicly, because the PIC was expecting initialisation codes, while the mouse was already in Data streaming mode. I fixed this by making the PIC send a Reset code after several failed authentication codes, so, after a reset you'll need to wiggle the mouse for it to start working again.

It will not hoever auto-fix itself if you unplug the mouse while it is powered on, and either plug it back in or plug in another one, Since the PIC will be in the "I am receaving data" mode, the only exception to this is if you manage to unplug it mid-stream, where it will cause the start bit of a byte to be the wrong value when it tries to resume with the new mouse, causing it to send a reset code. which is actually more robust than what you have on the PC if you hotswap PS2 divices. So... if you unplug a PS2 mouse, reset the board.


I am currently in the process of learning how to interface with USB to add true USB mouse compatability. Even with a USB controller on there, it is more difficult than I originally imagined. Although I have the PIC talking to the MAX3421E on the USBCON board, I have yet to get the MAX3421E to actually talk to anything on the USB port.

The down side to this version is that it'll completely fill the expansion bay, meaning no Intravission compatability. however, as long as you either solder in the 10 pin headder on early amiga 1200s that don't have one, or remove the right angle one on those that do, and replace it with a stright one (which in this case would require a new DB9M connector for Joystick in), this will actually be compatable with ALL A1200 models.


One problem that I did run into is that while the PIC16F84a can and will pull down the PotX and PotY lines for right and middle mouse bottons, the new PIC16F883 I am using cannot. I noticed that it will eventually register a RMB press if you hold the button down for about 5 seconds. This apears to be caused by the fact that a 16F84 is TTL, where the 16F883 is CMOS, the main difference being that TTL can pass more current to discharge the Capacitor in the RC debouncing circuit in the Amiga, where CMOS cannot. A sugested solution, which would be an easy fix because it doesn't require any extra components would be to simply use more than 1 pin on the PIC chip for these 2 pins. Another possible solution would be to use an NPN transistor to pull it to ground instead, though that'd require a base resistor too, and I would have a difficult time finding the space to squeeze it in, so for now I've gone with the 3 pin aproach.


Thoughts?
bobingabout is offline  
Old 17 December 2012, 07:09   #18
Methanoid
Retired Quartex Sysop
Methanoid's Avatar
 
Join Date: Sep 2001
Location: Roman Verulamium
Age: 52
Posts: 1,718
Coming on nicely... nice pics too
Methanoid is offline  
Old 20 December 2012, 10:33   #19
cosmicfrog
The 1 who ribbits
cosmicfrog's Avatar
 
Join Date: Apr 2006
Location: leek, Staffs, UK
Age: 51
Posts: 3,555
Send a message via MSN to cosmicfrog
I went through my pile of salvaged laptop bits the other day and found out that most of the touch pads are ps2 nearly all the symptatic ones are and I even found a little trackball

so when its done and I can afford can you guess what I am thinking
cosmicfrog is offline  
Old 20 December 2012, 13:57   #20
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 793
Quote:
Originally Posted by bobingabout View Post
One problem that I did run into is that while the PIC16F84a can and will pull down the PotX and PotY lines for right and middle mouse bottons, the new PIC16F883 I am using cannot. I noticed that it will eventually register a RMB press if you hold the button down for about 5 seconds. This apears to be caused by the fact that a 16F84 is TTL, where the 16F883 is CMOS, the main difference being that TTL can pass more current to discharge the Capacitor in the RC debouncing circuit in the Amiga, where CMOS cannot. A sugested solution, which would be an easy fix because it doesn't require any extra components would be to simply use more than 1 pin on the PIC chip for these 2 pins. Another possible solution would be to use an NPN transistor to pull it to ground instead, though that'd require a base resistor too, and I would have a difficult time finding the space to squeeze it in, so for now I've gone with the 3 pin aproach.

Thoughts?
How about using a small FET.. that should do away with any resistors..
hooverphonique is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
can I play with amiga 32 controller old amiga 500 games? gjb1985 Amiga scene 17 13 December 2012 12:03
Can a Commodore mouse work as an Amiga mouse? Akira support.Hardware 6 11 August 2012 18:01
AMIGA MOUSE == Any 9 PIN Serial Mouse ????? megajetman support.Hardware 15 26 April 2012 13:51
Amiga mouse moonlighting as Myarc Mouse thinlega Nostalgia & memories 1 11 April 2008 13:53
Best analog controller for Amiga Bamiga2002 support.Hardware 6 24 June 2006 18:36

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:27.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.09108 seconds with 13 queries