Jump to content
 

DCC++ Arduino based DCC controller


Recommended Posts

Hello all,

 

I just came across this arduino DCC controller that is some simple it's truly astonishing and I would like share with you! (I have no connection to this system at all, I just like it!)

https://sites.google.com/site/dccppsite/home

 

All it is is a Arduino (Uno) with a motorshield! Together with the open-source software this allows you to control your layout directly from a PC.

No soldering, no electronic schematics to decypher (both suits me fine as that aren't my strong points..) and unlike many other Arduino based DCC controllers out there it can actually control more than one train, read and write CV values and basically works the same as many commercial units but you will be able to build this system for less than a tenner!

 

The website is far from complete but if you have a look at the Youtube channel it explains the system very very clearly!

https://www.youtube.com/channel/UCJmvQx-fe0OMAIH-_g-_rZw/videos

 

The systems is mainly focussed on computer control, but there are also many people working on 'normal' throttles. One in particular I liked was this one with a normal tv remote control:

(ignore the talking controller, which is highly annoying!)

It should also be possible and not to hard to rig up a system that allows for multiple controllers to allow for more than one operator on the layout.

More information here: http://www.trainboard.com/highball/index.php?forums/dcc.177/

 

I really like this system so far! It's really simple to make and above all it is only a fraction of the cost of any of the commercial systems out there.

I have been using a Multimaus so far and I'm quite happy with it, however, as the modelling budget is tight, I haven't been able to buy a second controller which would allow for somebody else to join me in operating my layout. I have not really an interest in computer control, so JMRI with wifi throttles isn't an option either (don't own a laptop and to haul the PC into the layout room every time I want to run a train is a bit much), but with this system it is possible to build a complete control system with multiple controllers for (I guess) less than half of the price of a Multimaus throttle, let alone the complete set with command station! And even wireless if I wanted to! And this system can read CVs, something that the Multimaus cannot do.. Really impressed!

 

Has anybody else come across this system and any experience using it? I'd love to hear what you think about it!

 

  • Like 1
Link to post
Share on other sites

That looks awesome :O I'm not going to be able to resist playing with it.

 

One thing I can't get my head around with DCC is how the polarity swings between the rails, and how to work with this from a digital world like the Arduino.

 

Is that  of what the motor driver chip is for? It is an easy way to both supply a higher voltage and current, plus swing the polarity just using +5/0 volt signals from the Arduino?

Link to post
Share on other sites

That looks awesome :O I'm not going to be able to resist playing with it.

 

One thing I can't get my head around with DCC is how the polarity swings between the rails, and how to work with this from a digital world like the Arduino.

 

Is that  of what the motor driver chip is for? It is an easy way to both supply a higher voltage and current, plus swing the polarity just using +5/0 volt signals from the Arduino?

 

Hello Dajt,

 

The motor shield is exactly doing that converting the PWM output of the Arduino into a +/- DCC swing/wave at the voltage needed for running one (or several) engines.

Have a look at the hardware videos on the DCC++ channel: https://www.youtube....-_g-_rZw/videos Everything is very clearly explained in that. Even I could build this and that says a lot!

 

And I agree, it is near impossible to resist playing with this... Even if I continue using my Multimaus for running the layout. I can easily hook up one of these to my PC, so I can programme my engines very easily on the computer before letting them go on the actual layout. One thing that annoys me about the Multimaus is its disability to read CVs. This might be possible with some software from Roco, connecting the PC to the Multimaus command station with a network cable, I believe.. But in this day and age of WiFi I don't have a network card in my computer and the description of actually reading CVs is so vague in the software's manual, that it could actually mean that its not going to work! That's why I haven't bothered buying a network card + cable, downloading the software, moving the Multimaus command station from the layout to the PC, only to find out if it is working or not.. With this system I can have a less than €10 command station and a bit of track handy next to the PC where I can fiddle around with tuning my decoders!

Edited by Kiwi_Ed
Link to post
Share on other sites

I just realised I am still confused.

 

If I feed the motor driver 15v, it will set one rail at +15v and the other at ground, so a total of 15v difference. But doesn't DCC want the rails set at +15/-15v relative to ground for a total of 30v difference? This is the problem I have with DCC... I just don't get the voltages.

Link to post
Share on other sites

OK so the 2nd method is what we are using - +18v on one rail and ground on the other, swapping them using the direction signal to the motor driver.

 

Neither of those first two sound like how I interpreted the DCC spec! Lucky some good person solved the problem for me eventually :)

Link to post
Share on other sites

In a two wire system, there is no other reference so from the point of view of the locomotive, methods one and two are the same. Voltage is relative, not absolute. It is the same as domestic 230v power supply. The neutral is at ground potential, you can even touch it without getting a shock, (but I wouldn't advise it just in case you have a unknown fault). The live swings from +230 to -230v.

Link to post
Share on other sites

OK so the 2nd method is what we are using - +18v on one rail and ground on the other, swapping them using the direction signal to the motor driver.

 

Neither of those first two sound like how I interpreted the DCC spec! Lucky some good person solved the problem for me eventually :)

 

Hi All,

 

Please watch the hardware videos to get this explained better..

 

But: the motor shield actually swaps between +18V and -18V (or whatever voltage you feed to the motor shield) like any proper DCC system. This is achieved somehow by linking the PWM output of the arduino to the polarity switch input on the motor shield. Again: the videos on the hardware explain this very clearly..

 

One of the strengths of this system is that it is completely NMRA compliant, so does whatever an other DCC system does, but a lot cheaper!

Link to post
Share on other sites

I just realised I am still confused.

 

If I feed the motor driver 15v, it will set one rail at +15v and the other at ground, so a total of 15v difference. But doesn't DCC want the rails set at +15/-15v relative to ground for a total of 30v difference? This is the problem I have with DCC... I just don't get the voltages.

As Dutch said.

 

A decoder will never see more than + or - 15V. The first thing the decoder does is rectify the input to 15V (ignoring diode drops).

 

Your 30V is also a valid figure, but this is the differential voltage or the difference between the two voltages applied to the rails or 15 - (-15) = 30V. A decoder never sees a voltage of 30V.

Link to post
Share on other sites

Putting "stay alive" capacitors to one side, since DCC is a square wave you can use a much smaller capacitor than would be required for a traditional power supply fed with a rectified sine wave. Just a few uF is more than sufficient and cost/physical size are not really an issue.

Link to post
Share on other sites

NMRA standard DCC as I understand it:

 

There is a notional +15v to -15V applied to the track, but the loco decoder isolates the motor from that voltage and only when commanded sends a regulated directional PWM to the motor which moves at the speed and in the direction commanded.

 

If a DC loco without a decoder is placed on the track then the motor 'feels' the full +/-15V range, but as the net output is 0V then it doesn't move. It does however get warm from the pseudo AC it constantly feels. Upon command the PWM is directly modified with a bias to + or - and the loco moves in that direction at that speed.

 

This latter effect is why a decoder equipped loco with DC running enabled can receive a 'false' DC signal and take off like a bat out of hell uncommanded. 

 

Or have I missed the entire plot of the post...

Link to post
Share on other sites

There is a notional +15v to -15V applied to the track, but the loco decoder isolates the motor from that voltage and only when commanded sends a regulated directional PWM to the motor which moves at the speed and in the direction commanded.

 

If a DC loco without a decoder is placed on the track then the motor 'feels' the full +/-15V range, but as the net output is 0V then it doesn't move. It does however get warm from the pseudo AC it constantly feels. Upon command the PWM is directly modified with a bias to + or - and the loco moves in that direction at that speed.

 

This latter effect is why a decoder equipped loco with DC running enabled can receive a 'false' DC signal and take off like a bat out of hell uncommanded. 

 

Or have I missed the entire plot of the post...

Strictly speaking, the decoder doesn't 'isolate' the motor as such in the electrical sense, it just creates an internal DC supply from the track feed, which is used then to control the motor using PWM. The two processes are entirely separate functionally, but tied together in voltage terms by use of a simple bridge rectifier to generate the DC supply from the DCC waveform, i.e. the voltage available for the motor is directly related to the voltage on the track.

The 'nett' voltage value on the track could indeed be said to average to zero as the track data waveform is notionally square using two different full cycle periods for 1's and 0's. The bias applied for the DC 'Loco 0' option is not additional voltage to the track as such, but a distortion of the equality of the square wave periods - specifically during '0' bits. One half of the ''0' period is allowed to be stretched up to about 10ms, from a nominal 100us or so, thus the waveform starts spending more time at one polarity than the other, changing the average value in the process.

Apart from the average loco motor not really liking this method of control very much, it also drastically slows down the transmission of DCC commands to other items if done to excess.

A typical approach to minimise this delaying effect is to only stretch certain '0' bits in the data stream, say, the 'Start' bits in a byte (which are always '0's).

Link to post
Share on other sites

  • RMweb Gold

I gave dcc++ a try last evening, successfully running up and down on the dining room table. This was using a UNO and a genuine Arduino motor shield that I already had. Brilliant - and took about five minutes to get up and running.

 

Only issue I have is with the Controller software running on the PC, can't work out yet how to configure the layout diagram and define routes...not bad for day one though :-)

 

I know I can use JMRI, but fancied something different - will keep trying later today when finished work......

Link to post
Share on other sites

Hello Cornerman!

 

Thanks for sharing that. The simplicity is what appealed to me, after downloading the Arduino sketch and the software this system can work in five minutes indeed. No hassle with soldering or anything else (except connecting it to the track..), just as simple as any other DCC command station.

 

Very curious to hear how you are getting on!

 

All the best,

Ed

Link to post
Share on other sites

  • RMweb Gold

 

Very curious to hear how you are getting on!

 

All the best,

Ed

Well, this afternoon I have discovered that the track layout is "hard coded" into the Controller program that runs on the Processing IDE and have downloaded an excellent commented example from GitHub to learn from. Couple of long days in real work ahead, but should have cracked it by the weekend hopefully.

 

Good fun - electronics and trains!

  • Like 1
Link to post
Share on other sites

  • 4 weeks later...

Well that was easy. Only two mistakes hooking up the power supply to the motor board and one melted wire :) Just dumbness on my part. I'd say I'm lucky I didn't let the smoke out of various ICs or the decoder.

 

Rather than solder my one decoder into my one loco I put together a test harness with an '8 pin socket' bodged up from some female headers, a couple of LEDs to simulate head/tail lights, and a couple more female headers to plug the motor into and it worked no worries!

 

So next step is to solder the decoder into the loco and connect some track and see what happens. I only have a Hornby Jinty so there are certainly no bells and whistles to worry about.

 

Looking forward to getting back to my comfort zone of software now I know it works! I hate soldering things together on those prototype boards.

 

Regards,

David.

Link to post
Share on other sites

Brilliant that it's working for you David!

 

I'll be ordering my motorshield and arduino soon to give this a proper go. Have to dig into the system a bit deeper to figure out how to make a (wireless) handheld controller..

Link to post
Share on other sites

Ed,

 

I ordered the mega, motor shield, ethernet shield, and  bluetooth board probably more than a month ago and the two shields only arrived this week. Most frustratingly the motor shield last of all yesterday!

 

It all worked with no trouble and no changes required. You just have to be careful to make the right connection on the motor board because as Gregg notes in his video he plugs into the wrong pin. I was counting pins and remembered his comment just in time.

 

Also (obv) look carefully when making the power connections to the motor board - mine go GND VIN +A -A when I *assumed* it would be VIN GND +A -A and got smoke and melting and a lucky escape!

 

A wireless throttle should be easy. There's a million ways to talk to an arduino wirelessly. I'm ordering a few bits to make a throttle too but I won't worry about making it wireless. Someone on the trainboard forum is busily making a throttle for phones if you want to check that out.

 

Putting a front-end on the DCC++ to accept the standard IP throttle commands would be a good extension too I think.

 

Regards,

David.

Link to post
Share on other sites

It seems I'm destined to make bad power connections every time I turn this thing on. This time I found a likely looking pair of wires to connect the motor driver shield to the track, completely missing the big burnt off bit of insulation on both wires mid way along. Switch it all on and the laptop immediately switched off :(

 

I thought the laptop was toast - no response to the power button, no battery charging/wall power LED etc. But after taking it apart looking for a fuse and letting it sit like that for a few hours it came back when I put it back together. Lucky.

 

Still blew the Arduino mega clone. I had another one so was able to try again. I'd soldered the decoder into the Jinty and it doesn't run very well but it does run. So DCC++ is working and a loco moving. Maybe the loco needs running in, or the scabby old bit of flex track I'm using is too rough - sanded the rails to clean them.

 

Quitting today while my loss is only the mega clone. Have to buy a few more for spares the way I'm going with these power connections!

 

One thing I should have done before, and have now, is to cut the VIN bridge on the bottom of the motor shield. That separates the two power circuits. It may have saved my mega if I'd done it.

 

Regards,

David.

Link to post
Share on other sites

  • RMweb Premium

It seems I'm destined to make bad power connections every time I turn this thing on. This time I found a likely looking pair of wires to connect the motor driver shield to the track, completely missing the big burnt off bit of insulation on both wires mid way along. Switch it all on and the laptop immediately switched off :(

 

I thought the laptop was toast - no response to the power button, no battery charging/wall power LED etc. But after taking it apart looking for a fuse and letting it sit like that for a few hours it came back when I put it back together. Lucky.

 

Still blew the Arduino mega clone. I had another one so was able to try again. I'd soldered the decoder into the Jinty and it doesn't run very well but it does run. So DCC++ is working and a loco moving. Maybe the loco needs running in, or the scabby old bit of flex track I'm using is too rough - sanded the rails to clean them.

 

Quitting today while my loss is only the mega clone. Have to buy a few more for spares the way I'm going with these power connections!

 

One thing I should have done before, and have now, is to cut the VIN bridge on the bottom of the motor shield. That separates the two power circuits. It may have saved my mega if I'd done it.

 

Regards,

David.

what voltage were you running at ?  I queried cutting the VIN myself on the merg forum completely forgetting the arduino would run from the usb supply.

 

DCC will not fix a poor running loco it will improve a well running DC loco.

 

Are you using JMRI as I find it a nice friendly interface and it works with my phone very nicely

Link to post
Share on other sites

The loco is a RailRoad Jinty straight out of the box - I never even ran it on DC to see how it went. Maybe if I set up circle of track and left it go it might improve.

 

I'm using 12v I think, from an old PC power supply. I thought there were 15v wires in there but my multi-meter is not giving me any more than 12v on any of the plugs.

 

Just typing in <t 3 3 x y> in the serial monitor at the moment to see if everything works. The plan is to use this on a layout for the kids and build a couple of throttles with Arduino nano clones driving them, all talking via ethernet.

 

Would love to be able to power the throttles via the ethernet cable but I don't know power over ethernet works.

 

Regards,

David.

Link to post
Share on other sites

The loco is a RailRoad Jinty straight out of the box - I never even ran it on DC to see how it went. Maybe if I set up circle of track and left it go it might improve.

 

I'm using 12v I think, from an old PC power supply. I thought there were 15v wires in there but my multi-meter is not giving me any more than 12v on any of the plugs.

 

Just typing in <t 3 3 x y> in the serial monitor at the moment to see if everything works. The plan is to use this on a layout for the kids and build a couple of throttles with Arduino nano clones driving them, all talking via ethernet.

 

Would love to be able to power the throttles via the ethernet cable but I don't know power over ethernet works.

 

Regards,

David.

If it is an ATX power supply it won't give more than a set of rails for 12v, 5v and maybe 3.3v. The variance on each rail can vary wildly with some of the cheaper power supplies though.

Link to post
Share on other sites

Forging on I have now got it working with the ethernet shield. Nothing blew up or melted this time but it did take a long time to figure out the ethernet shield must be directly on top of the mega and below the motor shield due to it using the 6 pin in-circuit-programming header. This isn't made completely clear anywhere I could find via google and had me stumped as to why I could get the ethernet shield working on its own but not when it was mounted on the motor shield.

 

I am no longer a fan of the Arduino stacking mechanism - too fragile and I had a few times where pins didn't go there they should leading to more head scratching. The pins went inside the headers which couldn't be easily seen from the outside. It was only when I looked 'through' the shields front to back I noticed it. It also looks too easy for shorts to be made when shields have big metal shrouds on them like the USB socket on the mega, or the ethernet jack on the ethernet board. You have to ensure  shields above them have a gap or some insulation between them.

 

I get the idea, I just don't think the execution is very good.

 

The JMRI plugin seems to have problems - if you have say JMRI expecting to talk to DCC++ via serial but you've now changed the DCC++ to talk ethernet, JMRI throws an exception and hangs on startup. You have to manually edit the profile.xml file to get rid of the connection. The ethernet connection doesn't work either, it throws classcast exceptions when it tries to talk to DCC++. I can't be bothered fixing these problems, I think the plugin author already knows about the classcast one.

 

I'd rather use a physical throttle anyway. Computer control doesn't appeal to me other than as a curiosity.

 

Despite all that, a networked DCC controller which is so cheap compared to commercial alternatives and relatively easy to put together for the technically inclined is very cool. I think it's a knock out project and am starting to think of a housing and throttle design that connects up via ethernet. I love this project, it presses all my hobby buttons.

  • Like 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...