Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Simple DIY DCC system with App Locked

927 views
14 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    June, 2019
  • 8 posts
Simple DIY DCC system with App
Posted by Falkland Bill on Wednesday, June 05, 2019 9:21 AM

I am a retired electronics engineer with a big interest in DCC and model trains.

Over the past year, I have developed a brand new concept design of a low cost App based DCC system. Using around 15 components on a small PCB with an Arduino Pro Mini plus h-bridge module and a Bluetooth module, the cost to build is minimal giving the easiest ever, self build of a NMRA compliant DCC Command station !! 

Just use your Android phone or up-cycle an old one without a SIM card, to be your smart DCC controller. WiFi is only required to download the App and Bluetooth must be switched on to run the App .

Yes, the computer on the phone does the job of creating the DCC packets which are transmitted in comma separated groups of bytes in number form. 

The Bluetooth module receives the bytes for the Arduino module which adds the error detection byte and creates the DCC signal by interrupting a free running clock to create binary '1' (58us pulse) or '0' (116us pulse) in a series of packets on an output pin.

These packets of bytes are delivered to the track via a LMD18200t H-bridge module which converts the signal to an alternating DCC signal.

  • Member since
    May, 2010
  • 5,478 posts
Posted by mbinsewi on Wednesday, June 05, 2019 2:47 PM

Well........Ok then  IndifferentConfused

I,ve always thought that another forum should be added to the list, just for, and STRICTLY for you engineer types.  Laugh 

By the way, welcome to the MR forums.

Mike. 

  • Member since
    February, 2002
  • From: Reading, PA
  • 26,433 posts
Posted by rrinker on Wednesday, June 05, 2019 2:51 PM

 It's more or less already been done, except the actual packets are generated by the Arduino with the H bridge.

 I'm not sure what benefit there is by generating the packet in the phone and having the Arduino just echo what it gets at a higher current. The Arduino is powerful enough to take whatever sort of input you want to give it and generate DCC packets - for at least a few locos runnign at the same time. You won;t replace a club-size system with this, you'd need a much more powerful micro for that. But that too is pretty much already done, with the Pi-Sprog. The Raspberry Pi provides the compute and interface, you use your phone, or any cheap Android phone, as the throttle. 

                           --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July, 2009
  • From: somerset, nj
  • 2,628 posts
Posted by gregc on Wednesday, June 05, 2019 4:20 PM

Falkland Bill
Yes, the computer on the phone does the job of creating the DCC packets which are transmitted in comma separated groups of bytes in number form. 

can more than one loco be controlled using your approach?

greg - Philadelphia & Reading / Reading

  • Member since
    June, 2019
  • 8 posts
Posted by Falkland Bill on Wednesday, June 05, 2019 4:56 PM

Thanks for your interest, Randy.  This design is unique - there is no other like it on the market or on any hobby sites that I am aware of. The huge benefit is on simplicity and cost versus functionality and value for money. You do not need a computer or complex circuit. I already have a self designed boxed Command Station (on Instructables also) whereby I needed 2 Nanos (with huge sketches), a TFT screen and a key pad - capability limited by screen size and keyboard. This App system eliminates all of these while having a miultitude of function keys and turnout keys with configurable titles and visibility (including momentary functions for horns etc). It is aimed at small to medium size layouts rather than sophisticated club systems. It far exceeds entry level system from Bachmann, Hornby, etc. At the moment my App system only does CV1 coding, however future versions could have full CV addresing. 

Arduino on its own could not drive any locos, you need an amplifier / bridge at least to generate the DCC signal at required voltage levels (way above Arduino voltage) 

This App system has only 15 components + cheap Arduino (no external DCC libraries and simple sketch)  + h-bridge + BT module. Around £15 worth of parts from eBay - a lot cheaper than Pi-Sprog or any other DCC++ type systems.

  • Member since
    June, 2019
  • 8 posts
Posted by Falkland Bill on Wednesday, June 05, 2019 5:06 PM

Thanks for your interest. Yes all locos are sent DCC packets contiuously while the App screen has 4 speed control bars - so 4 at a time while the rest run as instructed - you can change the loco on each of the speed bars at any time. My loft railway has all of my 8 DCC locos running at once. The limitation is in the power drawn by your layout. In this design I have limited the total current to 2 amps which is 15 to 20 HO/OO locos - a booster could easily extend this. Many features include configuring loco names, functions and names approriate to each, momentary functions where required and max speed set for each.

  • Member since
    June, 2019
  • 8 posts
Posted by Falkland Bill on Thursday, June 06, 2019 2:31 AM
Yes, on the full App you can control up to 4 at a time and can easily change which locos to control from a list of 20. On the free App only one at a time.
  • Member since
    July, 2009
  • From: somerset, nj
  • 2,628 posts
Posted by gregc on Thursday, June 06, 2019 12:48 PM

from multiple android phones?

greg - Philadelphia & Reading / Reading

  • Member since
    June, 2019
  • 8 posts
Posted by Falkland Bill on Thursday, June 06, 2019 1:27 PM
No - only on one Android phone at a time due to Bluetooth connections used in the design.
  • Member since
    February, 2002
  • From: Reading, PA
  • 26,433 posts
Posted by rrinker on Friday, June 07, 2019 11:10 AM

 I still don't understand the benefit of having the DCC packet created on the phone and then transmitted over BT to the "booster" which is what your device is, since it it taking the DCC packet sent to it over a low power system and converting it into a high power output to drive the trains. Any interruption in the signal causes a complete loss of DCC traffic on the rails. And it limits you to one phone device since only one 'command station' can exist in a DCC system.

 There's no reason this very same Arduino that is connected to the rails with an H bridge can't read the BT data as a much simpler stream of commands and actually handle the DCC packet generation within it. This has already been done, actually. It's no more expensive than your proposal - you need a microcontroller and an H bridge driver to get sufficient power to the rails to drive the trains either way. Your way makes the app in the phone more complex AND limits you to one throttle. Even if it has sliders to control 4 trains, that's still only one person who can run trains. There is not one currently sold DCC system that has this limitation. I don't consider Bachmann still stuff the EZ Command in some train sets as actively selling the system - but even that super simplistic system actually does have provisions for a second throttle for a second person to run another train at the same time.

If you are going to use direct BT from the phone then you might as well send the BT right to a receiver in the loco itself ala BlueRail instead of to some Arduino device connected to the track.

 Google DCC++ for a simple and cheap Arduino DCC system. 

                                       --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June, 2019
  • 8 posts
Posted by Falkland Bill on Friday, June 07, 2019 12:19 PM

"Any interruption in the signal causes a complete loss of DCC traffic on the rails" this does not apply to my system. The DCC signal is created in the Arduino and stays live constantly without any break. The word 'interruption' is used in my description of the internal clock in the Arduino wherby a pulse width is changed in the clock signal to match the DCC packet '0' or '1' as required.  There is no delay to the DCC o/p. In fact all DCC systems must use this method in micro-controllers. (DCC ++ included).

I am aware of DCC++ but rejected that method due to complexity compared to my simpler, cheaper and user friendly coding. My method does not use any external libraries and is the simplest possible design for the Arduino which should appeal to some.

There is no need for expensive DCC systems in the future using this approach. App technology is easy to use and will only improve with time. All of the features of the most expensive system are possible in an App which will always sell at a fraction of the cost. I have developed this App on my own - others with more resources will take this idea forward. Use IoT devices (WiFi) instead of Bluetooth will give more options for multiple controllers etc

 

  • Member since
    July, 2009
  • From: somerset, nj
  • 2,628 posts
Posted by gregc on Friday, June 07, 2019 2:02 PM

Falkland Bill
I already have a self designed boxed Command Station (on Instructables also) whereby I needed 2 Nanos (with huge sketches), a TFT screen and a key pad - capability limited by screen size and keyboard.

sounds like your command station incorporated a controller and booster (e.g. PowerCab).   Otherwise it wouldn't need a user interface.

are you BillC35?  could you provide a link to your instructable?

The DCC++ base station code is  < 4200 lines (C).

 

i wonder if an ESP32 w/ an H-bridge would make a good platform for a command station/booster.   It could support multiple wifi controllers and possibly more conventional ones over a 485 bus.

greg - Philadelphia & Reading / Reading

  • Member since
    February, 2002
  • From: Reading, PA
  • 26,433 posts
Posted by rrinker on Friday, June 07, 2019 2:13 PM

ESP32 is not a bad choice especially when wireless is being used. Sure makes it a lto easier than external hardware. ANd it's a much more powerful processor than the ATMega 328. Funny is the remote temperature/humidity sensore I made - it uses an Arduino connected to a temperature and a humidty sensor, which sends the data to an ESP32 used ONLY for the WiFi interface. The ESP32 could easily do it all, no Atmel chip in sight. ANd they are still inexpensive chips, with as much or more IO than the same size Atmel chip.

                                  --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June, 2019
  • 8 posts
Posted by Falkland Bill on Friday, June 07, 2019 5:35 PM

yes I am BILLC35 and link is :

[Link removed by moderator for violating forum policy on buy & selling and advertising.]

My Arduino code is <420 lines. 

I will look into the use of ESP32 as suggested.

 

  • Member since
    July, 2009
  • From: somerset, nj
  • 2,628 posts
Posted by gregc on Saturday, June 08, 2019 11:13 AM

Falkland Bill
I already have a self designed boxed Command Station (on Instructables also) whereby I needed 2 Nanos (with huge sketches),

could you post a link?   I'm curious about the limits of Arduinos and large (especially huge) sketches.

I downloaded the the DCC Command Station V2 sketches.   They're only ~330 lines.

greg - Philadelphia & Reading / Reading

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!