Model Train Forum banner

1 - 20 of 23 Posts

·
Registered
Joined
·
3 Posts
Discussion Starter #1
I'm planning a G Scale layout that could best be described as a fun and unique, specific purpose. Assuming that I can pull it all together, I'll share the full details and pictures during the build, and when it is actually installed and running.

I have plenty of experience with HO and G scale equipment, and I develop manufacturing control system software (SCADA/PLC) for a living. Now I want to do a fun DCC type of project. I've been reading up on hardware options, and before I dive in at the next level, get some opinions from the gang here.

Specific Use Case:
- A single G Scale Loco and 2 or 3 pieces of rolling stock, nothing more than that. Ever.
- A single linear rail section about 40 feet long. It will never be expanded. Ever.
- Need to somewhat accurately (+/- a few inches) stop the loco at "Stations" spaced 2 feet apart, so at least conceptually, there could be 20 track segments/blocks to define the stations.
- "Home" is at one end of the track. When the train is at home, give it a command to move to a particular station. It would accel, travel, decel and stop. A separate command would be issued to return home.
- The ability to support a physical and/or PC display based panel to show the status.

I have used Arduino and Raspberry Pi for other home projects. I can program in multiple languages (Basic, C, C++, Javascript, PHP, PLC ladder logic, fluent in Cisco IOS, etc.) so this is not a challenge on the configuration and programming side.

I've done research, but here are some "sanity check" questions. I'm also looking for "Here's how I did it" or "Don't do THAT!" feedback:

I can do *all* of the software control/automation using JMRI?
I can use an Arduino or Raspberry PI with a Digitrax PR4 or Locobuffer USB interface? Would a PC be better?
I can use a monitor attached to an RPI running JMRI to display the panel status?
I can use a Digitrax BLD168 via the JMRI Reporter to get block status?

Assuming no drive train slippage, can you think of any reason that I couldn't use 10 track segments (instead of 20) and program 2 different decel rates to stop at two different locations in a single segment? This would reduce wiring/sensors.

Going a step further (assuming no slippage or load variations) is it realistic to program the stations strictly by speed and run time with no blocks/sensors other than Home?

Is there any reason that I should use ALL commercial hardware & software such as Digitrax instead RPI/JMRI?

Thanks!
 

·
Registered
Joined
·
5,368 Posts
Welcome to the forum. Sounds like a cool G scale project. Your questions are way above my pay grade. Good luck.
 

·
Registered
Joined
·
2,156 Posts
I don't think I can answer most of your questions directly, but you might want to look into DCC++ESP32 (an offshoot of the original, but the main DCC code is synced between the two projects). The ESP32 branch adds wifi control, and also includes S88 and LocoNet functions (which I don't know if the plain DCC++ has?). Because of the networking features, it becomes possible from the raspberry pi to write a script that opens up a port that sends/receives DCC commands. So if you tie some track sensors to S88 or LocoNet, when a sensor is tripped that information will also appear on the network port, allowing your script to respond. For example, if sensor 1 is tripped you can send a DCC command to speed up the train, then start slowing down when you hit sensor 2, and stop for 60 seconds when you hit sensor 3.

My own current setup uses the raspberry pi to set up a private wifi access point. The esp32 runs DCC++ESP32 as a base station and connects to the wifi automatically, and will soon be running S88 to detect track sensors. I also have an arduino set up as a DCC decoder to run servo motors controlling the turnouts. And the esp32 also provides a web interface, so I can connect to the wifi with my cell phone and run the train and turnouts from there. There is maybe $100 in equipment here, not counting the Digitraxx decoders in my three locos, but it sure does provide a lot of possibilities.
 

·
Registered
Joined
·
222 Posts
Take a look at some of my posts on using DCC++ and controlling turnouts with arduinos and motor shields.

The one thing I would be concerned with is the power draw of G scale locomotives. I imagine the draw is considerable. You would need a booster. The standard DCC++ without any boaster is about 1.5A if u recall. I regularly run four HO locomotives on my layout at the same time with no issues. There is a setting in DCC ++ to bump the short current threshold up.

Other than that I would see little of concern. I would personally make everything from scratch with no DCC off the shelf products as it would be a learning experience. I would use a magnet on the bottom of the loco with a reed switch in the track, IR sensor and LED or something similar.

Also as mentioned you could open a serial communication with the DCC++ base station and send a script. Not sure how difficult that would be from a Pi or JMRI. From a computer it would be quite easy. The tutorial on DCC++ on YouTube shows you how to do it during the testing. Turning track power on/off, etc.

There is also a YouTube video where someone has automated a layout with DCC++ if you search for it.

Hope that helps.
 

·
Registered
Joined
·
1,147 Posts
Who knew, a DCC specific forum topic area!

So this is a few months old thread and in the HO forum I put this new thread out on making the DCC++ and being happy that it "just worked" (more or less) -- and so it should have gone here.

Anyway on the topic of more amperage -- well I'm a little familiar with Pololus motor shield offerings. I have several of them. [limited use yet some...]

One would imagine the current code base of DCC++ could be ported to either of these other two higher current boards "with ease"... [VNH5019, TB9051FTG ]

https://www.pololu.com/category/113/arduino-shields

I have the VNH5019 already for other reasons... which doesn't mean I'm volunteering really but it seems like it could work instead of the MC33926.

In the HO and one imagines the other smaller scales the amperage needed is probably no more than 1 amp continuous at most [motors stalled out, sound on say and LEDs].

I'm a little familiar with O -- which is in fact why I have these things. The motors are bigger although I don't quite think anyone can state with absolute certainty except from the lionel/mth's mouths directly and they are mum on the topic -- what their amps neds are -- yet we can estimate.

For example I had an MTH SD70ACE apart the other day -- and I happened to notice its bridge rectifier part number and looked it up -- it's an 8 amp part.

Now I don't think MTH thinks that engine draws 8 amps continuously, but maybe with the engine stalled [it has 2 cheap chinese can motors] and the smoke blowing full bore and the sound cranked up and all the LEDs on and the couplers being fired ... maybe its something like that.

So one imagines that indeed for the larger gauges a higher amp rating board would be a good thing for DCC++.
 

·
Registered
Joined
·
2,156 Posts
The 1.5A board usually mentioned with DCC++ is only for testing a couple of locos or running a programming track. You wouldn't use that board for anything larger, however the BTS7960 board is commonly available, really cheap (less than $10 usually), provides up to 43 amps with proper cooling, and is already well supported by the DCC++ group. I can't imagine even G scale needing more power than that.

The caveat here is that the BTS7960 board is not an arduino shield... you have to wire it up yourself, but there's only 8 wires for the interface plus screw connectors for the incoming and outgoing power, and connecting it for DCC++ is pretty well documented.
 

·
Registered
Joined
·
222 Posts
The 1.5A board usually mentioned with DCC++ is only for testing a couple of locos or running a programming track. You wouldn't use that board for anything larger, however the BTS7960 board is commonly available, really cheap (less than $10 usually), provides up to 43 amps with proper cooling, and is already well supported by the DCC++ group. I can't imagine even G scale needing more power than that.

The caveat here is that the BTS7960 board is not an arduino shield... you have to wire it up yourself, but there's only 8 wires for the interface plus screw connectors for the incoming and outgoing power, and connecting it for DCC++ is pretty well documented.
I have been using the standard DCC++ set up with the 2amp motor shield. I have had good success in running 4 locomotives at the same time, 2 with sound. I went on vacation for a month and left it powered on by accident. I think I burned out the motor shield. Need to do some testing when I get a chance to see if it is the motor shield or arduino. If it is the motor shield, I might switch to the BTS7960. Is there anything special i need to do in comparison to the arduino motor shield? You referenced info being available- do you have a good URL link?
 

·
Registered
Joined
·
2 Posts
Hello there,

I'd be grateful for more details on VNH5019 working with dcc++. The software itself is written to work with motor shields consuming a binary DIR signal, whereas VNH5019 provides two separate MxINa/B directional signal. This can be alleviated by adding a NOT gate (7404 or transistor based), but still there is a question of signal delay at the HS side (see https://forum.pololu.com/t/vnh5019-as-dcc-driver/12136).
Unsurprisingly, I was not able to get it working: I've revised pins to match the dcc++ selection of MEGA's timers, added the inverter for MxINA/B. The dcc++ test works, signals switch off and on. BUT, when I connect this to the track the HS signal simply disappears. It looks like MxINA=MxINB=1. So, again, if you're got this working - respect! And would be great to learn the way you've done it...

Cheers,
 

·
Registered
Joined
·
3,444 Posts
the VNH5019 -may- require a circuit similar to the 43 amp booster circuit, if you do a search on threads i created, you will find the project for a 43 amp booster ...
again, the circuit works as a booster , and -should- work as a higher power supply for DCC++ , and it's only 10 bucks on ebay ..
 

·
Registered
Joined
·
2 Posts
Thanks wvgca - super quick reaction - you mean like Dave Bodnar‘s work with bts7960b (http://trainelectronics.com/DCC_Arduino/DCC++/)? That‘s exactly what the combination of arduino mega (command station) and the shield (booster) are. Added the required inverter (given, not 2n2222 based, but using bc547 -npn) and still no avail. So, would be grateful if you guys can confirm vnh5019 works in the combo with arduino uno/mega and Dcc++ for you, and I will keep trying (although a schematics and Dcc++ Pin/current monitor config wouldn‘t be bad neither ;).
 

·
Registered
Joined
·
3,444 Posts
nope, can't confirm the VNH5019 works, never tried it ....
as far as the booster is concerned, it's daves work in that the code and layout is his , all i did was the pcb for it ...schematic for the the arduino and the 7960 are there, in eagle format, with all the pins laid out .. semi-cleanly, lol
 

·
Registered
Joined
·
2,156 Posts
I have been using the standard DCC++ set up with the 2amp motor shield. I have had good success in running 4 locomotives at the same time, 2 with sound. I went on vacation for a month and left it powered on by accident. I think I burned out the motor shield. Need to do some testing when I get a chance to see if it is the motor shield or arduino. If it is the motor shield, I might switch to the BTS7960. Is there anything special i need to do in comparison to the arduino motor shield? You referenced info being available- do you have a good URL link?
Below is my own schematic of how I have my system hooked up. This is of course for the ESP32 version, but I believe the standard DCC++ code uses the same libraries. You just need to select the correct pins on your arduino (which should be the same as the you used for the smaller motor shield), and there is probably something in the DCC++ code where you select the H-bridge board you are using so that it responds properly to an overload condition. Sorry I'm not particularly familiar with the original DCC++, I've only ever used the ESP32 version.

For reference, the yellow wire is the DCC signal, orange is the enable line, and blue is the current overload sensor.

 

·
Registered
Joined
·
222 Posts
Below is my own schematic of how I have my system hooked up. This is of course for the ESP32 version, but I believe the standard DCC++ code uses the same libraries. You just need to select the correct pins on your arduino (which should be the same as the you used for the smaller motor shield), and there is probably something in the DCC++ code where you select the H-bridge board you are using so that it responds properly to an overload condition. Sorry I'm not particularly familiar with the original DCC++, I've only ever used the ESP32 version.

For reference, the yellow wire is the DCC signal, orange is the enable line, and blue is the current overload sensor.

Thanks for the information. I came across this information related to the board I am going to try. I don’t believe it has current sensing.

https://model-railroad-hobbyist.com/node/35753

Bought the board which should arrive by mid-November. On the slow boat from China I guess.

It doesn’t appear I need to use any additional circuitry.
 

·
Registered
Joined
·
222 Posts
Well I have great news in my application. I finally got a chance to do some testing and work on my DCC++ last night. I suspected it had a defective motor shield but it wasn’t. I ran through the testing for DCC++ using the Arduino IDE Serial monitor, using <0>, <1> and <D> commands. It wasn’t working so I reinstalled the DCC++ program on the arduino, still no joy. I then selected a different DCC system in the preferences in JMRI then selected DCC++ again, with serial, selected Com3 again and that solved the problem. All the settings were correct prior to doing this but I guess the reset worked.

I may try the higher amperage board in the future but currently I have not run into a current issue, even running 4 locomotives at once with my existing motor shield. I am going to put a heat sink on the motor shield IC though.
 

·
Registered
Joined
·
2,156 Posts
Rabman - I missed it before, but note mapod1's reply at post #13, which is actually the site where I first saw this BTS7960B board mentioned and talks about using it with DCC++. I had seen the board that you purchased, but the lack of current sensing and the higher price drove me away from it. You can get the BTS board for around $9 off ebay. The difference is that it only runs a single channel, thus why I have a separate 1.5A bridge (modified) for my programming track. Also note that for running only a few locos at a time, you can remove the heatsink from the BTS board.

There's a lot of different H-bridge boards out there, and the ones I've seen all have consistent markings for the pins. Makes it real easy to swap them out. The small transistor/resistor circuit simply acts as a 'not' gate to provide an opposite signal from the direction control line. Basically the bridges need a positive and negative signal on two pins, always opposite each other for the way we use them, and this little transistor provides a cheap and simple means of doing that. For this purpose the 2n2222 and 2n3904 are identical so use whichever you have on hand.
 

·
Registered
Joined
·
3 Posts
I am glad you posted this schematic I was really having trouble figuring out Dave Bodnar schematic for the high power motor driver now i can finally hook one up
 

·
Registered
Joined
·
2,156 Posts
H-bridges are one of those oddball things that don't quite make sense until you've played with them, but once you have something to follow it becomes a bit clearer. Basically the transistor (yellow and green wires) ensures the two outputs are always opposite each other (-+ or +-). The logic chips require such low power that I use the enable line (orange wires) to also provide power to the board. For comparison, these H-bridges are identical to half of an L293D chip commonly used to drive small motors, and I use the same transistor circuit to switch motor directions with a single I/O pin.

I forgot to mention, but that center board provides a 5V @ 5A output for me to drive all of the arduinos off of the track power supply -- probably not needed by everyone so you can safely ignore it.
 
1 - 20 of 23 Posts
Top