After a few hours of work tonight, I managed to mate the NES controller with my mill. Seems to be a match made in heaven. The video is below for proof and the code is below that if you want to try this out for yourself (it's very easy).

I'm planning to make this a permanent feature of my mill. In order to give it a cleaner appearance (instead of just shoving wires into the controller), I've ordered a set of NES controller sockets from parallax which I will be mounting in my case.

A couple of notes:
1.) The code is terrible, I will try to clean it up and re-post sometime soon.
2.) This is a very easy project, If you're trying to interface your easydrivers with a 3 axis mill, a homemade bot, or anything else and want to add NES controller pad capabilities, give this a look. You'll be surprised.
3.)The X axis on my machine is terribly loud. I need to fix that it....
nes_stepper.pde
File Size: 5 kb
File Type: pde
Download File

02/24/2010 - EDIT: An updated version of the code used to drive 3 Easy Drivers via and Arduino and a classic NES controller. Not a whole lot of changes to the original, just a little bit cleaner, more concise, and thoroughly commented.
nes_stepper_cleanedup.pde
File Size: 4 kb
File Type: pde
Download File

 
 
As mentioned yesterday, driving the mill with an N64 controller seems like an awesome idea. Today, I set to work trying to figure that out. I was almost immediately sidetracked
As luck would have it, my stash of NES controllers (qty: 2) were in the same location as my stash or N64 controllers! I couldn't resist.

Shapeoko needs a "joystick". All CNC machines have one. They are either software controlled (buttons on screen) or hardware.  They are necessary to move the gantry out of the way and to "home" your machine to the material. I have an old joystick from an arcade I build a few years ago that I have been planning to use.

However, one of the problems using a traditional joystick is that it takes up one port for each direction you are trying to capture. So in our case we would want: Forward, Back (Xaxis), Left, Right (Yaxis), Up, Down (Zaxis). That's 6 inputs we would need!

The NES controller doesn't need one output for each button because it's digital. What's that mean? Good question. Here is how I understand the NES controller to work: The chip inside the controller is polling the status of the buttons at a rapid rate. When the buttons are not being pressed, the result of the poll looks like "11111111" (one bit for each button). After the controller is done polling, it sends that string to the console (in our case the Arduino) which is then interpretted by the program into whatever the button are mapped for.

If you press a button then the string changes to reflect it. For instance if you press the select button the string changes to 11011111. The cool part about this is the arduino need only use 3 ports to interface with all 8 buttons! The three ports are for "Clock", "Latch", and of course data. The data wire is where all the action is! Clock and latch are there to keep the timing correct.

To be honest I don't completely understand how it works, but I figured it out enough to capture the inputs with the Arduino and light up the corresponding LEDs! I would like to say, as a side note, working with a "digital" also prevents you from having to debounce the button pushes. Because that debounce logic is already in the chip that's doing a2d inside the controller! we're just taking the "clean" data :)

Here's a quick video of the setup in action. The code is below if you want it.
Now that the buttons are mapped and I feel pretty confident about capturing button presses, I am going to get to work on writing the code to control the step/dir functions of the easy drivers.
simplenes_led.pde
File Size: 3 kb
File Type: pde
Download File

 
 
While doing any long term project you are bound to run across three things: Good things, bad things, and downright ugly things. It's part of the territory. In fact, for a hobbiest, these are the things that make a project a project!

The Good:
A short blip about the project was mentioned in a recent article on Tom's Guide. Grant it, after seeing the posting on Sparkfun, I was actively pursuing being featured in the article, but none the less we made it in! That pretty much made my week.

The Bad:
Last Saturday I drove to a "local" (2 hours away) hackerspace meeting to meet up with fellow geeks and check out what other people have been up to. A couple of bad things happened: Only 2 people showed up (not including the host and hostess). This ended up being OK as the the host and hostess did a fantastic job of making us feel welcome. Even with the limited number, we managed to bottle some beer and have a generally good time BSing with each other.

Worse: I tried showing off my mill project (yes, I brought it with me!) but for some reason, I couldn't get it to work. I thought that during the trip something on my protoboard became disconnected.

After all it was the first time I had moved the machine and with extensive use of a breadboard, it wasn't exactly in mobile form to begin with. After troubleshooting for about 15 minutes, I couldn't figure it out and just packed it up. Not a big deal. I figured I'd get it running once I got back home.

The Ugly:
After making the 2 hours trip back to my house, I unpacked the mill and took it back into the Lab, hooked everything back up, put the meter to a few key connections, and tried to give it a test run. Nothing. OK. It had been a long day, I unplugged everything and let it sit.

After a few busy days of domestic duties and work, I had some time Tuesday evening to work on it. After messing around disconnecting the easy drivers from the protoboard (not an easy task!) and simplifying my circuit to only one axis and a simple (known working) sketch. I couldn't get anything to work.

I emailed the creator of the Easy Driver and asked him on a couple of things. Being the generous person he seems to be, he replied with a few tests (procedures) to check if the drivers were fried. Long story short: They were.... All three of them were fried! Here's a couple of pictures of my metering.....
To make matters worse: I fried my Arduino too! It seems that when I tried to demo my machine at the hackerspace meeting I crossed the +24v from my Power Supply and the GND, which essentially meant that I sent 24V into the arduino and then into the Easy Drivers. Both of which were only expecting 5V....

Right now I have a new Arduino on its way from Sparkfun. I will order the easy drivers tonight. In the meantime I'm hoping to learn how one may protect against accidents like this....

But I'll stay positive because, to steal a quote from Dostoyevsky, "A just cause is not ruined by a few mistakes" :)