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 do you use Arduinos for on your layout?

4604 views
54 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Sunday, April 24, 2022 8:29 PM

I like the incandescent bulbs flashing atop my 130’ communications tower and my two 80’ water storage towers the most, flashed by Arduino NANOs.  

https://drive.google.com/file/d/1jnDeqGuJ1S0_8mHf-Rg15GEZOcNH0SS1/view?usp=sharing


A close second are the Random Light Controllers.  I scratch built a home for each of our children and did the interior walls for individual room lighting.  The random on off of the lights really makes them look lived in driven by 8 Aduino UNOs, 160 bulbs.

Using incandescent bulbs on my layout is more realistic to me of the 1950s lighting, much more realistic looking than a LED.  I operate all the incandescent bulbs at 70% voltage which enhances realism as well as bulb life.  With over 500 bulbs on my layout I’ve only had to replace three in 30 years due to reduced voltage.

I admit bulbs draw over ten times the current as LEDs but to me its worth it.  

I rarely operate my layout in a daylight mode, I bought a pair of 4000K LED floods to represent moonlight and run a dusk to dark operation with all layout lights on.





Interiors also look better at night too.









Mel


 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California

Growing old is a bummer, aging is definitely not for wimps.

  • Member since
    June 2020
  • 133 posts
Posted by Bayway Terminal on Sunday, April 24, 2022 9:44 AM

I installed 3M cool white flashing LED's at the top of my power grid high towers leading to a sub-station & switch yard, also used a 30 second delay circuit board to control green & red LED's marking the bulkhead sides of a barge berth on the layout, but I really like the incandesent voltage control shown in your video, nice job on the boards. Bayway Termianl NJ  

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Saturday, April 16, 2022 8:07 PM

Sheldon

Thank you.

I think the way you have used relays is great.  I’m not into that type of control, my layout is very small and super simple.



My health holding I plan to use an Arduino for turnout control using tiny cheapo servos where the turnouts are located close enough to see slow moving point rails.

Had the Arduino and tiny servos been available when I built my layout that’s the way I would have gone.  I really like the tiny servos to operate turnouts and for the price they can’t be beat.  A $5 Arduino can control a dozen servos at $1.50 each, a $8 MEGA could control all 21 turnouts on my layout.

And the for looks type signaling system the MEGA easily handles 8 blocks both directions for under $10.



Mel


 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California

Growing old is a bummer, aging is definitely not for wimps.

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Saturday, April 16, 2022 6:44 PM

gregc

 

 
ATLANTIC CENTRAL
so you build a little driver board.

 

the op-amp replaced relays and transistor drivers to drive the relays

 

 

 
ATLANTIC CENTRAL
Can you put multiple push buttons on the same input? For multiple control locations?

 

of course buttons can be wired in parallel, they pull the pin to ground.

 

 

 
ATLANTIC CENTRAL
I also use the onboard Tortise contacts for the frogs.

 

LEDs can be wired in series with the motors instead of using the SPDTs

 

2019

 

Yes I understood your answer, I know what an op-amp is and how it works.

I assumed so about the buttons from the PLC work I did, just making sure.

I am well aware of all the different ways to power LED indicators with the Tortise. In my case the relay I use to reverse the polarity is near the turnout, not near the push button. By using the relay holding circuit to light the LED, no extra wires are needed, just the 12v common. Note how the LED is wired in this diagram.

 

When the relay is energized, the LED is on. The relay is energized the whole time that route is selected.

The bottom portion of this diagram shows how the Tortise polarity is reversed, with or without the indicators in line with the Tortise.

So again, my thanks to you an Mel for taking the time to give me some insight into Arduino.

It would seem for my purposes it offers no adavantages for any of my primary systems, but may have a use for smaller stand along applications.

Again, with over 80% of my relays switching track power, and the available four sets of contacts often being all that is needed, there is no advantage to using a processor for the logic portions of the system.

Sheldon 

 

    

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Saturday, April 16, 2022 11:39 AM

ATLANTIC CENTRAL
so you build a little driver board.

the op-amp replaced relays and transistor drivers to drive the relays

ATLANTIC CENTRAL
Can you put multiple push buttons on the same input? For multiple control locations?

of course buttons can be wired in parallel, they pull the pin to ground.

ATLANTIC CENTRAL
I also use the onboard Tortise contacts for the frogs.

LEDs can be wired in series with the motors instead of using the SPDTs

2019

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Saturday, April 16, 2022 9:32 AM

gregc

a pair of lm324 op-amps can drive a pair tortoise machines (e.g. cross-over).  2 machines/chip

the built-in SPDT switches on the tortoise powers the frog and controls panel LEDs indicating switch position.

a pair of momentary buttons on the panel determines the route through the interlocking

1920

 

Thanks for the info, so you build a little driver board.

I use monentary push buttons that have LED indicator lights built in.

I also use the onboard Tortise contacts for the frogs.

Can you put multiple push buttons on the same input? For multiple control locations?

All my mainline turnouts are controlled both on the CTC panel and at local towers.

My 24v/12/v/12v center tap power supplies that power the relays also power the Tortise machines.

I can and have hooked up the LED's several different ways, but  on the new layout, in the interest of less wire, I am going to simply power them off the relay hold circuit. That hot wire is already at the button and stays on while the route is selected.

Sheldon  

    

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Saturday, April 16, 2022 4:45 AM

a pair of lm324 op-amps can drive a pair tortoise machines (e.g. cross-over).  2 machines/chip

the built-in SPDT switches on the tortoise powers the frog and controls panel LEDs indicating switch position.

a pair of momentary buttons on the panel determines the route through the interlocking

1920

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Friday, April 15, 2022 10:32 PM

Greg, After you build all that logic for the interlocking, how do you drive the turnout motors?

And is anything done to power frogs?

And what kind of user inputs?

Sheldon

    

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Friday, April 15, 2022 8:54 PM

CGW103
Is that C?

yes

the IDE requires that your "sketch" be named the same as the directory it is in with an .ino suffix (e.g. MyDir/MyDir.ino).

it copies the files which may include additional .ino, .cpp and .h files to a build directory where it translates the .ino file into a .cpp which it adds various includes, adds function prototypes and other statements avoiding the need for an Arduino programmer to worry about such details that can be very frustrating.

.cpp files can include "Arduino.h" for references to common librarie functions supporting I/O, Serial communication, ...

it also adds a main.cpp which includes a call to setup() and repeatedly calls loop() in a "for (;;)" loop.

i've simulated code for an Arduino on my laptop using the gcc compiler under cygwin

the IDE uses make, an application called avrdude to download code to the Arduino and has AVR versions of nm, gdb, ...

1782

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, April 15, 2022 8:14 PM

The random light controller is truly random.  Any of the 20 bulbs could be on or off for 45 minutes or 15 seconds, if you watch the structure long enough you could catch all lights on or all lights off.  I’ve left a test controller with bulbs on a connector for hours and I have seen all bulbs on.

On startup the sequence is never the same.

Mel


 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California

Growing old is a bummer, aging is definitely not for wimps.

  • Member since
    January 2019
  • 2,572 posts
Posted by John-NYBW on Friday, April 15, 2022 7:24 PM

RR_Mel

I appreciate the input guys.  Arduinos aren’t for everyone.

My Arduino signal system is only aesthetic and only controls the track side signals by position of a train.  My layout is very small and was designed as a single train operation operating on DC back in the 80s.  The design is a John Allen G&D twice around rip off, John is and always will be my model railroad mentor.

I originally only got into DCC for sound and as time passed I found another animation goody, DCC functions.  As my layout can only have one operational train at a time the DCC operations don’t do anything for me.

I would never have a computer controlled layout, for me that would take the fun out of model railroading.  I do enjoy tinkering around with automation and the Arduinos can really work great for that.  The Random Lighting Controllers are one of the best automation goodies on my layout, signals are a close second followed by vehicle lights.

Visitors WOW the vehicle lights the most and always comment on the structure lighting, trains are rarely mentioned.  They always notice the Arduino controlled crossing lights and operational gates as a train passes.

Most of the time I have to point out the lighting on a train.

Visitors always comment on the number of figures on my layout, hundreds viewable.  Every structure has at least two and 80+ at my passenger station.


Mel

 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California

Growing old is a bummer, aging is definitely not for wimps.

 

I can appreciate the fascination with automating various functions such as  structure lighting. I have one automated lighting function. I have a traffic light which runs through a green/yellow/red sequence although each green light lasts only about ten seconds which is very short by real world standards. My concern with doing that with structure lighting is that having individual room lights constantly turning off an on wouldn't be very realistic. Whether in their homes or their workplace, people tend to leave the light on in a room for long periods of time. Having lights constantly turning off and on seems to me would be somewhat distracting. I haven't done much with interior structure lighting but that is in the plan. Right now its #342 on my to-do list. If and when I get around to it. I'll have structures with some rooms lit and some dark but there won't be controls for individual rooms. If the lights come on, they will come on in all the lit rooms at once and stay that way. 

  • Member since
    January 2019
  • 2,572 posts
Posted by John-NYBW on Friday, April 15, 2022 7:12 PM

gregc

 

 
John-NYBW
Even simple reprogramming is probably going to take more effort than just performing an operation manually.

 

of course.  why would you write a program to replace a manual switch?

 

 

It seems much of these fancy electronics are designed to do just that. For example, I can use a simple on/off switch to activate grade crossing flashers and if desired, the gates as well. Some people prefer to use sensors to detect oncoming trains to automate that activation. That seems simple enough if one has a single track mainline. It gets more complicated if you have a double track main and either track can have trains approaching from either direction. In my case, at one location there are three tracks and another in which there are four. That results in lots of permutations where you could have one train having passed the grade crossing while another is approaching. Lots of sensors, lots of complexity. I could throw even more complexity into the mix but you get the idea. It seems so much simpler just to activate the flashers and gates with a simple switch.

I understand that the prototypes automate their crossing flashers and gates but that is a case where multiple trains are crossing every day. In that situation, it makes sense to spend the money to automate the activation of the flashers but on a model railroad that seems needlessly complex to me. It's fine if somebody wants to go to the time and expense to do that but I'm a big believer in the KISS approach.  

  • Member since
    November 2020
  • 71 posts
Posted by CGW103 on Friday, April 15, 2022 5:36 PM

Is that C?

Mike

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Friday, April 15, 2022 2:18 PM

John-NYBW
Even simple reprogramming is probably going to take more effort than just performing an operation manually.

of course.  why would you write a program to replace a manual switch?

greg - Philadelphia & Reading / Reading

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

I appreciate the input guys.  Arduinos aren’t for everyone.

My Arduino signal system is only aesthetic and only controls the track side signals by position of a train.  My layout is very small and was designed as a single train operation operating on DC back in the 80s.  The design is a John Allen G&D twice around rip off, John is and always will be my model railroad mentor.

I originally only got into DCC for sound and as time passed I found another animation goody, DCC functions.  As my layout can only have one operational train at a time the DCC operations don’t do anything for me.

I would never have a computer controlled layout, for me that would take the fun out of model railroading.  I do enjoy tinkering around with automation and the Arduinos can really work great for that.  The Random Lighting Controllers are one of the best automation goodies on my layout, signals are a close second followed by vehicle lights.

Visitors WOW the vehicle lights the most and always comment on the structure lighting, trains are rarely mentioned.  They always notice the Arduino controlled crossing lights and operational gates as a train passes.

Most of the time I have to point out the lighting on a train.

Visitors always comment on the number of figures on my layout, hundreds viewable.  Every structure has at least two and 80+ at my passenger station.


Mel

 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California

Growing old is a bummer, aging is definitely not for wimps.

  • Member since
    January 2019
  • 2,572 posts
Posted by John-NYBW on Friday, April 15, 2022 11:11 AM

gregc

 

 
John-NYBW
It's a very inefficient way to do a million things once. IOW, the computer is designed to do repetitive tasks. To program it to do something once or even a few times is going to take you far more time and effort than if you just did those tasks manually.

 

most applications for processors are not intened to perform their function just once -- unless you consider weapons or disposable sensors

 

it's often time consuming to design moderately complex a logic circuit and then have to make wiring changes to make corrections.   microprocessors and other programmable devices (Sheldon has mentioned PLCs) avoid the need to rewire with simple reprogramming

processors, and Arduino in particular, make it much easier to design/build a one-of-a-kind circuit.   processors make it easy to develop prototypes before potentially designing a more applcation specific circuit.   seems like many of Mel's applications are one-of-a-kind.

but the other aspect of a processor is that while they may be initially intended for one function, can be reprogrammed with function previously overlooked.

another aspect is that functions to damaged circuits can be reprogrammed to spare ciurcuits if available.

the fact is, the electronics industry has moved to more programmability because of the things i've mentioned and it minimizes design risk

 

Even simple reprogramming is probably going to take more effort than just performing an operation manually. If you are needing frequent reprogramming, a computer is not your friend. Some people get hung up on automating everything. There can be a place for some automation in this hobby but I see far too many examples of people wanting to program their electronics to automate things that can be handled quite simply by manually throwing a switch. 

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Friday, April 15, 2022 10:45 AM

John-NYBW
It's a very inefficient way to do a million things once. IOW, the computer is designed to do repetitive tasks. To program it to do something once or even a few times is going to take you far more time and effort than if you just did those tasks manually.

most applications for processors are not intened to perform their function just once -- unless you consider weapons or disposable sensors

it's often time consuming to design moderately complex a logic circuit and then have to make wiring changes to make corrections.   microprocessors and other programmable devices (Sheldon has mentioned PLCs) avoid the need to rewire with simple reprogramming

processors, and Arduino in particular, make it much easier to design/build a one-of-a-kind circuit.   processors make it easy to develop prototypes before potentially designing a more applcation specific circuit.   seems like many of Mel's applications are one-of-a-kind.

but the other aspect of a processor is that while they may be initially intended for one function, can be reprogrammed with function previously overlooked.

another aspect is that functions to damaged circuits can be reprogrammed to spare ciurcuits if available.

the fact is, the electronics industry has moved to more programmability because of the things i've mentioned and it minimizes design risk

greg - Philadelphia & Reading / Reading

  • Member since
    January 2019
  • 2,572 posts
Posted by John-NYBW on Friday, April 15, 2022 9:48 AM

ATLANTIC CENTRAL

A few other thoughts.

I don't need or want any computer interface.

People seem to make a big deal about the ability to make changes. That has never been a big issue for me, once designed changes have always been minimal to non existent.

A quick evaluation shows 80% or more of my relays are switching track power on at least one or two sets of contacts. So in my case, not many relays would be eliminated.

And given a choice, I would much rather wire 12 ice cube relays than build that small output board Mel built. Space and power consumption are not issues, there is plenty of room under the layout.

Again, thanks to all for the info.

Sheldon

 

I agree completely. I spend most of my working life in the computer industry. One of our IBM reps made a point to me that I have remembered all these years. A computer is a wonderful tool to do one thing a million times. It's a very inefficient way to do a million things once. IOW, the computer is designed to do repetitive tasks. To program it to do something once or even a few times is going to take you far more time and effort than if you just did those tasks manually. This point was driven home to me again a few weeks ago when someone suggested using a JMRI interface to change a CV. Changing a CV is dirt simple. Why would I need a computer interface to do that? 

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Friday, April 15, 2022 9:19 AM

Mel, thanks again. My signaling approach is just the opposite, I only model the interlocking signals so turnout position is necessary information. All my signals depend on turnout position,  cab assignment and detection for determining their aspect. It is actually rather easy with logic chain just like the prototype used with relays.

My signals are color lights not targets, so no special logic needed for that. 

Sheldon

 

 

 

    

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Friday, April 15, 2022 8:48 AM

A few other thoughts.

I don't need or want any computer interface.

People seem to make a big deal about the ability to make changes. That has never been a big issue for me, once designed changes have always been minimal to non existent.

A quick evaluation shows 80% or more of my relays are switching track power on at least one or two sets of contacts. So in my case, not many relays would be eliminated.

And given a choice, I would much rather wire 12 ice cube relays than build that small output board Mel built. Space and power consumption are not issues, there is plenty of room under the layout.

Again, thanks to all for the info.

Sheldon

    

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Friday, April 15, 2022 8:04 AM

Greg, thank you, that actually helps me understand a lot more.

And it sounds like it is an ideal way to implement programmable logic for our models.

Also sounds like a lot of features I don't need.

More later, have to run.

Sheldon

    

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Friday, April 15, 2022 7:39 AM

ATLANTIC CENTRAL
Still no one gets in to the nitty gritty of how Arduino works, which tells me that even for someone with my experiance in electronics the learning curve is steep.

something i've often had to do professionally is write routines to access hardware the processor is connected to.   another is scheduling.

the Arduino is targeted for animation artists, physical computing, people who are not computer professionals.   it has simple library functions to access the hardware: read and write digital pins, analog functions to read voltages or control motors using PWM, and many other library functions to simply programming

while more sophisticated multi-tasking is possible, an Arduino program requires two routines: setup() and loop()

setup() is invoked once for initialization.   this includes configuring input/output (I/O) pins as either input or output, and configuring the bit rate for a serial port that allow prints on the PC or sending command strings to the Arduino.

loop() is repeatedly called.   it would typically read input and invoke code depending on the state of the input.   for model railroading, reading a block detector might cause red and green signal LEDs to be turned on/off or activating a crossing.   Mel has described code for controlling lamps as well.

of course much more sophisticated functions are possible such as the interlock i described.

debugging is made easier using the serial interface to print text and values depending on activity.

the serial interface can also be used to communicate between Arduinos or Arduinos and a PC allowing the PC to monitor and control a layout

while an Arduino can be used for many conventional things, it can be programmed for many unique cases for which there is no commercial products and can be powered with a common USB wall adapter and micro usb cable commonly used as phone chargers.   this makes it possible to experiment with little cost.

here's a small program that randomly changes the intensity of an LED every 100 msec to simulate the flicker of a fire

1430

const byte ledPin = 10;

unsigned long msecLst;
unsigned long Period = 100;

void loop()
{
    unsigned long msec = millis ();

    if ( (msec - msecLst) > Period)  {
        msecLst = msec;
        analogWrite (ledPin, random (200, 255));
    }
}

void setup()
{
    pinMode (ledPin, OUTPUT);
}


greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Friday, April 15, 2022 6:30 AM

gregc

 

 
ATLANTIC CENTRAL
Cheap, my system is pretty cheap compared to most plug a play solutions, I don't understand the "power" of Arduino to compare costs with my system. That is the question I am asking?

$50 Arduino vs industrial grade relays I paid $1 each for.

 

an arduino board is typically < $10.   dozens of relays can be replaced with an arduino

but it's not so much cost as time. 

 

while controlling lights may not be the most sophisticated use of a processor, there's a threshold where the complexity of a circuit is much easier to build, modify and maintain using a processor like an arduino.

of course it depends on your skill set.   it's difficult or anyone to do something they haven't done before, much less seen done before

 

i helped a modeler with an interlocking more complicated than the one in the diagram, implemented using an Arduino, I2C I/O expanders and relays to drive tortoise machines.   the problem was not all the routes were aligned properly.

while there was a lot of wire between the relays, panel, panel LEDs and tortoise machines, none of that wiring controlled the routes.   that logic was all in the code.

the "power" of using an Arduino is that the routing problems were corrected by plugging a longer usb cable between the arduino and laptop on top of the layout and reprograming the arduino.   there was no need to rewire anything under the bench or even on a workbench.

but there are several other advantages to using an Arduino rather than just a microprocessor.

  • the processor is on a small board with a crystal, ready to run
  • the board has a usb interface for programming and telemetry
  • there is an Integrated Development Environment for writing, compiling and programming the board
  • the Arduino is programmed in a conventional language, C/C++

so while many things done with processors today can be done with electronic or relay circuits, they are more easily done with an Arduino and there are many more complicated things that an Arduino makes much easier to do and inexpensively.

the wiring using an Arduino is simply the inputs and outputs, it's not the "logic" of the circuit that is often difficult to understand, design and debug.   the logic is in the code, and while maybe also a bit mind boggling, is much easier to create and change.

1366

 

Well, first let me say that I agree, there is a point of complexity were a processor is a better logic solution, there is no question about that.

A quick survey of the interlocking you pictured suggests that some of those choices would be stand alone functions in any case. Without understanding all the operational and functional goals I am unable to know if even this exceeds a building block approach of simple circuits. But OK, I will give you that in any case it is complex enough to make a processor a logical choice for turnout control.

But in my case, I am doing more than turnout control and signaling, I am also switching track power and that needs to be discrete and have 5 amp capacity because unlike DCC, or old common rail DC systems, each of my throttles has a separate power supply.

So the end of the logic chain would still need a relay output......

On average, for turnout control, my relay count is one relay per turnout, relays I bought for $1.

My relay count for the cab asignment logic is 8 relays per primary mainline block. And the CTC permission circuit uses 4 more per block.

My interlockings are not separate blocks but rather self selecting X sections of the blocks on either side based on the route selected - no more relays than those listed above. So that makes the count per "typical" bock effectively 6.

The logic is simple and wired on the bench. The logic of the cab selection circuit is on a mass produced circuit board I had made. - just wire the inputs and outputs - like your choice.

If I was doing full prototype signaling with every prototype aspect represented, I agree a processor would be better. There is no need for all that on a model train layout. Even on a large layout, time and distance does not support that.

My system provides for full bidirectional signal interlocking with turnouts, not just  block signals.

If I was using DCC and wanted to control tunouts with a throttle, other choices would be bettere than my relays, clearly.

I have no interest in the "full" CTC process, I use a simplified version. Again, in my view time and distance on a model railroad......

My detectors come with onboard relay outputs (Dallee) and are inductive so they do not effect track voltage.

Still no one gets in to the nitty gritty of how Arduino works, which tells me that even for someone with my experiance in electronics the learning curve is steep.

Time I see no point in spending at this point. 

Thank you all for your thoughts and info.

Sheldon

    

  • Member since
    July 2009
  • From: lavale, md
  • 4,677 posts
Posted by gregc on Friday, April 15, 2022 5:01 AM

ATLANTIC CENTRAL
Cheap, my system is pretty cheap compared to most plug a play solutions, I don't understand the "power" of Arduino to compare costs with my system. That is the question I am asking?

$50 Arduino vs industrial grade relays I paid $1 each for.

an arduino board is typically < $10.   dozens of relays can be replaced with an arduino

but it's not so much cost as time. 

 

while controlling lights may not be the most sophisticated use of a processor, there's a threshold where the complexity of a circuit is much easier to build, modify and maintain using a processor like an arduino.

of course it depends on your skill set.   it's difficult or anyone to do something they haven't done before, much less seen done before

 

i helped a modeler with an interlocking more complicated than the one in the diagram, implemented using an Arduino, I2C I/O expanders and relays to drive tortoise machines.   the problem was not all the routes were aligned properly.

while there was a lot of wire between the relays, panel, panel LEDs and tortoise machines, none of that wiring controlled the routes.   that logic was all in the code.

the "power" of using an Arduino is that the routing problems were corrected by plugging a longer usb cable between the arduino and laptop on top of the layout and reprograming the arduino.   there was no need to rewire anything under the bench or even on a workbench.

but there are several other advantages to using an Arduino rather than just a microprocessor.

  • the processor is on a small board with a crystal, ready to run
  • the board has a usb interface for programming and telemetry
  • there is an Integrated Development Environment for writing, compiling and programming the board
  • the Arduino is programmed in a conventional language, C/C++

so while many things done with processors today can be done with electronic or relay circuits, they are more easily done with an Arduino and there are many more complicated things that an Arduino makes much easier to do and inexpensively.

the wiring using an Arduino is simply the inputs and outputs, it's not the "logic" of the circuit that is often difficult to understand, design and debug.   the logic is in the code, and while maybe also a bit mind boggling, is much easier to create and change.

1366

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, April 15, 2022 12:25 AM

Sheldon

My signal system only tells the block signals to display the correct color by occupancy detection.  That’s as sophisticated as I need.  It operates as a simple truth table.

https://melvineperry.blogspot.com/2017/02/february-3-2017-arduino-mega-signal.html

I haven’t up dated this post and it shows the 7 channel drivers but I found some 3 color LEDs for under $1.50 so I didn’t go with the expansion boards.  The $7 MEGA drives all 14 signals direct.  I have 8 blocks but I dropped the siding block from the installed system.

The Arduino code is the same for just the LEDs, just no high current chips. Each color LED max current is 4ma-green, 12.5ma-amber and 2ma-red, no high current driver needed.  The total cost less the occupancy detectors was $9 and I built my signals with the three color head for about $4 each, total cost for visual only signals was $9 for the controller and $64 for 16 signals (14 in service and two spares).


https://melvineperry.blogspot.com/p/blog-page_49.html

EDIT:

As I'm stuck in my recliner I'll up date my signal posts.



Mel


 
My Model Railroad   
http://melvineperry.blogspot.com/
 
Bakersfield, California

Growing old is a bummer, aging is definitely not for wimps.

  • Member since
    July 2006
  • From: North Dakota
  • 9,592 posts
Posted by BroadwayLion on Thursday, April 14, 2022 11:51 PM

I do not know what an Adrino is, but if it moves, I'm sure the cat can catch it.

The Route of the Broadway Lion The Largest Subway Layout in North Dakota.

Here there be cats.                                LIONS with CAMERAS

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Thursday, April 14, 2022 11:05 PM

Mel, thank you, you answered some of my questions and confirmed some information for me.

So from where I sit, Arduino looks great for things like your random structure lighting - that is no doubt easier with a processor.

A large part of my system is switching track power - connecting track "blocks" to wireless throttle base stations and providing frog power.

And then there is turnout control. By simply using a typical motor starter type relay circuit, a tortise machine can be controlled by push puttons at as many differnet locations as you want, and be given "route logic" that is pretty simple.

All wired on the bench except for the inputs and outputs..........

So, once you have a set of contacts reversing the polarity to a Tortise machine, you have left over contacts which all indicate statis - frog power, interlocking signal logic, it s already there.

How "complex" is your signaling? Is it on your blog somewhere?

Thanks for the info. 

On last question, explain "cleaner" in the contect you used it?

Sheldon

    

  • Member since
    January 2009
  • From: Maryland
  • 12,897 posts
Posted by ATLANTIC CENTRAL on Thursday, April 14, 2022 10:44 PM

speedybee

 

 
ATLANTIC CENTRAL
My question is why this particular electronics solution?

What are its advantages? Why should I want to use it?

 

 

I think you mostly answered your own question when you described how complex your setup is and that few would want to build it.

Using IC logic, like programming an Arduino, is a fast, cheap, and simple way of implementing electronic logic and power that would be tedious, expensive and complicated to do otherwise

 

 

FAST? Not if there is a high learning curve? There needs to be a compelling advantage to justify scraping something that is working fine that you already know how to do in favor of something new that you have to learn.

Cheap, my system is pretty cheap compared to most plug a play solutions, I don't understand the "power" of Arduino to compare costs with my system. That is the question I am asking? $50 Arduino vs industrial grade relays I paid $1 each for.

How many relays will the Arduino replace for my applications?

How many little driver boards will I have to build instead to handle higher current levels? 

Simple? Having designed, built, repaired and converted to PLC, the relay logic of the past, many decades ago, one simple fact remains, inputs are inputs, and outputs are outputs, and they all require some level or another of hard wiring for tactile operation. The use of touch screen or cell phone type interface is not an  acceptable input method for me. 

So be it a relay or an IC/processor, I need to wire inputs (buttons and lights mostly) and obviously the end goal is to control trains, turnout motors, signals and in my case direct track power.

So I don't see how a solid state device is going to reduce wiring by very much for my goals.

AGAIN, I'm asking for someone to explain enough to show me otherwise.

And again, I already use solid state inductive detectors, solid state regulated power supplies, solid state wireless radio throttles, and mass produced custom relay boards for my most basic relay circuit.

Please explain how Arduino is going to make my wiring easier? or better?

Sheldon

 

    

  • Member since
    December 2016
  • 168 posts
Posted by speedybee on Thursday, April 14, 2022 10:24 PM

ATLANTIC CENTRAL
My question is why this particular electronics solution?

What are its advantages? Why should I want to use it?

I think you mostly answered your own question when you described how complex your setup is and that few would want to build it.

Using IC logic, like programming an Arduino, is a fast, cheap, and simple way of implementing electronic control that would be tedious, expensive and complicated to do otherwise

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!