email 02

What is an Arduino? (R-dwee-no, King of Italy from 1002 to 1014)

It is a little board with a micro-controller doing whatever you told to do by running the software you put on it. Just like your computer, but a whole lot smaller with only a few (about 20, yes a few) pins to turn things on and off, or send pulses to move them around, or simply send 1's and 0's as data, like communicating with Morse code.

What can it do for your railroad, take a look at the pages I set up to follow along with the clinic: http://www.txnamib.com/electronics-and-software/rrrduino-for-model-railroads and the division-3-clinic page linking from it.

Then, take a quick look at the circuit shown here for a grade crossing controllerhttp://trains4africa.co.za/?p=309 and then imagine putting all that into ONE $5 Arduino, while also adding a speaker so the code can send out the bell sounds as the crossing gates go down. All now for less than $7 while they sell the posted controller for $47 (without sound)!

How do you power the Arduino? Either with the USB cable and plugging it into a computer or a normal 5V phone charger...or with a little higher voltage, like a 9V battery plugged into the Vin pin (it needs 7 to 12Vdc). There is a regulator on the board, dropping the voltage down to 5V, which the micro-controller wants.

How do you get your code onto the chip? With the USB cable plugged into a computer. Once you plug it in, a new COM port will show up in your computer's Device Manager (assuming Windows here) (MAC and Linux people will get a /dev/ttyXX...X) and you would the tell the software (Arduino IDE, free of course) you use to verify and upload your code, which processor and board you have and which COM port it is connected. Now, most people don't use a lot of COM ports on a daily basis, so I would most likely be the only one available in the software's list to choose from.

When does the code start running? As soon as you power the board up (the File->Examples->Basics->Blink program is pre-loaded on almost all Arduinos), or after the code is uploaded. There is also a RST (reset) pin on the board, so if you mess with that, the code would run after you release the reset, but if you don't touch that pin, you have no worries about it.

A few things to keep in mind, (only read further if you are still awake):
- your computer's USB port can only supply 500mA (USBv1 and v2) or 900mA (USBv3.x), so sorry, you can not power your whole layout from the computer. And neither should you try to turn on a huge motor with it either. When not connected to the computer, you need to think about how much energy the new power source can provide. An Energizer 522 9V battery can, according to the datasheet, can give you about 300mA for only 1 hour! Now, we can all say hook it up to the 110Vac, it has a 20A breaker in the box. No, you need to provide between 7 and 12Volts DC, which goes through a regulator that has its own limit on how much it can provide! But here is the real story, any Arduino I/O pin, can only provide 20mA*, but the ATmega328P chip can in TOTAL, only provide 200mA*, so you can not turn 11 pins on to each supply 20mA! So, when you do plan on running something of higher than 10mA current, think about putting a transistor in between (ask, we will explain), so that the pin only needs to give it 1mA or less (depending on the transistor or the speed you are switching at for a FET, but a whole lot less)

(* the datasheet only specifies "Test Conditions", but also at only 1MHz. Some sites claim 40mA and the datasheet specs certain groups of pins not to exceed 150mA. There are also different numbers for Vcc=5V and Vcc=3V, the latter as low as 10mA. Our Nano will have Vcc at 5V)

- the Arduino Nano's ATmega328 run at 16MHz (I still remember our first PC/XT computer running at 4MHz and then we could press the "Turbo" button to get it to do 8MHz until it got too hot and shut itself down!), but it all depends on what your code is doing on how fast you can move a digital output up and down.

For the Advanced Learners:

For the Super Geeks:

Comments