Results 1 to 14 of 14

Thread: Arduino Question

  1. #1
    Join Date
    Jun 2013
    Location
    Espanola, NM, USA
    Posts
    162
    Thanks
    203
    Thanked 69 Times in 34 Posts
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default Arduino Question

    Hello

    First if this is in the wrong section I apologies in advance. I was working up some schematics on how to run my model train when I ran across the arduino post below. I read though all nine pages and was fascinated on what this little board can do and how I believe it can work for me. Unfortunately after reading and watching youtube vids I am unsure as to what I need and if it will cover all my basis.

    I want to control with PWM two trains (three if my f units are running) at once along with my turn outs with the arduino. Can I do this with one Arduino Uno R3, and a Adafruit Motor/Stepper/Servo Shield or do I need a L298 Board for the Arduino instead of the adafruit board? I know I will need other electronic components which is fine but as far a microprocessor what is required.

    Thanks for all the help

  2. #2
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,402
    Thanks
    714
    Thanked 3,285 Times in 771 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    I take it you want to PWM DC trains right?

  3. #3
    Join Date
    Mar 2011
    Location
    High Point, NC, USA
    Posts
    326
    Thanks
    453
    Thanked 211 Times in 123 Posts
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by emmdom View Post
    Can I do this with one Arduino Uno R3, and a Adafruit Motor/Stepper/Servo Shield or do I need a L298 Board for the Arduino instead of the adafruit board? I know I will need other electronic components which is fine but as far a microprocessor what is required.
    If someone on this forum doesn't have an answer, you may try posting on:

    http://forum.arduino.cc/

    The folks on that forum are very knowledgeable and willing to help.
    HAROLDN212

  4. #4
    Join Date
    Dec 2003
    Location
    Columbus,OH, USA
    Posts
    3,252
    Thanks
    79
    Thanked 1,568 Times in 910 Posts
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have not used the adafruit motor driver shield, but if it is anything like the sparkfun version, it will have H bridges as the motor control outputs.

    Paul

  5. #5
    Join Date
    Oct 2010
    Location
    Campinas SP Brazil
    Posts
    51
    Thanks
    21
    Thanked 54 Times in 19 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I've been messing around with the arduino, but I have not come to a PWM setting that I would be happy with. Take a look at these pages:

    http://modelrail.otenko.com/arduino/...ith-an-arduino

    http://playground.arduino.cc/Main/TimerPWMCheatsheet and

    http://www.instructables.com/id/Wii-...d-Model-Train/

    As far as the arduino UNO board is concerned, it will be enought for controlling three trains. I was not happy with the noise the locos make at low speeds, even though I tried all the available PWM frequencies, so I have just given up on Arduino control.

    As for turnouts, depending on what you want to do, it will use from 2 to 5 digital ports per turnout.

    Using DPDT switches you can use one side to control a servo and the other to change position LEDs, with just 2 ports per turnout. The last code here works fine:

    http://forum.arduino.cc/index.php?PH...&topic=61780.0

    so if you have a lot of turnouts na Arduino Mega will be better.
    Ricardo R N Jorge
    Campinas SP Brasil

  6. #6
    Join Date
    Apr 2007
    Location
    Christiana, TN
    Posts
    603
    Thanks
    4
    Thanked 399 Times in 257 Posts
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by rnjorge View Post
    ...
    As far as the arduino UNO board is concerned, it will be enought for controlling three trains. I was not happy with the noise the locos make at low speeds, even though I tried all the available PWM frequencies, so I have just given up on Arduino control...
    Get two large matching caps, 250 - 1000 uF and 16v or greater. Hook them up ground to ground and hook the + of one to the output going to one rail and the + of the other to the output going to the other rail and it will help greatly with the noise.

  7. The Following 2 Users Say Thank You to CSXRobert For This Useful Post:


  8. #7
    Join Date
    Jun 2013
    Location
    Espanola, NM, USA
    Posts
    162
    Thanks
    203
    Thanked 69 Times in 34 Posts
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes I am looking into controlling dc trains with PWM. I have 10 atlas true track turnouts to control. If this is not possible I dont want to make the investment, I can do what I need to do with switches and block power, but if I can control everything my turnouts and trains without having to invest into dcc then I will look into it. I guess the bigger question is do I have enough IO on the arduino uno r3 to control the 10 turnouts and 3 trains, plus IR sensors to control the trains?

    The adafruit shield does have h bridges but what I have found in my searches it that people also use the L298 board and I yet to find a post or post or vid that shows the adafruit in action. Thanks for all the help.

  9. #8
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,402
    Thanks
    714
    Thanked 3,285 Times in 771 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by emmdom View Post
    Yes I am looking into controlling dc trains with PWM. I have 10 atlas true track turnouts to control. If this is not possible I dont want to make the investment, I can do what I need to do with switches and block power, but if I can control everything my turnouts and trains without having to invest into dcc then I will look into it. I guess the bigger question is do I have enough IO on the arduino uno r3 to control the 10 turnouts and 3 trains, plus IR sensors to control the trains?

    The adafruit shield does have h bridges but what I have found in my searches it that people also use the L298 board and I yet to find a post or post or vid that shows the adafruit in action. Thanks for all the help.
    Well ...

    The Uno has 6 alnalog inputs and 13 digital outputs, 6 of which can be PWM. So certainly you can control 3 DC motors (locos) with it (were not dealing with how you get the control signal yet, i.e. throttle method). That leaves you with 6 analog inputs and 10 digital outputs (with 3 PWM).

    I use Kato turnouts which use a short DC pulse to switch them. But that comes from the DCC accessory called a DS64. However you could generate a pulse with the Arduino to do it.

    But ... you have Atlas switches. I am not familiar with the control method for them. How are they switched? What type of voltage state/transition is required?

    So given the I/O available, you tell me - can you use an Uno for your setup? Just think about the number of I/O pins you need vs. what is available as I've listed at the moment. There are some ways to extend the outputs with shift registers but hold that thought ...

  10. #9
    Join Date
    Jun 2013
    Location
    Espanola, NM, USA
    Posts
    162
    Thanks
    203
    Thanked 69 Times in 34 Posts
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default

    I looked at my turnouts and they are connected to the AC side of my atlas power pack. When I opened the bottom of the turnout they work on a solenoid method. I attached a pic of my layout with some text which I hope helps describe what I would like to use the arduino.
    I have 10 turnout switches (SW1-10)which I would like to control with the arduino, along with what I call my 7 blocks. The red lines across the track indicated places where I plan to add isolation rail joiners and spst swithces.
    First I have a staging area for 4 train labeled train 1-4. The plan is to have a spst on BLK 4-7 so that I can power only the train I want to run, the spst on BLK 1-3 is so I can have some passing lanes. There are also two DPDT switches on BLK 1 and 2 to reverse the polarity indicated by the blue lines is where I isolate BLK 1 from 2. So with that do I have enough outputs on the arudino? ... I don't know if I understand correctly what you said previously then no I dont have enough IO on the arduino uno R3. I believe I need 17 digital to control the switches and blocked power spst. Not including at least 3 pwd outputs. Please correct me if I am wrong.

    THanks
    Last edited by emmdom; 29th Jul 2013 at 11:48 AM. Reason: forgot to add image

  11. #10
    Join Date
    Jun 2013
    Location
    Espanola, NM, USA
    Posts
    162
    Thanks
    203
    Thanked 69 Times in 34 Posts
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default

    Forgot to add image.truelayout2.jpg
    Last edited by emmdom; 29th Jul 2013 at 03:05 PM.

  12. #11
    Join Date
    Oct 2010
    Location
    Campinas SP Brazil
    Posts
    51
    Thanks
    21
    Thanked 54 Times in 19 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well, for each turnout you would need to use two digital ouputs, one for each coil, and a circuit like the one showed here:
    http://www.instructables.com/id/Cont...-with-arduino/
    That's 20 outputs plus the parts used to drive the coils.
    Ricardo R N Jorge
    Campinas SP Brasil

  13. #12
    Join Date
    Jun 2013
    Location
    Espanola, NM, USA
    Posts
    162
    Thanks
    203
    Thanked 69 Times in 34 Posts
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Ricardo!
    So from what I gather so far 20 digital for turnouts, 3 pwm (digital outs) for loco control seems to me that the arduino mega is a better fit for what I envision. Do you all know if shields that are the same form factor as the arduino r3 work with the arduino mega.

    Thanks everyone.

  14. #13
    Join Date
    Oct 2010
    Location
    Campinas SP Brazil
    Posts
    51
    Thanks
    21
    Thanked 54 Times in 19 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    My personal opinion: It is not woth it!

    I was going the same way. I have a small DC layout and I wanted a control pannel with LEDs showing the turnout position and, as I woulb be usining an Arduino I also wanted the pwm for speed control.

    After a lot of investment in time and money I decided to use this for the turnouts (I'll be ordering the 10 bundle this week). http://www3.sympatico.ca/kstapleton3/751D.HTM

    For speed, I got two of these http://www.bakatronics.com/shop/item.aspx?itemid=383 and, apart from the humming at low speeds, they are very good.

    I only think the arduino would be a good choice if you would use servos.

    But, it is only my personal opinion...

    As for the shields, I have never tried with the Mega.

    Let me know if you are more successfull then I was.
    Ricardo R N Jorge
    Campinas SP Brasil

  15. #14
    Join Date
    Jun 2013
    Location
    Espanola, NM, USA
    Posts
    162
    Thanks
    203
    Thanked 69 Times in 34 Posts
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well Ricardo after a day of research I think I may stick to the solid state approach and ditch the arduino idea. I plan on building some capacitor discharge units for my turnouts, blocking my power and using the power packs I have for now. I can build that for the same price as the arduino and the shields, plus it seems that I will still have to build additional circuits then program the unit. Very interesting idea but that adds more time which is very limited for this project. There isn't or atleast I have not found a clear cut how to run a train with an arduino there is still a lot of look here look there and that is where I am getting confused on what I actually need and what I can actually do. I wish I would have found someone who has a layout running off and arduino with a list of parts this is how I did it. Something I may want to dive into later for now I am not convinced.

    Thanks again for all the help!

Similar Threads

  1. Model Power Haunted House using Arduino Micro Controller
    By ndronet in forum Structures & Scenery
    Replies: 7
    Last Post: 12th Oct 2018, 10:24 AM
  2. The Arduino & Model Railroading
    By Nskale in forum DIY Controllers
    Replies: 196
    Last Post: 5th May 2015, 03:17 PM
  3. Swing bridge: Arduino sanity check
    By Paul Schmidt in forum Turnout Control Devices, Signaling, & Detection.
    Replies: 13
    Last Post: 27th Mar 2013, 09:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •