Tuesday, October 11, 2011

Turnout Switch Controller Schematics

Turnout Switch Controller Schematics

Now for the complete schematics. This schematic is Copyright by myself 2011, but I grant permission for anyone to use it for personal purposes. If you'd rather not build it yourself, I am selling the blank PCB to help offset my design costs and keep my own per boards cost down. I don't have a high markup, the intent is to keep the price down to help out hobbyists and experimenters.





The final PCB measures 3"x4.5" and has four plated through mounting holes spaced 2.5"x4" apart for #6 screws. In my mounting for the train set, I used some cheap plastic spacers and wood screws to mount them to the 2x4's of the train layout.

Previous Section: detailed descriptions

Assembly Options
 
Most of the assembly options ar compatible with each other with the exception of only one output MOSFET/Transistor per stage is permitted, and a high voltage output with voltage regulator can't be combined having a low voltage power supply input for the timing and logic stage, Even having the extra diodes on the output stage used for transistors is safe to combine with MOSFET's since they will simply add extra protection.

When you don't need the flexibility of using jumpers as options, I encourage you to replace the headers with a wire jumper. The designs allow for jumpers for when flexibility is required. This is also why some jumpers are in pairs so that either two 1x3 or one 2x3 header can be used as well.

For capacitors C1, C16, C17, and C18 only install as much as needed. Using all four at 1000uF each is only needed if you have a weak power supply and high current devices. having a single 100uF capacitor works for good quality power supplies. When using high output voltage, at least one capacitor in each section should be installed after cutting the runs on the top layer (marked by the X's) and installing either a 7805 or a 7812 in the holes near the top X in the picture if you want to power the low voltage from the high voltage. It's recommended to also add a diode between the low voltage and the high voltage to help drain the low voltage capacitors faster as a fail-safe.

Connector J1 is there for the convenience or using a ribbon cable. I expect most people won't be using that and and be omitted. Input connectors J2 & J3, output connectors J6 & J8, and power connectors J4, J5 & J7 have extra large pads and larger then needed holes to allow direct soldering or wires people people trying to save a little. Also, many people will only need one of the three power connectors, the additional connectors are to make it easier to choose where power comes in, daisy chaining boards, and the high voltage output stage option.

For two wire only assembly, input connectors J2 & J3 can be two position, leaving the third pin unused. When two wire with a single common voltage is used that the main control signal goes above or below, you could make J2 a 3 position connector, and then solder a wire from J2-3 to J3-1 and install the common jumper JP3. When the common voltage changes or is not the same, do NOT jumper JP3 since that shorts J2-2 & J3-2 together.

Normally jumpers JP1 & JP2 need to be in the same position as do JP4 & JP5 to select two wire or three wire operation. Jumper 1-2 for two wire operation and 2-3 for three wire inputs. Each half of the board though does not need to be the same, but be careful of the JP3 common jumper that shorts the two common inputs together, specially since some two wire modes change the voltage on this input.

In the Timing circuit, JP6, JP7, JP11, JP13 determine if the timers are edge or level triggered, using edge triggered allows for safe control of coil/relay style switches, Level triggered should be used only for devices that are safe to be on constantly, such as stall motors (Tortoise) and lights. If you will be using only level triggering, then the pulse capacitors C2, C4, C8, C10 can be omitted along with R7, R10, R13, R14

Paired output and timer resetting is controlled by JP8, JP9, JP10 & JP2. When in position 1-2, an input will clear out the timer on the other output for that pair to prevent turning on both sides of the output at the same time. This is highly recommended (almost required) for good three wire output to snap/coil style switches. But, when you want to use the output independently, you don't want that to happen and connect pins 2-3 together. People experimenting or needing other additional logic can even jumper other signal into pin 2 or wire things differently (such as JP8-2 to JP12-1 to watch a different input).

For Transistor output, D1, D3, D5, and D7 are required when driving relay, coils or anything they might deliver a back voltage. When driving lights or using MOSFET's, these diodes aren't needed.

The resistors R21-R24 are used only with low current two wire output mode they can be omitted in three wire mode. The values can easily be adjusted for two wire mode, but remember that the MOSFET/Transistor used with them will need to draw twice the current in two wire mode.

For High Current output, I recommend using MOSFET's rated for higher voltage and at least 5 times the current for driving typical snap/coil type switches. Having them them needing to draw 3A is common, which is why in my design & tests I show a 20A part. This allows for good snappy action and at the same time no heat sink is required unless the turnout is used a lot. In my tests win an older concor 12V dual coil switch, the switch was getting hotter faster then the MOSFET's were. In general with MOSFET's, the higher the current rating the cooler they will run and often be more expensive, but even many 40A parts are fairly cheap. Some room has been reserved for small heatsinks to be used, but be careful not to let them short out to other parts. Heatsinks may be required for high current constant use.

Timing Options

As stated above, the timing control can be edge or level triggered. When it is level triggered, the timers are used to debounce the input signals and fairly short timing is needed. When edge triggered, the timers determine how long the outputs stay on. I;ve found that 1/5th of a second works well for snap/coil switches and about 8-10 seconds for tortoise switches works well.

There are 4 pairs of parts that control the timing, R8+C3, R15+C12, R11+C6, R16+C15. Each pair controls the timing for one output. Adjusting their values down shortens how long they will be on.

Some approximate sample values are listed below:
RCTiming
1M ohm0.1uF 1/10th sec
2M ohm0.1uF 1/5th sec
1M ohm10uF 10 sec

Other combinations of values can easily be used to get the same timing. These are simply based on RC time constants and measured with parts I had on hand. Since most of the boards for me needed the 1/5th second timing, being able the same type of capacitor for timing and power filtering was handy.

Sunday, October 2, 2011

Power Subsystem

Power Subsystem

In my original design, the power subsystem had two pairs of connectors, envisioned as an input and an output, or use the one of your choice as the input. Intended for up to 16V DC and 7.6A total current and 3.8A constant on a single output.

I ran two power and ground buses off of the power connectors in loops and wired the two buses together to into multiple parallel paths allowing twice the current to reach any one point or just to help the power be cleaner.

Adding 4 medium sized capacitor positions (which I populated to 1000uF 35V caps), I was easily able to fire the 3A relays using my under powered 2A power supply. Since for a hobbyist or experimenter, this is a 'good thing' I also added multiple hole positions on the power and filters caps to make it easier for a variety of parts to work. This means anyone using this design can optionally add different capacitors depending on what they have on had or special requirements.

Then as part of bumping up to a rev 1.0 and trying to be more flexible for the hobbyist or developer, I added a third power connector in the output stage and made sure there was a power loop just for the output stage, connected to the inner power loop by just two runs marked for 'easy' cutting leaving three large capacitors in the output stage on and to help filter the timing stage. Then I added holes for 7805 or 7812 voltage regulator and a bleeder diode, to allow a higher voltage to be used in the output then 556 timers could handle. You either use two external power supplies, or a single power supply feeding the output stage and a regulator feeding the timing stage. Again, how this is setup depends on the exact needs, the board defaults to a single set of power with up to three connectors, but is designed to be modified to isolate the two voltages.

Next, I changed the track thickness of all runs from 1oz to 2oz, allowing any single output to handle up to 6.3A continous and a total current capacity of about 12.5A and even higher for surges. This helps if all four outputs needs to be run constantly at up to 3A each and reduces problems from surges. The cost increase for the thicker traces was barely noticeable and it made ALL the runs more durable, not just power/ground.

If more is ever needed, reinforce the runs with wire and watch the connector specs or solder the wires directly. The connectors I was using in my testing were rated for 15A, but I did allow for flexibility there, including slightly over sized holes & pads as well.

That leaves the final limiting factors to the selection of MOSFET, heatsink, and external power supply more so then then actual board design.

Next Steps ...

This improved design I've now had built in a small quantity beyond our modest needs in the hopes that the extras can be sold off on eBay during the next year or two to help keep my total costs down. If people do seem to find this useful and deplete my spare stock, I'm willing to order more and continue selling to help fund additional designs. But, being that this is a hobby of mine and I want other hobbyists to be able to benefit, the price stays low, around $5-$6 each PCB blank plus shipping here in the USA. No Chinese imports here!

I'll be posting a full set of schematics to what I've done so far and post the results of the final installation and testing as well as my next project. More docs as well, including infomration on all the optional jumpers, etc to make it easier for people to work with the design.



Saturday, October 1, 2011

I'm back!

After a bit of an unexpected absence I'm back again and plan to continue with my designing and experiments. This does leave me in the unusual situation where I need to read my own blog in order to catch up with where I was.

I can at least say that I've gotten myself more board blanks and tested my high voltage modifications to run some 24V coil switches also and it worked as well as expected.

Hopefully I can sell off some of my extra PCB blanks on eBay in order to help reduce my own per board cost. I figure on selling the blanks cheaply so they are within reach of others to use or experiment with. Maybe even help fund my next design I'm working on, an occupancy detector using track current sensing and/or photo-optic detection.

Now, to start reading ...

Saturday, June 18, 2011

Output Stage

The Output Stage

The output stage is fairly simple.

For three wire output, power is always applied to the output via the common  wire and the control wires are grounded out when they are triggered. This allows multiple outputs to be safely wired together if needed. In most cases though, simply all three wires will be wired from the output to the switch. The resistors R21 & R24 used by two wire switches are optional, but can safely be installed if the circuit might be used both ways.

For two wire output, the output resistors R21 & R24 are required and also help limit how much power is available in two wire mode. The two switched lines are used to connect to the switch, the common is not used. Power is left applied via the resistors and depending on which side is grounded will run the switch as needed. Negative voltage is never actually applied, but voltage reversal is achieved by switching moving the ground.

Hight Current vs. Low Current

The circuit is designed to use either high current TO-220 MOSFET's or Transistors, or low current TO-92 MOSFET's or Transistors. On my circuit design, holes for both are available, but you only populate one of them. The high current parts are required for running relays but can handle the low current switches as well. The low current parts should only be used if only low current is required and you need to save money. If you have both parts sitting around, or the board might be used for different purposes, it's recommended only the high current parts are installed.

Care needs to be taken when installing the MOSFET's and even Transisyots. Some devices are Reversed for the pinout versus the case. Because of this, I did take the time in my design to mark the Gate/Drain/Source on the TO-92 pins since those are the ones most likely to be reversed.

For really high current or constant output usage, space had been provided for some small heatsinks on the TO-220 cases. I designed the circuit board layout for 6A continuous current and 10A surge. If higher current requirements are needed, you need to reinforce the power and ground runs from the power connector(s) to the the high current MOSFET's and optionally the outputs. The heatsinks and air flow over them will start becoming important at this time.

Under normal usage with switches, even high current 12V ones, heatsinks will not be required, even if running in a hump switch yard. Tests have been run with this circuit switching a heavy duty ConCor style switch a full cycle every 7 seconds for 10 minuts and the relay gets hotter then the 20A MOSFETS. The same test burns out an Atlas Snap Switch within several minutes.

MOSFET's vs. Transistors

While the circuit is designed for with, it is recommended that MOSFET's be used for high current systems and either can be used for low current. In my tests, I was very satisfied with using 20A or greater MOSFET's for high current, they ran cooler and no heatsink were required even under high usage. You're more likely to to damage the relays before they they will have problems.

If transistors are used with relay type switches D1 & D3 are required. With MOSFET's they are used only if really large coils are involved or if high usage is, they are optional.

Diodes D2 & D4 are required for any relay or coil device to prevent damage. IF you have any doubts, just put them in. The only time you won't need these is only tortoise type switches are being used or it you are running non-coil or motor type loads, like lights.

Output Voltage and Current

By default, my circuit uses the same power to run all sections. It is designed that only two runs need to be cut to isolate the power of the output stage from the rest. That is the only time you need to add the power connector that is part of the output stage unless an extra connector is desired.


Plenty of capacitors can be added. Please make sure that they are rated for more then the voltage applied is. If a relay type switch with a good high current MOSFET or Transistor won't switch, that usually means the the power supply can't handle it. Adding more capacitors helps offset weak power supplies.

During testing a 2A 12VDC supply was used to run 3A relays simply by adding several 1000uF capacitors to help handle the surge required by the relay. Several different hole spacings were even supplied to allow for a variety of capacitors that a hobbyist may have on hand. Just watch the Voltage and Polarity when installing them!

Output schematic

Updated ...
Doing even more testing with additional devices and scoping my circuit, I've decided that when MOSFET's are used for the output stage, the resistor to the gate works better with a value as low as 100 ohms. The original 470 ohm value had been selected because of the transistor option and that value was already used. The 100 ohm value for the MOSFET driver helps get everything moving when you have sub-optimal situations, which can happen easily.

Wednesday, June 15, 2011

Timing Section

The Timing Section

The timing section is responsible for the pulse widths output as well as protection from both outputs being on that the same time.

The jumpers JP8 & JP10 in the first half are responsible for either treating the controls & outputs individually or as pairs. If they are both in the pins 1-2 RST position, everything is treated as paired inputs and the Reset inputs on the 556 timers are connected to the other input before pulse shaping. That means that zero or one side of the timer can be active at the same time. If the jumpers are both in Pin 2-3 positions, the halfs are isolated from head other and can be operated independently. This is useful if you want to control something else other then relays, such as lights or motors.

The timing is handled by R8+C3 and R15+C12. Usually both sides have the same values. If the pulse-shaper is in use, this controls how long the output will be on. If the shaping has been disabled and output follows input, this controls the switch debouncing to smooth the output. For relay/snap type switches, values of 2M ohm andd 0.10uF work very well to drive the relays for 2/10ths of a second. Changing the capacitors to 10uF makes a handy 20 second timer for tortoise switches to make sure they have made at all the way to the other side even if only a pulse was received on the input. The last thing you want is a switch halfway between positions!

For debounce only, the timing can easily be reduced by changing the resistors to lower values, even going as low as 100k-200k to get 1/100th - 2/100th's of a second debounce to reduce the obvious lag when the switch is turned off.

Capacitors C5 and C13 are optional and simply help make sure the timing stays more consistent.  C9 simply helps get rid of power noise and in most cases isn't needed either, but a good practice to put in.

Since U2 is a 556 timer, that is a limiting factor on the lowe voltage power. 16V is it's max rating, which means the input and timing stages should normally be powered by 5V to 15V DC. It it important not to go over 16V! That's why I will repeat myself again later and mention that you can cut two runs to isolation the output power from this section and supply different power to both or install a 7812/7815voltage regulator and diode between the two!

Even when running in output follows input mode, it's recommended to use the 556 timers since even switch bounce. But when in that mode, you can drop the timing to a much smaller value by reducing the resistors. When pulse shaping is being used, you must ensure that the timing will make sure the switch travels to the other side!

Optional, easily bypassed
If timing isn't needed, we can easily bypass this by not installing the 556 timers and pulse shaping components, jumpering around the pule shaper, and then jumpering the 556 input to output. This turns the curcuit into on inverter, meaning that a low signal into the opto-couplers turns on the output stage, but is useful as a voltage or current converter.

I would encourage leaving the timer section in unless the inversion is required just for the sake of gaining the debounce capability of the timer.

Timing Schematic

The timing stage of half the circuit is shown below. A complete schematic will follow at the end as well.

Sunday, June 12, 2011

Input Stage

Now to start going over my design in detail that I have been testing ...

Input Stage

The main input control signal is either a two wire or three wire signal accepting 4V-16V by default.

For three wire input, J2 handles one pair with the common between the two signal inputs and JP1 & JP2 are both jumpered 2-3 in order to feed each signal into the optocoupler U1. For two wire input, only pins 1 & 2 are used on J2 and JP1 & JP2 are moved to pins 1-2 to feed the signal to both optocouplers, but reversed in the second on.

By using a DC optocoupler and the jumpers the +/- voltage for a two wire is handled by different circuits without having to add anything else fancy.

The voltage input range is adjusted with the input resistors (R1-R4). The default value of 470 ohms allows enough current to flow for 4V to 16V range easily, and it can safely handle a 24V signal. If digital input over long wires is planned, these resistors can easily be lowered to 300 to 330 ohms. If ONLY digital 5V signals are planned, they can go as low as 220 ohms, but 12V signals should be avoided.

The LTV-847 optocoupler is shown as U1, but multiple LTV-817's or LTV-827's can be used. I do find it's simpler to work with a single chip, but allowing for different parts allows populating from 1 to 4 inputs as needed.

The 'Common' jumper JP3 is used to connect the common lines between the two half's of the circuit so that the second half does not require a common line to be connected. It can even be convenient to use the second common as an output to another board if desired! The reason the jumper is there instead of hard wired is that some two wire circuits reverse the +/- lines instead of using a common and a +/- voltage. If the were hardwired together you could short out the two sets of signals and maybe ruin your power supplies or worse.

One-shot or Constant?

For one signal line, JP6, C4, and R10 decide if a single pulse coming in goes to the timing stage or the actual signal. By shorting out the capacitor that actual length of the signal seen on the input is forwarded on, otherwise the capacitor changes it to a pulse no matter how long the signal is left on. Note that that optocoupler circuit with the pulse-shaper inverts the signal so that the rising edge of the input causes a falling edge into the timer as needed by the 556 timer. If no pulse shaping is ever needed, the parts can be omitted and a simple jumper installed instead.

One last option...

If the input needs to be wired directly to switches and no external voltage applied, the input resistors and U1 and be replaced by jumpers as long as you also jumper it to three wire input mode. Then a ground is applied to the common line and voltage goes out the signal lines. When you throw the switch, the signal line is grounded out and the high-to-low can be seen by the pulse shaper and to the timing stage. When wired this was, the pull-up resistors like R9 can be increased in value safely. The 1K ohm value is there to ensure a nice crisp signal from optocoupler into the pulse-shaper.

The Input Schematic

A cleaned up version of 1/2 of the input stage is show below.

Friday, June 10, 2011

Parts sources

While it may seem strange to blog about getting your parts, there are some very obvious things that many hobbyists might forget about in their enthusiasm in getting their parts.

How many do you need? Now and in the future? For some common parts, getting more at one time to cover current and future needs buying in bulk can change who your supplier is as well as the price. Different sources can have widely different prices for the same or comparable prices. Since I'm limiting myself to through-hole components and trying to stick to a small number of values for things like resistors and capacitors, I can be willing to buy some extras for future use, lower the cost per item, and be less concerned with wasting a few. Some resistor values for example are so common that I got 1000 at a time from Digikey so they cost less then a penny each. For some IC chips, tube qty's from Avnet can make sense. But, in some cases, I did go straight to eBay . Don't assume your favorite supplier is the best deal, look at quantity discounts, and try to think ahead!

Don't forget about Shipping, Handling, and Minimum Orders! Of course, shipping varies greatly. Some places include shipping in their pricing, which is good only for one off items. Others won't ship via certain methods or will take a long time to be delivered. Take into account when do you really need the items, try to order as much as you can from one source at a time, and watch the weight & shipping costs of your orders. Digikey for example will ship light weight items via USPS if you want, saving you shipping costs on smaller or light weight orders. Others have minimum shipping costs, so if you must get from them adding a few more items to your order adds little to no extra, saving you more money. In general unless shipping is prepaid (as some eBay items are), the more you get from a source in one order, the cheaper the shipping per item becomes. Being a hobbyist, I tend to have my things shipped the cheapest method, so I've worked to bundle my orders from one source together and looked at what else they have to offer that also makes sense. Don't be afraid to deal with the big boys like Avnet, Most of my UPS Ground orders from them only cost me $8 or so for shipping a fairly good sized bunch of parts. So far in the US, they have shipped to me from AZ so it's fairly quick even via ground.

Beware of eBay, and don't be afraid to use eBay! Sounds like I can't make up my mind eh? This isn't a buyer beware comment, but be smart as to how you use it. Some items on eBay may be used, cheap, or substandard, but in most cases this does is NOT a factor for hobbyists. Where you want to pay attention is the shipping costs and can you get it cheaper from a larger distributor in quantity? Plus, many of the parts end up being shipped from Asian inexpensively, taking a lot longer to get here. But, something simple and common can often be found cheaper from local suppliers and be delivered quicker! I've been able to get parts from Avnet and Digikey delivered in a week or less cheaply where my final costs were below eBay pricing before shipping. I'm actually close enough to Digikey that sometimes the USPS packages arrive the next day! But, in some cases eBay was actually cheaper if I was willing to wait the extra time! Shop around and compare! Sometimes I've found one item where in my qty & style I needed eBay was cheaper, then I looked at what else that vendor had and was able to expand my order with other things that wouldn't have made sense from eBay, except I was already ordering and I saved a bit on the shipping. Also, if you bought too many parts but they were cheap, try selling some on eBay to recoup the cost. While you may make little or no money on the part it helps reduce your losses and keeps the costs of your projects down.

Look at specialty sites! While many items may be more expensive from them, sometimes they have gems you don't expect. Other times they make suggestions on what should be used for specific projects or useful links. Spending research time can really prevent headaches while keeping the costs down.

Substitute! Hobbyists do this all the time and need to. Keep you mind open on parts and designs. In my current schematic I even realize that both low current and high current requirements exist and I'm making sure that either can be used and that substitution of parts will be easier (low power MOSFET's and transistors often have different pinouts or spacing from most high current parts, so in this case I actually have both in my schematic to help). Besides, hobbyists often need to use the parts they have on hand, which also affects everything else. In my designs I'm even placing multiple holes on the PCB layouts for some items such as capacitors to allow for easier substition or variance in the parts.

Over-spec the requirements & parts! Hobbyists have very flexible requirements and might use a design in unexpected ways. A few extra cents in savings isn't worth the effort while it might limit what you can do. Also, how well do you really know the full engineering load/design? I encourage everyone to be willing to allow for too much or extended optional uses when it doesn't significantly affect your costs. My current switch design is being tested with  20A MOSFET's when 2-3Amps is typical because the parts didn't cost much more and then they won't be getting as hot either and then I also don't need as much in the way of protection diodes since the MOSFET's integral diode is more then enough. Sometimes saving a few pennies can actually cost you more in effort or other parts. At least in my case I'm also testing with 5A transistors with the required diodes since hobbyists sometimes have to use the parts they have on hand.

Keep a Wish List! When you have an idea or see something interesting while you're searching around, make a note of it including source(s) and cost. That way later on when you are actually going to have to get parts you can make intelligent decisions, check your budget, and you might be able to get some of the optional stuff at the same time to save on shipping.

Budget! Know how much you can and are willing to spend and stick to it! Sometimes you just have to get the more expensive version of the part in a smaller quantity in order to not blow your budget. Don't get too carried away on saving money. If you really want the larger quantity at lower per part cost, take the time to put the money aside and wait until you can get it within your budget.This is supposed to be fun, don't cause yourself unwanted financial headaches.

Share with others! Know someone else that has some of the same interests and requirements? Maybe you can get together on your orders to get better pricing and shipping. My father-in-law for example sometimes needs some parts for his train set that he can't find in the local store, and ordering them online adds shipping. I was able to include some parts he needed that were heavier in an order I was already placing that was also heavier, but that saved him money on the parts and the shipping. In another case with a different supplier, he needed that some other parts and I was able to include some of my items saving me on shipping.

Make sure you don't fall into any ruts on what you are doing. Yes, you can default to how/where you do something, but at least take the time to verify that it's still the best way to get what you need. Bring  a hobbyist sometimes means being creative on how you get what you need.