Kay Sievert

Hi,
I am currently working on a LocoNet controller for stationary DCC decoders. This controller will allow me to throw turnouts on my layout with a fairly small but dedicated controller, instead of using my Zephyr for loco and TO control, or having to run a PC program to do that. Or trying to cram dozens of toggle switches on a layout panel.

The controller connects to the Zephyr via LocoNet, and the TO signals will be received by the Zephyr which in turn will send a DCC signal to the DCC decoders.

It will be a pretty simple design - with an Arduino Pro Mini, a 10-key pad, and either an LCD or several 7 segment displays.
A prototype with an LCD display is already operational. I am waiting to receive the 7 segment displays to try those out, because it seems an LCD display is just overkill for this type of controller. And I'm used to the Zephyr display.
We'll see.

Since the circuit is pretty simple and I'm not planning on making more than one of these controllers, there will probably not be a PCB designed for this. It will be build on prototype board instead.
Installing it into a nice enclosure will probably be the biggest challenge!

More to come soon,
Kay
 

Reply 0
Kay Sievert

Components

OK, here is a quick list of the components that I have used for the controller:

1. An Arduino Pro Mini
2. A robust(!) 10-key pad. I purchased this one from Adafruit: 3x4 Phone-style Matrix Keypad
3. For the LCD variant: LCD Display (eBay) and Display Driver (eBay)
4. A small circuit that converts the LocoNet signal for the Arduino. I used this schematic: Interface

5. For the Zephyr style 7 segment version: LED Display Module
    This type of display is really all that is needed IMHO.

Here is the sketch I am using with the LCD display: Turnout_Controller_v7.ino

I'll try to upload a picture of the prototype soon.

- Kay

 

 

Reply 0
Kay Sievert

@Peter Re:Controlling DCC accessory decoders via Loconet

Hi Peter,
Thanks for pointing out that the link was bad.

There is no extra code needed for the LocoNet interface. The code is already integrated in the sketch I have posted here. I basically used examples of Alex Shepherd's LocoNet library and added my one code for the keypad and the LCD display.

Hope this helps,
Kay

 

Reply 0
Kay Sievert

Demo video

Hi,
I have added an (admittedly crude) demo video of the controller in action. Still needs a little
bit of work I'd say..

- Kay

Reply 0
Geoff Bunza geoffb

@Kay One idea to offer

Hi Kay,

I have enjoyed your project and the board looks great. Here's an idea for you-- if you dedicate a Pro Mini to the Keypad and display, you might consider using the scheme Peter is using here: The Redwood Sub http://model-railroad-hobbyist.com/node/25098

(Use the MRH search for "Redwood Sub" I can't get this link to work ) Essentially he does all the interface work in the Pro Mini and send the "results" (characters and numbers) to the larger Arduino Mega. In your case, if you have more than one of your boards, the interface Pro Mini could simultaneously send the messages to all and each could decode only those assigned to each (to throw servos, or whatever). With a little code change, you could also have multiple interface Pro Mini's around the layout that could set switches from different locations.

Just another thought when that one wild brain cell of mine fires without warning! 

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
ChrisNH

Same circuit for PI?

Cool stuff. I will try something like this, I have a few Arduino sitting around wondering what to do now that my robot project is moving on to using a Pine64.

Would the same circuit allow me to hook up my pi to loconet via the GPIO pins for JMRI?

I can't find my MS100 anywhere and with my DT400 going to digitrax for repair I will have no way to turn on track power if I can't hook it up to JMRI. Originally I was going to feed the MS100 from GPIO using a TTL to RS232 converter.

Thanks!

“If you carry your childhood with you, you never become older.”           My modest progress Blog

Reply 0
Kay Sievert

@Geoff Re:One idea to offer

Hi Geoff,
Thank you for your kind words.
I will go ahead and take a look at Peter's design. It's a sizable blog, but I'm sure I can find the pertinent sections.

The way I have designed this is as follows: The controller I am building generates a LocoNet signal to throw a turnout. It then sends it to the Zephyr, and the Zephyr sends the throw signal via the DCC bus to the servo decoders.
 

Regards,
Kay

Reply 0
Kay Sievert

@Chris Re:Same circuit for PI?

Hi Chris,
I'm sure that a PI would work just as well. What is going to be problematic is to find the libraries to support the hardware (keypad, display, etc). It would probably be a lot easier to just use an Arduino for this IMHO.

Regards,
Kay

Reply 0
ChrisNH

JMRI should handle it

Once I am connected JMRI should be able to use it in MS100 mode. Originally I was going to us a TTL to RS232 chip and use my MS100.. if only I could find it.

I can probably extend the sketch to turn on track power, my main short term need, if I end up coming up short running JMRI on my PI,

edit: found a schematic on JMRI site.

“If you carry your childhood with you, you never become older.”           My modest progress Blog

Reply 0
Heisler wanted

Reading data

Hi Kay,

Your PCB looks great, wish I could read about it..... I know you have tried to help with this, but feel a bit stupid as no one else has written anything about problems with reading your links. I can see the page where it says "download", but my W7 computer won't/can't do that !  Could I humbly ask for at least the schematics in another form ? (I know Geoff suggested old port as a persuader, but....I'll just ask for now).

I am mostly interested in your transistor modification, consider doing my own board(s).

Also, your loconet controller is of interest; am I right that you will enter TO numbers on that keypad ?

For myself I would stick to good old switches on a panel, but that would be doable too, maybe with a separate

Pro Mini for entering switch status, and transferring that data to the DCC controller. So, this DCC link really works like a multiplexer, to allow many inputs and many outputs.

Anyway, good luck with your efforts, looks very good so far !

Regards

Peter

 

Reply 0
Kay Sievert

Re:Reading data

Hello Peter,

You just click on the down arrow on the Google Drive page and it will download the file for you.

docs.jpg 

Reply 0
Heisler wanted

No reading data

Thanks Kay, for trying to sort this out, have tried "everything", still can't access the files.

This is not good of course, I want to either use your idea with a DIY loconet TO controller, and Geoff's decoder, or redesign the decoder with direct switches (w/o DCC). If you have any other ideas about the files I'd appreciate it !

Best Regards

Peter

 

 

Reply 0
ChrisNH

Good for interim setups

Quote:

For myself I would stick to good old switches on a panel,

Agree I would rather have a panel in the long term but it would make a nice interim solution until panels are ready. A friend recently completed a large yard on his layout. It was all wired up with DCC control but it took a while before the panel was ready (they set up to switch by routes via software). This would have been alternative to punching numbers on the throttle.

“If you carry your childhood with you, you never become older.”           My modest progress Blog

Reply 0
Heisler wanted

One strange thing I noted is

One strange thing I noted is that all other links on the "Components" page work fine, only Turnout_Controller_v7.ino refuses to download ?

Peter

Reply 0
Kay Sievert

@Peter

Peter,
I just tried the link to the sketch and it is working fine for me. Not sure why you can't access it.
I'll try to find some other way to get you the file.

- Kay

Reply 0
Heisler wanted

Re @Peter

Thanks, I appreciate that !

Best Regards

Peter

Reply 0
Kay Sievert

Quick update

Update:

I have made another sketch which now supports a display like this one:

p.jpg 

I'm not too crazy about the red LEDs, so I have ordered green and yellow displays to use instead.
The first 3 digits are the turnout / route address, and the right most segment is for "t" and "c" like it is on a Zephyr.

I will also be adding route functionality to the controller. This should be easy enough to do. My idea is that routes will have addresses in the 900 - 999 range and are hard coded in the sketch. I.e.: route 900 would throw or close turnouts 11, 36 and 38. Since the controller has access to every DCC controlled servo, this will work for the entire layout.
I have also ordered an enclosure, which will hopefully make for a nice and compact device.


Btw, the reason why I choose to go this route is that I am able to get a nice and compact layout panel to display turnout status and block occupancy. Adding toggle switches for turnouts would have made the panel at least 3x that size if the switches where mounted in the turnout locations on the panel. With enough space in between switches that is. I just don't have enough room for a panel with 30 switches, so a small numerical controller is the way to go for me. Unless I fire up the PC and let JMRI do the driving..

- Kay

Reply 0
Kay Sievert

Circuit

Here is the schematic for the circuit.
The pins from the keybpad are going to Arduino pins 2,3,4 and 9,10,11,12

The small LocoNet circuit can be build as a small standalone circuit, or integrated on a larger protoboard for the Arduino. The GND from that circuit goes to the Arduino ground.

- Kay

Circuit.jpg 

Reply 0
debaker02

SSB may help?

RR circuits sells a nice small board that takes loconet and connects a 3 wire bus. Wire one is power, wire 2 is the data, wire 3 is the ground. You can power the arduino from power, and then hook up the data to it. It's nice to not need to fab. a board. Not sure if this helps...
Reply 0
Kay Sievert

Re:SSB may help?

Thanks debaker02,

Not a bad choice to get an Arduino hooked up to LocoNet.
Since I'm mounting the Pro Mini on a small protoboard anyway I'll just toss in the couple of components for the interface.
If time permits I will try to put the controller into an enclosure this weekend.
I'm pretty happy with the ease of switching individual turnouts. And being able to execute routes without a PC or an ECOS command station is really cool. The routes are hard coded, but that's not a big deal since they won't change all that often. And if they do - I'm planning on making the Pro Mini bus accessible from outside the enclosure, so that routes can get added or modified.

Regards,

Kay
 

Reply 0
Kay Sievert

The controller is finished!

Hi,
I managed to wrap this project up. Everything is working just as good as I had hoped.

Here is a short demo of the finished controller in action:


(I apologize for the noisy air conditioner in the background. I got REALLY hot here in SoCal today.)

While the controller is finished - laying track is not. So don't be surprised that the turnouts are not going anywhere right now.

ntroller.jpg 

- Kay

Reply 0
Heisler wanted

Controlling the controller

Hello Kay,

Nice work with your controller !  the video plants ideas in my head....

Since my last blogs re your work I have finally got Geoff's controller to work; All it took was looking up how the Zephyr handles accessories: I simply was not(yet) aware of the "Switch" command (!) and how to use it. Looking at your video I have a question; with at least 30 turnouts, and no panel, how do you know which TO is which i.e. what number corresponds to each TO ?  I imagine a smaller panel with numbers only, w/o the spacing for switches, but perhaps you have found a better way ?  

Best Regards  Peter

 

Reply 0
Kay Sievert

Re: Controlling the controller

Hi Peter,
Glad to hear that you got Geoff's decoder to work!

I will have a control panel for the layout - just not with switches for the turnouts as you correctly guessed.
It will have only indicator LEDs for turnout status and block occupancy. And the turnout numbers will be labeled
on the panel as well.

Here is a first sketch of what I have in mind. I will be able to keep this comfortably at about 28" x 3" using 2mm LEDs.
If I had to place individual toggle switches in the locations of the LEDs and maintain a reasonable distance between
them, then the panel would have to be at least 3x larger.
Click here for the full size image

v5_small.jpg 

Regards and Happy 4th everyone!
- Kay
 

Reply 0
Heisler wanted

Re: Controlling the controller

Hi Kay,

Looks like a neat solution, are you going to monitor TO status with micro switches, or drive the LED's from the Pro Mini ?  My thinking is down the same path as yours, a panel as small as the necessary info allows, though my layout is a lot smaller. This of course leads to another question, tapping TO positions from the Pro Mini. I am not sure how a LED reacts to servo pulses or, for that matter, if the combined load is allowable. Will have to look into that, wouldn't be surprised if servo pulses are shut down following changes. Or was that your special circuit, the one I couldn't read ?   Anyway it's great getting these solutions to work, be it big or small layouts. And, as Geoff always points out, have fun ! 

  Regards

Peter

 

Reply 0
Kay Sievert

Re: Controlling the controller

Hi Peter,
I am driving the TO status LEDs with micro switches at the servos. This way I get the actual status of the TOs,
instead of an assumed one.
My layout is modular due to space constrains, so I wanted to minimize the amount of wires going back to the
control panel. I decided on using LocoNet as my main data bus, so that I only have to run LocoNet, DCC and
a 5V power bus throughout the layout.
Because my frog polarity switches are SPST, I have developed a circuit that turns the DCC polarity into a digital High / Low depending on a straight or divergent turnout.
That High / Low signal then goes into another circuit that turns it into a LocoNet sensor signal which goes back
to the panel, so there is not that much wiring from module to module. That sensor signal then can drive an
accessory decoder in the panel to turn TO status LEDs on or off, or show the status in JMRI.

I know, there's a lot of converting signals back and fourth, but that is the only way I can route that many signals
through the modules without have huge cable trunks with unwieldy connectors from module to module.

If you do want to go the Arduino route for TO status LEDs, you can simply build one of Geoff's decoders and give it the same address as your servo controller. You can use the output from that decoder to drive your LEDs and
it will be in perfect sync with your servo decoder as long as you start with a known state of the turnouts.

Geoff is right - Have Fun! really is key. No point in getting bogged down over something that's just not worth pursuing. I've fallen into that trap before..

Best of luck,
Kay
 

Reply 0
Reply