What's new

Strider999

Student
Joined
Feb 24, 2019
Messages
16
Reaction score
24
Location
Chicago
Hey all, Im working on a supergun design that uses a teensy 4.1 microcontroller. I want the button presses to come from the teensy but the pins are not 5v tolerant. Would using a level shifter, transistor or an optocoupler make the most sense? Or something else entirely?
 
I'm no expert, but when you're simulating button presses, I think all you're doing is tying a pin to ground. I don't think you'd ever put voltage through it.
 
You'll have to protect the teensy if it can't handle 5v.
Inputs on JAMMA boards are active low. This means that they're pulled high from the board side. This is usually accomplished with a resistor array as a pull up, so the voltage will be close to 5V.
When you press a button, the input is grounded so this is what you have to accomplish.
There are level shifters that are also buffer drivers so they can easily sink the current from the board. I think TI has what you want... From memory, you can accomplish this with the 74lv16(something)245. Input a low from the teensy and the IC will pull down the JAMMA input, simulating a press.
 
If you're trying to increase output voltage then you use a boost or step-up converter. If you're trying to reduce voltage you'd use resistors or pots.

A button press is just applying or disconnecting voltage (I.e. closing or opening a circuit). One of the easiest ways to do this is with relays (preferably solid state for gaming) or a mosfet.

Instead of having a button closing the circuit by tying a pin to ground, install the relay instead. Then use the Teensy to trigger the relay.

If the voltage from the Teensy is insufficient to trigger the relay, use a boost converter or an USB powered relay. I used this booster to increase the output voltage from my Guncon 2 from 3.3v to 5v for my recoil circuit:

WIN-20210419-12-09-39-Pro.jpg


I don't know what your project is but using a different device (I.e. one that can handle the right voltage) may end up being cheaper.

Are you making a USB decoder to use PC joysticks with jamma PCBs?
 
Have a look at your microcontroller's datasheet or application notes, they probably have suggestions how to interface it to 5v logic.
 
If you're trying to increase output voltage then you use a boost or step-up converter. If you're trying to reduce voltage you'd use resistors or pots.

A button press is just applying or disconnecting voltage (I.e. closing or opening a circuit). One of the easiest ways to do this is with relays (preferably solid state for gaming) or a mosfet.
this is all terrible advice.

the problem is that 5V is being generated by the arcade PCB, and the teensy needs to be protected from this (because it's outputs are not 5V tolerant) while also being able to drive those pins to ground. A Mosfet and a relay will "do it" but they're 100% the wrong tools for the job.

It's like someone saying they need to hang a photo on their wall and you're telling them to use a shovel to drive the nail... I guess technically it would work but no sane person should be doing that.

There are many good solutions to this problem. @ic3b4ll's advice is on the right track.
 
I think this is what you need: SN74LVCC4245A
 
Hey all, Im working on a supergun design that uses a teensy 4.1 microcontroller. I want the button presses to come from the teensy but the pins are not 5v tolerant. Would using a level shifter, transistor or an optocoupler make the most sense? Or something else entirely?
It sounds like you want the mcu to output a button press. Normally mcu's detect button presses as an input and respond.
I assume that the mcu uses 3.3volts as you said it's not 5V tolerant. If a non pressed simulated state is high (3.3V), the potential issue you have is that 3.3V may be below the threshold of the device that is detecting the button press. As you said you could use a transistor so that high uses the 5V rail and not your 3.3V rail.
 
I have never used the teensy, but I if I had to solve this I would leave the port in tri-stade (input mode with no pull-up resistor) when no button is pressed and to output ground when button is pressed. That might work but you have to look at the microcontroller data sheet to understand how the port behaves when you switch from tri-stade to output low. If the microcontroller is able to switch to one state to the other without any intermediate step (such as output high) you should be good.

I also recommend powering the microcontroller from the same power source as the supergun / jamma (you may have to use a voltage regulator if the teensy uses 3.3v and the PCB uses 12v or 5v) and have a common ground for the whole circuit. If you use different power sources you may create a differential (DDP) between both boards and burn either.
 
Zebra, Your youtube video inspired me to make a lightgun machine and connect it to a U-HID.

I have successfully completed it. The hardest part was actually the recoil.

I copied you as much as I could with the ne555.

I hooked the recoil signal wire to the uhid. But I could not figure out how you got the uhid to see the trigger signal and send it back out of the uhid via the recoil signal wire.

Most people had no idea what I was talking about. But I know you would.
I ended up using the LED function in the uhid config utility to send the 5 volt signal to the recoil signal wire. But I really want to know how you did it.

I’m not sure you are on here anymore. It looks like you haven’t been on since 2021, so I hope you are ok
 
Back
Top