Building simple circuits

Pelsea's picture

One of the joys of model railroading is it provides the opportunity and motivation to learn new skills. One skill many avoid though, is building electronic circuits. I admit circuit building is intimidating, and not terribly necessary since so much is available RTR, but it is particularly satisfying to turn on the power and see things light up (most DIY circuits involve lights) knowing you put that part together from scratch.

You do not have to go to engineering school to learn circuit building. In fact, many ee programs do not include practical circuit building-- all lab work happens on breadboards or in computer simulations. The best way to learn these skills is to get some electronics kits and put them together. If you are a guitar or bass player, an excellent sources for interesting kits is Build Your Own Clone, a company that specializes in classic and cutting edge stop boxes and effects. Their web site is a cornucopia of information-- especially see the "confidence booster" kit-- it doesn't do much (it's a simple volume control) but the instructions are a complete lesson in soldering and parts handling.  Another excellent site is Adafruit, which has a section called "learn' with guides to simple and complex projects and topics for the glow in the dark, performance art, Arduino widgets crowd. Another goto resource is SparkFun, which slants a bit more to the robotics fan-- all of the parts needed to build a stepper motor indexed turntable can be found here. Finally, (Definitely not least) is Make, which is a magazine/ publishing house dedicated to DIY in many forms. Their Electronics PDF bundle is a perfect resource for the beginner.

In addition to these, the web has thousands of tutorials and projects including the hobbyprojects.com Model trains section and a site full of circuits from Mark Rollins.

My intent with these notes is to let you get a toe in the water by showing how to build some very basic circuits*, starting with a simple track power detector. I'm not going to teach any theory here, just the actual building skills needed to make a schematic into a board.

pqe

*Suggestions welcome

Comments

Bernd's picture

Comment on Circuit Building

pqe,

I learned circuit building back in the Heathkit days. Everything from TV, test equipment, oscilloscope, to a their train control throttle. In later years I got interested in the digital chips and built circuits with those. Got to the point of where I bought a computer and expensive program to design circuits and do the layout. Routing the traces was the hardest part. It got to be a hobby almost.  Then I decided to stick with model railroading. Did learn a lot about electronics though.

Looking forward to your postings. Your detection circuit will be a great place to start.

Bernd

New York, Vermont & Northern Rwy. - Route of the Black Diamonds     

Pelsea's picture

Reading a schematic

The first circuit I'll cover lights up when a section of track is powered (with DCC). This is handy to show the state of power routing in a yard or following Peco turnouts. This is the schematic of the circuit.

Schematics are the lingua franca of the electronics business. A schematic is to the technician as a score is to a performer-- It specifies exactly what to do.

A schematic consists of component symbols connected by lines. There are thousands of components available, but they are represented by a relatively small set of generic symbols. Details about components will be written by the symbol (if details are left out, any variant of the component is expected to work, but it may be a good idea to test the one you have before you solder- this is what solderless breadboards are for.) There are several sites that list the standard symbols, such as this one. You will notice that for many there are US (IEEE) and European (IEC) versions.

The lines are the meat of the schematic. Every line indicates a connection between parts (or leads of the same part). They may be literally interpreted as wires, but any sort of connection will do. (Example, the parts may share a pad on a circuit board.) Schematics are usually drawn so the lines do not cross much-- this makes the intent clear. However, if lines do cross, it does not necessarily mean there is a connection between the wires- such connections are indicated by a dot where they cross (old school) or by two different horizontal lines stopping at a common vertical one. Old school schematics may indicate that two crossing lines do not connect by adding a little loop to one. When schematics reach a certain level of complexity, the more convoluted lines may be left out, with connections instead indicated by letters, numbers or names. In most cases, connections to the power supply are indicated by labels such as +12 or -15 as appropriate. There may be an arrow or cross hatch at the label. 

Another set of connections are indicated by the ground symbol, which is three horizontal lines at the bottom of a line suggesting a rod shoved into the dirt. This is connected to the neutral or negative side of the power supply. (It's actually a bit more complicated than that. For various reasons, you may run into circuits in which the ground is connected to the positive supply lead, or even with both positive and negative power lines in addition to ground.) The ground wire may be connected to the case of the device- in some designs the case is used for all ground connections. The concept of "ground" is deeply philosophical, but the practical meaning is "put the black lead here to measure voltage."

It is often possible to literally lay out the circuit just as it appears on the paper, but this would probably make for a really spread out board. In practice, the layout is "folded" with parts shown in series actually laid out in parallel but connected with zig-zag wires and other convolutions. Two parts that are next to each other on the schematic may wind up at opposite ends of the board.The important thing to remember is that no matter how tangled up a wire or circuit trace is, as far as the electrons are concerned, it's all one point.

Interestingly, you do not need to understand how a circuit works to build it. If you get the parts connected the way the schematic specifies, it will work. Probably, unless a component got damaged, or the circuit was a dud in the first place. For that reason, I suggest you try all new circuits in a solderless breadboard before turning the iron on. Here's one in action:

The original breadboards were pieces of wood with brass nails in them-- you would try a circuit by wrapping wires around the nails. A solderless breadboard is an array of little sockets sized to accept the leads on most components. The sockets are in groups of five (usually) and anything in one socket of the group is connected to the other sockets in the group. Breadboards also feature "busses" which are long strings of sockets- in the above photo, the red and blue lines indicate busses. (The grouped sockets are vertical in this view.) The resistor and LED are both plugged into group 12 of the upper half of the breadboard, so they are connected together. The clip leads are connected from a lead of each to a rail, and since the track is powered, the LED is lit. Breadboards are handy, but not very reliable. The sockets wear out quickly, so I generally thrown one out after a couple of years of use. Besides, a little wiggling is all that is required to loose a connection. My students would often try to use breadboards in their exhibitions, but they usually came to regret that.

In the next installment, we will make a permanent version of this circuit.

pqe

Edit 8-2-16. Since this is a building tutorial, not a circuit design tutorial, I used the simplest useful circuit I could think of. However, it has come to my attention that some LEDs will not last in this design, because of the reverse voltage that is applied half the time. Here is an improved version.

pqe

edfhinton's picture

Thank you!!!!

Thanks for putting this tutorial together.  This really will boost my confidence working on one of these.

-Ed

----------------------------------------------------------------------

Proprietor - Northern New England Scenic (V3). N scale NH B&M Eastern and western coastal routes in the late 1950s.

https://nnescenicmodelrr.com

 

Great thread

It seem like there was more activity on this around 25 years ago.  It may be DCC, or it may be more of the RTR issue.  Thanks for the links and I look forward to more of your work that your willing to share.

So many trains, so little time,

Larry

check out my MRH blog: https://model-railroad-hobbyist.com/node/42408

 or my web site at www.llxlocomotives.com

Pelsea's picture

From schematic to board

If you have a known working schematic, you can get a printed circuit board produced for about $70. However, I'm not going to get into what you need to do to design a board, and 70 bucks is 70 bucks. I'm going to build all of these projects on proto boards:

Proto boards (prototyping boards) are a piece of phenolic or fiberglass board with a grid of holes and solder pads.

  • The boards are usually 1/16" thick, but this varies.
  • The holes are usually on 0.1 inch centers to fit standard IC pin patterns, but other layouts do turn up. Always check this spec.
  • Various pad patterns are available, from none to complex ones with power busses and edge connectors. I find two patterns most useful-- the one pad per hole shown above (pads on one side only) and patterns that exactly match a solderless breadboard, like GC Electronics 22-508.
  • Pads may be square or round. The round ones build a little neater (less chance of solder bridges) but the square one can be persuaded to accept smd parts. (See plastic diner.)
  • They come in all sizes-- I generally keep a bunch of 2" x 3" or similar sizes around and order bigger ones as the need arises. Some are sized to fit specific cases-- handy when building a slick product.
  • Good ones have tinned pads-- cheap ones (I'm looking at you, Radio Shack) are varnished plain copper and need to be lightly sanded before use.

The boards can be cut to size by scoring along a line of holes with a glass cutter or razor saw and snapping along the score. This is easy if you clamp it into a vise.

The hardest part of transferring a project from the schematic to proto board is knowing where to start. No, really-- you have to consider the position of any controls on the board, any indicator lights, and how wires that lead off the board will be dressed-- you usually want all wires to come off of the same edge so you can easily turn the board over for service. In this case, there are two LEDs (I'm building two circuits on the same board) that will have to fit holes in the panel. Here are the parts concerned:

  • A panel
  • a hunk of proto board
  • 2 2.2k resistors (Actually I changed my mind after taking this picture and used 2k resistors.)
  • 2 LEDs

​Note that I have already drilled holes in the panel. The small holes match the mounting holes in the proto board, and the large ones are a bit larger than the LEDs. I used the proto board to mark the panel for drilling- I lined it up straight and pushed a #61 drill on a pin vise through the holes to make a mark. To get the panel, board and LEDs lined up, I dry assembled them:

Everything is mounted on two 4-40 screws. The proto board needs to be held clear of the panel about 1/4" or so. I use nylon spacers for this, but anything will do, scrap styrene, wood, drinking straws, some folks use extra nuts. The nuts on the top are nylon-- steel works, but will short out a few pads, and Murphy is always watching to see that those particular pads become necessary.

With the work assembled this way and the LEDs pushed firmly through the panel, I soldered the LED leads.

Soldering these is not as difficult as soldering track. For one thing it is quick, and you are not trying to reach behind a delicate water tower.

  • If you have never soldered to circuit boards before, practice with odd parts on scrap board.
  • Make sure the pad and lead are clean-- they will be if they are new, but it never hurts to give the pad a touch of sandpaper before starting a project.
  • Use fairly thin rosin core solder. (No Acid flux here!)
  • Use a medium point tip at 650-700° F.
  • Apply the iron tip to both the pad and lead and start counting at 60 BPM.
  • On the count of 5 touch the solder to the lead and pad-- it should flow.
  • On 7 lift the solder.
  • On 8 lift the iron.
  • Watch for the sudden color change when the solder freezes.

Things that can go wrong

  • A huge blob means too much solder-- don't hold it down so long.
  • If the pad is barely covered that's not enough solder. The solder should fill the pad and make a cone up the lead-- the rightmost joint above is the best.
  • If the solder is rounded at the pad or lead instead of a cone, one or the other was not hot enough. Be sure the iron touches both lead and pad, and wait a bit longer before applying solder. (Many folks put a preliminary drop of solder on the tip of the iron to help the heat transfer. This is fine, but it can be overdone.)
  • If the solder is an ugly grainy grey, the lead moved as the solder was freezing- you have to do it again.
  • A bit of brown shiny rosin around the joint is natural. A lot of black crispy rosin means your iron is too hot.

There are more parts to add, so at this point the panel was removed.

Next I added the resistors. Note the colored stripes. These reveal the value of the resistor. They read from left to right (in this picture anyway- the gold or silver stripe comes after the value)

  • First digit- in this case 2
  • Second digit-- 0
  • Number of zeros to follow (or multiply by ten to this power) again 2

So the value is 2000. AKA 2k ohms.

The color code is published many places- it is basically the colors of the spectrum:

  • 0 black
  • 1 brown
  • 2 red
  • 3 orange
  • 4 yellow
  • 5 green
  • 6 blue
  • 7 violet
  • 8 grey
  • 9 white

Well, sort of a spectrum. Like I said, it's easy to look up. Download a chart, color print it and hang it on your shop wall. These colors are used to mark a lot of things. The gold or silver stripe is tolerance- gold is 5%, silver is 10%, no fourth stripe is 20%. What, did you think electronics was a precision science? 1% tolerance is available, but expensive. Instead, we design so 5% is close enough.

Note that I placed one lead of each resistor close to a lead of the LED. I then turned the board over and bent the resistor lead around the LED lead:

Then I soldered the leads together and clipped off the excess.

Next was to bend the remaining leads in a  curve over a nearby pad. Wires will be soldered to these that will connect to the track:

The wire is pushed through the pad and bent over the associated lead. In this case I used 26ga solid wire, but if the wire runs very far I recommend stranded. Tin stranded wire before soldering it, and enlarge the hole with a #58 or #61 drill if necessary.

It's a trick to visualize both sides of the board at the same time, so here's a close up of one of the circuits with the symbols drawn in:

This is a situation where dyslexia is helpful! That extra resistor lead ws soon clipped.

Putting it back together:

I envisioned attaching the wires to some sort of connector to complete the run to the track, but which kind will depend on your preference. A barrier strip attached to the panel would be a good choice. 

And the user view:

More holes are needed to mount the panel to a fascia, but again that should match what is already in use.

Next: a bit more complexity, but not much.

pqe

ronheiser's picture

Great thread!!!!! Thanks!

Great thread!!!!! Thanks!

Ron H.

Long Live The Burlington Northern!!!!!

OKGraeme's picture

Good Stuff...

....I don't need the tutorial myself being an Electronics Technician by trade (I could never spell Teknition now I are one) but it is always good to see how others do things. I like your precise explanations and the pictures of in progress are excellent. Well Done.

Graeme Nitz

An Aussie living in Owasso OK

K NO W Trains

K NO W Fun

 

There are 10 types of people in this world,

Those that understand Binary and those that Don't!

Toniwryan's picture

... Good old "Roy G. Biv"

One of my favorite Christmas presents was a "150 in 1 experimenters kit" from Radio Shack.  That and all the Forrest Mims experimenter handbooks.

 

Toni

edfhinton's picture

WIll try it soon...

I should have the parts and the time available in a couple weeks.  I can't wait to try it. I especially appreciate the specifics on the soldering and how to mount each item and the board to the panel.

Thanks,

-Ed

 

----------------------------------------------------------------------

Proprietor - Northern New England Scenic (V3). N scale NH B&M Eastern and western coastal routes in the late 1950s.

https://nnescenicmodelrr.com

 

GregW66's picture

Excellent!

Love the thread and hope you continue with more. 

GregW66

 

 


>> Posts index


Journals/Blogs

Recent Blog posts: