Windlenook Gets Its Joystick Throttle

When I took the Windlenook project on its very first outing to the Maker Faire last November, I had to hook it up to an old MRC power pack. I’d attempted to get an Arduino-based joystick throttle working at the last minute, and couldn’t get it to respond. I finally revisited the throttle circuit after New Year’s, and discovered that it was just a few code errors away from working. Oh, well.

I’m a little rusty on my Arduino these days, but I’m trying to work my way back in. Two of the errors were improperly-declared variables: integer, instead of Boolean. The microswitch is either on, or it’s off. Why did I try to use an integer for that? Amateur mistake. The other mistakes were nearly as dumb. Without the pressure of a show the very next day, it took me maybe twenty minutes to find and fix the problems. And it worked!

The joystick I’m using is a standard, off-the-shelf arcade game part. I had assumed when I ordered it that it would have an X-Y pair of potentiometers, for sensing just where on each axis the stick was. The thumb-sized joystick I used in the Command Project was like that. Nope, this one’s not analog, it’s just four microswitches surrounding the stick. So much the better, as far as I’m concerned. This project doesn’t need a high degree of control, and this joystick was easy to wire up, and write code for.

A throttle like this needs to be a little more sophisticated than simply power on-or-off, however. I wanted to limit the speed, so as to minimize the pounding on couplers and bumpers. I also needed to be able to adjust the voltage to accommodate different engines. It got even more complicated than that. While the Athearn switchers would start and run just fine on a steady voltage, the Dockside needed extra voltage to kick it into motion. Without that, it would just sit there and hum, or tear down the track at high speed, depending on the setting. Blame it on a very old, high-friction drivetrain. I added some code to deliver an initial burst of full voltage (for about 1/12 of a second) before settling down to the running voltage. The Dockside seems to respond pretty well to that. I can get it to move along at an almost-reasonable switcher speed now.

We had a show at a suburban library last weekend, in a multi-purpose room with plenty of space and available tables. I brought Windlenook along, and set it up across the room from the club’s T-Trak layout. A lot of families with 5-and-under kids showed up to see our display. The joystick throttle did its job well. Windlenook calls for a little more cognitive development than a typical preschooler possesses, but they all loved moving the joystick back-and-forth, and watching the locomotive push a long string of boxcars into the bumpers. Parents were grateful that there was something hands-on for the youngsters, and my clubmates, despite their lingering suspicions about HO scale, appreciated the distraction for inquisitive fingers.

I still have a lot of features to add to Windlenook, but I’m pleased with the progress.