Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

what exactly is an arduino?

994 views
4 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    September 2002
  • 7,486 posts
what exactly is an arduino?
Posted by ndbprr on Sunday, January 20, 2019 12:08 PM

how does it interface to dcc?  Thank you

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Sunday, January 20, 2019 1:14 PM

 An Arduino is a family of microcontrollers and the programming environment developed for them - it's the whole system, where the development environment has commands to simplify writing programs - prime example is the most common thing, seeting a pin to be an input or an output. Arduino has pinMode to set a pin to be input or output, like pinMode(1,OUTPUT), pinMode(7,OUTPUT), and pinMODE(0,INPUT) - those three commands mad pins 1 nad 7 output, and pin 0 an input. If you didn;t have the Arduino IDE to work in, you would have to write code like DDRD = DDRD | B11111110. 

 Arduino is a complete ecosystem. It;s not any perticular board, nor is it even all one brand of microcontroller.  

 To interface to DCC you need some external components to electrically transform the DCC signal into voltages that do not exceed the microcontroller's limits (most are 5V, some are 3.3V), and you need software that can decode the NMRA packets. Such software is readily available for download. To that you then add your code to do something based on the received data, or send something based on some inputs.

                                   --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Sunday, January 20, 2019 1:56 PM

one aspect of the Arduino environment I don't hear mentioned often is it's serial monitor that can be brought up from the IDE.

It just a simple ASCII serial interface.   A Serial library allows strings and values to be sent across the interface and displayed on a window.  Similarly, characters or strings can be sent to the Arduino which can be used to control a program using your own code to monitor and process the serial input.

recently, i was experimenting with using opto-detectors for position sensing on a turntable.  After getting eratic results using a digital input, i switched to an analog input.  I created a command to read and display the analog input.

it didn't take long to write some code to repeatedly read and collect analog data in a buffer that with a command could be dumped thru the serial display.

I was able to plot that data and see the sensitivity of the sensor and quickly wrote some code to stop the turntable bridge when it crossed the sensor.

while the Arduino is certainly well suited for DIY projects, it's also useful for instrumentation and measurement.

since Arduino code is C with many useful libraries, i've often developed code on my laptop that was easily ported to an Arduino application.

greg - Philadelphia & Reading / Reading

  • Member since
    March 2018
  • 72 posts
Posted by Cymrych79 on Sunday, January 20, 2019 2:35 PM

ndbprr

how does it interface to dcc?  Thank you

 

 

Do a search on YouTube for DCC++. The guy has several videos describing how he utilizes an Arduino and a Motor Shield as a DCC command station, including an automated routine that randomly selected trains and runs them over his layout, and even parks them and choices another train to go out. Pretty nifty stuff.

 

I use my Arduinos for some much simpler tasks, such as using opto-detectors to change signal lights. Much easier to program than a full automation routine.

  • Member since
    October 2006
  • From: Western, MA
  • 8,571 posts
Posted by richg1998 on Sunday, January 20, 2019 2:37 PM

It is quite an open source project.

I use to play with microcontrollers some years ago. They can do a lot.

 A couple links below you should keep. A search will bring a lot more information about them.

https://www.arduino.cc/

 https://en.wikipedia.org/wiki/Arduino

 Rich

 

If you ever fall over in public, pick yourself up and say “sorry it’s been a while since I inhabited a body.” And just walk away.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!