Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:08 01 Aug 2025 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 : CMM2 Joystick Interface

     Page 1 of 2    
Author Message
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 04:59pm 14 Apr 2021
Copy link to clipboard 
Print this post

I have to admit that I am not much of a video game player. I had a console in the 1970s that had Pong and a few other games on it. I played those a lot, but after that generation of monochromatic games I played very few.

But I have had a lot of customers that have requested a joystick port for the CMM2 (RetroMax that I sell) and I decided to throw together a little board to be a joystick interface.

The features:
 Based on MMBasic '170 so it can be user programmed
 Support Atari (digital) joystick
 Support PC (analog) joystick
 Operate as I2C slave interface
 Operate as serial interface
 Support 16 key keypad
 Support rotary module
 Support analog joystick module

The PCB layout will be all through-hole so the end-user can populate whatever parts he/she needs. When done with the PCB layout I'll post the Gerbers here on TBS.

Here is a cobbled-together prototype. I jokingly call it a NONchuk. It's little more than a '170 and connectors. I've connected it to joysticks etc to test.



Here is the current schematic.



What I'm looking for is feedback from the minds here on TBS that have worked with joysticks before. Take a gander at the schematic and let me know if I'm off base.

It won't need a program on it that does everything, as new programs are easy enough to install. The CMM2 can address this slave I2C device with simple commands. I'd be interested in knowing if anyone is willing to make this device act like a Nunchuk so that the CMM2 can be fooled into thinking that a PC joystick is a nunchuk.

The keypad, analog joystick module, and rotary input are like these:






Micromites and Maximites! - Beginning Maximite
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 05:06pm 14 Apr 2021
Copy link to clipboard 
Print this post

Nice project. I also have played almost no computer games other than Pac-Man and space invaders on a Xerox Alto-Bravo system in the early 80s, so I am hopeless with the arcade-style games.

However, I am interested in joystick control. I've found the "37 Sensor" joysticks to be almost useless except for the grossest control. Do you have a recommendation for a more sensitive one?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 05:23pm 14 Apr 2021
Copy link to clipboard 
Print this post

  lizby said  
However, I am interested in joystick control. I've found the "37 Sensor" joysticks to be almost useless except for the grossest control. Do you have a recommendation for a more sensitive one?


I remember seeing "arcade size" analog joysticks. (most arcade size ones are just switches, not pots) Visually this:



But not digital. Harder to find.

Amazon has these:



I've never tried them.

.
Edited 2021-04-15 03:24 by CircuitGizmos
Micromites and Maximites! - Beginning Maximite
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 08:40pm 14 Apr 2021
Copy link to clipboard 
Print this post

Dual controls for 2 player games?
Visit Vegipete's *Mite Library for cool programs.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 08:59pm 14 Apr 2021
Copy link to clipboard 
Print this post

I went with the Arduino rather than micromite because I thought that new users to the maximite game will not be able to easily program the micromite.
Easy to do once you have another micromite or Arduino set up but that first one is a bit more involved.

Now, if Peter could port the micromite flashing software from micromite to CMM2, that problem would be solved.

Jim
VK7JH
MMedit
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 10:21pm 14 Apr 2021
Copy link to clipboard 
Print this post

  vegipete said  Dual controls for 2 player games?


For one board there is one digital game joystick, one analog. Unless I make this board really large and full of big connectors, that is the limit. For a second player a second board could be used.
Micromites and Maximites! - Beginning Maximite
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 10:22pm 14 Apr 2021
Copy link to clipboard 
Print this post

  TassyJim said  I went with the Arduino rather than micromite because I thought that new users to the maximite game will not be able to easily program the micromite.
Easy to do once you have another micromite or Arduino set up but that first one is a bit more involved.

Now, if Peter could port the micromite flashing software from micromite to CMM2, that problem would be solved.

Jim


If pre-programmed with MMBasic a CMM2 could easily program the "NONchuk".

Jim - since you already went down this path, is there anything you see with the joysticks that should change?
Edited 2021-04-15 08:23 by CircuitGizmos
Micromites and Maximites! - Beginning Maximite
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 02:38am 15 Apr 2021
Copy link to clipboard 
Print this post

  CircuitGizmos said  
Jim - since you already went down this path, is there anything you see with the joysticks that should change?

I can't see any obvious changes to make to your circuit.
I am not a gamer and have only really worked on the IBM style joysticks.

I did come up with a method of auto-detecting and swicthing between IBM style and 'normal' analog sticks.
I went with just the IBM 15 pin connector.

I should have a couple of Atari joysticks somewhere in the shed but I haven't found them yet.

Something that is really useful for the 'normal' analog joysticks is some way of auto centering them. The IBM ones have trim-tabs so they are OK but for the normal ones, I read the voltage on startup and assume that the joystick is centered during that time.

Deciding which of the many fields of the Nunchuk protocol get mapped to the various inputs is an interesting conundrum.

Jim
VK7JH
MMedit
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 12:42pm 15 Apr 2021
Copy link to clipboard 
Print this post

  TassyJim said  Now, if Peter could port the micromite flashing software from micromite to CMM2, that problem would be solved.

Jim

How would you want to connect the MM to the CMM2?

(E.g. ICSP pins or some other pins on the MM? And then to where on the CMM2?)

And what source of program?

E.g. from a HEX (?) on (where? an SD card?).

John
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 02:41pm 15 Apr 2021
Copy link to clipboard 
Print this post

Jim: Welcome to the "I'm no gamer" club. :D

The Atari joysticks are just plain switches. The up/down/left/right/trigger are pulled high by internal '170 resistors. Joystick operation grounds the line.

The PC/IBM analog joysticks need the 10k to ground, from what I gather. The other analog type can be treated as just an input voltage to an analog '170 pin.

My opinion is that the input centering can be done in the host (CMM2) software. The host could also decide what the "dead" range is for centered input. But emulating a nunchuk would be different, right? Perhaps a host calibration program.

You are right about the nunchuk input. I was hoping someone with more nunchuk knowledge could make some of the various inputs "look" like a nunchuk. Then this board could be used for various games without the game knowing any better.
Micromites and Maximites! - Beginning Maximite
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 02:58pm 15 Apr 2021
Copy link to clipboard 
Print this post

  JohnS said  
  TassyJim said  Now, if Peter could port the micromite flashing software from micromite to CMM2, that problem would be solved.
Jim

How would you want to connect the MM to the CMM2?

(E.g. ICSP pins or some other pins on the MM? And then to where on the CMM2?)

And what source of program?

E.g. from a HEX (?) on (where? an SD card?).

John


I would think that the target '170 programming lines (reset, pgc, pgd) would be the choice here. A completely blank '170 could be programmed by a CMM2 that way.

I perceive this as a way to load the MMBasic firmware onto a blank '170 via a CMM2. MMBasic firmware located on the CMM2 SD card. A MMBasic program (perhaps with CSUB helper) running on the CMM2 would ICSP program the '170.
Micromites and Maximites! - Beginning Maximite
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 03:29pm 15 Apr 2021
Copy link to clipboard 
Print this post

  Quote  Now, if Peter could port the micromite flashing software from micromite to CMM2, that problem would be solved.
Jim


There is no Micromite flashing software. There is software for flashing the PIC16F1455 and there is the 16F1455 Microbrige software for flashing a Micromite using PIC32PROG.

Flashing PIC32s is an order of magnitude harder than flashing PIC16s
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 03:45pm 15 Apr 2021
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Now, if Peter could port the micromite flashing software from micromite to CMM2, that problem would be solved.
Jim


There is no Micromite flashing software. There is software for flashing the PIC16F1455 and there is the 16F1455 Microbrige software for flashing a Micromite using PIC32PROG.

Flashing PIC32s is an order of magnitude harder than flashing PIC16s


I read this as the term "micromite flashing software" being firmware (the microbridge firmware) that flashes a '170.

That would be icing on the cake, but I was only thinking of a pre-MMBasic-programmed DIP package for this NONchuk.

.
Edited 2021-04-16 01:49 by CircuitGizmos
Micromites and Maximites! - Beginning Maximite
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 04:14pm 15 Apr 2021
Copy link to clipboard 
Print this post

  CircuitGizmos said  The PC/IBM analog joysticks need the 10k to ground, from what I gather. The other analog type can be treated as just an input voltage to an analog '170 pin.

When I was experimenting with this a while back, I never got good results trying to use a PC joystick with a resistor as a voltage divider. No combination would give both good range and linearity.

Instead, capacitor timing worked well. I settled on a capacitor (marked 103) from the joystick axis pin to ground and a 2k2 resistor from the joystick pin to the MCU input pin. (MCU was a PIC16F18345 running at 5 volts.) I2C output emulating a Nunchuk worked nicely.
Visit Vegipete's *Mite Library for cool programs.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 05:53pm 15 Apr 2021
Copy link to clipboard 
Print this post

I was wondering about either persuading the code I wrote to flash PIC32s (it's in C) to be a CSUB or else convert it to Basic.

Looks a pain, so unless there's a lot of interest?

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 06:34pm 15 Apr 2021
Copy link to clipboard 
Print this post

IIRC the PC analogue joysticks were a 100k or so variable resistor from 5V. That fed a capacitor on the input of a monostable, so it set the time delay after the port strobe signal. There was no resistor to ground so linearity wasn't awful. It was a nice cheap system with no analogue inputs needed. :)  That would tie in with what you found, vegipete.
Edited 2021-04-16 04:36 by Mixtel90
Mick

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

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 06:58pm 15 Apr 2021
Copy link to clipboard 
Print this post

  JohnS said  I was wondering about either persuading the code I wrote to flash PIC32s (it's in C) to be a CSUB or else convert it to Basic.

Looks a pain, so unless there's a lot of interest?

John


I wouldn't mind looking at this if you are willing to send it to me. If so, perhaps I'll start a new thread to keep this one a joysticky thread.

gizmo2009 @ circuitgizmos.com
Micromites and Maximites! - Beginning Maximite
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 07:00pm 15 Apr 2021
Copy link to clipboard 
Print this post

  Mixtel90 said  IIRC the PC analogue joysticks were a 100k or so variable resistor from 5V. That fed a capacitor on the input of a monostable, so it set the time delay after the port strobe signal. There was no resistor to ground so linearity wasn't awful. It was a nice cheap system with no analogue inputs needed. :)  That would tie in with what you found, vegipete.


That makes some sense. Perhaps with the '170 there is a better input pin? Has this been done on a '170?
Micromites and Maximites! - Beginning Maximite
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 07:21pm 15 Apr 2021
Copy link to clipboard 
Print this post

It's been done on other PICs. I remember having a pot input using this method on a PIC16C84. :)

Set pin to output low to discharge cap. Start a timer & set pin to input. When it goes high stop the timer. The length of time is proportional to the joystick resistance. The 170 should be good for this as the pins have pretty well defined operating points.

I bet there's some info on the IBM analogue sticks somewhere...
Ah-ha! http://vintage-pc.com/pc_analogue_joystick.html
Edited 2021-04-16 05:35 by Mixtel90
Mick

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

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 08:11pm 15 Apr 2021
Copy link to clipboard 
Print this post

  CircuitGizmos said  
  JohnS said  I was wondering about either persuading the code I wrote to flash PIC32s (it's in C) to be a CSUB or else convert it to Basic.

Looks a pain, so unless there's a lot of interest?

John


I wouldn't mind looking at this if you are willing to send it to me. If so, perhaps I'll start a new thread to keep this one a joysticky thread.

gizmo2009 @ circuitgizmos.com

Will email you :)

John
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025