This page contains a Flash digital edition of a book.
dwell time after turn on providing 60 percent on time on the average. It uses a pseudo-random number generator to make the sequence as unpredictable as possible. You really don’t need to know how it all works, but you should learn how to copy it and load it into your controller. The fun comes when you start to modi- fy it to make it do more for what you want it to do.


Grade crossing animation Remember the sequence of actions we considered before at a railroad crossing? Table 2 shows what has to happen at each step. You will notice right away that there is a delay before the gate is activated, which is often missing from modeled crossing activities. This is actually an


help you out. In turn, you can intro- duce them to scale model railroading too! (See Arduino side bar.) For my modeling, I use the version of


the Arduino called the Pro Mini. Its ad- vantages include low cost ($3.28 at this time, early 2014), accurate fine timing, and overwhelming flexibility. With it you can control lighting, d.c. motors, servo motors, stepper motors, sound modules, and even generate DCC com- mands.


The example in the accompanying


Table 1 shows how to randomly turn a set of up to 16 lights on and off with a


The Arduino as a modeling tool T


he essence of an Arduino is a small, self-contained comput- er on a board, containing the basic elements (processor, memory) necessary to run programs. But conceptually, it also includes the tools to write, edit and organize the collection of programs you might likely want to control lighting, d.c. motors, ser- vos, steppers, timers, sound generators, displays, touch panels, memories, communications channels, and DCC decoders. It can also read, sample or measure data from switches and sensors. A sensor is a piece of hardware that makes some physical measurements like distance, sound levels, light levels, magnetic fields, voltages, acceleration, motion, pressure, RFID tags, shaft encoders, and, well, you get the idea, just about anything. Look it up at: http://playground.arduino.cc/Main/InterfacingWithHardware. There is a great deal to see there. Most of my animation work with Arduino controllers uses the small, cheap ($3.28 as of this writing) Pro Mini boards. One Pro Mini con- trols one animation, or in some cases one part of an animation. If you compare the cost for a grade crossing application, the little Pro Mini comes way out ahead of all alternatives, including typical commercial units. You only need a USB to TTL serial programming cable ($8-10) connected to your Windows PC, Apple MAC, or Linux machine, and free software from http://arduino.cc/en/Main/Software to get going. Programs for the Arduino are called sketches. Sketches typi- cally consist of definitions, a section which runs only once, and a section which loops indefinitely. All the tools to edit, translate, and load your sketches are part of the free package. Sample


RAILROAD MODEL CRAFTSMAN


sketches used in this article are available too. The Arduino started as a common, freely available teaching tool in Italy and has spread, literally, world-wide. Technically, it is a mi- cro-controller based on the Atmel family of integrated circuits. They can operate on as little as 2.2 to 5.5 volts, but on standard Arduino boards which include a voltage regulator they can be powered from up to12 volts. You can use a small, plug-in “wall wart” power adapter (anywhere from 5 to 12 volts). The boards alone consume very little power. Often, most power consumption comes from what the Arduino controls. I never used to consider battery power for anything but radio throttles on my layout, but I can run some bat- tery powered animations on AA batteries for over ten hours. So, my criteria has become if I can power something for an entire, long op session, then that’s good enough. The Arduino is not the only available, low-cost, micro-controller


board. MicroChip has the PIC series, and Texas Instruments has its LaunchPad boards. The gigantic differentiator is the amount of free and freely available software applications (programs), li- braries, tools, board varieties, compatible hardware, books, guides, tutorials, and general knowledge oriented around and for Arduinos. They are used as teaching tools from grade schools to research organizations at MIT, and there are libraries available to have the Arduino substitute for a DCC command station. For mod- el railroading, they are cheap, versatile, small, and low power. There is a learning curve, no doubt about it. Get past that and you will have a new powerful tool on your workbench.–GEOFF BUNZA


77 Fig. 3: Building lights circuit GND


1 2 3 4 5 6 7 8 9


10 11 12


Pro Mini


TX0 RX1 RST GND 2 3 4 5 6 7 8 9


RAW GND2 RST2 VCC A3 A2 A1 A0 13 12 11 10


Arduino Mini


24 23 22 21 20 19 18 17 16 15 14 13


VCC 5 volts


L2


L3 L4


L9 L8 L7 L6 L5


R12 R11 R10 R9 R8 R7 R6 R5 2K 2K 2K 2K 2K 2K 2K 2K


L13 L12 L11 L10


L17 L16 L15 L14


2K R4 2K R3 2K R2 2K R1 2K R14 2K R13 2K R16 2K R15


Page 1  |  Page 2  |  Page 3  |  Page 4  |  Page 5  |  Page 6  |  Page 7  |  Page 8  |  Page 9  |  Page 10  |  Page 11  |  Page 12  |  Page 13  |  Page 14  |  Page 15  |  Page 16  |  Page 17  |  Page 18  |  Page 19  |  Page 20  |  Page 21  |  Page 22  |  Page 23  |  Page 24  |  Page 25  |  Page 26  |  Page 27  |  Page 28  |  Page 29  |  Page 30  |  Page 31  |  Page 32  |  Page 33  |  Page 34  |  Page 35  |  Page 36  |  Page 37  |  Page 38  |  Page 39  |  Page 40  |  Page 41  |  Page 42  |  Page 43  |  Page 44  |  Page 45  |  Page 46  |  Page 47  |  Page 48  |  Page 49  |  Page 50  |  Page 51  |  Page 52  |  Page 53  |  Page 54  |  Page 55  |  Page 56  |  Page 57  |  Page 58  |  Page 59  |  Page 60  |  Page 61  |  Page 62  |  Page 63  |  Page 64  |  Page 65  |  Page 66  |  Page 67  |  Page 68  |  Page 69  |  Page 70  |  Page 71  |  Page 72  |  Page 73  |  Page 74  |  Page 75  |  Page 76  |  Page 77  |  Page 78  |  Page 79  |  Page 80  |  Page 81  |  Page 82  |  Page 83  |  Page 84  |  Page 85  |  Page 86  |  Page 87  |  Page 88  |  Page 89  |  Page 90  |  Page 91  |  Page 92  |  Page 93  |  Page 94  |  Page 95  |  Page 96  |  Page 97  |  Page 98  |  Page 99  |  Page 100