Robot Trains in the Garden motor control circuit

11,741

Robot Trains in the Garden motor control
Robot Trains in the Garden motor control

The individual has been engaged in garden railroading for just over a year, utilizing skills from various hobbies. They have designed and built two scratch-built bridges and nearly 100 trestle bents to support a 200-foot main line. Their interests in photography, computers, and web design have enabled them to document and share their railway work. The latest project involves programming small, single-board microprocessors to control devices and sense their environment. They have experience with Basic Stamp microprocessors, using them for tasks such as temperature sensing, battery management, and operating small autonomous robots. The current project focuses on controlling a battery-operated railroad engine, which is programmed to accelerate from a stop, cruise at a preset speed, and stop when passing over a magnet that activates a reed switch. The system can be expanded through software modifications to include various functionalities, such as pausing at multiple locations and controlling turnouts for different routes. The design allows all electronics to be housed in the engine, facilitating operation on switchbacks and enabling multiple engines to run on the same line. NiMH batteries are employed as a cost-effective rechargeable power source, providing 14.4 volts from 12 AA cells to power the engine for several hours. Although a circuit could be built using discrete logic and timer ICs, the microprocessor approach offers greater flexibility and ease of modification. The choice of microprocessor is critical; while the Basic Stamp is widely used, its lack of interrupt capability in common models is a limitation. A more affordable option, the PICAXE, has entered the hobby microprocessor market. Interrupts are essential for responsive operation, allowing the microprocessor to prioritize important events, such as detecting magnets on the track.

The project utilizes a microprocessor-based control system for a battery-operated railroad engine, enhancing the functionality and flexibility of the railway operations. The microprocessor is programmed to manage the engine's acceleration, cruising speed, and stopping behavior in response to magnetic sensors embedded in the track. When the engine approaches a magnet, the reed switch is activated, signaling the microprocessor to initiate a gradual deceleration to a complete stop. After a brief pause, the system reverses the engine's direction and resumes movement until it encounters another magnet, at which point the cycle repeats.

This design not only simplifies the wiring and component requirements by integrating all electronics within the engine but also allows for sophisticated operational capabilities. By modifying the software, the system can be programmed to pause at various predetermined locations marked by magnets, enabling complex route management. Furthermore, by incorporating additional microprocessors, the design can control track turnouts, allowing for dynamic routing of the trains.

The power system is based on nickel-metal hydride (NiMH) batteries, which are chosen for their cost-effectiveness and rechargeability. A configuration of 12 AA NiMH cells provides a nominal voltage of 14.4 volts, ensuring sufficient power for extended operation of the small engine. This choice of power source supports the project's objective of maintaining a lightweight and efficient system.

While discrete logic circuits could fulfill many of the project's requirements, the use of a microprocessor significantly streamlines the design process. Changes to the system's behavior can be implemented swiftly through software updates, eliminating the need for extensive rewiring or additional components. The selection of the microprocessor is crucial; while the Basic Stamp is a popular choice among hobbyists, its limitations regarding interrupt handling necessitate consideration of alternatives like the PICAXE, which offers more advanced features at a lower cost.

Overall, the integration of microprocessor technology into garden railroading presents an innovative approach to enhancing the user experience, allowing for customization and expansion of functionalities that cater to the creative aspirations of hobbyists.I have only been actively involved with garden railroading for a little over one year but have found it to be a wonderful way to use the skills and interests that I have developed over the years in other hobbies. For example, I used my love of woodworking to help me design and construct two scratch built bridges and nearly 100 trestle bents to sup

port much of the 200 foot main line on the railway. My interests in photography, computers and web pages allowed me to document the work on the railway and share it with my friends and family, wherever they may live. (see: ) My latest collaboration between hobbies involves using my work with programming small, single board microprocessors and using them to control devices and sense things around them.

For many years I have worked with small Basic Stamp microprocessors (see: ). I have used the Basic Stamp to sense and react to temperature changes, monitor and control the charging of batteries, record the acceleration of model rockets and to operate small, autonomous robots. This project is a logical extension of my work with robotics as it involves using a similar microprocessor to control a battery operated railroad engine.

The system is designed to have the engine slowly accelerate from a complete stop and then cruise at a preset speed until it passes over a magnet located on the track. When this happens a reed switch closes and the microprocessor gently slows the engine to a full stop.

After a short pause the engine reverses and starts up again until it passes over another magnet when the process repeats. Although the original objective of the system was the auto-reverse system as described above, the hardware is capable of much more sophisticated operation by modifying the software.

It could, for example, have a train start off and pause any number of times at various locations identified by magnets in the track. In conjunction with another microprocessor and controller it could also cause turnouts to switch so that the train could follow a different route.

The only limitation is one`s imagination. (In the event that your imagination is suffering from a long, cold winter I have some ideas at the end of this article!) operation simplifies this particular system by allowing all electronics to be housed in the engine. It also allows us to ignore problems that arise when entering switchbacks and wye`s and allows us to run multiple engines on the same line.

NiMH batteries are used as they provide the most economical rechargeable power source. A total of 12 AA cells provide 14. 4 volts and should power a small engine for several hours. Although most of the objectives for the project could be met by creating a circuit using discreet logic and timer integrated circuits the overall flexibility and design is simplified greatly by the use of a microprocessor. Changes can be made in seconds with a simple program modification rather than needing to rewire or add components to a circuit.

The choice of microprocessor is always a challenge. The most popular small programmable system is the Basic Stamp by Parallax. Unfortunately the two most common stamps  do not have interrupt capability. The most inexpensive unit that supports interrupts costs nearly $80. 00. A new entry into the hobby microprocessor market is the PICAXE from Interrupts are something that we use on our computer every day. Whenever we use a mouse on a PC we are using interrupts. An interrupt simply tells the microprocessor that something very important is happening and that it must interrupt  everything else that it is doing so that it can deal with that special event.

When you move your mouse it is very important that the PC not miss that movement. An interrupt is generated that stops other things, moves the mouse cursor and then returns to its other obligations. Our system has one very important event that can`t be missed. The microprocessor must catch every magne 🔗 External reference