Load Control 2

Something new was on the horizon. Actually, the idea for a controller replacement I had was not new. Back when I built my last wattmeter hack, I was already thinking I'd like to sense the direction and speed of a rotating meter disc using an optical computer mouse. I had spent a good deal of time searching the internet for ideas or plans, and asked nearly everyone I knew who had computer or programming experience about the hardware and code needed to do such a project, but no workable solutions presented themselves.

A few months back I was explaining my solar power system to a visitor (John of the Polymecca Housetruck), and mentioned the mouse idea. John replied that "a lot of people are building things using Arduino microcontrollers". That sounded kind of exotic and probably expensive, so I didn't think much more about it.

A few weeks later, I tried searching again using the string mouse+control+stepper+motor. One of the results was a kid who built a controller for a toy robotic arm that used a mouse for the user input. One thing did jump off the page at me, he was using an Arduino to interface with the mouse and run the code needed to make it work. It didn't take much more searching to turn up as much information as I wanted about these small and ubiquitous processors. People were indeed building an amazing array of projects around the platform. Searching auction sites brought back results indicating that the complete circuit boards, ready for loading a completed program were available dirt cheap and from many suppliers.

For many years, I had thought about exploring microprocessors, but never quite made the leap. Basic Stamp, PIC, etc, although they were reasonably priced, by the time you bought the development kit, prototyping board, communications adapter, and all the other add-on accessories, it seemed to be a bit of an investment for something that might or might not catch on with my interest. The clincher for the Arduino was when I looked at the programming code, "C", it looks very like PHP, which I'm already familiar with, if not proficient in. Also, all of the code, etc is open source, and programs are freely distributed on the 'net. I ordered a unit from one of the auctions, $16.99, with a free bonus!, a USB interface cable.

While I was waiting delivery, I took more time to explore the world of Arduino, reading the "Getting Started" guide, downloading the development software interface (open source, "free"), and looking for suitable program examples I could integrate into a working mouse driver. To my surprise and satisfaction, there were program "sketches" (Arduino programs are called this before compiling) that interfaced a PS2-type mouse to the processor. There were even tutorials on ripping apart optical mice and soldering wires into their tiny brains to grab signals to use for motion control. Things were looking better, but whether or not I'd be able to actually control my big, heavy Variac with all this stuff was still open to question.

Once the processor had arrived, I realized that it was even smaller than I had imagined. I had opted to purchase the Adruino Duemilanove with an ATmega 328 processor chip. Duemilanove means "2009" in Italian, so I guess I was right in my first impression that this was somewhat exotic. The circuit board was simple to set up, easy to connect outside wiring to, powered itself from my computer's USB port, and accepted and ran all of the elementary sketches I fed it without complaining. I did all the basic stuff, making a blinky light, running a serial communications connection, and even controlled a small RC servo motor using a potentiometer as the input device.

Digging around in my storage of old computer parts, I found a PS2 mouse. "WTH", I thought, "if I burn this stuff up experimenting, I'm not out a lot of cash", so I made the indicated connections, loaded a simple sketch that would read the mouse and display output information on the serial terminal, and fired it up. Like everything else I tried, this simply worked, the serial display indicated the movements of the mouse in each direction, complete with velocity information, button presses, etc. This was a big step forward! Plugging in an optical PS2 mouse produced the same results, so things were looking even better.