Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:24 27 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PZ Control - my quest for the perfect game controller

     Page 1 of 2    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 01:54pm 11 Dec 2023
Copy link to clipboard 
Print this post

At the risk of boring you all to tears this my latest idea.

First the failures:
No case. The idea is to put another (full size, not notched) board or plastic underneath it. It looks a bit gross!
No standard connector. There isn't one for I2C.
This isn't really what would like (because there's no case).
It's not directly supported in MMBasic, but it doesn't need to be as I2C is easy enough.
Probably limited to two controllers at 400kHz. Probably more at 100kHz, with a maximum of 8 on one I2C port.

Then what I see as advantages:
I2C - will work on anything.
The I2C address cam be easily changed so you can have up to four controllers on two pins.
Easily re-programmable in MMBasic, C, Python etc.
Can be used in both analogue and digital modes
There are effectively 15 digital controls or 11 digital + 2 analogue directions,
Not tied to any particular connector
Reasonably cheap to build.





The slot in the top accepts a RP2040-Zero fitted from the bottom of the board. The two shoulder buttons are fitted underneath the board, the gap between the board and the back

The yoystick can be either the module often seen as part of the sensor kits or the bare joystick module itself, easily found on ebay and AW.

Overall size is approx. 120x55mm.

The intention is to use 1/2 of a 2m RJ14 modem lead for each controller. However, the important thig is to have I2C, 3V3 (or 5V) and GND. This works out on the PicoGAME D9M connectors as well. It's just a case of fitting a D9F plug and running the right software.

Despite the odd shape, the pcbs are only about £5.50 + postage etc. for five from JLCPCB.


EDIT:
Incidentally, the pins used for the I2C interface (GP8 - SDA and GP9 - SCL) are also COM2 TX and RX so there's a little flexibility included there.)

.
Edited 2023-12-12 00:51 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 04:52pm 12 Dec 2023
Copy link to clipboard 
Print this post

Awaiting this controller but does it use i2c as is? dunno but cheap

 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 04:59pm 12 Dec 2023
Copy link to clipboard 
Print this post

From the photo I suspect it's just components wired to pins with no electronics. I wondr if it plugs on top of a UNO?
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 06:11pm 12 Dec 2023
Copy link to clipboard 
Print this post

https://thepihut.com/products/adafruit-mini-i2c-gamepad-with-seesaw-stemma-qt-qwiic?
i2c is neat for a controller imho. £7 , is it worth the bother to make one?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 06:38pm 12 Dec 2023
Copy link to clipboard 
Print this post

Depends on what you want.
A modified SNES controller has four more switches and a proper case.
The PZ Control has no case, but has a better analogue thumbstick with a switch.
The cost of either option is probably about the same if you get the bits from AE or ebay.

I've just ordered a pair of USB SNES controllers for their cases from ebay. Less than £7 for the pair.
Edited 2023-12-13 04:40 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 06:58pm 12 Dec 2023
Copy link to clipboard 
Print this post

Years since we had a snes, bought for the kids, honest. I forgot if it got 4 buttons at the front.
snes controller using i2c would be neat, good luck.
starfox was my fav but emulator no way pico.
Could a usb to ttl converter as used for programming be used for usb joypad?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 08:28pm 12 Dec 2023
Copy link to clipboard 
Print this post

The current problem is that MMB4W has no joystick or controller support. AFAIK there's no way for it to read a USB input. That's why I'm looking at something that appears to be a second USB keyboard, but only has certain keys. MMB4W will think someone is using the keyboard, which it does know about.

I2C is, IMHO, a great way to do controllers and it's something else I'm looking at. However, converting I2C to USB probably won't work in this case as MMB4W would have to look for a serial port (I assume that's how the converters work - like the TTL-USB ones.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 05:04pm 14 Dec 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  From the photo I suspect it's just components wired to pins with no electronics. I wondr if it plugs on top of a UNO?

it arrived and no chips on board. it fits a uno as a hat. joystick is analogue.
desoldering iron arrived to so for the price I could desolder the board for parts.
I wondered if I need an analogue joy stick. I will go back to mcp23017 i2c button pad and test the desoldering iron and is it better than an iron and solder sucker for getting the buttons I got 90deg wrong way round out.
happy days, stan . aliexpress stuff does arrive
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 05:40pm 14 Dec 2023
Copy link to clipboard 
Print this post

That joystick and the buttons are the same sort tat fit the PZee board shown at the beginning of this thread. :)

You don't *have* to use the joystick as analogue. If you use comparison you can produce digital signals from it. By adjusting the comparison value you can set the sensitivity of the joystick.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 10:06pm 14 Dec 2023
Copy link to clipboard 
Print this post

Mick, my needs are not as specific as yours but for a button pad the mcp23017 i2c is ok. I'll do some general code with and masking to get a result, the point if I want to detect multiple key presses. The touch screen is ok but sometimes buttons are better.
I got 5 mcp23017... must have been a min order.. it's a tidy chip
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 10:21pm 14 Dec 2023
Copy link to clipboard 
Print this post

I've just done another version of PZee Control, with 4 buttons instead of the joystick. It's probably of more use to some people. Apart from that it's more or less the same thing.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 06:24am 15 Dec 2023
Copy link to clipboard 
Print this post

Hi Mick, All,

I am not really much into playing retro type games using joysticks and controllers with more buttons than I have fingers but my thought process would be to try to find a commercial controller of some sort that suits your specs (and aesthetics) and rip the guts out and design a board to interface to what ever connection style you like.

I have a tiny '400 game' hand held console cheapie toy that I was going to replace the guts with a SMD version of the Game*Mite but it is on the bottom of the pile of toys I have to play with at the moment.

What I am saying is rather than try to design/print/etc a case to house your controller, find a controller and squeeze your design into that.

Regards,

Mick



.
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 09:17am 15 Dec 2023
Copy link to clipboard 
Print this post

I've been looking at that approach, Mick. The problem is that unless you can find a source of more or less identical controllers to start with it doesn't work. The SNES controllers are like this - only the genuine ones are likely to be even similar inside (and even those have at least 4 different PCB designs over 3 year production). The clones are much worse. Of course, genuine controllers are much more expensive than the clones.

NES controllers show a little more promise as the case is simpler than the SNES but you get less buttons (and they are quite horrid inside. :) ).

Direct plug-in of any "standard" controller is an idea but that falls over because of special connectors. And some WII Classic controller clones seem to work oddly (if at all). Some SNES clones are actually NES inside.

I'm coming round to thinking that having a DIY controller is the best bet overall. It may not look as pretty and may require assembly but at least we have control over the design and connection. To that end PZee Control is on single-sided board to keep tracks off the visible side. The back cover is on standard 8mm spacers so it's not very thick. If someone wanted to 3D a case it would probably be quite simple - it may even be reasonably economical to get JLCPCB to make them. There are plastic boxes 134x69x25.5mm available on ebay, which is another possibility.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 07:29pm 15 Dec 2023
Copy link to clipboard 
Print this post

This is better than an iron and desolder pump. really cleans the joint. just tested on vero with all switches 90 deg wrong way. tidy job removing them, no damage.
just thought mention for £9

 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 07:53pm 15 Dec 2023
Copy link to clipboard 
Print this post

https://github.com/nutki/rpi-nintendo-classic-controller
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 08:02pm 15 Dec 2023
Copy link to clipboard 
Print this post

We don't have a problem in reading the WII Classic on either the PicoMite or the CMM2 now as MMBasic supports it. You can only have one on a PicoMite though as it has to be on System I2C and they all have the same address.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 08:35am 18 Dec 2023
Copy link to clipboard 
Print this post

Here's a reduced version for those who prefer the Game*Mite controls. I think all the buttons are in the same places. Soft Reset simply sends the code for F3 and the game can treat it in any way.

It is envisaged that this would be I2C by default (again). Other options are possible:
I2C with interrupt on S3 wire.
TTL serial - gp8 is com2 tx, gp9 is com2 rx
emulated NES - S3 wire is Latch (this would be much slower to read than a real one)
HID connection over USB

R1 & R2 are optional and need only be fitted if the host hasn't got I2C pullups. Could be handy for a Micromite backpack. :)

I'd probably do this single sided again, just because it looks a bit neater. The RP2040-Zero is surface mounted from the rear again, although it's not obvious in the pic.

GP0 and GP1 are there just in case there's a use for them at some stage. :)


Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 08:55am 20 Dec 2023
Copy link to clipboard 
Print this post

I've had ideas on how the things will work for the I2C system now.
There would be a number of registers in the RP2040-Zero.

Commands use bit zero to control a vibration motor if fitted. If the bit is set the motor runs, if reset it stops. This is similar to the way Nintendo do it.

Command &h99
Returns nothing. Stops the vibration motor.

Command &h01
Returns nothing. Starts the vibration motor.

Command &h02
Returns one byte. Bits 0-3 are controller type. Bits 4-7 are revision number.
01 = Game*Mite type
02 = PZee Control using buttons on the left
03 = PZee Control using a joystick on the left

Command &h04
Returns two bytes:
Byte 1
Select, Start, P, Z, LT, RT, soft_reset (Type 1) / Joystick_switch (Type 3), spare
Byte 2
Bits o-3 = RH buttons
Bits 4-7 = LH buttons or "virtual D-pad" using joystick

Command &h06
Returns four bytes:
Byte 1 - as above
Byte 2 - as above
Byte 3 - Joystick X position scaled 0-100 (centre = 50)
Byte 4 - Joystick Y position scaled 0-100 (centre = 60)

Command &h20
Controller reset (although I'm not sure if this is really needed).

All button inputs returned are active low, with unused inputs reading high.
The bits in the registers bear no relation the the GPIO pins as they are read using PORT.

These are the basic commands and are based on what I've had working so far. I intend to expand them, allowing the program to control the LED colour, for example. It's possible to change the sensitivity of the "virtual D-pad" by changing the offset comparison value, but I may not implement that as it didn't make a lot of difference.

Game*Mite mode would return bits 4-7 (LH buttons) and two bits for RH buttons (for A and B) as well as the status byte for Select, Start etc.

The RP2040-Zero is normally updating the registers continually and responds to messages on an interrupt. There is no delay while it scans the buttons & joystick.

I might include a facility to "flip" the controller for left-handed players too, but that would be done on the controller itself.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4040
Posted: 10:22am 20 Dec 2023
Copy link to clipboard 
Print this post

FWIW Mick I think it would be convenient if there were a simple way to read the digital inputs in the Wii Classic format supported by CMM2/PicoMite firmware:

Const ctrl.R      = &h01
Const ctrl.START  = &h02
Const ctrl.HOME   = &h04
Const ctrl.SELECT = &h08
Const ctrl.L      = &h10
Const ctrl.DOWN   = &h20
Const ctrl.RIGHT  = &h40
Const ctrl.UP     = &h80
Const ctrl.LEFT   = &h100
Const ctrl.ZR     = &h200
Const ctrl.X      = &h400
Const ctrl.A      = &h800
Const ctrl.Y      = &h1000
Const ctrl.B      = &h2000
Const ctrl.ZL     = &h4000


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 10:57am 20 Dec 2023
Copy link to clipboard 
Print this post

Unfortunately I don't think I can emulate the WII Classic, but I'm open to putting the bits in any order. :)

Somewhere I found a long article on how the WII Classic is read. I'll have to try to find it again as I think there may be an ID register. It would be nice to use the same one so that a WII Classic could also be detected.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 1 of 2    
Print this page
© JAQ Software 2024