Railway project: Power from tracks

Hi all,

I am quite new to Arduino, but not to programming in general. I have a project in mind - basically model trains, in a rather large scale (1:22).
There will be a "controller arduino" off-track.
Each train will have its own arduino, receiving wireless commands from controller, and acting accordingly.

Now, my plan is to have the tracks provide 12v power, with ground on the other side of the track.
The on-board arduino should get these 12v as input voltage - is this safe? I can perhaps imagine that there may be spikes in the supplied power, so what is the safest way to do this?
The motors will be PWM-controlled by the on-board arduino, but from the same power supply. I imagine some hefty capacitors are needed.

When running, I could easily imagine the wheels sometimes slipping, or not completely touching the rails for short periouds of time. Could I use a large capacitor before the arduino, as a buffer, so it does not reset when/if this happens? If so, what specs should I be looking for?

Thank you in advance for any guidance :slight_smile: I don't want to completely start with the wrong idea, if any of this is out of the question.
Casper

it should be possible
if you pick up power through more than one wheel it should help with contact glitches
lots of smoothing as there will be LOTs of electrical noise
instead of using wireless, why not send the signal over the track as well?
sort of upside-down POE technology :slight_smile:

You should include a 'Bridge Rectifier' in the circuit. Otherwise if you put the train on the track the wrong way around you would blow up the Arduino.
You will also need to add additional filter capacitance to the Arduino +5v line. Perhaps a 6.3V (10V if you can find one) super capacitor on the +5v line to smooth things out.

Hi,

Thanks for the replies!

mmcp - Good idea with multiple wheels - should indeed prevent total loss of power.
I can image a lot of noise though, as you say. When you say lots of smooting - what kind of places do you think capacitors should be placed? I would have thought only for the voltage supply, but what other critical areas could you imagine?
Would love to have communication via the rails, but am thinking the technical expertise required in that is more than I am currently capable of. I want to keep the circuits as small as possible, while I am still new to that part.

Tom - Good idea with the Rectifier - had not thought of that, but is definately necessary.
You say I need a capacitor on the +5V line - I was thinking of using the VCC IN line, would the built-in voltage regulator not take care of most of that?

Again, I am new to electronics, but a basic idea of what I am thinking it would look like (sorry for the probably abused symbols and if the mosfet is incorrectly attached :wink: )

Casper

Why reinvent the DCC wheel?

Hi AWOL,

I have read some on the DCC topic, and know it is an existing standard. But it does not seem trivial to implement via the Arduino, from what I have read. So although it would give me a way to communicate along the tracks, I am not sure if I can use the Arduino to decode it. Besides, the trains also needs to send data back to the controller, which I do not see as possibly using DCC.

Besides, reinventing the wheel is more fun than using one that actually works :wink:

Googling "Arduino DCC" yields some interesting links.

Power from the tracks sucks!
And DCC is yesterday's technology.

Go direct to BPR/C - battery powered radio control.

Put a battery in your locomotive and then you don't have to worry about problems with poor contact or voltage spikes. And you don't need any track wiring.

I am doing this with N-Gauge trains so it should be no problem for 1:22 scale.

You may also be interested in this post Very Small Arduino with 2.4Ghz wireless transceiver and motor bridge - DelTino - Microcontrollers - Arduino Forum

There is also a lot of information about BPR/C here R.C. The Future Now If You Desire - Model Railroad Forums - Freerails

...R

Hi :slight_smile:

I have read some information on DCC, and it does sound like an interesting approach, as an alternative to what I had in mind.
I cannot seem to find any information online on the wiring of this in relation to an arduino, but I guess I could figure that out some how.. hmm...

As for Robins idea of BPR/C, it would be nice to have - but considering the size of the models I want to work with, where the weight of a train incl. cargo could be up to 4-5kg, I think batteries would have to be too large and costly for it to be feasable. Or would it?
But I was initially planning on the wireless aspect of this, only providing raw power through the rails. This may still be the way to go.

What do you all think? Is DCC overkill, when radio units are so relatively cheap for the arduino, and I have no plans whatsoever to use any off-the-shelves model train equipment (ie, wont need DCC)?

Put a battery in your locomotive and then you don't have to worry about problems with poor contact or voltage spikes. And you don't need any track wiring.

Do you have a siding with powered track where your locomotives can go to charge their batteries?

Hi, I guess it would be possible to create a side-track for charging. Could probably find room for that, yes.
Would I be able to power these with say 8 rechargable AA batteries in series? Do anyone have any idea of what kind of mileage I could get out of something like that? An hour of runtime?
I guess I could wire up 2 packs of 8 in paralel to further increase runtime.

So many ideas. What do you think? Would it be more feasable to run this from batteries with automatic charging (guess I could rip out the internals of a battery charge, and hook up some sort of connectors the train can press against).

Thanks for the great input so far everyone! Very see this from an angle I had not at all previously.
It would be so much easier to create the rails without having them to be able to conduct power.

why so many batteries?
use batteries to power the Arduino; 5 volts or even 3.3 volts
track power for the motor; whatever voltage you want

Hi mmcp,

The reason for that amount of batteries was in response to those who mentioned battery powered vehicles, where I was thinking of powering everything off of batteries, thus not having power through the tracks.

What would the advantage be of having the arduino battery powered, but not the tracks themselves? Would you consider it to be a safer way to power the arduino, and result in less problems?

Hotcut:
Would you consider it to be a safer way to power the arduino, and result in less problems?

Absolutely certainly.

Regarding motive power, even quite a small battery charged from the track would be enough to eliminate glitches and dead spots and remove the need to have every inch of your track energized.

PeterH:
Regarding motive power, even quite a small battery charged from the track would be enough to eliminate glitches and dead spots and remove the need to have every inch of your track energized.

I would run the electrified track at full power all the time, and let the Arduino control how much power gets from the track to the motor via PWM for speed control.

I don't think batteries would be necessary at all if you electrify the whole track, just a big fat cap. Somewhere north of 2,000uF would do, I should think?

Hotcut:
Hi mmcp,

The reason for that amount of batteries was in response to those who mentioned battery powered vehicles, where I was thinking of powering everything off of batteries, thus not having power through the tracks.

What would the advantage be of having the arduino battery powered, but not the tracks themselves? Would you consider it to be a safer way to power the arduino, and result in less problems?

almost what I said
retain track power for the motors; all the power you need
use battery pack for the Arduino; less noise/heat problems

I would also have a charging station for the batteries - couple of contacts in the buffers?

The beauty of batteries is that you don't need to have powered track, and it can be quite difficult to ensure electrical continuity across track joints and to maintain voltage over long distances. And even in the best of situations you can get power interruptions at crossovers.

You need much the same amount of electronics whichever way you do it, so why waste time and money on track wiring.

I think LiPo batteries would be a better choice than NiMh batteries. They have a better energy density and discharge ratio. For model trains there is no need for the really heavy discharge rates or fast charging that is common in the model flying world so the scare stories about LiPos are not applicable.

My plan is to have top-up charging from the tracks while a loco is waiting in the off-scene fiddle-yard.

If your plan is to have a single train running round a loop continuously for hours at a time BPR/C may not be suitable - but DCC would hardly be necessary either. However if you want to operate trains in a replica of real operations then there will be plenty of idle time for topping up batteries. If you haven't already done so you should look at the link I gave to the FreeRails website where several people have recounted how long trains can run from batteries - some of the people have large scale garden railways.

I can't understand why anyone would use DCC and wireless - it just doubles the cost for no benefit. DCC was designed to give a "wireless-like" experience back in the day when very small wireless receivers and small batteries weren't available. The PWM motor control that you get from an Arduino (including the Deltang devices) is exactly the same as what is produced by a DCC chip.

...R

Robin2:
The beauty of batteries is that you don't need to have powered track,

And the real beauty of powered track, is that you don't have to have batteries. Batteries are the most troublesome part of any design.

Robin2:
and it can be quite difficult to ensure electrical continuity across track joints and to maintain voltage over long distances. And even in the best of situations you can get power interruptions at crossovers.

This depends a lot on scale. For a "board" layout, the wiring cost is trivial. For an "outside" layout it may be significant. Inertia tends to manage the crossovers (and the larger the gauge, the more substantial the inertia) and a decent capacitor (10mF or so) will hold the electronics.

Robin2:
You need much the same amount of electronics whichever way you do it, so why waste time and money on track wiring.

Batteries aren't that cheap. Track wiring is once for ever.

Just saying ...

So many good points here!

I do like the idea of battery powered vehicle, but thinking in terms of costs, as well as the requirement for a charing circuit, it does seem easier to "just" have a large cap to protect the electronics from crossovers etc.. and then 12v through the rails.
At least I can start with this, and if there are too many problems along the way, I can add a battery instead. There will be plenty of space inside the vehicle for that stuff.
Wireless communication will then provide the 2-way communication I need.

I haven't started much of the project, except for the locomotive, so am still in the planning stages of the track itself. Have some ideas on how to make the tracks, which on its own is an interesting topic.

Thank you for your input everyone!

I suggest the following:

  • feed the track power into a bridge rectifier
  • connect a capacitor across the output of the bridge rectifier, to reduce transients and interference generated by the motor
  • feed the output of the bridge rectifier to the barrel jack input of the Arduino (there is a diode between this input and the Vin pin). The bridge rectifier output also feeds the motor/mosfet combination.
  • connect a large capacitor between the Vin pin and ground. This will act as a reservoir just for the Arduino. It is isolated from the motor by the diode. So it will power the Arduino even if there is an outage of a substantial fraction of a second.