Skip to main content

Replies sorted oldest to newest

I posted asking for a timer that I could use on a proposed layout build.  My intention is to have a button on the side of the layout that when pushed will operate a train, I will be running two trains on two simple loops, so preferably will run two trains with a pushbutton for each, on a timer for two minutes.  Simply, A kid comes up to the layout, pushes the button, a train runs for two minutes on a simple loop. Two buttons, two loops.  An 'interactive' layout.  I was advised to check out the arduino by forum members.  I haven't yet, but am getting back to it.  Is that an application the arduino could handle?

The use for Arduino really all depends on what kind of hardware you are working with.  Because there is no standard hardware, "off-the-shelf" applications are rare.

 

For example, I have a complete Arduino-based automated control system that interfaces with:

  • Legacy Base via serial port
  • DCS TIU via serial port
  • PC-based layout control panel using JMRI vis serial port
  • RFID readers via serial ports
  • Track occupancy and accessory state sensors via SPI
  • 64-line I/O expander to read switch states and control signals vis I2C

Except of course for the Legacy and DCS bases, all of it is home-brew.

 

My code is probably too specialized and convoluted to be applicable to anyone else's setup, but I'm happy to share it with anyone who is interested.

 

William: yes, the Arduino could easily handle your application - once you have the hardware designed.

You would probably use relays to turn the track power on and off (assuming conventional control).  The Arduino would read the pushbuttons and activate the relays using a transistor.

 

 

 

Originally Posted by William 1:

I posted asking for a timer that I could use on a proposed layout build.  My intention is to have a button on the side of the layout that when pushed will operate a train, I will be running two trains on two simple loops, so preferably will run two trains with a pushbutton for each, on a timer for two minutes.  Simply, A kid comes up to the layout, pushes the button, a train runs for two minutes on a simple loop. Two buttons, two loops.  An 'interactive' layout.  I was advised to check out the arduino by forum members.  I haven't yet, but am getting back to it.  Is that an application the arduino could handle?

If you are interested (or for anyone else that might be) another thing you might look into along these lines are the PICAXE programmable chips. Chips are fairly inexpensive and programming software is free. There is fellow railroader (garden scale, I think) that has a website that might be a good starting point for these.

 

http://www.trainelectronics.com/

 

Info on PICAXE chips here:

 

http://www.picaxe.com/

 

I don't know much about these either, but is also on my "to learn more about one of these days" list.

Originally Posted by Professor Chaos:

My code is probably too specialized and convoluted to be applicable to anyone else's setup, but I'm happy to share it with anyone who is interested.

 

I'd love to have your code.  I am working with the Arduino, and I'd like to interface to the RailSounds serial stream that has a command structure like the base commands.  It would be interesting to see your code.

Originally Posted by Al W.:

Nicole:

 

The fellows here have given us plenty of answers. WOW!

 

Al W.

They have indeed Al.

 

I may be a little bit behind the times on some of these gadgets.

In fact I think that I'll go and write a letter to Charles and Ada, as I'm still having trouble connecting Mr Jacquard's program input device to my analytical engine. 

There are lots of thngs that you can do with the Arduino.  While there are public programs out there, you would probably have to know how to program to modify some of them to suit your needs.  They are great for IR detection to activate things.  They can be used to manage lighting leds.   They are actually pretty powerful and any of the usual components you might use like resistors, leds, relays are very cheap.  My nephew and I have done some work using IR detectors and such.  If you do decide to get more involved with it there is a book titled Arduino Cookbook.  It is about $25 but has a wealth of information and example programs you can download.  I think we started out using a number of their programs to learn how its done and then modifying them to suit our needs.  

 

i bought the Arduino more out of curiosity to see what they could do and to just learn something new.  I am not at the point to use any of it yet but it is another useful way to make the train layout more interesting.

 

ed

You can do this with a 555 timer driving a relay.  There are 1000s of these timer circuits online. Here is one that drives a relay. You would need to increase c1 (try 220uf) and maybe a 1 meg resistor in series with R1 to lengthen the delay to 10 minutes.  No programming needed.

 

http://www.aaroncake.net/circuits/relaytim.asp


Or you can buy this timer as a $12 kit or $15 assembled. Just add a relay to handle the transformer output. 


http://electronickits.com/kit/.../timers/canck002.htm


and the simplest of all is to wire an electronic light timer in your AC circuit to power off/on your transformer. Make sure that you don't exceed the load capacity of the timer. If you are not experienced with AC house wiring, find someone that is.

Here is a heavy duty one:


http://m.globalindustrial.com/...th-hold-light-almond


bob



I agree, John.

The Arduino is much more versatile, especially for complex tasks.

TI has a competing microcontroller, the Launchpad.   They were selling the development kit/board/chip etc for $5.   Customers were ordering them by the dozens, so TI got wise and raised the price to $10. 

Terry Terrance has posted his code for a variety of Model Railroad applications, including a signaling system.  See this link:

 

http://freemodelrrclinics.blogspot.com/

 

BTW John, I have enjoyed reading your posts over the last year or so.  Thanks for taking the time to provide circuits and great advice for all of us.

 

Bob

The idea of using the ARDUINO is to set up routes and be able to control them with a push button. Each push would cause the o22 to change direction. I am not sure about the type of hardware that the ARDUINO talks to control the actual voltage to the switch. I have looked at a 4 and 8 relay shield for this. Is this a good way to go or is there another sield (or buikd your own) that I can use. I am looking for suggestions.

 

The code is not the problem, it is what hardware to interface to control the voltage, mainly the current, to the individual switches. I plan on about 20 for the layout.

 

John,

Oh how I wish I had found these relay modules a while back!

 

You see, I have been making relay modules (6 relays per) to control track blocks on my layout, and used the inexpensive (about $2 each) automotive relays with 12VDC coils, higher than necessary contact ratings, and they work fine.

 

At the same time, I have been playing with the Arduino and finding all sorts of neat gadgets such as the relays you just mentioned.

 

Well, there is no need for the Arduino or any other such device to control these relays. They run on 5VDC, and simple toggle switches will operate them just fine! 

 

I could have saved a lot of $$ and a LOT OF TIME using these relays modules instead of the ones I made. Besides, they take up less space and look a lot neater.

 

Now I am tempted to replace the home-made modules I have already installed, change my DC power supply from 12V to 5V, and use the existing wiring and toggle switches.

 

It seems that there always is a better way of doing something, and we usually find out after we are done with the more difficult approach.

 

Alex

Originally Posted by gunrunnerjohn:

I've been a victim of the "gee that's an easier way" after completing a project many times.  

 

I still can't understand how the Chinese manage to ship these products from halfway around the world for the prices they do!

 

Government subsidy?

...and quit showing me neat electronic stuff like the relay bank that I wish I needed!

Al,

 

There is an interface to the PC via a usb cable.  You download the free Arduino software from the internet.  The software provides you the programming tools for the Arduino.  You write  the code, compile it and then download the "script"onto the arduino.  (I don't believe the program you create is actually called a script but I cannot think of the actual name at the moment). It is all one step to accomplish.  The programming appears to be similar to C.  Instructions IMO are clear and fairly easy.  There are tons of free scripts available.  If you do get into it there is an excellent book called

the Arduino cookbook.  Explains every function and has lots of example scripts you can modify to suit your purpose.  You will need a bread board, jumpers and whatever electronic components you need for your project. All available very cheaply.

 

Ed

You are close, Ed - they are called 'Sketches'. There are many YouTube videos on how to use and program the Arduino, and I believe that the series by Jeremy Blum is the best. Just do a Google or YouTube search for his Arduino series.

 

And to revisit the topic of relays, here is a picture showing the relay modules I have been making for my layout using automotive relays, and the readily available modules. The latter are intended for the Arduino, but work fine with a 5VDC supply and plain toggle switches.

 

Cost of the home-made 6-relay module: About $20 and 3 hours.

 

Cost of the ready-made 8-relay module (Ebay): $10 delivered.

 

Also, the ready-made modules have an LED for each relay, all inputs are optically isolated, and each relay has a flyback diode. (My home made modules also have flyback diodes.)

 

Two Relays Modules med DSC07697

 

Alex

Attachments

Images (1)
  • Two Relays Modules med DSC07697
Post
×
×
×
×
Link copied to your clipboard.
×
×