Wednesday, June 19, 2013

Electronics - continued

In my quest to link my computer with the model trains I've had to do a lot of reading about sensors, feedback, loconet (I'm using Digitrax) and all sorts of other really dry stuff.  Most of it goes way over my head but some is getting through the thick cranium I've got - to the point that I think I'm ready to share my findings.  Keep in mind that although my father is an electronics engineer none of his knowledge transferred (much to our mutual disappointment !) so I'd classify myself as a muddler at best.

First thing I want to ramble on about is the underworld that is the bottom side of my layout - electronic schematics and wiring plans are all pretty but once they hit the real world and the layout things can get pretty ugly and fast.  There are some folks who have done a fantastic job keeping everything wired nicely and neatly.  Those folks deserve an award (maybe sainthood ?) for their work  and patience.  Me ?  not as neat. or patient.  but I'm trying. Oh I'm trying.  Which brings me to what I've been up to lately.

Part of my plan now is to wire up my tower controller TC-64 to my TamValley Quad's. Originally I was only using the TC-64 for sensors but I read that it handles TTL which, in a pleasant surprise for me, the Quad's put out.  Therefore all the switch changes can go into the loconet and be monitored by the computer (using JMRI, but I keep looking back to Perecli's Railroad Automation as it looks so darn crisp, organized and easy).

So I want to connect all my Quad's to the TC-64's which is a lot of cabling.  As well the connectors for the TC-64 are IDC 2x5's, while the Quad uses standard header male pins - jibberish? no just connector types, see below as I've included pictures.  They don't mate naturally so you either do ugly wires wrapped around the Quad  and the TC (soldered or not) that might touch each other or possibly just female pins at the TC side (soldered /crimped whatever) but that gets nasty quickly.  I decided to I'd try for a nice neat converter board rather than a cable with appropriate ends for each.  My reasoning has two major arguments - first reason would be the strength of the connector at the TC end. The 2x2 connector would be soldered to the wire and then inserted into the TC which is snug, the ground would have to be shared with both Quads using a different method.  I'd be afraid that pulling out the connector would break the wires/connection.  and the 2nd argument is if I ever wanted to do something in the middle of that connection, like say light an LED or ?, I couldn't. So I decided on a small breakout board.   I'll break out the parts and costs and then the pin out conversion from RR-Cirkits to TamValley.  At the end I'll have a CAT6 cable run to each Quad from my main drawer / panel where these small boards are.  Then its a small ribbon from that board to the TC-64.

Naturally nothing seems to work out evenly and easily so each Quad, technically, needs 5 connections.  As pictured below.  1 per turnout 1 for the ground (negative or GND).  Cat 5 or 6 wire has 8 wires.  So 1 cable per board, which can add up to a fair amount of wires going everywhere underneath the layout and wire = mess.  However if we could use 4 wires per board, we can use 1 cable per 2 boards !  less wire, less mess !  Or so my thinking goes.

How can we get away from having that ground on each board ?  well... there's a couple ways we can cheat.  If you're not using all 4 turnouts on a particular quad (for whatever reasons), then just wire the needed pins.  Or what I've noticed is that if I wire up 1 quad with the GND, ALL the other boards work as if they have their GND wired !!!  that means 5 connections for 1 board, 4 connections for every other board.   There are probably a million reasons that this is BAD and not the right way to do it.  But it seems to be fine, so I'll probably wire up a couple boards with the GND and the rest without.

So I made two types of breadboards - one that feeds two full cables and one that feeds 1 cable.  The pictures make more sense I hope...

You'll also notice that I'm using 8 pin connectors when I really only need 7 (to cover the header pins we need to connect to neatly).  Well.... they had 8's in stock but no 7's and I didn't feel like waiting for eBay China shipments.

Some pictures to astound and amuse...




Converting the straight pins to the 2x5 IDC connector type and feeding 1 cable of the full 8 wires going to 2 Quads.  This doesn't carry the GND
Converting the straight pins to the 2x5 IDC connector type and feeding 1 cable of 5  wires going to 1 Quad.  These have the GND connected

My Parts List
 I've also included ebay searches to make it easy to find the right parts, in bold links

    • 2x5 IDC  Female Header Socket Connector .100" / 2.54mm  (the ends for the ribbon cable) should be <40 cents each, you need 2 per cable. This goes to the TC-64 from my conversion board
    • 7 pin housing (the blue connector) .100" / 2.54mm and it needs pins to go into it. Less than <5 cents a piece, you need 2 per cable.   When I ordered them , they had 8's and no 7's so I did 8 position. Use this to search ebay "7P Dupont Jumper Wire Cable House Female Pin Connector 2.54mm Pitch" ... I later ordered 4 position from eBay for my GND-less  wiring - Ebay link here
    • terminals  for the housing above 100 for 3 dollars  you need 10 per cable (remember we're only pinning out the stuff we need - 4 x TTL and ground), make sure they're long enough for male headers you buy.  
    • Strip board (the yellow brown board that everything is built on), 5 for about 3.50, I'm cutting them into half, 1 per 2 cables.
    • 2x5 10 Pins Box Header IDC Male Sockets Right Angle .100" / 2.54mm (these are the male parts the ribbon cable ends plug into.  The right angle is so it lies flat, if you wanted it upright, then you get straight ones. <40 cents
    • 7 pin male header pitch of .100" / 2.54mm or the blue connector to plug into (the straight pins on the left middle picture)  I got right angle ones, but you can get straight for vertical.  About 30 cents each.  Again I had to get the 8's due to supply. Ebay also is sometimes lean on 7 pin units but you can always buy the 20 or 40 pin lengths and just cut them to the right number.
    • Spare runs of CAT5 or CAT6 wiring for the cables.  I get cut-offs from cablers at my datacenters, but you could buy a spool or buy cut offs from cablers (as copper is expensive they probably won't give it to you as they can sell it "dirty" to recyclers)
EBay is your friend for sourcing these parts !  much much cheaper than Digikey / Mouser but not as easy sometimes finding the parts.

You need 1 cable per Quad, and each Port on the TC-64 can handle 2 Quads. So the price per is TC-64 port (or 8 inputs, or to put it another way per 2 Quad's) about... $2.00 or so.  I'm sure that price can be driven down with more hunting on E-bay !

The next hurdle is the pin out demands and making sure the TC and the Quad are talking on the pins they should.  The TC-64 pin outs are below.  Usually everything has a number, so it would go to 10 but this schematic is showing inputs (8) and power (+/- 5V).   The Quad needs 4 inputs and the Ground.





So that should be easy enough right ?  yes!  it is.  But, and there's always a but, you have to first realize that the TC-64 pin is the actual ribbon cable connector, so its reversed from the usual socket diagram, like the one below, so TC -64 pin 2  is the "1" pin that IDC connectors also show as a triangle.  A typical pinout for IDC is below.  So to re-iterate the "1" pin is the "2" on the TC-64.  It just means that you can ignore the "1" pin marking and just follow what the TC needs.  Oh and putting power through the ground is bad.  I think its opto-isolated so you should be ok but don't do that. 

 and that is how, more or less, I've tried to neaten the connection change and keep my layout wiring clean.












No comments:

Post a Comment