My next module

Ordering prototype boards next week. I decided to bitbang the protocol as suggested in the other thread here. It uses a Y socket, but only the first four data pins (clock, select, data1 and data2.

I finally found the data sheet on the original NES controllers – looks like they support a minimum of 3v on the internal shift register, so no need for me to scale down the (usual) 5v data signal.

The most expensive part here is the NES socket - they’re $1.99 each through a single supplier (parallax), and there are two on the board. You can order new NES controllers these days through Parallax and others for under $5 each.


Awesome! So, are you taking orders? I’ll take two.

The top red trace doesn’t seem to end anywhere. Am I missing something? Is this for one controller or two? Been a while since I’ve seen what the connector looks like…

Eventually. I’ll need to get the samples turned around (takes the better part of a month - shipping from china is always around 14 days) and the driver written before taking orders :slight_smile:

Fixed after posting. The whole top layer is 3v3 so the trace was redundant. Part of it hung around after I added the pour.

Two controllers. On a Y socket, I could technically do 4, but those connectors are big (board would end up large - the connectors are almost as big as standard 3 pin poiwer supply plug connectors) and expensive ($8 just in connectors in that case). I hate to use up a whole Y socket, but I couldn’t see any other reasonable choice here unless I made it X socket and only allowed one controller. Supporting the gun and glove don’t seem possible (they use other types of IO not compatible with Y), but I’m still looking into it.

The connectors used are these:

They have an end-of-life’d breakout board which is dirt cheap as well.


Is there a 90 deg option for the socket? Of course, I want to put one of these on the side of Gadgetab :slight_smile: Actually, the way the sockets are laid out I would have to add two in order to use two joysticks (if the sockets are available in 90deg) :frowning:

EDIT: I just looked at the end-of-life breakout board. That actually looks like it would work out better for my configuration. I may get one of those then buy one of yours just for the driver :slight_smile:

Ian, no need to get one of mine just for the driver, but I appreciate the thought :slight_smile:

I’m looking at optimizations for the board as I don’t like the layout. For example, moving the Gadgeteer socket to the back side to give me more room to play with.

What would make it work for your situation (what’s the constraining factor)? The board from parallax is pretty big: just over 3" by 1 3/8"


Don’t worry, I’m sure I can find more than one use for this :wink:

Ideally, I’d like to mount it to the base board of Gadgetab and have the sockets mounted at right angles so they are accessible through the side openings (see pic). However, I just checked out the dimensions for the NES sockets and I think they may be too big. My openings are 9/16". So, my only plan B if I were to mount it in Gadgetab would be to drill some holes in the box and make it a permanent fixture. To do this, I would prefer to have the sockets side-by-side in a long width and short height with the 10-pin socket on the opposite side.

Ok. If I put the Gadgeteer socket on the backside, and stretch the board horizontally (it will be more expensive than the other one as it no longer fits in a 5cm square), I can fit both sockets side by side.

It ends up apx 17mm by 74mm.

Would that work in your situation?


I may have to stretch it one more notch to make sure the mounting holes are cleared, but LMK either way.

This layout is a little nicer as it fits a generally expected joystick port layout.


That would work great for mounting to an enclosure. If others want to just mount to a plate it wouldn’t be so great. Don’t let me be the deciding factor. I have another problem in that where I would want to mount it the wood is over 3/4" thick. So, it still may not work out too well. I could just make it so that it looks like a Y adapter and plug it into another header in the side gap when it’s needed. If there’s a next revision of Gadgetab then I could route out a good spot for it. Once it’s all glued up that’s tough to do.

This reminds me… I could really use some 90deg 10-pin sockets to mount on an Extender. Have you seen any 90deg versions?

You picked the right type of gamepad then :wink:

The end of the connector sits 1/16 under 3/4 from the face of the PCB.

Regardless, I actually like this layout a bit better. It feels more Nintendo-ish to me than the stacked version.


You mean Gadgeteer sockets? I think Samtec may have actually had some of those in through-hole.


btw, routing close to the mounting hole has been fixed. Just noticed it when uploading :slight_smile:

Sounds like a match made in heaven then :slight_smile: I should be able to work up a router template then to match the sockets and fairly easily route it from outside the box then if I can get by w/o recessing the module into the wood. I’ll just screw it flush with the inside of the box.

[quote]could really use some 90deg 10-pin sockets to mount on an Extender.
You mean Gadgeteer sockets? I think Samtec may have actually had some of those in through-hole.[/quote]

I’ll look into that. It would be nice to be able to have the option of connecting modules from outside the box.

I’m interested as well in everything above. Pete, put me down for a couple of boards as well! Between Ian and I, should be able to come up with some nifty mounting solutions for it as well.

Prototype works. Driver written (supports both a polling approach and an event approach). Time to order boards :slight_smile:

Here’s an example polling client:

private void PollingTest()
    var timer = new GT.Timer(1000);

    timer.Tick += (t) =>

            ShowGamepadState(gamepad.GamepadAState, "A");
            ShowGamepadState(gamepad.GamepadBState, "B");
            Debug.Print(" -------- " + DateTime.Now.Ticks);



private void ShowGamepadState(NesGamepadState state, string gamepadID)
    if (state.IsButtonAPressed)
        Debug.Print(gamepadID + ": Button A Pressed");

    if (state.IsButtonBPressed)
        Debug.Print(gamepadID + ": Button B Pressed");

    if (state.IsStartPressed)
        Debug.Print(gamepadID + ": Start Pressed");

    if (state.IsSelectPressed)
        Debug.Print(gamepadID + ": Select Pressed");

    if (state.IsDPadLeftPressed)
        Debug.Print(gamepadID + ": Left Pressed");

    if (state.IsDPadRightPressed)
        Debug.Print(gamepadID + ": Right Pressed");

    if (state.IsDPadUpPressed)
        Debug.Print(gamepadID + ": Up Pressed");

    if (state.IsDPadDownPressed)
        Debug.Print(gamepadID + ": Down Pressed");

and here’s an example event client

private void EventTest()
    gamepad.ButtonAPressed += new NesGamepadModule.ButtonEventHandler(gamepad_ButtonAPressed);
    gamepad.ButtonAReleased += new NesGamepadModule.ButtonEventHandler(gamepad_ButtonAReleased);

    gamepad.ButtonBPressed += new NesGamepadModule.ButtonEventHandler(gamepad_ButtonBPressed);
    gamepad.ButtonBReleased += new NesGamepadModule.ButtonEventHandler(gamepad_ButtonBReleased);

    gamepad.SelectPressed += new NesGamepadModule.ButtonEventHandler(gamepad_SelectPressed);
    gamepad.SelectReleased += new NesGamepadModule.ButtonEventHandler(gamepad_SelectReleased);

    gamepad.StartPressed += new NesGamepadModule.ButtonEventHandler(gamepad_StartPressed);
    gamepad.StartReleased += new NesGamepadModule.ButtonEventHandler(gamepad_StartReleased);

    gamepad.DirectionChanged += new NesGamepadModule.DirectionEventHandler(gamepad_DirectionChanged);


void gamepad_DirectionChanged(NesGamepadModule sender, NesGamepad gamepad, bool up, bool down, bool left, bool right)
    Debug.Print(gamepad + " Direction changed. Up:" + up + " Down:" + down + " Left:" + left +" Right:" + right);

void gamepad_StartReleased(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Start Released");

void gamepad_StartPressed(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Start Pressed");

void gamepad_SelectReleased(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Select Released");

void gamepad_SelectPressed(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Select Pressed");

void gamepad_ButtonBPressed(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Button B Pressed");

void gamepad_ButtonAReleased(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Button A Released");

void gamepad_ButtonBReleased(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Button B Released");

void gamepad_ButtonAPressed(NesGamepadModule sender, NesGamepad gamepad)
    Debug.Print(gamepad + " Button A Pressed");

Tested with a spider since my Cerberus testing was…interrupted.

I’ll have this all up on codeplex. For testing, I used one of those end-of-life parallax boards, so feel free to use the driver if you have one of those kicking around. Connect the board’s +5V to Gadgeteer 3V3. The chip in the NES controller will run find on that voltage, and I don’t have to worry about stepping down 5V.

// need a Y socket.
// Pin 6 is latch
// Pin 7 is data A
// Pin 8 is data B
// Pin 9 is clock

Now this is out of my system, back to working on my XAML book :slight_smile:


You can find the full driver source code in the tree:

I don’t have all the Gadgeteer module goo there yet (image, designer support), but the code is up.


Bummer, just got excited, then disappointed… :frowning:

A few weeks ago I cleaned out my closet and found my(now useless) PAX Power Glove.

Then I saw this work being done. Yay.

Now looked at the connector on my Power Glove. Normal 15 pin, for Famicom… :frowning:

As far as I know though it doesn’t use anything different from a normal controller. It can look like a normal controller to the console. But the console can identify it and get more info from if via extra commands…

Nice job, Pete. Looks like it does everything anyone could want it to do.

The power gloves can be made to work, but the pin requirements are more than a single Gadgeteer socket is going to handle without help, I believe :slight_smile: I left the glove and gun connections off the pinout in this Gadgeteer module.

Cool that you have one of the old famicon ones. I bet those are rare.