Tuesday, January 6, 2009

Robotics and DCC.

What if we had a little robot in every loco?

Today, there are a lot of very smart little high tech toys that employ robotics. We also have vacuum cleaners and lawnmowers that are very smart.


Robots are aware of their surroundings and react to them. You can buy a robot kit from your local Radio Shack. I got one just to learn how to program the processor. It's amazing to see a little robot avoid obstacles or follow your movements as you walk around. Even more surprising is that the little kit can "see" without some expensive camera. Using just one simple photocell, and two LEDs, it can tell if an object is directly ahead, a little to the left or right, or a lot to the left or right. It can also tell how far away it is and how wide it is.


Today's robots use very simple sensors and a lot of "smarts". It surprised me to discover that most of the sensors that these robots use are the motors that run the robot.


Back Electro-Motive Force (BEMF) tells the robot how much the robot moves. Current draw tells the robot how much work the robot is doing. Many robots use the motor to detect when they run into an obstacle, eliminating expensive, unreliable bumper switch contacts.


Carpet cleaning robots can tell how thick the carpet is, how much dirt is being sucked up, and when the bag is full, in part by measuring the current draw of the various motors.



An experiment with a PIC-AXE robot.


Just for fun, I modified a little robot kit from Radio Shack to run around on my garden railroad. It had one motor for the left side wheels, and another for the right side wheels. Since the wheels on the outside of a curve turn faster, I was able to store that data in the little robot. Then, at the end of it's run, I could download the data into my PC and draw a crude diagram of my layout. It didn't work very well, but, it did work. Imagine that! A track diagram using only the motors as sensors.



So, I can imagine some reader is about ready to give up on me.
He probably thinks,"There is no way I'm going to install all new decoders with robotics built into all my locos."


Remember, I want the system of the future to be smart, but use existing, off the shelf DCC decoders. We won't be installing "robot boards" in every loco.


It turns out, that we can install "VIRTUAL ROBOTS" in our trains. We will just use one small processor connected to the system, to run robotic software for all the trains.


All our robots can be connected trackside. They control each train by sending DCC commands over the rails.



It turns out, that this is a very efficient, and inexpensive way to add smart features to all the trains. The system only needs to load one copy of a robots code into memory. That single copy can be executed over and over for multiple trains.