Geoff Bunza geoffb

Take the 2 boards pictured below, download the efforts of Gregg E. Berman, the creator of DCC++:  https://sites.google.com/site/dccppsite/, add 2 wire jumpers and you have a DCC base station that can be controlled with multiple throttles directly from your PC. It will also act as a $9 JMRI to DCC hardware interface—really! This was pointed out by Dave here: DCC++ on Arduino supported by JMRI https://forum.mrhmag.com/post/dcc-on-arduino-supported-by-jmri-12202303 -- JMRI has recently been updated so that it can directly control the Arduino board combo without any other software on your PC. Moreover, you can follow the exploits of the intrepid Dave Bodnar here: My Experiments with DCC++ https://forum.mrhmag.com/post/my-experiments-with-dcc-12202876 and add a booster or remote handheld throttle—great stuff. This article describes some tinkering beyond my own first DCC++ build that may be of interest to other modelers too.

Uno.jpg   eld%20R3.jpg 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 2
crusader27529

compile failures

When I attempt to compile your base code (no LCD stuff) I get these errors:

 

DCCpp_Controller:81: error: 'import' does not name a type

 import processing.serial.*;

 ^

DCCpp_Controller:82: error: 'import' does not name a type

 import processing.net.*;

 ^

DCCpp_Controller:83: error: 'import' does not name a type

 import java.util.regex.Pattern;

 ^

DCCpp_Controller:84: error: 'import' does not name a type

 import java.util.regex.Matcher;

 ^

DCCpp_Controller:85: error: 'import' does not name a type

 import java.util.*;

 ^


Looks like the IDE (on windows) doesn't like the import lines....
I'm running IDE 1.6.7.

 

 

Reply 1
Geoff Bunza geoffb

@crusader27529 re: Difficulties

Hi crusader27529 (name?),

It sure looks like you confused some compiler. I am not sure which one and I am not sure what you mean by my "base code" so...

Let us review...

The download http://www.scalemodelanimation.com/blog/dccpp_controller.ziphas a folder in it: DCCpp_Controller  (please note the capital letters) which contains 17 items. This folder in its entirety is to be copied onto your computer and using the Processing Program which you can learn about and download yourself in the DCC++ references I provided at the beginning og this blog. Then run DCCpp_Controller.pde found in the folder with the Processing application loaded on your PC. Processing is not the Arduino IDE. It is a completely different program. The corresponding Arduino program that accompanies the Processing programs above, or can be used with JMRI and is loaded on your Arduino UNO or Mega is Gregg's program from here https://github.com/DccPlusPlus/BaseStation/archive/master.zip  which you can get to from Gregg E. Berman, the creator of DCC++ here: https://github.com/DccPlusPlus This is not my code.

The only other code I provided was this:

You can load one of 2 sketches into your new base station/controller:
for loco/mobile/function decoder control
for accessory decoder control.
 
And the inner folder in these zip files need to be loaded in their entirety into your My Documents/Arduino/ folder. Please note that the inner folder is the one that contains either DCCpp_Ctlr_SW.ino or DCCpp_Ctlr_Loco.ino and they do load into an Arduino, they use displays, and they are not dependent on the Processing program.
 
The beginning of this blog directs you to the appropriate links of Gregg and other modelers, who have already detailed their experiences with DCC++. This blog, as titled, is a commentary on my extensions and "tinkering" based on their work. If you are going to try what I developed, it would be a good idea to investigate the other references first.
Have fun! 
Best regards,
Geoff Bunza

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
jayfmn

Great project

Hi Geoff! Is there a way to speed up the incrementing of the decoder address?

I have several loco's & they all addressed by Cab #.

Most are 4 digit addresses.

Hitting the button 337 times gets boring fast

Thanks! Jay

Reply 1
Geoff Bunza geoffb

@Jay re: The need... for SPEED!

Hi Jay,

You are absolutely right, having worn out my finger getting to loco address 2288 was not fun!

So... a near term fix and a far term fix:

Near: Before you load the sketch into your Arduino, in the file "SerialCommand.cpp" and find the line:

int vars [ ]= {0,0,0,0,0,0,0,0,0,0};  //address,speed, F0,1,2,3,4,5,6,7

and change the first numeric entry to the lowest address you might normally be using, like:

int vars [ ]= {2200,0,0,0,0,0,0,0,0,0};  //address,speed, F0,1,2,3,4,5,6,7

This will start the display at that address, and from there you can wear out your finger!

Far: The (far) better way is to have the Arduino watch how long the button is pressed (up and down arrow) and continuously increment and adjust the increment up and down accordingly -- that is if the button is held down more than a second or two increment automatically by tens; if held down longer than 5 seconds increment by 100. That should limit the finger wear and tear!

If you can tolerate waiting, I may get to this sometime. I am in a time bind with other obligations in the very near term, but will take a look at this when I can. Maybe some other intrepid soul can rustle this up?

On an allied note: This was put together in part in the same spirit of simplicity as the original DCC++ hardware came together-- with very little customization that virtually any modeler could handle. I would like to re-do my stand alone LCD/keypad display project with a 3-5 inch touch screen display, which I think is a far better way to go. I published this because I was particularly impressed with how fast I could get DCC++ operational, not due to my work, but due to the efforts of others like Gregg and Dave and Dave B.There has not been much published in modeling using touch screen displays, but you can make some really easy to use controls with even a small display and big clutsy fingers ike mine! 

Have fun! 

Best regards,

Geoff Bunza

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
jayfmn

Fixed

Bad solder joint. The DF Robot version is compatible!

Reply 1
jayfmn

Suggestion

Is there a way to  increment the digits individually?

Like Increment digit 1, then digit 2......

Or is that too much work?

Thanks!

Jay

Reply 1
jayfmn

Geoff, can both programs be

Geoff, can both programs be loaded on to my Mega 2560 at the same time?

Throttle & switch control at the same time?

Thanks!!

Reply 1
Geoff Bunza geoffb

@Jay re: Enthusiastic Questions!

Hi Jay,

I love it when people get enthusiastic about their hobbies!

In order:

-- Bad solder joints can happen to almost everyone, tracking them down is a good skill to learn. Someday I may learn the skill without the frustration! 

-- Incrementing each digit may well be more code than the variable increment I described-- just a guess,

-- You can't load both programs as is without some kind of modification, without a minimum of recoding to determine which one you want to use at any given instant.

-- Two points on this issue:

First, I would like to refer you to Dave Bodnar's excellent work on his DCC++ throttle, which while more complex is much more complete a solution. This "tinkering" was an attempt to explore whether any solution could be concocted with minimal changes to readily available hardware, in the same vain as Gregg's original DCC++ efforts.

Second, The big problem with the LCD/Keypad board is both the limited 2 line by 16 character display, and the small number of useable pushbuttons (5). One of the challenges to any designer is how to orchestrate the display and buttons to create an easy to use and easy to learn (not the same) unit. So... my challenge to you and any other modeler, is if you can come up with a detailed description of what should be on the display, and what functions the buttons should perform step by step to provide a better or combined solution, I would consider rebuilding the code. Here's the proviso -- your potential scenario cannot go into into many levels down of menu picks that no one will remember or have any interest in performing such! Much like pressing the address increment 2287 times to get to address 2288, or with a complex set of menus so bad that people would never set the time of day clock correctly on their VCR's. In other words, if it is too complex -- it's not worth doing with this hardware set. This is precisely why I want to look at a small color touch screen display instead  of this LCD/Keypad shield.

Again, DCC++ is not my design. I think it is a terrific effort. I think many modelers will want to use it as a substitute to a commercial DCC base station, and find out that the completeness of the solution, the robustness of the solution, and the ongoing support are where much of the extra costs are in the available commercial products.

Have fun! 

Best regards,

Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
jayfmn

OK

How about an Arduino Uno running DCCpp_Ctlr_SW separately?

What would I need?

Can I hook that output to a switch controller?

My mind is running in circles on this!

Thanks!!

Jay

Reply 1
Brent Ciccone Brentglen

JMRI and DCC++

Someplace on one of these forums I was reading that Decoderpro and DCC++ don't work together. I just hooked mine up and was able to program a Tsunami with no problems using the programming track outputs and Decoderpro. What I can't get to work is programming on the main, but the programming track works just fine. I use the JMRI throttle to control the DCC++ system and I haven't had any problems. I did note that it runs better with a little higher output power source, 12 volts and an amp power doesn't seem to work so well with the motor shield I am using, an 18 volt 2 amp power supply works better.

When switching to the programming track it helps to restart Decoderpro, or at least close all the programmer windows and reopen after switching to the programming track.

Brent Ciccone

Calgary

Reply 1
Geoff Bunza geoffb

@Brent

Hi Brent,

Were you able to do anything other than single CV programming?

I could not get any whole sheet programming to work. Were you able to update only changes on the sheet? That never worked for me.

Thanks for your info.

Best regards,

Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
jayfmn

DCCpp_Ctlr_SW

@Geoff

How would I get a DCC Signal from a separate Uno using DCCpp_Ctlr_SW

to a 2560 running the DCC_Pulsed8 sketch?

The 2560 has a ISE I/F on it that converts it to an ISC Bus to a 16 relay board. (http://www.iascaled.com/store/ModelRailroad/ARD-DCCSHIELD)

It has a DCC input.

Will I need another motor driver board for the DCC Signal?

Or is the DCC signal generated by the Arduino Duo?

If so, what pins do they come off?

Thanks!!

Jay

Reply 1
Brent Ciccone Brentglen

DecoderPro

I didn't try a full sheet update, but I did change several sound level settings and did the "update changes" and it worked fine. Ops mode programming returns an error about no response from command station, so maybe it isn't implemented in DCC++? My understanding from the the guy that developed this is that he based it on the NMRA standards, maybe Ops Mode programming was a later development and not part of the standard?

When switching to programming track mode, try restarting Decoderpro, it wouldn't work if I was running a train first and then tried to switch to programming mode without closing down any open Decoderpro windows first.

Jay, you have to have a motor shield, the Arduino only generates half the DCC signal, the motor shield creates the other, matching half of the signal. It has to be a motor shield that is capable of doing this, not all of them will.

 

Brent Ciccone

Calgary

Reply 1
Geoff Bunza geoffb

@Jay re: Connections

Hi Jay,

Quote:

How would I get a DCC Signal from a separate Uno using DCCpp_Ctlr_SW to a 2560 running the DCC_Pulsed8 sketch?

You would take the DCC track output from the Motor control shield and connect it to the DCC decoder optocoupler circuit input directly. Trying to use signals directly from the UNO has other problems.

Have fun! 
Best regards,
Geoff

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
jayfmn

@Geoff

I think I figured it out. 1 Uno, 1 Motor Driver Board & a Display.

Just use the DCC Output to drive the switch controller.

Keep it separated from the 2560 Command Station.

Thoughts?

Thanks!!   Jay

Reply 1
Geoff Bunza geoffb

@Jay

Hi Jay,

Sounds like a good plan!

Have fun! 

Best regards,

Geoff

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Heisler wanted

DCC++ and CV

Hello Geoff,

As always a great job done !  I ordered a Mega to be able to add direct switch input to your decoder; you have posted some ideas for that. Now with SMA25 I will try a separate command station for my turnouts, and possibly other things. The code you have provided is very detailed, specifying what each part does, but (there's always a but):

In the first page there's a list of what the program supports; locomotive/accessory adressing, function activation and also Programming CV:s on main track and programming track. How to activate that ?

You also specify "a special packet register with id=0" which is involved with CV storage, can't find a reference to that in the program, is it "hidden" in the libs ?

Best Regards

Peter

Reply 1
Geoff Bunza geoffb

@Peter re: Questions

Hi Peter,

Quote:

In the first page there's a list of what the program supports; locomotive/accessory adressing, function activation and also Programming CV:s on main track and programming track. How to activate that ?

I am assuming you are referring to this:

ller_Mod.jpg 

Once you have Processing running with the basic window open, typing the "h" key will open up the help frame. It lists all the commands you can issue in this window. So, typing "a" will open up the Accessory Control Frame. I need to warn you that the Acc Address/Sub Address does not match the JMRI accessory address scheme directly. I cannot remember the addressing scheme calculation to equate the two, and I don't have it here in front of me-- you will have to experiment to get it right. A reminder, this is not my code, although I modified the Processing sketch to get rid of the layout and sensor stuff. I have never used this window to program any decoder. I know that the single CV programmer through JMRI works fine, and others have reported that service mode programming worked for them, but I could not get either to work consistently for me. JMRI throttles work great together with functions and accessory operations. All complements for the code should go to Gregg E. Berman, the original developer.

Quote:

You also specify "a special packet register with id=0" which is involved with CV storage, can't find a reference to that in the program, is it "hidden" in the libs ?

Again, Peter this is not my code. I think that the packet register you refer to is a unique variable for each decoder listed in the window. If I remember correctly, Gregg stores the Function and speed settings that will be repeatedly transmitted in DCC commands to each decoder. If you change the decoder address, the variable name for this storage does not change. The throttles are defined in controllerConfig.pde (if I remember correctly). You should look for references to throttle definitions and packets for detailed info.

Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Heisler wanted

SMA25 CV

"I assume you are referring to this..."

Yes and no!    I was looking at your own version, with keypad LCD and no PC connected. For that there are two sets of code, for mobile decoders or for accessory decoders. I picked the accessory version, and in the first section there is the list of function I referred to. So your simplified version omitted that I guess, and CV programming must be done either from my Digitrax, or of course from the program you refer to above. I actually tried to open the PC part of it, but could not do that, for some reason. You refer to opening it under some "processor" or such, maybe that is where I'm lost ?

Questionmarks again, and, also as before, any guidance is most appreciated.

Regards

Peter

 

 

 

 

 

 

 

 

 

Reply 1
Heisler wanted

SMA25 CV

Hello again Geoff,

My apologies for bothering you with almost nothing.... I went through the Berman websites and finally understood there's two programs, what you did is basically removing the layout and some graphical features of the original command program; this will still instruct the original base station program to do it all(or I hope so). Then there's the  simplified base station program I looked at, which uses keypad buttons instead, but can not program CV:s right(?).

So, the challenge here (if you don't want PC control but want programming) is sending enough characters to the base station to provide programming, and adding display signalling to see what you are doing. Could this be done in addition to the keypad that's on the display you use ?  Sorry, my thinking wandered away a bit here..... I need to slow down, and do small changes I think. Perhaps install your LCD keypad version, and experiment from there.

Best Regards

Peter

 

Reply 1
Geoff Bunza geoffb

@Peter

Hi Peter,

Quote:

Then there's the  simplified base station program I looked at, which uses keypad buttons instead, but can not program CV:s right(?).

Yes, correct. The 2 stand-alone versions I put together are exactly that -- stand alone.They will not support the JMRI nor the Processing interfaces. They both change the  serial interface to interface to the display and buttons.

Quote:

So, the challenge here (if you don't want PC control but want programming) is sending enough characters to the base station to provide programming, and adding display signalling to see what you are doing. Could this be done in addition to the keypad that's on the display you use ? 

In some limited way ...probably, but you are a long way away from specifying what you really want to see. The LCD/Keypad is a poor interface for multiple, complex operations (with many steps). This was an experiment, to see how easy it would be to re-use the basic code and simplify things -- ie. tinkering. Remember, unlike may modelers who might see this as a replacement for a commercial DCC base station / throttle, I'm looking into small independent DCC control busses, primarily for animation and diorammas. Hence, CV programming is not one of my primary interests, nor is a full-featured base station.

Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Heisler wanted

SMA25 programming

OK, point taken. Also, for turnouts it's really about installing them, maybe make minor adjustments, and then forget about CV:s. Having done that (on my Digitrax) I could use your version, maybe add an IR hand controller, or even local switches.

Thanks for your time and engagement !

Best Regards 

Peter

Reply 1
crusader27529

DCC++ & JMRI

Just what part of DCC++ won't work with Decoder PRO??? The decoder libraries are all that I use.

I use is successfully to run my club layout with no issues. The only issue I had was that the original JMRI interface code had an error where if you tried to write a CV on the MAIN, it would wait for an ACK response, which can't be done from the MAIN, just from the PROG track.

That bug in the JMRI interface has been resolved in the 4.5.6 development release, and will be in the next production release due before Christmas.

 

Reply 1
crusader27529

DCC++ MAIN Programming BUG

The is a bug in the current JMRI release for DCC++ that is fixed in the development release 4.5.6, and should be in the next production release before the new year.

The BUG caused the DCC++ to wait for an ACK after writing the CV on the MAIN, and that can't be done.

I use JMRI with DCC++ to program all my club equipment and works fine when writing full sheets of data. Some decoder parameters appear incorrect, attempting to write to non-existant CVs, which cause a hang condition when the decoder doesn't respond.

Issues with trying to terminate JMRI when one of the related JAVA programs can be a PITA, but that's a JAVA implementation issue common to any DCC system, and not specific to DCC++.

 

Reply 1
Heisler wanted

Compilation error

Hello Geoff, hope you had à great Christmas and New year.   I feel à little bit like trouble, bringing this up but, you really have spoiled everyone on this forum with solutions,,so; I'm compiling your sketch DCCpp_Ctlr_SW. This results in à warning considering line 136, "depreceated conversion from string constant to 'char*'  [-Wwrite-strings]

The line reads  CurrentMonitor mainMonitor (CURRENT_MONITOR_PIN_MAIN,"< p2> ");

Then on line 343 there's an error:  "R.current.bit++;" gets the complaint "R does not name a type"

I'm beginning to  understand à little bit of this addicting timesaver called Arduino, but this I can't solve.

So,again, ideas are most welcome....

Regards

Peter

 

 

Reply 1
Reply