At the moment a friend and I are working on project to digitalize an old model railroad. It concerns a g-scale model train The infrastructure of this train is based on a DC powered track. One rail functioning as a plus and one as a negative pole of the system. Normally a variance in voltage on the tracks makes the train go forward, or if the poles are reversed backward.
Our plan is to use a system of master - slave arduino ideally communicating over a I2C Bus via the existing infrasturucture, namely the tracks. For as far as track voltage goes, we want to make this static at around 20 volts and make the arduino take care of regulating voltage to the actual motor, this however is a later stage in our project, for now we are focusing on communication between the arduinos
The master arduino (Uno) will be a stationary item (ideally built into a nice casing) the second, slave, one will probably be a Nano integrated into a locomotive.
For now all we wish to accomplish is to send a (serial / bus) signal from one arduino to the other while the track power is at 20 volts.
All suggestions concering this signal are welcome!
We have looked into I2C, because this being a standard, the principle drawback is that it requires a clock line and a data line (via Wire library)
We have looked into a master slave pure serial (via the SoftwareSerial Lib) which is less limited but might suit our needs since this can be done with a single ground wire and a wire from RX to TX (since we are only transmitting this might work but is not ideal
Also we have looked into the OneWire protocol, however it being propietary does not have out personal preference.
All of the above are options we might considering based on the problem of actualy sending a data signal over a powered track. At this point we are stuck.
Is there a possibility to modulate/demodulate the frequency of the clock line and the data line of the I2C Bus to run via a single powered up wire? If so does anyone have any schematics on how to actually build said modulator? Or could someone explain the theory on how this should work
Or does anyone know if a prebuild modulator exists?
Or, using a one wire solution, is it possible to modulate that single signal over a powered up DC line?
Any general hints about sending data over a powered DC system as described above are already very welcome!
Yes i agreeg using RF would be the easiest option, however Rf becomes a tad unreliable when the signal has to cross walls. furthermore it adds a layer of infrastructure to the whole project. If indeed the data over rails idea is too difficult / will take up too much physical space in the locomotive, this will be a great go to second option. For now i'm going to keep focusing on getting that data signal over the rails ty for the response!
If you want to send data through the rails just use DCC. You can make Arduino based DCC encoders and decoders if you don't what to use commercial DCC stuff.
How many walls must the radio signal penetrate? Can't you choose a location for the master transceiver that eliminates the problem? And if your layout is so extensive that 2.4GHz wireless with nRf24L01+ modules won't work reliably you could use 433MHz wireless with HC12 modules.
With G Scale you can easily use battery powered trains and completely avoid all the problems of power through the rails.
I have converted some 20 old Maerklin locomotives into digital using existing dekoders.
If the main purpose is driving trains, buy existing stuff. If You like to spend time creating electronics, go for that. You can modulate the power, the 20 volt, letting a negative flank be the trigger for the receiver that a message is coming. Than decode the message in the loco.
Using technic suggested is also an option.
First off, I was aware that something like DCC exists for g-scale LGB trains, however i wasnt aware it was actually called DCC, and indeed this is exactly what i am trying to mimic.
A minor side note to this is that i'd rather have a PC interface with the command station instead of analog throttles.
Programming an actual UI for this is much less of a problem, however to me this is a far later stage then i am at now.
So back to the matter at hand, how on earth am i going to pulse the power and send data via the pulses? If at all possible, i'd love to see how it works in a schematic =D
The voltage divider bit i get, also, yes i quite like soldering a bit so i dont mind putting in some hours if i can find the schematics, however if anyone has prebuild parts, also very welcome
Either you buy a commercial DCC unit to power the rails or you grab a motor controller shield like the Sparkfun Monster Moto Shield. Use that to power the rails with the pulses you require.
jelgerlemmens:
So back to the matter at hand, how on earth am i going to pulse the power and send data via the pulses?
DCC is a little more elaborate than just something that pulses power. It is an extensive protocol for controlling trains and lineside accessories.
The DCC specification is published by NMRA and it is worth studying it.
Unless there is a compelling reason to do otherwise I suggest you just get one of the proprietary systems. I think they are all capable of interfacing with a PC and there are also several off-the-shelf PC programs that can be used to control the trains including the free JMRI system.
BUT ... (there is always a 'but')
If you plan to send control signals and power through the track you will need a very reliable track electrical system with no unreliable joints or dirty patches where the loco might lose contact. If you use Battery Powered Radio Control (BPR/C) then you can save yourself a great deal of work and track maintenance.