Upgrading a Web based DCC control station
This is a WORK IN PROGRESS! Do not trust anything as "real" just yet!
--Eric Timberlake (talk)
A DCC WiFi receiver upgrade
At the April RCGRS MRT SIG meeting, Dr. Geoff Bunza gave a presentation on a steam locomotive throttle he and others have developed. It requires actual input from the operator to run the locomotive. It is packaged in a clever 3D enclosure with levers for the Johnson bar, speed control, and braking, and a lot of other controls needed for a real steam locomotive.
Geoff Bunza's work is a derivative of Ulysse Delmas. The Petite Command Station.
The concept is this - a DCC command station with a built in web server. Using ANY tool with a browser and a WiFi connection, you load the control page(s) and can from there control any DCC decoder (locomotive or accessory) attached to the DCC output. Geoff uses HTTP post commands from his Steam Throttle to this web server enabled DCC control station.
In Geoff's presentation to us, the DCC output was attached to a short section of HO track and DCC locomotive control was demonstrated. The locomotives shown were configured with off the shelf HO scale DCC decoders.
Everyone was quite impressed with all work Geoff had done.. The G-Scale attendees at the April 2023 MRT SIG meeting were all very excited about the project and the idea of adapting it to G-Scale use.
Applying to G-Scale
For G-Scale applications, we need 3-6 amps of DCC modulated power to run our big locos and loud sound cards. DCC is a protocol describing how to modulate a non-polarized square wave to encode information, aka binary, or ones and zeros and additionally the square wave can be rectified to provide power to the equipment (decoder or accessor) in contact with it. GENERALLY speaking, this non-polarized square wave is transmitted to the train via the track to provide both instructions and power to a decoder equipped device. To create this DCC signal, a micro processor wiggles the control lines of an H-Bridge, which simply flips the signal back and forth, not unlike reversing a motor over and over, but VERY FAST.. The H-Bridge component has a finite limit in terms of allowing current to flow through it.
I volunteered to see about updating the command station end of all this work by Geoff and others to support a G-Scale sized load, which mostly just means "upsizing" the H-Bridge for more current capacity.
Research

The diagram on the right shows the basic theory of an H-Bridge. Close S1/S4 or S3/S2 to forward or reverse the motor. DO NOT close S1/S2 or S3/S4 at the same time! NOT GOOD. In place of the motor, put the track rails and switch it banc and forth fast. That's DCC.
My first step was to research what this electronic "H-Bridge" thing is and some design theories behind it. I learned that when using MOSFET transistors as a switch, a thing called "Gate Capacitance" is your enemy.. This isn't a deep electronics lesson, but what I learned is that Gate Capacitance affects the time required to TURN OFF a typical MOSFET and how if you're not careful with your design process it's easy to turn on BOTH SIDES of the bridge for very brief periods which will lead to overheating and eventual failure of the output stages despite is looking logically impossible on the schematic side of things. This referred to as "shoot through" and is undesirable. All this boiled down to this. I'm not smart enough of an electronics guy to solve this problem and create a reliable device.
Fortunately, I don't have to be.
Reverse Engineering existing product
To advance Geoff's design to G-Scale, we need to increase the amount of current supplied by the DCC 'control station', which in our case is an ESP32 or ESP8266 WiFi capable micro controller that drives a full H-Bridge to create the non-polarized square wave and encode the DCC commands via the square wave period or frequency.. This means re-designing his very small board designed for HO scale locomotives and layouts into something a LITTLE larger and capable of supporting more current.
I spent LOTS of time digging through various component SPEC sheets, but then I realized I had an actual example of what I want to do sitting right on my bench.. An Airwire 900 CONVERTER-60 - the EXACT THING I want to duplicate, except it's receiving a signal via 900MHz radios vs. WiFi frequencies at 2.4GHz. It uses a Texas Instruments microprocessor, but that's effectively the only difference.
They use a device called a BTN8982TA.. More on this device from the manufacturer, Infineon
Airwire uses a Texas Instruments micro-controller and an off the shelf 900MHz receiver module connected to two BTN8982TA Half Bridge devices together creating a full H-Bridge. so there's not really much to reverse engineer here. All we're going to do is swap out the Texas Instruments microprocessor with a ESP microprocessor running Ulysse Delmas' ESP8266 code base that is the web server part I mentioned earlier.
Sample Application
Reading the SPEC sheet for the BTN8982TA, I found this device has built in circuitry to prevent the overlap condition mentioned above, aka "shoot through". Further reading showed Infineon had done almost all the work for me in terms of a "sample application circuit"! Talk about helpful! No shoot through, and a ready made example to leverage!
Here's their sample schematic intended to teach folks how to apply their device:
Adapting to the D17 ESP8266 code
So, now I can take all these concepts and start working on a schematic that integrates a everyday ESP8266 "Wemos D1 Mini" into a "wifi" web server that outputs DCC capable of up to 6-10 amps or so.. This example application lines up VERY nicely with Ulysse Delmas' ESP8266 code base for a 754410 half bridge chip.. The inputs of the two BTN8982TA parts is essentially identical. The 754410 "EN" (enable) input is the same logic as the BTN8982TA "INH" (inhibit) input and the individual H-Bridge halves are identical, it's just the BTN8982TA is capable of (IN THEORY!) 50 amps of current. Now, we're not getting ANYWHERE near that kind of power capacity here - keep in mind that Airwire uses the SAME PART, but is only rated at 6 Amps continuous. That's the cost of simple no-heatsink air cooled parts slapped on a very small circuit board like ours. Nowhere for the heat to go, so we're seriously de-rating as a result.
The BTN8982TA half H-Bridge features an "IS" output or Current (I) Sense (S) ,but we can't really use it:
- I didn't write the D17 code, and I'm not about to change it...
- The Wemos D1 Mini only has one Analog input, and we'd need two, so...
We'll just leave the IS outputs open and forget about that feature for now.
I also skipped the reverse polarity protection in the example like many mfgs, including Airwire - just be careful how you hook it up!
Here's my upgraded D17 schematic. The Wemos D1 Mini runs the web server and handles WiFi as well as having three output pins that control the H-Bridge. Swiftly switching the H-Bridge back and forth creates our DCC signal. Using beefy components means the decoder end can rectify that wave form and provide up to six amps of DC power for motion, lights and sound without over heating the control station switch components. (The H-Bridge part.)
Make a circuit board
Now that we have selected the parts list, or Bill Of Materials, designed a schematic and assigned what is known as a "footprint" to all the parts we can consider trying to craft a circuit board to hold it all...
TBC - To Be Continued... Check back soon-ish - or not.. ;-)
--Eric Timberlake (talk)