Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:30 29 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 : PicoMite: Controllers ... again ;-)

     Page 1 of 3    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 09:22am 19 Apr 2023
Copy link to clipboard 
Print this post

Spun off from: https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=15819&LastEntry=Y#202268

I didn't want to polute the original thread which was I believe intended just to be a place to aggregate a list of games with yet another retread of the zombie controller apocalypse.

Hopefully this thread will die quickly .

This is @Mixtel90's last post quoted in full:

  Quote  I'm not sure...
The MMBasic platforms aren't game consoles and there's no reason why they should have any compatibility whatsoever with controllers made for them, other than those controllers being available. Even then, Atari switched joysticks are nowhere near as common (or as good) as they used to be. Levering MMBaasic into using someone else's controllers doesn't seem sensible to me.

Use of the WII controllers is all well and good on the CMM2 (although they are of a particularly nasty and unforgiving version of I2C) but the sockets for them only appear to be available from one source on AliExpress now and plugging them onto the edge of the PCB is a kludge of the first order. I don't think it's a good standard to follow.

The NES controllers, although in reasonable supply from China, have QA issues, but at least they (can) have sensible plugs.

Most of the MMBasic platforms don't have a lot of IO left for controllers, especially if you are using a parallel LCD display. It appears to me that the very best solution is to use addressable controllers of some sort, and all MMBasic platforms have an I2C port available AFAIK. I2C expanders are cheap too, and I2C is already supported in MMBasic. All it's software needs could be in two library routines - Sub Joystick_Config() and Function Joystick_read(). The first configures the I2C expander and the second reads the buttons/switches/whatever. You could even use the same joystick as switched an analogue by using a Pico as the I2C expander. It could then return a single digital value for switches and two analogue valuess for joystick x &y positions.

Am I banging my head against a brick wall? I don't know. It just seems logical to me that we don't need to think of the PicoMite as being a WII just as the WII doesn't have to think it's an X-Box or an X-Box a Sony Playstation. Why even attempt to standardize on someone else's system when we can have one that fits our hardware better? Ok, so you'd need to build your own controller(s) but the PCBs, joysticks & components are cheap.

It may put non-constructors off, that's true, but there aren't that many game players anyway. If you look at it that way then why even attempt to follow any standards? Just set some SETPIN and DIM values (or whatever) in the program to suit your chosen controller. Or stick with the keyboard.  :)


I think my issue is that once you take 'x' the number of PicoMite users who are going to play homebrew 80's quality games and multiply it by 'y' the number of PicoMite users who are going to build a homebrew controller with dodgy ergonomics and a dicky analogue stick (where you want digital) you are getting frighteningly close to zero %.

Anyway it looks like you are having fun and I'll happily update my controller library to support whatever you produce - will you send me a PCB for the cost of postage if/when the time comes ?

Notes:

1. I think the XBox and Playstation controllers (at least the wired ones) are USB these days.

2. I believe those Chinese chappies are selling some NES clone style controllers (specifically ones intended to plug into cheap hand-held videogames) that have USB Micro B connectors, but only because they have the 5 pins necessary to handle the power,ground,latch,clock,data used by the NES controller ... so not USB at all. And there are some NES style controllers that are true USB for plugging into modern PC's .

Best wishes,

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 09:36am 19 Apr 2023
Copy link to clipboard 
Print this post

  Turbo46 said  Maybe a special version of the transpiler which could add in the controller or controllers that would suit the particular Pico and user. The user could answer prompts as to which Pico and controller he wants to use and the transpiler would do the rest.


Technically possible, but practically x * y = 0 so I won't be persuing it.

I think the solution is still a "library" such as mine but with the addition of a global configuration file or a program variable that needs to be updated to indicate which controller configuration(s) should be enabled.

Best wishes,

Tom
Edited 2023-04-19 20:14 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 10:23am 19 Apr 2023
Copy link to clipboard 
Print this post

No controllers suit everyone, or there wouldn't be a after-market sale for them. Huge quantities of the original Atari joysticks ended up being junked because people wanted microswitch controllers. Some consider the official WII controllers to be very poor. You either learn to put up with what you have or look elsewhere.

I think its probably unfair to pick on "dodgy ergonomics and a dicky analogue stick", especially as that "dodgy analogue stick" is that used in some of the big-name controllers (Xbox One & PS5). They aren't always used in analogue mode on those platforms either. Of course, you could always shell out 26.50 UKP for a proper switch joystick instead of 1.80 UKP for the analogue one. :) Then find a bigger, more expensive or even custom made case for it.

If the ergonomics are dodgy then anyone is quite welcome to suggest better layouts.

My point isn't completely about the hardware anyway - it's how it's connected to the MMBasic platform. For two joysticks/controllers (and I wouldn't accept single user systems) you have to have:

Atari:
10 GP pins & 10 pullups
For a third joystick add 5 GP pins & pullups
If you diode gate the lines then you can keep it down to 5 common pins plus one select pin per joystick. You do need 5 diodes per joystick though.

NES:
4 GP pins & 4 pullups
For a third controller add 1 GP pin & pullup
2 pins are common, plus one select pin per controller

WII:
4 GP pins & 4 pullups (but have to be on two separate I2C ports)
For a third controller add 2 GP pins & pullups (on a third I2C port)
You can fiddle these as white and black controllers sometimes have different addresses, but there are only two possible ones.

I2C:
2 GP pins & 2 pullups
For a third controller don't add anything.
Both pins are common to all controllers as they are addressable.
Note: a "controller" can be an Atari joystick with a port expander if you prefer. Anything with up to 8 switch inputs will do.

You can use up to 8 controllers on a MX170 or a CMM2 if you use I2C, but it might be a bit slow reading them on the MX170. All on 2 pins.

Software can check I2C ports to look for controllers - you don't have to specifically define where they are, even if they are on different ports. As long as you know the possible address range for them you can sort it out.
Edited 2023-04-19 20:30 by Mixtel90
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 10:57am 19 Apr 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  If the ergonomics are dodgy then anyone is quite welcome to suggest better layouts.


That comment was wrt to it being packaged in an electronics equipment box rather than something designed as a controller.

Best wishes,

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

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 10:57am 19 Apr 2023
Copy link to clipboard 
Print this post

Hi Mick,

Here are my 5 cents....

For controllers to be usefull you need games that benefit from control via controllers, and people who are prepared to sit and play such games.

Controllers (over keyboard) have the benefit that you can:

a - have multiple (some consoles support 4 controllers).
   I2C will have problems with multiple controllers, not becuase the addressing, but
   because the cabling involved. One I2C bus connecting to 2 cables of 2 - 5 meter
   length will become problematic. Ever wondered why the nunchuck cable is only 1
   meter..??
   By the way... I already experienced there are no people in this forum that even
   play a dual player game... Solitary is the norm ... This is where we may differ
   in opinion. I do not believe anymore in dual player games on Pico or CMM

b - have standardized button layout tuned for gameing on a couch, in front of a TV.
   This is something of benefit. By designing (and adhering) to a controller layout
   people like me (myself) stop writing code for any keyboard key in a game. Although
   using cursor keys on a keyboard seems to be common in CMM land (versus WASD).

c - controllers give you the option to go diagonal. Keyboard dus not gracefully
   handle dual keys.

If you are designing for a single controller use, then the NES controller is only 1 pin in disadvantage over I2C, has a standardized layout, and a serial bus that is more robust than I2C will ever be. And I2C is sometimes already used (RTC) so you may not want to burden that bus with controllers.

I have seen cheap NES controller samples that are quite usefull, and cheaper than a beer (nowadays). And you can extend the 9 pin D with 5 meters (off the shelf cable), and it will still work.

This are my 5 cents...

Volhout

P.S. But I am happy to wire a PCF8574 chip in a NES controller if I2C becomes the standard for mites....
Edited 2023-04-19 21:03 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 04:22pm 19 Apr 2023
Copy link to clipboard 
Print this post

The WII has 1m cables as standard. They also sell a 1m passive extension cable. If the cable capacitance is sensible (note that flat 4-core flexible telephone cable has a capacitance of about 22pF per foot and I suggest using the outer pair for SDA and SCL) you can get lead lengths of about 2.5m at 400kHz - the speed that the WII uses. You don't normally need more than 1m each for two players unless you are using a pretty big TV and put the computer near to it. It gets in the way and 640x480 will look pretty rough on a big TV.

If timing allows, slowing the I2C bus down to 100kHz would allow much more flexibility in cable lengths. This speed is also closer to that of the NES system. It's only the Pico that prevents I2C running slower.

The *official* NES controllers are fine (or probably so) but you'll have to either change the plugs or find some matching sockets from somewhere as AFAIK none of them use DB9. The main problem seems to be the mechanical side of the cheap Chinese versions. (of course, you can never use NES protocol for analogue inputs or to drive a vibration motor).


@Tom
We work with what we have...  If I had access to a 3D printer and the skills to use it then I wouldn't be looking at a 3 UKP Chinese project box. :)  Unfortunately no-one seems to sell ergonomic cases for you to make your own controllers in. Not at less than earth-shattering prices anyway. The project boxes are actually not too bad to hold, having nicely radiused corners. The layout I am considering allows the controller to be used "upside down" if you are left-handed. It may even be feasible to make this option selectable on the controller...
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 04:38pm 19 Apr 2023
Copy link to clipboard 
Print this post

I apologise Mick, I shouldn't have said anything, probably residual frustration because of the NES controller Q/A fiasco.

Best wishes,

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

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 04:55pm 19 Apr 2023
Copy link to clipboard 
Print this post

Oh, no apology necessary. You made a good point.  :)

One possible solution to controllers (for the PicoMite anyway) is to use the library. If there is a function in there called with READSTICK() it could return a binary value for up,down,left,right,a,b,select. The version of READSTICK could be to suit the hardware, so it might read the keyboard, a NES, Atari or whatever. The game doesn't need to know what hardware is available.
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 05:23pm 19 Apr 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  One possible solution to controllers (for the PicoMite anyway) is to use the library.


@Volhout suggested the same in the previous thread.

I'm personally not a fan of messing with the LIBRARY not least because it's not an approach portable to the CMM2. Also what if you want two controllers (ok, two functions in the LIBRARY) or to make it configurable within the game itself, or handle the keyboard seamlessly with the same code.

I *think* I've got the right approach, we just need more games to apply it to - I'll be updating Pico Frogger as soon as Peter has put the performance issues to bed.

Best wishes,

Tom
Edited 2023-04-20 03:37 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 06:10pm 19 Apr 2023
Copy link to clipboard 
Print this post

A long time ago...
  Turbo46 said  I had the idea to produce as series of functions, say PA() and PB().

There would be a version of PA() to read the joystick, one for NES, one for keyboard etcetera on Port A and a similar set of functions for Port B.

The idea was to just tack the appropriate function onto the end of the game program rather than include a whole suite of routines to read all of the types of input and having more logic to select the appropriate one.

ie:
ACTION = PA()

Similar functions could be used for the CMM2 only the pin numbers changed to protect the innocent.

That suggestion was poo-pooed by Mick and Tom because it:
  Quote  produces a version of the game for a particular controller/joystick/keyboard setup

I don't really see that as a problem because the user would create a version that suited them and their hardware.

In hindsight and having experience with Tom's controller library, as produced for the CMM2 Deluxe, an initialize function or subroutine would be needed for each controller as well.

Not suggesting that there is anything wrong with Tom's approach. Laser Cycle worked seamlessly with every controller that it supported.

Bill
Keep safe. Live long and prosper.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 06:20pm 19 Apr 2023
Copy link to clipboard 
Print this post

I'm not a fan of tying up an ADC pin when there are only three. ;)

At least a READSTICK() function allows new controllers to be added and they will be automatically used by all games.

Perhaps a combination:
Look for file default_stick.config on the default drive.
if present and it contains WII controller info then use that controller
If present and contains a library flag then use the controller in READSTICK() from library.
If file isn't present then use keyboard.

There's no need to cater for a variety of sticks & controllers on the CMM2 as it has nowhere to (officially) connect them and already has the WII controllers supported in firmware. There's no guarantee that any given PicoMite board could match the same GP numbers anyway as it's a different chip.

@Turbo46
I still don't like the idea of producing a special version of a game for one particular hardware setup. You can move SD cards between platforms. It makes things so much easier if the game will just run automatically with no messing about.
Edited 2023-04-20 04:28 by Mixtel90
Mick

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

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 07:54pm 19 Apr 2023
Copy link to clipboard 
Print this post

The trouble is there is no standard hardware setup. Once the original board designer doesn't include a controller interface (or two) the horse has bolted. Then people will talk around in circles about which controller to use and which pins to use for it.

"You can't use THAT pin because it is used for..." "You can't use the dreaded pin 40 because..." Well Poitr did. And so it goes on and on and... we end up disappearing where the sun don't shine with no result.

It's been going on since the first Maximite.

How many Pico VGA designs are there on Geoff's site now? Four, with a fifth to come. Which one do you support?

Every version has a keyboard. Well I personally have trouble playing games that need a fast accurate response, my fingers don't work too well and I tend to lose the correct keys.

Bill
Keep safe. Live long and prosper.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 08:31pm 19 Apr 2023
Copy link to clipboard 
Print this post

Exactly. With multiple PCB designers - and lots more not on PCBs at all - you can't enforce a standard. This is why I argue that the game shouldn't know or care about the hardware. It merely calls READSTICK() from the user's library. The constructor produces READSTICK() for their hardware and all versions of READSTICK() return an identical value. So, you can use anything you like. A left-handed keyboard layout, Atari joystick, trackball driving comparators - it doesn't matter. All that has to be settled is a) what the bit sequence is b) how to make it work on systems that don't support a library.

You *could* append READSTICK() to the game to make it work, but you can't then run that copy of the game on any other hardware arrangement. - not good if you share a SD card. You can't "include" it on platforms that don't support that.

One approach that I don't think anyone has suggested yet is a PS2 joystick. It would simulate pressing at least nine keys, eight directions plus fire from a normal joystick. Of course, it's no use on systems that don't support a PS2 keyboard.
Mick

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

Joined: 17/05/2016
Location: United States
Posts: 3152
Posted: 08:36pm 19 Apr 2023
Copy link to clipboard 
Print this post

  Turbo46 said  Well I personally have trouble playing games that need a fast accurate response, my fingers don't work too well and I tend to lose the correct keys.


LOL, it's my brain which isn't fast and accurate enough for the games requiring speed and accuracy--too old to have encountered them at an age when I would have been willing to invest the time to lay down the neural patterns.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 08:41pm 19 Apr 2023
Copy link to clipboard 
Print this post

Me too.....  :(
I have the lightning reaction times of a typical garden snail...
Mick

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

Senior Member

Joined: 15/07/2021
Location: Australia
Posts: 141
Posted: 05:15am 20 Apr 2023
Copy link to clipboard 
Print this post

Oops...looks like I accidentally stumbled into this conversation.

Keyboard Form-factor for PicoMite VGA

In choosing my hardware configuration, I need to solve this problem.  I was going to defer it a bit like the VZ computers did, and have a gamepad module that plugs into the I/O port.  This allows I/O pins to be re-used for other purposes if you don't want to play games.

The problem still exists as to what interface format is supported.  The above link summerises my preferences, but I'm just a newbie, so what would I know really?

Anyway, I will be monitoring this thread with interest.

Mike
Edited 2023-04-20 15:15 by Hawk
 
Hawk

Senior Member

Joined: 15/07/2021
Location: Australia
Posts: 141
Posted: 07:31am 20 Apr 2023
Copy link to clipboard 
Print this post

Here's an example of how the SNES connector could be mounted to a PCB.  Note that the PCB has a cutout for the over-hanging flange of the connector.  The pins are extra thick, but to create a better mechanical attachment, a wire could be soldered across the top of the connector closer to the edge of the PCB.



Photo courtesy of console5.com.
Edited 2023-04-20 17:33 by Hawk
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6808
Posted: 08:00am 20 Apr 2023
Copy link to clipboard 
Print this post

Oh, just go ahead and invent your own standard. There are plenty to choose from, what's one more?

At the end of the day this is *your* project, Mike. If you wait for an actual standard to appear you may never get to build it. We've been waiting for a while now.  :)

Personally, just at the moment, I think the implementation of the NES system used on the PicoGAME is probably the best. It's using six pins though and I'd like to see that reduced to four as I consider it wasteful. I couldn't get the tracks to play ball on that board though.

===================

As it's unlikely that anything else will be used at the same time I'll suggest this as the new "standard" controller system and see if anyone would like to hack it to bits:

*** PROPOSED STANDARD JOYSTICK / CONTROLLER SYSTEM FOR PicoMite SYSTEMS ***

1} Use NES controllers but rewired to get rid of the DB9 connectors as they are unnecessarily bulky. Do NOT use any sort of proprietary connectors.
2) Rewire using RJ-12 (6P6C) telephone connectors and flat 6-core wire. Both are cheap and you can chop up ready made leads to avoid buying a crimping tool.
3) Use GP0, GP1, GP2 and GP3 in this manner:
they are connected to the RJ-l2 socket:
.  1 - 3V3
.  2 - GP0 - CLOCK (with 10k pullup)
.  3 - GP1 - LATCH (with 10k pullup)
.  4 - GND
.  5 - NO CONNECTION (RESERVED)
.  6 - DATA (with optional 10k pullup)

Where one socket is fitted pin 6 would be connected to GP2
Where two sockets are fitted pin 6 would be connected to GP2 on one and to GP3 on the other.

This pin arrangement is intended to make it easy to connect to the PicoMite.

This allows for two controllers. The sockets are only about 16mm wide and 13mm deep so take up a lot less space than DB9s.

EDITED:
Ideally the supply should be 5V and level shifters used on the GP pins. However, merely powering pin 1 from 5V via two  silicon diodes should be ok. (supply to controller = 3V8). Most seem to work from 3V3 anyway.

To use this spec properly we *do* need to find some reliable NES controllers though. Whether they are even made now is something else. :)

It would be possible to use the same shift register idea to accept inputs from a standard joystick or an analogue stick with comparators. I would strongly suggest that this method be used to connect standard joysticks rather than use direct connection to the PicoMite pins:
Shift register 4021
Pin 7 (P1) - Right
Pin 6 (P2) - Left
Pin 5 (P3) - Down
Pin 4 (P4) - Up
Pin 1 (P8) - Fire (Button A)
Optionally:
Pin 15 (P7) - Button B
Pin 14 (P6) - Select
All inputs have 1k pullups to supply.
Pin 3 (Q8) - DATA
Pin 10 - CLOCK
Pin 9 - LATCH
Pin 16 - VDD
Pin 8 and Pin 11 - GND
The 4021 should NEVER be on the same PCB as the PicoMite system. It can be either incorporated into an existing joystick or put into a small converter box. The idea is to keep the DB9 connectors off the board completely.

This is only a proposal. All comments are welcome.

EDIT:
References to RJ-11 changed to RJ-12. The connectors are the same size but RJ-11 has no connectors in the outer positions so has only 4 conductors (it is 6P4C).

=========================
Edited 2023-04-20 21:37 by Mixtel90
Mick

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

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 04:46am 21 Apr 2023
Copy link to clipboard 
Print this post

I'm sorry Mick but I could hardly disagree more. You can't expect people to replace the DB9 connector on a NES with ANY other type. Apart from the skills required, many of them contain a blob and (probably) not a 4021. How do you determine which wire is which once you've cut of the plug? Maybe you could buzz it out before you cut the plug off but how many are going to want to do that? There are so many variations out there the finding a standard version would be impossible.

I don't think we should expect anyone to mess with the connectors just to make a more compact unit.

Also if the number of pins is a problem, then, if a 4021 is to be used, then I believe that it SHOULD be on the PCB to provide the extra input pins required for (say) a joystick. See the Tomboy for an example of that.

Do we really need yet another PicoMite VGA version?

Bill
Keep safe. Live long and prosper.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 06:41am 21 Apr 2023
Copy link to clipboard 
Print this post

Would this help ???

connector

Volhout

p.s. the game console using controllers should be sturdy, big and heavy. I understand there are amongst us that want the benefit of cheap JLC pcb's and make everything small, but people playing games would want the controller to move, and rest of the setup to be fixed (to avoid monitors smashing to the ground at the moment of exitement).
I personally would not suggest to people that cannot solder SMT (majority of this forum) to start modification on the cheap NES controllers I have seen, just to connect it to a different telephone "alike" cable.
I admire your energy Mick, and I will follow if this is the forum direction, but I am hesitant to support what you are proposing.
Edited 2023-04-21 16:49 by Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 1 of 3    
Print this page
© JAQ Software 2024