I'm currently working on project where I need an analog SPDT switch to be only triggered by a long button press.

Long story short I'm trying to make a module that would fit inside a Game Boy. This module would consist of the analog switch and the long button press registration part. The switch needs to be triggered when one of the existing button on the Game Boy is pressed for a long time (let's say select held for 2-3 seconds). The switch will then trigger a different oscillator and send a higher frequency to the Game Boy, overclocking it. I've got everything figured out but the long button press thing (at least I think).

Thanks in advance for the help, and sorry for my limited knowledge in electronics

  • \$\begingroup\$ hm, while not impossible, switching out a crystal oscillator does sound tricky. How do you plan to hook up the crystals through an analog switch? \$\endgroup\$ Commented Nov 4, 2018 at 19:06
  • \$\begingroup\$ It's on an SP, I removed the existing the crystaland added an 8mHz one. This is figured out as I tried with a physical SPDT switch and it worked fine, so electronic one should be fine ? \$\endgroup\$ Commented Nov 4, 2018 at 21:00
  • \$\begingroup\$ hm, it might be, but a physical switch is, at higher frequencies, pretty different from an analog one, and you'd need to take things like its parasitic capacity and phase behaviour over frequency into account! \$\endgroup\$ Commented Nov 4, 2018 at 21:06
  • 1
    \$\begingroup\$ This is getting to be a FAQ here. Looks like a lot of people are looking for something that mimics the behavior often found in cell phones and other devices, now. If someone else doesn't do it, I may just set up a small business making odd-ball parts, with selectable options available, in sot-23-6 that the big boys won't bother competing in. \$\endgroup\$
    – jonk
    Commented Nov 4, 2018 at 21:45

1 Answer 1


That'll be harder than you think.

As far as I remember, the gameboy buttons are scanned, i.e. the hardware activates a set of current sources in sequence, and for each of them checks which current sinks see a current flow.

That way, you don't need an pin for every single button. Compare reverse engineered schematics.

But that means that no button ever is "continuously" conducting current if pressed.

So, you'd have to build something that "counts" how many times within a time span a button has been closed whenever there was voltage across it; basically, do the same as the gameboy hardware does itself.

There's certainly clever ways of doing that, but let's be honest here: the by far easiest way, and with a solid chance also themmost compact one, would be a cheap small microcontroller hooked up to observe the voltage across the button matrix diodes (with high impedance, of course).

Doing so would have another benefit: Instead of then using an analog switch to change crystals (not even sure that works; analog switches have their own capacitances and phase behaviour, and your CPU + oscillator combo needs a specific loading capacity to work), you could unsolder the crystal, and replace it with a differential clock generated by your microcontroller; it's totally feasible to use the original oscillator (or a compatible one) to drive your microcontroller. That would then use a multiple of the oscillator's frequency (for example, 16× the oscillator's frequency) to generate its internal clock, and you could then generate any division of that clock with the built-in PWM unit that basically any microcontroller has.

Lower-tech solution: Use a reed switch / relay to switch out oscillators, and actuate that with an external magnet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.