Building your own Netduino-powered Game Console – Part 1

So, you’ve decided to build your own PIX-6T4 game console and you’re excited about learning C#?

Awesome! Buckle up, you’re in for a wild ride ūüôā

The first step of your journey starts with gathering a few parts, which you can find listed in this spreadsheet along with their current retail price¬†and links to the suppliers. In a nutshell, you’ll need about $95 to get all the required parts.

In an effort to keep the number of suppliers down to a minimum for your convenience, most of the parts for the PIX-6T4 prototype come from Sparkfun Electronics.

However, there are many alternative suppliers out there and with some research in Octopart, you will be able to reduce the cost of building this prototype.

Next time, we’ll cover the first step of the build, laying out the IC sockets, the analog joysticks, and some headers on the prototyping board, just like this:






Build a Netduino-powered Game Console

Over the past few months, my friend Bertrand and I have been working on a game console, the PIX-6T4, which is powered by a Netduino mini.

The console is designed as platform for learning digital electronics and C#: we’re in the process of writing a book covering all aspects of building the console, how its components work and how to write games for it with our¬†framework.

Here’s a video of the prototype of the console below:

and here, as we presented it during the Ask An Engineer Show-And-Tell run by AdaFruit on Google+ last weekend:

As always, it’s entirely open source / open hardware and we hope that you’ll have as much fun building your own and making games as we did, which¬†we will cover in a series of upcoming posts, often referring to past articles¬†on this blog.


Make Blog:

MSDN Blog:

Connecting an analog joystick to a netduino

Atari Joystick by Derek Erdman

The netduino project that I’m currently working on requires an analog thumb joystick for user input. Such parts can be scavenged from game console controllers¬†(PS/2 or Xbox 360 for instance) ¬†or can be bought from Sparkfun and Ada Fruit among others.

The joystick that I used in this article is Sparkfun’s and the datasheet for it is located here.

This 2-axis analog joystick is composed of two 10K potentiometers and features a push-button. Sounds like a piece of cake to work with, right? Well, it is but the devil is in the details as usual: each potentiometer is spring-loaded so that the joystick can return to the center when released.

If the springs aren’t perfectly balanced or with wear and tear, they will cause constant fluctuations in the readings even when the joystick is at rest. Even worse, the joystick might start drifting in one direction all the time!

For that reason, it’s important to calibrate an analog joystick at least once before using it so that the driver reading the potentiometer can compensate for the fluctuations.

The AnalogJoystick¬†netduino driver that I wrote (see the links at the bottom of the post) does this automatically when an¬†analog joystick instance is created by taking a bunch of sample readings and tracking the min / max values of the fluctuations, later using these are the ‘center’ area of the joystick. The caveat here is that the joystick must not be touched during that process. Fortunately, it only takes a fraction of a second to perform this calibration.

Connecting the joystick to the netduino

  • We’ll need to connect the potentiometer of the joystick to the analog pins on the netduino. I used the 3.3 volt power rail. Using analog pins first requires connecting the AREF pin of the netduino to the¬†3.3 volt power rail. Using the¬†5 volt power rail would work too, as long as the joystick and AREF are connected in a voltage divider configuration (v3.3 is the max on the netduino’s analog pins).
  • Designate one of the potentiometer as the X axis and the other as the Y axis. It does not matter which one is which.
  • Designate an analog pin on the netduino for the X axis (say GPIO_PIN_A0) and another one for the Y axis (say GPIO_PIN_A1).

Notice in the schematics that each potentiometer has 3 pins:

Connect them as follows:

  • Pot. pin # 1: netduino GND rail
  • Pot. pin #2: a netduino analog pin (GPIO_PIN_A0 /¬†GPIO_PIN_A1 in this example)
  • Pot. pin #3: netduino v3.3 power rail

The switch can be connected to any given digital pin on the netduino. Lady Ada has a fantastic tutorial on how to do it properly so I won’t elaborate on the subject ūüôā

The only thing that I will mention here is that I wrote an interrupt-driven  PushButton driver which will call back a user-defined method when needed, which is way more efficient than polling the digital input.

That’s it!

Action shot

You can see a video of the analog joystick used for moving a sprite on an LED matrix, building upon my previous posts discussing connecting an SD card to a netduino and driving an 8×8 LED matrix using persistence of vision:

Netduino analog joystick driver and test code

The analog joystick test code can be downloaded here.

Happy hacking!

The Atari Joystick artwork was used with permission from Derek Erdman. Thanks man! ūüôā