MODEL RAILROADING WITH ARDUINO - Mrrwa

Transcription

MODEL RAILROADINGWITH ARDUINODave Falkenburg & John PlocherSilicon Valley Lines Model Railroad ClubSunday, September 12, 2010

WHAT IS AN ARDUINO?Sunday, September 12, 2010

WHAT IS AN ARDUINO? Arduinois an open-source electronics prototyping platformbased on flexible, easy-to-use hardware and software. It'sintended for artists, designers, hobbyists, and anyoneinterested in creating interactive objects or environments. Alittle programmable computer platform designed helppeople “make things go.”http://www.arduino.cc/Sunday, September 12, 2010

Sunday, September 12, 2010

HARDWARE Basedupon widely available 8-bit Micro-controllers Single-chipComputers as powerful as the early PCs.but cost much less OpenHardware Schematics Kitsand board designs freely availableand Built-up Boards from 15 to 80Sunday, September 12, 2010

HARDWARESunday, September 12, 2010

HARDWARE 19pins, each can be either Input or Output 6can be PWMed (digital dimmer) 6 Analog 13Digital pins 6V-12V Easilypinsexternal Power Supply or from USBExpandable & Customizable to add features Think “C/MRISunday, September 12, 2010on a chip” with extras

SOFTWARE Works Openwith Windows, Mac OS X, and LinuxSource Freeto Download & Use Easyand fast to use ProgramSunday, September 12, 2010via USB

SOFTWARE C-likeLanguage Programs Rapid Can Easyare called “Sketches”Prototyping of small projectsdo useful things in 1 or 2 pages of codeto use “Libraries” developed by others DCC, Communications, motorSunday, September 12, 2010control, LED dimming etc.

SOFTWARE Allthe “grunt work” is done for you by Arduino, which hidesmost of the complexity (remember, it was designed for artists!) Onlytwo functions to worry about setup loopSunday, September 12, 2010: initialize inputs & outputs: run over and over again until power is removed

/*Blink: Turns on an LED on for one second, then off for one second, repeatedly.* LED connected from digital pin 13 to ground.* Note: On most Arduino boards, there is already an LED on the board connected topin 13, so you don't need any extra components for this example.Created 1 June 2005By David d on an orginal by H. Barragan for the Wiring i/o board*/int ledPin 13;// LED connected to digital pin 13// The setup() method runs once, when the sketch startsvoid setup(){pinMode(ledPin, OUTPUT);}// initialize the digital pin as an output:// the loop() method runs over and over again, as long as the Arduino has powervoid loop(){digitalWrite(ledPin, HIGH);delay(100);digitalWrite(ledPin, LOW);delay(100);}Sunday, September 12, 2010// turn the LED on// turn the LED off

WHAT CAN YOU DO?Sunday, September 12, 2010

SPECIAL EFFECTSSunday, September 12, 2010

SPECIAL EFFECTSNOTE: This is an mbed, notan Arduino; probably shouldre-shoot the video.Sunday, September 12, 2010

EFFECTS YOU CANNOT BUYSperry Rail Service Inspection VehicleSunday, September 12, 2010

SIGNALSSunday, September 12, 2010

CONNECTING LEDS Anode ( , long leg) of LED to 5V (or 3.3V) Cathode (-, short leg, flat side) of LED to DIGITAL I/O Pinthrough a 470Ω resistor (330Ω for 3.3V)5V470ΩI/O470ΩI/O Anode ( , long leg) to DIGITAL I/O Pin through a 470Ωresistor (330Ω for 3.3V) Cathode (-, short leg, flat side) to GroundSunday, September 12, 2010

MAKING FIREint ledPin 13;// LED connected to digital pin 13void setup(){pinMode(ledPin, OUTPUT);}void loop(){int dark;for (dark 0;dark 1000;dark ) {if (dark 500) {digitalWrite(ledPin, HIGH);// set the LED ledPin, LOW);// set the LED offdelay(random(10 dark,50 dark));}}Sunday, September 12, 2010

AN ARC WELDERint ledPin 13;// LED connected to digital pin 13void setup(){pinMode(ledPin, OUTPUT);}void loop(){int i,count;count random(10,60);for (i 0;i count;i ) {digitalWrite(ledPin, HIGH);delay(random(60));digitalWrite(ledPin, Sunday, September 12, 2010// set the LED on// set the LED off

WHAT ELSE? PushButtons RFIDReaders Photocells Other Arduinos Current Other ServoMotors Stepper MP3DetectorsComputers WiFiMotors EthernetPlayback Chipsetc., etc., etc.Sunday, September 12, 2010

MOTOR SHIELDhttp://www.adafruit.com/Sunday, September 12, 2010

ETHERNET SHIELDhttp://www.arduino.cc/Sunday, September 12, 2010

“PATCH 4/index.htmlSunday, September 12, 2010

MIX AND MATCH An Arduino ChubbSMC12 for using digital output to control Tortoise DCCOD,Sunday, September 12, 2010can connect to existing Model Railroad ElectronicsTeamDigital DBD22, and NCE BD20 Detectors

DEMOSTO GET YOUR IDEASFLOWINGHardware & Software by John PlocherSunday, September 12, 2010

BLINKING LEDS WERE EASY. What How Canabout something more challenging?about doing something with the user’s INPUT?we make noise? Maybeeven Annoy The Neighbors?Sunday, September 12, 2010

DANGERSHIELDAn Arduino add-on.buzzertemperature & light sensorsIt's got a variety of electroniccomponents that you can useto do fun and useful things:linear slidersLEDs (of course!)A excuse to learn by playing!Sunday, September 12, 2010pushbuttons

Two servosan LCDdisplaya xylophonea few sparepartsanda couple ofhours oftinkeringSunday, September 12, 2010XYLO -TIGER

NEED SOMETHING MORE“RAILROAD RELATED”? Allthese were simply fun ways to learn while playing Thereal fun begins when you apply these lessons to yourlayout!Sunday, September 12, 2010

CP MICHAEL Takethe “best of ” Loconet, C/MRI and Arduino and try tobuild a control point for the layout, similar to those used bythe “big boys”, without having to have a computer runningthings.Sunday, September 12, 2010

GOALS Talk “Code ControlLine” to other nodespackets from dispatcher’s cTc machine Indication Usepackets from the Control Point field unitsLoconet to talk to the devices in the interlocking (Future)Sunday, September 12, 2010use NMRAnet as the Code Line.

CP MICHAELand a littleimagination(it is a work in progress ;-) 16 Track Circuits 4 Switches 6 SignalsSunday, September 12, 2010

DEMO ThePanel simulates the Dispatcher’s view Trackcircuits simulated by toggle switches ModelBoard displays occupancy One Arduino Thepretends to be a (crude!) cTc machineother Arduino simulates a field unit and controls switches BoardsSunday, September 12, 2010cost 6- 20 each to design and build myself

LOTS MORE INFO ingWithHardwareSunday, September 12, 2010

USEFUL LINKS http://www.arduino.cc/ http://www.sparkfun.com/ http://www.adafruit.com/ http://moderndevice.com/ http://spikenzielabs.com/ http://techshop.ws/Sunday, September 12, 2010or just Google/Bing/Yahoofor “Arduino” in yourfavorite web browser!

SOME OTHER COOL LINKS DCC Throttlebuilt with an Arduinohttp://www.oscale.net/en/arduino DCControl with ntrol.htmlSunday, September 12, 2010

Q&ASunday, September 12, 2010

EXTRA 2011 WESTThe Unconventional Conventionwww.x2011west.org2011 NMRA National ConventionJuly 3 to 9, 2011 - Sacramento, CaliforniaDOING THINGS A LITTLE DIFFERENTLY An Advanced Section of layout tours andOP sessions in the San Francisco Bay Areaon the weekend at the start of theConvention The world-famous California StateRailroad Museum and the movie-starSierra Railroad at Jamestown in theMother Lode country and a full-blown Railroad Prototype Meet as part of the Convention, OPSIG andLDSIG events, numerous clinic tracks including clinics to teach you entirely new skills,the S scale NASG national convention, Bay Area Garden Railroad clinics well, this listjust goes on and on Sunday, September 12, 2010

WHAT IS AN ARDUINO? Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. A little programmable