![]() |
Forum Index : Microcontroller and PC projects : CMM2 Joystick Interface
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
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 StatesPosts: 3378 |
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 StatesPosts: 1427 |
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: CanadaPosts: 1132 |
Dual controls for 2 player games? Visit Vegipete's *Mite Library for cool programs. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
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 StatesPosts: 1427 |
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 StatesPosts: 1427 |
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: AustraliaPosts: 6283 |
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 KingdomPosts: 4044 |
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 StatesPosts: 1427 |
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 StatesPosts: 1427 |
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 KingdomPosts: 10310 |
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 StatesPosts: 1427 |
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: CanadaPosts: 1132 |
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 KingdomPosts: 4044 |
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 KingdomPosts: 7937 |
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 StatesPosts: 1427 |
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 StatesPosts: 1427 |
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 KingdomPosts: 7937 |
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 KingdomPosts: 4044 |
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 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |