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.

Saturday, May 28, 2011

Switch controller

The initial project I'll be doing is a switch machine controller as outline in my last blog post Circuit design begins

With the requirements laid out there, I end up with 4 basic subsystems:
  • Power
  • Input controls
  • Timing
  • Output
Power

Most HO model railroad layouts have low voltage AC and 12V DC readily available. Most of the common switch machines run with 10V-12V (some accept both AC & DC others DC only). So, the design is around running from 12V DC just to keep things simple. What I'm designing will easily run with 10V-16V DC.

Many hobbyists and layouts though, may not have high quality 12VDC power. the snap style relay switches can often draw 3A while in use. This means that options for how much in the way of capacitors can easily be added is a plus.

Trying to keep in mind other possible uses as well, the Output stage might need to be able to run at higher voltages in certain situations. By laying out the runs carefully and allowing for an extra power connector, we can allow a couple runs to be cut to isolate the main circuits from the output so that we can allow higher voltages. An added plus is if I have room, allow for a 7812 or 78L12 to be added at the cut location so that we can regulate power our elves. This easily allows for 24V DC or greater for the output stage depending on the rest of the components chosen.

Finally, we may have multiple boards near the same area of the layout. Allowing for a power out connecter can simplify wiring. When we don't want that, not installing the connector saves money.

Input controls


Accepting either two wire or three wire input with voltage ranges from digital to +/- 12V DC could risk the circuit getting more complicated then needed. Thankfully, optocouplers are readily available that have a wide range of current & voltage. By using a DC optocoupler and a single 470 ohm resistor per input, gives us a wide range of input from less then 4V to well over 12V.

Using a DC coupler then I add a couple three position jumpers to select between two wire & three wire mode. By moving the jumpers, I can hook one coupler up in reverse with other to trigger on negative voltages for two wire mode. Three wire mode is same polarity, but to the third input.


Lastly, transistor output type optocouplers are vary insensitive to the input voltage. Just select the proper resistor and wiring, and you have either an inverting ot non-inverting circuit. In my case, I'm going with the inverting circuit since the timing stage likes to trigger on the falling edge.



Timing


We need at a minimum to either output a one shot pulse or debounce the input to clean it up. Just running the signal straight through I consider a debounce with a very short timeout. A 556 dual timer is handy for this, being a dual timer means a single chip handles both of the inputs and outputs. It's also forgiving on power requirements running on up to 16V DC.

For adjusting the timing, I'm just going to be using a simple RC without making it adjustable. Someone needing to make it adjustable can modify that easily, but we don't want to worry about calibrating trimpots or them changing in most cases.



For one-shot verses debounce, using a coupling capacitor with the input stage and an optional jumper or installing a wire instead lets me choose either easily.


We also want to make sure that both outputs aren't on at the same, so adding a jumper between the two half's of the 556 timer between the output of one and the reset of the other accomplishes this. By allowing a jumper, this becomes optional, and removing the jumper allows each side to be independent allowing for non-switchout uses, such as lighting control.


Output

As outlined in power, we want the output voltage to default to what's running the entire board or optionally it's own voltage. That's mostly a layout issue.

We also need to run two wire or three wire type output at anywhere between 20mA to 3A from 10V-12V DC. Two wire needs to reverse the outputs to apply negative voltage, while three wire has a common plus two wires that just get the required voltage as needed. Luckily, for a two wire arrangement, we normally only need low current, we don't need to worry about high current and reversing voltages at the same time. This allows us to avoid using an H-Bridge and simplify the design by using a resistor with a MOSFET or transistor.

The high current requirement with a relay does mean we need to worry about power spikes when we shut down the circuit or it's moved by the other half. That's one or two diodes more on each line to add that protection

Additional notes

Connectors! I personally love the euro-style screw connector that clamps down on the wire for things like this. It works easily and gives you a secure connection rated at 10A to 15A for the smaller parts. You have an added bonus that some of the connectors use a slightly larger hole size. If I lay it out for the larger hole and add an extra large pad around it, I also have something that's easy to solder a wire to for people trying to save money on connectors.

For the circuit board size, since more then one turnout is usually together and increasing the size won't greatly increase my board costs, I've decided that having two pairs of circuits on a single board makes a lot of sense. Each pair handles one turnout giving my design the ability to handle up to two turnouts or four separate outputs.

Sunday, May 22, 2011

Circuit board design begins

How time flies when you're having fun!

General design considerations
 
I've been busy designing a board for the train layout, along with getting parts I needed for prototyping . Considering what all I've accomplished on the design, I'm going to cover some of the tidbits & hints related to hobbyists getting parts for another post. As it is, I'll be splitting the thoughts behind the board design into more then one post so I don't feel limited by post length.

Since I hand previously decided I was liking PCB Artist and the capabilities of Advanced Circuits, I've been using their tool for laying out my circuit as I've been designing it.

For the hobbyist,  I've been keeping in mind:
  • Use through hole components. Many hobbyists won't have the skill or patience for surface mount work
  • Avoid specialty parts. The parts needs to be easy to find and inexpensive.
  • Avoid high tolerance parts. They are more expensive and the greater the usable values used, the better the chance they may have a usable part already.
  • Use discrete resistors instead of SIP modules. Hobbyists are more likely to have the normal resistors and it's easier to adjust the values
  • Try to reduce the number of different component values when possible. This makes assembly easier and might help lower costs by getting larger quantities on common values. I'll get more into this when I get back to getting parts.
  • Size is not an important factor. Cost & easy of assembly are much more important.
  • Think about modifications and build time options. This can make final design much more flexible and usable in other situations.
  • Stick to double sided boards when it comes to layout. I won't be saving money or effort by going to single sided since they will be manufactured for me. Having internal layers will make them more expensive and harder to modify if the internal layers need to be modified.
  • Plated through holes for ease of assembly and fewer problems. With the manufacturing facilities available, you won't save money skipping this. This would apply to home made boards only.
  • Solder mask to reduce the chance for shorts during assembly. Same thing as plated through holes above, but even more important.
  • Silk screening and labeling. If the PCB is being manufacture for you, why wouldn't you? In most cases you will save little to no money skipping this with the high amount of automation involved and the
  • Try to avoid having component leads too close together. Hobbyists can make solder shorts very easily.
  • Don't assume the components will be a specific size or lead spacing. Make sure there is elbow room. For example radial capacitors have different lead spacings and even size for the same value from different manufactures or old vs new parts. Even something as simple as bypass caps for TTL chips can vary from 0.1" to 0.4" spacing with 0.2" and 0.3" both being very common.
  • When in doubt, allow for excess capacity in specifications. For example, we know we need to expect 3A surges and maybe up to 5A surges. For example, that means the power connectors & runs should handle 3A to 5A of continuous current or more.
  • When in doubt, add stuff and mark it optional.
  • Don't be locked in on anything for now
Keeping these things in mind will help me make myself something that is more flexible then what I need right now at no significant additional cost. In small quantities, the size of the board isn't a factor for example, the size isn't a factor until you start doing high volume, and the price difference between a 2x3 and a 3x4 board isn't very big at all then anyways.

Project design considerations

The first project I want to work on will be a circuit board to assist in running the relays/motors used in turnouts/switch machine operations. For now, I'm keeping my father-in-law's requirements in mind, but as I work on the design I want to keep more general rules in mind.
  • Only need to worry about two position turnouts at this time. His design doesn't include anything other then two directions a train could go and other peoples designs will have many more of these then all the others combined. This keeps the circuit much simpler.
  • Need to be able to run two wire and three wire switch machines. He has a mix he will be using and having the option to not be worried about what type of switch machine goes where will help during the build and maintenance.
  • High current coil switch machines and slow motion switch motors. He's been accumulating parts for many years, most are used, all have been real cheap deals. So far, all of his coil/snap/relay style switches are three wire and the motor switches are two wire machines.
  • 10V-12V DC operation. His snap switches will work with AC or DC, but his motorized switches are DC only. By designing to DC only, I can keep the circuit simpler and then install low current or high current parts in the output stage. When in doubt, high current parts that can also run at low current.
  • Allow for higher voltages. We don't need it, but other people may need to drive a 24V relay or motor? If I can accommodate a modification that allows for this if the proper components are used without adding to the cost, I will!
  •  3A or more surge. Coils need a lot of current to work, but for a short period of time. most of the time you must limit powering them to 1 second or less to avoid damaging them. Fraction of a second works very well.
  • Many layouts might suffer from under powered DC power supplies after taking long wires into account or trying to use multiple cheap power supplies. That means allow for excess capacitors to help handle the high current surges. Cheap power supplies often can only handle 1.5A, but we need a 3A surge.
  • Low current motorized machines may need to be on for 8-15 seconds and are often on all the time.
  • Two wire or three wire inputs. Since both types of switches are common, might as well try to support either type of input if I can do that without driving the cost up. Three wire uses a common and two separate signal lines (one for each direction). Two wire either reverses how power is applied, or has a common on one line and then applies positive or negative voltage on the other line to select the direction (both effectively do the same, the difference is when multiple machines are in use and wired together). Two wire with one being a common can help reduce the amount of wiring needed.
  • Momentary vs. throw switches at the control panel. Snap style switch machines usually are connected to momentary switches or three position switches and the switch MUST go back to neutral usually within 1 second to avoid burning out they coil. Motorized switches are usually connected to throw switches (single or double pole, double or triple throw). What controls are used can sometimes depend on what is available at the time it is built. At the same time we need to protect the switch machine from mistakes if possible.
  • Switches bounce! Relays and motors tolerate that, but if we can debounce it, they will work that much better.
  • Don't require calibration beyond components being installed into the board. Trim pots are nice for somethings, but something going out of spec timing wise it not something they need to worry about. It is a plus if it can be adjustable for other uses, but initially fixed values that are easy replace if we want to change the timing is good enough.
  • Don't turn on both directions at the same time! This will either do nothing or risk damaging something even to the point of a risk for fire.
  • Future upgrade to DCC. While I'm not going to build in a DCC controller, we need to easily be able to connect to a DCC or digital controller of some sorts in the future. There are commercial DCC switch control units which may replace this or be hooked up to these boards in the future. KISS, and keep the cost down here! Maybe in a future design I can include DCC decoding if needed, but we don't need this currently. Not all DCC systems will use DCC switch machine controllers either. for this specific layout, he doesn't have a budget at this time for DCC other then working to convert the locomotives to DCC. Allowing for future DCC or digital controls though means that if we can accept either 5V or 12V DC low current on the input controls, we can future proof the design.
  • Turnouts often happen in groups or pairs. Since the cost of the circuit board isn't affected significantly by the size, allow for more then one switch machine driver on a single board. Allow for only populating half the board if only one switchout will be required.
  • Try to minimize the wiring needed from the control panel. Have you looked at the price of copper lately? Long runs from control panels can get expensive and train layouts can spread over a large area.
  • No moving parts. Those are more likely to wear out. I've seen too many bad micro-relays back in my days as a technician. Granted, those were used more then these will be, but relays still are more expensive then the options available using transistors or MOSFET's.
  • Train layouts are electrically noisy. I don't want to see what the EM spectrum looks like or the power spikes & noise on the wires. Wee need to operate in that environment and reduce our contribution to the problem when possible.
  • Probably be mounted directly to the train layout with screws, not in a box. This is a safety vs cost trade-off but we do need to account for that. This means allowing for #4 or #6 screws to be used, even wood screws to mount the board!
  •  Safety! Other then the risk of things blowing up when you first turn it on and test it out, we need to minimize the chances for short circuits and fires. Most model train layouts are very flammable and in the basement, attics, or spare rooms. In our case, it's in a basement and a lot of pine & plastic is being used. That last thing you want is a fire! This means in the long run I won't be building a high current power supply for example. We'll either build or buy multiple low current ones or buy a commercially made high currently supply with all the required safety features.

If you read over everything above, you'll notice I'm already thinking other people might be able to benefit from my design and work. That final decision and details will have to come later, but I am considering making more then we need to lower the per board cost and then see if I can sell the extras on eBay to recoup my costs. My father-in-law doesn't know it yet, but I'm covering all the initial prototyping and testing costs myself, including having the PCB's made. After all, electronics is my hobby and I'm the one wanting to go this route.

Enough for now. I think I've setup whats going through my head related  to the hows and whys of some of the design decisions. In my next post I'll go into the actual design and details I've been working on.

Wednesday, May 4, 2011

Tools research

Being a hobbyist puts specific restrictions on how I'll be working. I do have a monthly budget I can work with, but commercial design software is expensive. I also like commercial quality PCB's for any projects I do that need more then one or two built. I don't want to mess with the etching chemicals and I know from experience the benefits of solder masking, plated feed through holes, and fine runs running between pins without worrying about shorting.

I decided to see if I could kill two birds with one stone. I started searching the web for PCB manufacturing companies that seemed hobbyist friendly that had good design tools usable with them. Hobbyist friendly includes things like simple ordering, reasonably priced low volume production runs, reasonable delivery times & cost, plus Made In The USA! Here I have a choice, but I very quickly decided I was willing to ignore the overseas production facilities to improve my communication, delivery times, and delivery costs. Yes, it might cost a little bit more per piece, but I feel the benefits outweigh the for me personally.

I won't go into the details of all the searches and looking at websites, specs, etc. Since I was choosing a manufacturer and a tool together though, I did download and try out three different tools as part of trying things out from companies that looked good. One tool definitely worked better for me then the others, even if the parts library wasn't up to that of a full professional system. There was a lot of personal tastes in how the tools work and easy of use that was a deciding factor for me. Being hobby grade, I'll be limiting myself to through-hole components just to make things simpler, so a more limited component library isn't much of an issue for me. I don't want to be worrying about about soldering to pads or mass production that's for sure.

I've gone ahead and settled on one company based on the tools, pricing, location, and capabilities. Advanced Circuits in Colorado seems to have good capabilities, a reasonable tool, reasonable pricing, as well as support for commercial tools and production. While I'll be sticking to two layers and won't need their more advanced capabilities, I'm not stuck in an emergency. I don't ever expect to need a flexible PCB or 28 layer board, having very fast turn times on small runs along with fast delivery to me in the Midwest using ground shipping adds up to a nice combination for me personally.

Now, to play more with their design tools!

Tuesday, April 26, 2011

Ground work

Doing digging and thinking, I need to decide what I want to be doing with electronics.

Being a software engineer during the day encourages something for or using computers. Lots of cheap microcontrollers available now days, so that's a good fit. Plus, over the years, I've had an on and off interest in model railroading, but never wanted to use up that much space and my artistic skills are lacking.

Then there is my hand, my father-in-law. He's always been into railroading and is currently building himself a brand new layout within a restricted budget and questionable electronics skills. So I popped on over to his place to see how he's doing. I admired his layout and chatted with him for a while. Turns out that he already has several specific needs and wasn't sure how to address them.

He's currently using traditional straight DC for testing and showing off his layout, and plans to switch to a DCC system for the locomotives in the future, but can't go to DCC for his switch outs at this time, but might in the future. He'll be using a mix of solenoid/snap and tortoise switches he's been collecting over the years and was worried he may have damaged a couple tortoise switches because he found out that his power packs weren't putting out the proper voltages. To make things more complicated, the snap style switches and tortoise slow-mo switches use different type of wiring and actuation. Mess it up in installation or usage and it either doesn't work or you can burn out the solenoids in the snap switches. Small things like either using a momentary contact switch vs. a regular toggle make a big difference.

He also redesigned a portion of his layout and needs an emergency collision avoidance emergency cutoff in one portion of his track (he already had one collision when he was running two trains at 'similar' speeds and got distracted). Then there's other little things, like wall warts being used to power what lighting he has in place that are running hot. That's an accident waiting to happen.

One more thing, parts. He's not very internet savy, can't spend a whole lot, doesn't know a lot about some of the specs he's dealing with. He's the type of person that used to keep Radio Shack parts area busy. He was even upset when he needed something as simple as some barrier strip terminal blocks and discovered that Radio Shack isn't a place to go to any more.

Checking if he damaged anything is scheduled for my next visit along with some catalog, we ended up running out of time before we finished, how time flies.

Looks like we have a fit for matching skills and interests to actually be able to make something useful. 

Saturday, April 23, 2011

The start

Recently I've gotten back into an old hobby of mine, Electronics. This has spurred me on to write about some of my endeavors in that area and others. This blog will be focused on various technology related things of interest as well as my endeavors that may be of interest to the hobbyist.