I suppose it's possible, but extremely unlikely - the code won;t change all by itself, and I'll have it thoroughly cleaned up by the time the final thing goes in the case. You'd have to set multiple outputs high somehow, which is extremely unlikely. I'm using active high, not current sinking, since there's a driver chip between the Arduino and relays. The FIRST thing that happens whenever you push a button is the code turns off all the relays. There's nothing that has code like "relay 1 off, relay 2 on". It's "all relays off" then goes and reads the buttons and the selected option and then "relay 3 on" or whetever one you selected. To electrically lock out the relays I'd have to get some 3 pole ones (I'm switching both lines on all sources, no common wire which could cause problems with feedback between the sources if one has its AC source reversed).
Those breadboard pattern perfboards are handy, but probably not ideal for this, since what will be PC mounted is the Nano, some resistors for the LEDs, the Darlington driver chip, and the relays - and a bunch of connectors for all the off-board stuff like the 1602 LCD, the buttons, the LEDs, and the terminals on back to connect the input devices and track output. I haven't even decided what sort of terminals to use, though probably something like the screw terminals like on the Digitrax command stations. If I really get ambitious I'll convert the schematic to a board layout and have one made - between each of the relay outputs I'd need fairly heavy traces which would be the common output bus to the track connector, and then 4 pairs of inputs to each relay. Maybe use an 8 pin connector and a 2 pin, keep the output away from the inputs. I haven't decided on a power supply solution, perhaps just power it from USB since it won;t draw that much even with a relay held in, but I'm thinking the relay power should be seperated, or at least additional capacitors used to minimize transients when the relays switch. If I think about it while building it, I'll take pictures for a potential article, or at least comprehensive forum post.
I'll also have much the same discussion over on the EEVBlog forums where the details of the electronic design are a more appropriate subject then here. And I need all the help I can get - yes, I have an EE degree but it's been over 25 years since I actually worked as an EE (instead of IT). Discounting that all the complicated work is done with software in the Arduino, this is probably the most complex thing I've designed since then. But I have more - I plan to build my own signal and detection modules, with RS485 communications, and write my own PC control software to read them all.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
rrinkerI have an Arduino with an LCD display to select which source of power - DCC, DC, PR3, or Lokprogrammer. 3 buttons select an item from the menu (next/previous and enter). The code makes all relays open first, then closes the selected option. Select a different source, they first all open, then the selected one closes.
This may not be the case, but it sounds like from your description that if your code messed up you could have more than one source connected to the track. Personally, I would wire it so that would be impossible, for example: relay 1 selects DCC or the next relay, relay 2 selects DC or the next relay, relay 3 selects PR3 or the next relay, relay 4 selects Lokprogrammer or off.
rrinkerI have it working as a prototype on a breadboard, got to find and make a case for it.
I don't remember if I 've posted these on here before or not, but anytime I get something wokring on a breadboard and want to move to a more permanent solution without making a circuit board I use one of these: https://www.adafruit.com/products/591 (also available through Digikey now).
They exactly duplicate the breadboard ciruit so you can copy straight from the breadboard to one of these. These are also very well made with gold plated holes plated through (MUCH easier to work with than the cheap "Radio Shack" prototype circuit boards).
Once I get it totally done I'll post some pictures. It's a mess on a breadboard right now, using a 4x4 switch matrix for the three pushbuttons. And I still need to order the relay driver chip. But you can scroll through the choices of ALL OFF, DC, DCC, PR3, and LOKPROGRAMMER and hit the select button and the approriate LED turns on. I also need to get another Nano to get soldered in place in the final product.
Compared to my current one which has a simple DPDT center off switch to select between PR3 and Lokprogrammer. The track for this new one will likely be attached to the back edge of my workbench rather than be a portable unit like the current one.
Randy,
If I had your electronic knowledge I would have done the same thing. I love overkill when it comes to model railroad projects. BTW, I didn't see any mention of you having an APP for your Iphone to run the programmer?
-Bob
Life is what happens while you are making other plans!
Randy... in reply to your post in my questions about the SDH166D... I made the comment I was a retired computer specialist.. well I'll be 71 next week,,, and really love the way the hobbyist "overkill" everything... its the only way to "keep young" and not let technology push you in the corner... I've been interested in the Arduino technology but haven't gotten around to pursuing it yet... your project sounds really interesting..
Incidently... I've always been interested in HO Trains...(having three boxes of stuff that I've just recently got out.. from my early days... for the past 5 years I've been into RC airplanes... but sold off most my stuff last year... .. I wanted to start learning about DCC and am having a great time reading,, building and learning the technology..... I don't have the room for a large layout..but hope to get a small shelf type layout going... enjoying the ride.... joeg
You're not going to want to see my new one. Talk about overkill - I have an Arduino with an LCD display to select which source of power - DCC, DC, PR3, or Lokprogrammer. 3 buttons select an item from the menu (next/previous and enter). The code makes all relays open first, then closes the selected option. Select a different source, they first all open, then the selected one closes. I have it working as a prototype on a breadboard, got to find and make a case for it.
Nice job! These are the ingenious ideas we modelers come up with when faced with a design solution. I did a similar thing with mine using two rotary switches; one to select one of three tracks and the second to select DC, DCC, Program and off. Works the same just a different route.
Wanted to post some pics of my completed test track for DCC.. thanks to all those who steered me in the right direction for wiring, etc.
Each track uses a three position toggle... specific to what I want to do on that track.
Top track toggles between using PR3 access or RUN access...
Bottom track toggles between using Zepher Xtra DCS051 Programming mode or RUN mode.
Note: The RUN mode for both top and bottom track is the same.
My DCS051 has Two sets of wires... one set for PROG and one for RUN (each RCA plug runs only the center lead active.
Also... if I want to run a DC train test... I just hook up my DC transformer to the set of RUN wires... and the track/s is DC (The wiring and toggles keep things electrically separate)
I've successfully run both DCC and DC on the setup... and accessed CV programming with both the DCS051 and the PR3.
I built this to learn about DCC technology and I'm having a lot of fun in my retirement years for the new tech developments...
enjoy..