Large Scale Central

Bob's Adventures in DCC

If you want to make your DCC++ command station wireless, here is a good possibility.

I have used these EPS-01 units and they are fast and have good range. You can pick them up for at:

https://www.addicore.com/ESP8266-ESP-01-p/130.htm

Be aware there are some ESP-01 modules from other vendors that have the small IC chip with “PUYA” stamped on it. This chip is not in the esp2866 library yet officially. The above vendor has been confirmed to have the good working chips installed on the ESP-01.

Problem is the manufacturers code is not in the library to adjust the timing on how to program the chip (Spiffs).

Symptoms is it will work upon programming, but remove power and restart the ESP-01 and the program is gone.

In the last few days, I have most of the hardware and the code working as I want. I’m still waiting on the display to finish it up.

I’ve modified Dave’s code to use buttons for speed up/speed down/e-stop.

Here’s the keypad and the STM32 board I have it running on. The STM32 board gives me much more memory to play with. With the sketch loaded, the Arduino IDE reports:

Sketch uses 39000 bytes (14%) of program storage space. Maximum is 262144 bytes.
Global variables use 6576 bytes (20%) of dynamic memory, leaving 26192 bytes for local variables. Maximum is 32768 bytes.

And a shot of the debug console

I have things mostly working right now. I have the display and keypad doing what I want. I’ll need to do some code changes to support the Nucleo L432KC, but it runs fine on an Arduino Uno.

The A and B key are speed up/slow down. Every click changes the speed by 1. If you hold the button down, it changes it by 5 every half second or so. The C key changes direction. # switches between the stored locomotives, and * sets the currently selected ‘slot’ and allows you to enter a decoder number. The base of this code is from Dave Bodnar’s throttle, I just tidied up the code some and changed from a rotary to buttons for speed. If anyone is interested in taking a look at the code, Ill zip it up and attach it to the thread.

I’m interested. You should archive it on github. Its a great place to share code and libraries.

Martin Sant said:

I’m interested. You should archive it on github. Its a great place to share code and libraries.

Yea, I put all my stuff on my Gitlab account. I just dropped the throttle up there.

https://gitlab.com/Rmccown/newthrottle

Should get you there.

Is there any difference between using GITHUB and GITLAB?

Gitlab offers free private repos. Github they cost $, or at least used to. I use both.

Dennis Cherry said:

Is there any difference between using GITHUB and GITLAB?

I’m not sure but I know they are both lyrics from a James Brown album.

Spent some time today and got it working on both the Arduino Uno and the Nucleo-32 L432KC.

Next up is getting it to work wirelessly via XBee

What sort of data are you going to send over xbee? Perhaps we could speak the same set of packet payloads.

Martin Sant said:

What sort of data are you going to send over xbee? Perhaps we could speak the same set of packet payloads.

The DCC throttle protocol is a VERY simple text-based protocol over the serial pins. For example, here’s me throttling from 0-5, then back down again, for locomotive 50:

<1><t1 50 1 1><1><t1 50 2 1><1><t1 50 3 1><1><t1 50 4 1><1><t1 50 5 1><1><t1 50 4 1><1><t1 50 3 1><1><t1 50 2 1><1><t1 50 1 1><1><t1 50 0 1>

and the same for locomotive 3

<1><t1 3 1 1><1><t1 3 2 1><1><t1 3 3 1><1><t1 3 4 1><1><t1 3 5 1><1><t1 3 4 1><1><t1 3 3 1><1><t1 3 2 1><1><t1 3 1 1><1><t1 3 0 1>

The commands are listed here

https://github.com/DccPlusPlus/BaseStation/wiki/Commands-for-DCCpp-BaseStation

At least for this, I dont really need any kind of fancy packets or anything, it just accepts the data on the RX pin, and I can send them out via the TX pin.

Hmm, ok. I see. Basically a radio usart. API mode off. Bytes in on the one side, bytes out on the other. But it is the same concept, right? Send a small ‘packet’ to the destination device, it builds the DCC stream?

Martin Sant said:

Hmm, ok. I see. Basically a radio usart. API mode off. Bytes in on the one side, bytes out on the other. But it is the same concept, right? Send a small ‘packet’ to the destination device, it builds the DCC stream?

Pretty much. This would be an ideal job for the HC12’s that Ive been playing with, since they’re basically a wireless text widget, but Ive had less than stellar results with range. Still may try, since I have a handful of them. But I also want to get more familiar with the XBee, because they’d be a better fit for my signaling mesh Ive been playing with.

Decisions decisions.

Video update on where I am

In digging around for high-amp solutions, I found out Pololu has a 12A motor shield, the Pololu Dual VNH5019.

https://www.pololu.com/product/2507

Might be worth a try to see if it will work for DCC++

" Rooster " said:

Dennis Cherry said:

Is there any difference between using GITHUB and GITLAB?

I’m not sure but I know they are both lyrics from a James Brown album.

They both provide very similar feature sets from the same core, GitHub is owned by Microsoft now and thereby are the de-facto owners of the world’s largest Open Source repository :wink:

Bob McCown said:

In digging around for high-amp solutions, I found out Pololu has a 12A motor shield, the Pololu Dual VNH5019.

https://www.pololu.com/product/2507

Might be worth a try to see if it will work for DCC++

Pololu Dual VNH5019 - It’s an excellent driver with fine grain control capability and doesn’t need a heat sink at high amperage runs but I still place one on it anyway. Been using it for years, with the built-in current sense features. The directional LEDs built in are another useful item.

Fifty Bucks? Ouch. Are you driving motors or ‘amplifying’ DCC logic level outs?