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
Erik A. Erik84750

@Geoff: reply to "Accessory Decoder Addressing"

"If you use DCC++ as a DCC hardware interface for JMRI, you can simply use 40,41,42,...etc. as normal. My SMA20 series of decoders all use the "linear" scheme consistent with JMRI."

I do use the JMRI software with interface for DCC++, and in the Panel Pro GUI I assign a column of 15 adresses starting at address 40. The DCC+ traffic monitor shows the actual address and subaddress included in the DCC packet transmitted. Address 10 subaddr. 3 is sent when I issue a command for DT44 (hence the 5th address after DT40 which is address 40).

With the decoder from SMA20 programmed with the AccDec_15Servos_2LED_6Ftn.ino and connected to the Arduino/motorshield track output (with Vin = 12V) I get no response on any of its outputs pins 0 to 14.

The decoder definitely receives DCC commands; but I wonder if I may attach a scope to any of these output pins (scope ground issue?).

Erik

 

 

Reply 0
Geoff Bunza geoffb

@Erik

Hi Erik,

Quote:

The decoder definitely receives DCC commands; but I wonder if I may attach a scope to any of these output pins (scope ground issue?).

There can be a scope ground issue, but it gets complicated by how you power your DCC system and whether your scope ground is really connected to earth ground.

I would try to simplify your test first, by reloading you decoder with the AccDec_17LED_1Ftn sketch, and see if you can turn a LED or two on and off first. Always simplify your debugging situation first and incrementally add complexity back in so you know what is working 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 0
Erik A. Erik84750

@Geoff: reply to "Accessory Decoder Addressing"

Hi Geoff, thank you for that reply. That works; however: setting up a 17 lamp table in JMRI starting address 40 it gives me a table with system names DL40 to DL56. Pin 0 on the decoder lights up or off when addressing DL44, the DCC++ traffic monitor gives address 10 subaddress 3. Pin 12 on the decoder lights up or off when addressing address 13 subaddr 3.

There seems to be a 4-address offset.

What would be the reason?

Grts, Erik

 

Reply 0
Erik A. Erik84750

compiling for Pro Mini?

Hi Geoff, the DCCpp_CTRL_SW does not compile for a Pro Mini. I understand you used either an UNO or Mega because of the shield-ability. However, a Pro Mini uses less current hence I would like this to compile there too.

My questions: 1. is it a logical project choice (using a Pro Mini), ie. is the result worth the effort? and 2. is it possible to either add a program version for the Pro Mini or can you direct me at where to change your program accordingly please?

Kind regards,

Erik

EDIT on 01/12/20: Geoff, you may ignore this question. I did some research and question 1 I answered for myself: not worth the effort. Grts, Erik

EDIT on 01/12/2020: Geoff, I have to rephrase the above; this SMA25 is outstanding work, I will build this up to gain more experience but as command station I will follow up with your work using a larger display.

 

Reply 0
Geoff Bunza geoffb

@Erik re: Acessory Decoder Addressing

Hi Erik,

I do not know all the issues addressing accessory decoders, particularly when involving DCC++. As I explained previously there is an ambiguity in the NMRA spec that allows for a base decoder address and a 2 bit offset (like you are seeing) and another where there is a straight linear address. There may be a way to tell JMRI to use a particular one - I do not know. The JMRI DCC++ interface has changed recently, This is exactly the reason why I do not use DCC++ as my usual command station (plus other reasons).

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 0
Geoff Bunza geoffb

@Erik re:DCC++ on the Pro Mini

Hi Erik,

Quote:

the DCCpp_CTRL_SW does not compile for a Pro Mini. ...
1. is it a logical project choice (using a Pro Mini), ie. is the result worth the effort?

There is no reason whatsoever why the Pro Mini could not support DCC++, as it uses the exact same Atmel Mega328P processor as the Arduino UNO. That said, it obviously cannot simply plug into a Motor Shield with an UNO form factor. You would have to wire the shield directly to the Pro Mini pins.

That said, Gregg's DCC++ code has a switch internal to the code to test whether it is being compiled for a Mega2560 or an UNO. This is used to reset the pin connections precisely as Gregg describes. This board "switch" is set for you by the Arduino IDE when you select either the UNO or Mega. DCC++ code uses the same switch that the Arduino IDE uses, and checks if you are using only one of these two. To change to using a Pro Mini, you would have to find the test(s) in Gregg's code, override them, and then change all the default pin connections to the motor shield or equivalent that you want to use with the Pro Mini. This way, when you select the Pro Mini Board in the Arduino IDE, it would not affect the DCC++ compilation.

By the way, the Pro Mini uses marginally less current. So little I would not bather with the difference.Most likely most of it goes to the larger volatge regulator on board.

Quote:

2. is it possible to either add a program version for the Pro Mini or can you direct me at where to change your program accordingly please?

Yes.See answer to 1. above. In my opinion this has marginal real value.

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 0
Erik A. Erik84750

@Geoff, re: Accessory Decoder Addressing

Hi Geoff, I follow suit. You make very smart decisions re. project choices and concept design. Your SMA30 is another such example, it is wonderfull and challenging to learn from you.

Kind regards,

Erik

 

Reply 0
FrightRisk

Accessory control in DCC++ vs. JMRI's numbering?

Geoff,

You said:

Quote:

I also can’t stand the Accessory Control mechanism and addressing as provided – I prefer JMRI’s numbering scheme. While I could change that...

Can you elaborate? If you were going to "fix" it, what would you do and why? What is the difference between the DCC++ method and the JMRI method? Thank you.

Reply 0
Geoff Bunza geoffb

@FrightRisk re:Accessory Decoder Addressing

Hi FrightRisk (name?),

Quote:

Can you elaborate? If you were going to "fix" it, what would you do and why? What is the difference between the DCC++ method and the JMRI method?

First, as I have stated quite a few times before, the issue is:if you use the DCC++ interface with the "Processing" software you will find that DCC++ uses an odd scheme to address accessory decoders, and address 40 needs to be entered in the 2 part form as "10 and 3" decimal.

For for reference, the code to convert the "normal" accessory address to the DCC++ form is:
    sw1=(sw_address+3)/4;
    sw2=(sw_address-(sw1*4)) +3;
where sw_address is the "normal" accessory switch address, and sw1 and sw2 are the 2 parts of the DCC++ address reference. So...
    address 40 becomes 10  3
 
    address 45 becomes 12  0
    address 46 becomes 12  1
    address 47 becomes 12  2
    address 48 becomes 12  3
Remember in integer arithmetic the fractional remainder in division is dropped.
 
It is one of the features of DCC++ I don't like and don't use.
If you use DCC++ as a DCC hardware interface for JMRI, you can simply use 40,41,42,...etc. as normal.
 
This is not simply a DCC++ issue. The NMRA specification contains an ambiguity that allows a thoughtful person to interpret the decoding of a DCC Accessory decoder address two ways, as I indicated above. If you look at my code for this "tinkering" exercise, I added code to convert the "linear" address into the DCC++ scheme. I prefer a simple linear address to the alternate "base address plus a two bit selector." Also I do not use DCC++ as my primary DCC system. I much prefer Digitrax.
 
If you are curious, the origins of this likely go way back to the beginnings of the DCC Standard creation, likely based on the Lens addressing approach at the time. It is a historical remnant. As a systems engineer I prefer a straight linear addressing space for its sheer simplicity. I believe you can also find some commercial DCC systems using the alternate addressing scheme today.
 
DCC++ is no longer being actively maintained by its original developer. There are at least two "branches" of DCC++ that others have "extended." I cannot comment on their robustness nor quality. I am not involved in any development of DCC++... just an old tinker! 
 
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 0
FrightRisk

Updating DCC++

Thank you! I found the formula portion of your response a few hours after I posted to you. Sorry I made you repeat it. It is here  https://forum.mrhmag.com/post/sma25-tinkering-with-dcc-base-stations-jmri-to-track-connections-accessories-fun-12204471 I'll look into that. I want to maintain the DCC++ code with a group of people I am soliciting and consolidate as much as I can into one fork that everyone can go to. I've added features like reading and writing true current in milliamps instead of Arduino pin values and added more motor board support. We want to really update the documentation.I was thinking this method of addressing could be "fixed" too. Not sure if JMRI talks to DCC++ regarding addressing and things would break because it is hard-coded to the way DCC++ does things now, or if it is just the "Processing" version of the controller software that would need to be changed (perhaps with an option for "addressing mode" so it could be done either way. Or get rid of processing.org stuff altogether and write it in something people actually code in Thanks again.

Fred - N4IXL

Reply 0
Geoff Bunza geoffb

@Fred re:DCC++ Development

Hi Fred,

'Glad to hear there is serious interest in DCC++ maintenance. You might consider  maintaining one version as close to Gregg's original intent, and a development fork to remove the Processing and graphics in favor of a streamlined, upgraded DCC hardware interface to JMRI. Your intent to support alternate H-Bridge drivers is a very good one too. Good luck with all your efforts.

Have fun! 
Best regards,
Geoff 
73 \AD7JP

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 0
FrightRisk

Connecting an esp8266 to DCC rails with an optoisolator

Hi Geoff, If you have time, I hope you can help me. I imagine you have seen this circuit by Dave Falkenberg:

isolator.png 

I am building a packet sniffer and I wanted to power this with the 3.3V that comes off of the ESP8285 ESP-M2- CH340 development board (like the nodemcu kit, esp8266 boards, etc.) and I saw on one datasheet a 6N137 that does 3.3 and 5v. I was hoping that 3.3v,would still power my chip and the levels would still give me a high and a low (I thought my 3.3v would give me the .8v low and 2v high I need). My version is digikey 160-1791-ND and does not mention 3.3V‎. I need to power the esp with the micro USB, so have no easy way to pull the 5V off that (unless I jumper a very tiny wire somewhere).My math says I can connect the input to between 12 and 18 volts on the rails with a 1K resistor. But I am thinking I need more like a 1 to 4.7k or lower for the R3 pullup to go to a 3.3V gpio pin. I don't suppose R2 matters? Lastly, do you know why he does not have a .1 uF bypass cap between pin 8 and 5 like the datasheets say MUST be there? Does it have to do with the relatively slow 8kHz switching speed of DCC? Thank you. -Fred

Reply 0
Geoff Bunza geoffb

@Fred FrightRisk re: Questions

Hi Fred,

Quote:

I saw on one datasheet a 6N137 that does 3.3 and 5v. I was hoping that 3.3v,would still power my chip and the levels would still give me a high and a low (I thought my 3.3v would give me the .8v low and 2v high I need).

Here is a more detailed spec sheet by LiteOn (same manufacturer):  /sites/model-railroad-hobbyist.com/files/users/geoffbfiles/6N137M%20ON%20Semi.pdf

You can power your 6N137 with the same 3.3V as the ESP board. Use the 3.3V for the pull ups.

A bypass cap placed near the chip is always a good idea. Check the variation I use in the SMA20 decoder here: SMA20 Low Cost 17 Channel DCC Decoders Ver 6.01 with Sound,Triggered Sound,Stepper,Dual Motor,LED and Servo Control  https://forum.mrhmag.com/post/sma20-low-cost-17-channel-dcc-decoders-ver-6-01-with-soundtriggered-soundstepperdual-motorled-and-12201920

Particularly notice the pull ups and the cap across the input diode to the opto coupler. It adds a distinctive advantage in an electrically noisy environment. Bypass caps are added by engineers as a preventative measure. I will not comment on a motivation to omit it intentionally.
'Hope this helps.  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 0
FrightRisk

First, Thank you! There

First, Thank you! There should be another degree after PhD, GeN for genius!  Second, I am angry with you because after looking at the link in more detail about the 17 channel decoder, I now realize I have to buy those boards too...and more parts! Please stop inventing things because I can't keep up 

Best to you,

Fred - N4IXL

Reply 1
Geoff Bunza geoffb

@Fred FrightRisk re: Apollogies

Hi Fred,

Kind thanks and apollogies at the same time. I'm afraid I may be making you mad at me again soon...there is more to come!  ...soon.

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 0
dapenguin

You would/

Yes, You would do dat

 

TC Carr
Malheur, Kopperton & Tejas * Sn3½ in 1923
(the I don't know yet) * Sn2 "Gilpin in Idaho"
​Anaconda, Oregon & Pacific * S Scale Heavy Electric
My Blog Index

Reply 0
Geoff Bunza geoffb

Comments on Max Current for DCC++ Drivers

Hi All,

I have recently been asked about the max current out of the "standard" DCC++ motor shield, typically using the ST L298P, but also the L293 and the SN754110 chips, all rated at 2A per bridge. This 2 Amp rating is almost always cited when computing how many locos DCC++ can support-- I am not considering any other motor drivers in these comments. Using the 2 Amp rating is incorrect at face value. These chips are not short circuit protected. They all have internal thermal shutdowns built in. DCC++ does monitor the current draw and does shut down the driver, but it is typically set well below the 2 Amp limit, and is not instantaneous. Even if the DCC++ code were modified, without external additional heatsinking and increased air flow to remove the heat, as the current draw rose above 1 Amp the chip will heatup and eventually shut down. Continuous operation avove a 1.2-1.3 Amp draw is risky and unlikely. Small heat sinks can likely be found for these chips and would need to be affixed with thermal epoxy or other heat transfer mechanisms to support higher current loads. The 2 bridges in the L298P can be paralleled (with great care) to achieve a theoretical max of 3.5 Amp but the heat sinking requirements are even more stringent. If you experience your DCC++ power cycling on and off you may have been demonstrating the thermal cut off capability in the driver chip. Without heat sinking, your "mileage will vary" depending on the ambient temperature in the room and the air flow around your DCC++. There are other driver boards with higher current ratings. Please consider that virtually all are rated at their max ratings only when special conditions for heat dissipation are met, and they are typically what are not present in the units as shipped.
I hope this clarifies the constraints and keeps you out of trouble.

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 0
jayfmn
I am back at this. I have the software loaded on a Arduino Uno.
After fiddling with it, I do have a display. Unfortunately, it does not work.
I cannot power up the base station or connect to it through JMRI.
Reply 1
Geoff Bunza geoffb
Hi Jay,
 
You will need to be more specific about what software you loaded on your Arduino, which Arduino board set you are using, and how you are trying to connect them to JMRI.
 
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 0
Reply