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!

My Free Book: (updated) Getting Started With Arduino Programming

3717 views
18 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    December 2004
  • From: Pa.
  • 3,361 posts
My Free Book: (updated) Getting Started With Arduino Programming
Posted by DigitalGriffin on Friday, January 21, 2022 11:20 AM

I noticed there is a lot of people have a lot of interest in Arduino in automating and controlling their layout.  I taught multiple classes on this over the years and ended up writing my own free book.  Hopefully it will be of use to some of you.

It's very step by step with photos and covers most aspects of programming and controlling Arduino boards.  If you have any questions, please feel free to write me.

Chapter 1: what is arduino?

https://docs.google.com/document/d/1B4J3W5YNGknMACiwGy09IYAA1AthaOhrFR8NBHwgbGk/edit?usp=sharing

chapter 2
https://docs.google.com/document/d/1CeyqSjzJf-7Y7l8c7xeUil_rQ9xUZqcudJG7DCYzoSA/edit?usp=sharing

 Appendix A: basic electronics

https://docs.google.com/document/d/14VHMT5pRuD8Nq42TJhyGsgo3aOZCekYddbOjoCTvyiI/edit?usp=sharing

 

Don - Specializing in layout DC->DCC conversions

Modeling C&O transition era and steel industries There's Nothing Like Big Steam!

  • Member since
    March 2021
  • From: Vermont
  • 135 posts
Posted by Ablebakercharlie on Friday, January 21, 2022 11:31 AM

Thanks very much for posting this to the community!

Coincidentally I just started working yesterday on understanding how to program  Arduino nanos.  This is all brand new to me. 

My goal is to use Arduinos for lighting of buildings and lamposts as well as running servos for some animation on the layout.

Another use I see is to use with sensors for railroad crossings.

Looking forward to reading your book!  Big Smile

Thanks again!

 

charles

 

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, January 21, 2022 12:02 PM

Thank you Don, you’re not only a good instructor but you did a bang up job putting your book together!!!!

Much better than the $15 Arduino book for sure.


Mel


 
My Model Railroad   

 
Bakersfield, California
 
Turned 84 in July, aging is definitely not for wimps.

  • Member since
    November 2005
  • From: Phoenix, AZ
  • 693 posts
Posted by woodone on Friday, January 21, 2022 1:04 PM

Mel, tried to start a message to you.

can not seem to make that happen?

woodone.    AKA Jerry        

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, January 21, 2022 7:45 PM

woodone

Mel, tried to start a message to you.

can not seem to make that happen?

woodone.    AKA Jerry        

 

Jerry

If you sent me an email I haven’t received it.


Mel


 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California
 
Turned 84 in July, aging is definitely not for wimps.

  • Member since
    November 2005
  • From: Phoenix, AZ
  • 693 posts
Posted by woodone on Friday, January 21, 2022 8:14 PM

Yes--I did send you one- about 4 PM

I used my I-Pad to do that -shows sent?

I get another out, well I will just copy it and resend it-thanks for keeping me up to date

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, January 21, 2022 9:00 PM

 

 
Nothing
Try my blog email
 

 

 
Mel


 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California
 
Turned 84 in July, aging is definitely not for wimps.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Friday, January 21, 2022 11:07 PM

DigitalGriffin
I noticed there is a lot of people have a lot of interest in Arduino in automating and controlling their layout.  I taught multiple classes on this over the years and ended up writing my own free book.  Hopefully it will be of use to some of you.

Hi Don,

You deserve a great deal of praise for writing your book! I have tried to get into using Arduino several times but I gave up, perhaps too easily. I have only read the first 20 pages so far, but the important thing is that I think I understand what you are saying! That's quite an accomplishment on your part. You have motivated me to take another stab at it.

Thanks!!

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Saturday, January 22, 2022 1:22 AM

the Arduino Forum is available to answer programming questions and provides a wealth of examples

greg - Philadelphia & Reading / Reading

  • Member since
    September 2003
  • 21,669 posts
Posted by Overmod on Saturday, January 22, 2022 11:05 AM

Greg, why not start ginning up a counterpart for ESP32 (and C/MRI)?  Community needs one.

  • Member since
    December 2004
  • From: Pa.
  • 3,361 posts
Posted by DigitalGriffin on Tuesday, January 25, 2022 2:52 PM

Not to beat a dead horse, but I updated the links above. 

There's an intro chapter:

  1. what arduino is, 
  2. accessories available for arduino (like servo and stepper motor control)

Appendix for basic electronics showing you some elementry circuits and how to use things like volt meters, voltage dividers diodes, LEDs, etc...

There's only 3 things you need to know with arduino to master it:

  1. Know if you want to read something (sensor, another arduino device) or control something (ie: Relay, servo, dc motor, stepper motor) and how to set up the pins to do that.
  2. Know the pins are very low current and only operate at 5V/3.3V max.  You'll need to learn how to use transistors/relays/step-up,step-down circuits, logic level shift circuits, or voltage dividers.  (All very simple)
  3. A little basic programming and what shield board packages are available (ir detectors, photo voltiac detectors, servo controllers, stepper motor controllers, and DC motor PWM controllers

I could start a series showing how to create IR or current detection to detect a train.  Then how to use that information to create working aspect heads or servos for aspect flags/RR Gate Crossings.  I could also show how button presses could be used to animate a layout, or even play sound.

Don - Specializing in layout DC->DCC conversions

Modeling C&O transition era and steel industries There's Nothing Like Big Steam!

  • Member since
    September 2003
  • 21,669 posts
Posted by Overmod on Wednesday, January 26, 2022 7:39 AM

DigitalGriffin
I could start a series showing how to create IR or current detection to detect a train.  Then how to use that information to create working aspect heads or servos for aspect flags/RR Gate Crossings.  I could also show how button presses could be used to animate a layout, or even play sound.

Rubbing my hands in anticipation...

  • Member since
    January 2002
  • From: Redwood Falls MN
  • 90 posts
Posted by draftingplans on Tuesday, February 1, 2022 12:40 PM

I have a Elegoo for UNO starter kit and I am wondering of you know how much difference there is between this and the Arduino?

Thanks

  • Member since
    January 2010
  • 170 posts
Posted by nycmodel on Wednesday, February 2, 2022 1:54 PM

Judging from the Elegoo items and pictures on Amazon this appears to be identical to the "Arduino" brand. A number of companies have made their own clones of the Arduino boards. I don't know if it is a license agreement or the Arduinos are in the public domain.

  • Member since
    December 2004
  • From: Pa.
  • 3,361 posts
Posted by DigitalGriffin on Thursday, February 3, 2022 10:17 AM

draftingplans

I have a Elegoo for UNO starter kit and I am wondering of you know how much difference there is between this and the Arduino?

Thanks

 



The main chip is a genuine atmel.  The PCB design is licensed under creative commons and is available on the arduino website, meaning anyone can make one of these.  If you burn out the main atmel chip on the uno, you can buy them in bulk < $5 each

Arduino is open-source hardware. The hardware reference designs are distributed under a Creative Commons Attribution Share-Alike 2.5 license and are available on the Arduino website. Layout and production files[24] for some versions of the hardware are also available.

Don - Specializing in layout DC->DCC conversions

Modeling C&O transition era and steel industries There's Nothing Like Big Steam!

  • Member since
    January 2002
  • From: Redwood Falls MN
  • 90 posts
Posted by draftingplans on Monday, February 7, 2022 11:52 AM

Thanks for that reply.

  • Member since
    July 2018
  • 661 posts
Posted by IDRick on Wednesday, February 16, 2022 4:44 PM

DigitalGriffin

Not to beat a dead horse, but I updated the links above. 

There's an intro chapter:

  1. what arduino is, 
  2. accessories available for arduino (like servo and stepper motor control)

Appendix for basic electronics showing you some elementry circuits and how to use things like volt meters, voltage dividers diodes, LEDs, etc...

There's only 3 things you need to know with arduino to master it:

  1. Know if you want to read something (sensor, another arduino device) or control something (ie: Relay, servo, dc motor, stepper motor) and how to set up the pins to do that.
  2. Know the pins are very low current and only operate at 5V/3.3V max.  You'll need to learn how to use transistors/relays/step-up,step-down circuits, logic level shift circuits, or voltage dividers.  (All very simple)
  3. A little basic programming and what shield board packages are available (ir detectors, photo voltiac detectors, servo controllers, stepper motor controllers, and DC motor PWM controllers

I could start a series showing how to create IR or current detection to detect a train.  Then how to use that information to create working aspect heads or servos for aspect flags/RR Gate Crossings.  I could also show how button presses could be used to animate a layout, or even play sound.

 

I'm very late to this thread...  Don, nice work on the first two chapters and the Appendix!  Will you be preparing any chapters on how to operate servos with arduino?  It would be nice chapter to encourage adoption of servos.  Easy to find links to setting up servos but very little on sketches to operate the turnouts.  If I may, I'd suggest a chapter for layout with just 8 turnouts using a Uno + sensor shield.  Include how to program crossovers.  A second chapter could discuss larger layouts with many turnouts and using the larger arduinoes.  Maybe a third chapter for setting up routes in yards...  Just a thought, keep up the good work!

  • Member since
    February 2018
  • From: Flyover Country
  • 5,557 posts
Posted by York1 on Wednesday, February 16, 2022 5:19 PM

draftingplans
I have a Elegoo for UNO starter kit and I am wondering of you know how much difference there is between this and the Arduino?

I also started my projects using the Elegoo starter kit.  I believe they are almost exactly the same, but the Elegoo has a few more items, and it costs a lot less.

I did use the Uno for mapping out projects and testing them, but I bought a bunch of Nanos for very little money.  They work the same as Unos, but cost less.

I'm still just a novice, but I really like my crossing signals I made that are controlled by nanos.

At age 70 with no computer background, I was at first reluctant to do this.  But I actually enjoyed learning the basics.

York1 John       

  • Member since
    July 2018
  • 661 posts
Posted by IDRick on Wednesday, February 16, 2022 6:25 PM

York1

 

 
draftingplans
I have a Elegoo for UNO starter kit and I am wondering of you know how much difference there is between this and the Arduino?

 

I also started my projects using the Elegoo starter kit.  I believe they are almost exactly the same, but the Elegoo has a few more items, and it costs a lot less.

I did use the Uno for mapping out projects and testing them, but I bought a bunch of Nanos for very little money.  They work the same as Unos, but cost less.

I'm still just a novice, but I really like my crossing signals I made that are controlled by nanos.

At age 70 with no computer background, I was at first reluctant to do this.  But I actually enjoyed learning the basics.

 

John, great comment on using nanos.  One can find great deals on nanos using screw terminals for those who prefer not to solder.  I used a uno with sensor shield, very easy for beginners to set up servos with sensor shield.  So many options!

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!