Homemade DCC Software

Post

Posted
Rating:
#235781 (In Topic #13003)
Full Member

DDC software to control Teasel Bay

As well as physically building Teasel Bay (http://yourmodelrailway.net/view_topic.php?id=15131&forum_id=21) I set out to build some software to run it.  Just like people build scratch built models, my interest lies in scratch building some software.

My plan is to be able to run locomotives, accessories such as signals and points as well as control lighting etc from multiple computers which are all connected.  Eventually adding sensors to locate locomotives around the layout so I can automate them with the ability to take control of aspects such as a locomotive or the signals and the system react.  I also want to be able to control locomotives from my mobile as well as a more tactile controls like I used to on DC.

If you are not interested in the technical bits simply ignore anything in italics!.. I've written Mainline as a web service in .NET Core. Having it as a web service means I am unrestricted in how many devices and connect and fur fill different roles. The front end is written in Angular with JSON as the communication layer between the server and client. I found an open source library called XPressNetSharp which takes commands and converts them to HEX which is then fired down to the eLink.


Today I got trains running with it for the first time which is exciting!  It needs prettying up but this is how it looks currently. Hitting connect creates a link to the eLink and initialises it ready for commands.


"Trains"/Control screen has a list of my trains and a control for each.



Its a start, I've no idea if I'll ever get around to writing half of the software I plan to but it was very satisfying controlling trains this evening on something I'd written.

Hope this is of interest to some!

Last edit: by TeaselBay

Online now: No Back to the top

Post

Posted
Rating:
#235789
Sol
Avatar
Site staff
Sol is in the usergroup ‘Super-moderators’
It shows that there are so many aspects in this hobby so enjoy what ever you do is the motto....

Ron
NCE DCC ; 00 scale UK outline.
Online now: No Back to the top

Post

Posted
Rating:
#235852
Avatar
Full Member
A someone that uses a computer program to run  a layout I think your new venture is great.
I dont know much about computer programming but I have heard of Xpressnet in conjunction with JMRI software.

Dave
Notmutley
British OO outline, DCC - NCE PowerPro, Sound chips, Computer Control- RR&Co software
Online now: No Back to the top

Post

Posted
Rating:
#235905
Avatar
Full Member
[user=540]gdaysydney[/user] wrote:
A someone that uses a computer program to run  a layout I think your new venture is great.
I dont know much about computer programming but I have heard of Xpressnet in conjunction with JMRI software.

Xpressnet is the information bus used by Lenz and other DCC systems…….I assume it is the equivalent of loconet.

So on Granby, Xpressnet sends data to the Lenz box which in turn sends it to Train Controller

John
Granby III
Lenz DCC,RR&Co Gold V10 A4 Windows 10
Online now: No Back to the top

Post

Posted
Rating:
#235945
Avatar
Full Member
Thanks John   :thumbs :thumbs

Dave
Notmutley
British OO outline, DCC - NCE PowerPro, Sound chips, Computer Control- RR&Co software
Online now: No Back to the top

Post

Posted
Rating:
#235946
Full Member
[user=434]John Dew[/user] wrote:
[user=540]gdaysydney[/user] wrote:
A someone that uses a computer program to run  a layout I think your new venture is great.
I dont know much about computer programming but I have heard of Xpressnet in conjunction with JMRI software.

Xpressnet is the information bus used by Lenz and other DCC systems…….I assume it is the equivalent of loconet.

So on Granby, Xpressnet sends data to the Lenz box which in turn sends it to Train Controller
Yeah spot on, Xpressnet is a protocol which just defines how information is passed down the DCC bus to the locomotives/accessories. XpressNetSharp is a C# implementation of it which simply takes messages and converts them into commands for the ELink in this instance: https://github.com/networkfusion/XpressNetSharp

Thank you for the positive feedback, it is most appreciated. I wasn't sure if anyone would be interested in this aspect!

Last edit: by TeaselBay

Online now: No Back to the top

Post

Posted
Rating:
#236646
Full Member
I recently bought an Arduino Mega https://www.arduino.cc/ (which is basically a simple computer) which is very good at controlling inputs/outputs. This makes it perfect for controlling lighting across the layout.

I created a simple proof of concept application on the Arduino which listens for inputs from the usb and then changes the state of the output which is a light. I then wrote a little C# play app to toggle the light on the laptop. You can see it working in the video below.

[yt]RIeB3flqPDQ[/yt]


This can easily be scaled up to turn on the platform lights, building lights etc.
Online now: No Back to the top

Post

Posted
Rating:
#237476
Full Member
The Arduino finally being pushed into action! Simply blue-tacked to the frame so it can easily be removed for prototyping. As I stated above, the Arduino takes commands from my laptop and turns on/off the corresponding light. Wiring is using reclaimed CAT5 cables, for the LEDs is low powered 5v 20ma direct from the Arduino digital outputs.

Commands to pin:
  • Gnd - Black
  • 13 - Green: Signalbox
  • 12 - Red: Station lights
  • 11 - Orange: Station building lights
  • 10 - White: Station house outside light
  • 9 - Yellow: Ticket office outside light


At the moment this is controlled by a very simple C# desktop app which simply toggles the lights on/off.



There is something strangely satisfying by simply turning the lights on/off, lol!
Online now: No Back to the top

Post

Posted
Rating:
#237479
Avatar
Full Member
[user=2057]TeaselBay[/user] wrote:
There is something strangely satisfying by simply turning the lights on/off, lol!
:thumbsI agree - maybe its the therapy/gratification  from the satisfaction of getting it to work

 :nice
I am following this thread with interest as the electronics / automation side of layout building has always appealed to me. Keep it going

Dave
Notmutley
British OO outline, DCC - NCE PowerPro, Sound chips, Computer Control- RR&Co software
Online now: No Back to the top

Post

Posted
Rating:
#237495
Full Member
Brill Dave.  Glad it is of interest to someone  :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.