Monday, February 9, 2009

HO scale train layout signal dispatch panel

My dad has a pretty good sized HO scale model train layout that he has been working on for the past year or so. The last time I came to visit I realized that he was in serious need of a signal control panel. A few years ago when he started planning his new layout, I had told him that he needed to upgrade all of his target signals that then used grain of wheat light bulbs to LEDs. Previously, you had to put very small light bulbs in each signal whcih ran on 12 volts. While they have always worked fine, they did have several disadvantages. First, they produced a lot of heat. Often your signal would get very hot just from operating. Second, each target of the signal was limited to a single color ( unless you were able to stick two light bulbs side by side in the same target light ) which was difficult to do and never looked very good. Finally, they were usually very bright, bright enough to illuminate the entire section of track in front of the signal which is very unrealistic.

A typical target signal you see in the midwest ( pretty much the only style signal you see in Michigan ) is this:


This signal is typically in a two or three target configuration where each light can produce Red, Yellow, and Green light. To have a convincing signal on a model layout you need to have signals that have the same effect, which is where LEDs come in. A bi-color red / green LED can produce the exact effect needed for this. Power the LED and you get green, reverse the voltage you get red, provide fast alternating current ( faster than the persistance of vision ) and you get yellow.

My dads model layout has approximately 30 signals on it, so a cool control panel is definitely in order. I have always been all about things with lots of lights and switches. So after my dad upgraded all of his signals to LEDs, I began work on the control panel. First I needed a simple circuit to control the LEDs to provide the three colors necessary from a two-lead LED. I came up with the following circuit to allow their operation:


A 555 timer provides a simple clock at a 50% duty cycle set by the 1K adjustable resistor. The switch on the far right is a single pole double throw toggle switch with a center off. Based on it's poistion of up or down decides on the color of the LED. Up is green, down is red. In the center off position the 555 provides the fast switching current provided by the invertor to the LED producing a yellow color. The exact shade of yellow can be adjusted by changing the duty cycle of the 555 by adjusting the variable resistor. I have a single 555 providing the clock to all my LEDs through this simple circuit. I have a bunch of buffers in line from the clock not shown in the schematic driving each LED. This also allows me an easy upgrade path to a logic based solution in the future where I can have a microcontroller controlling all of the LEDs as well.

On to the panel assembly. I started by creating a schematic of the layout and creating a template on a 4' by 6" length of 3/8" plexiglass.


Once the layout of the panel was complete it was time to start drilling. Knowing a hand drill would not provide adequate and consistent holes, I bought a small 10" drill press which I have been wanting for a long time anyway. The drilling begins.


Another thing I found out is local hardware stores do not carry metric drill bits. I had to buy 5mm drill bits online to make sure the LEDs had a perfect fit. After drilling was completed, I peeled off of the protective paper and painted the back of the plexiglass black. It gave the front of the panel a nice look. Then assembly began.

Once the 62 switches and 62 LEDs are mounted and glued in place the wiring began. I also installed two 4' U channel peices of aluminum on the back of the panel to give it some rigidity and stability. Now time for the wiring. I decided to not use any PCBs when buliding for sake of time saving, but the amount of wiring necessary soon became very regrettable. I did use a perf board for all of the logic driving, but the resistor and diode networks became a bit much.

The logic portion was much easier.

There are still many wires to run from here, but that was finished after this picture was taken. Now the front of the control panel needs to have the layout schematic placed on it. For this I used this vehicle pin striping which is cheap and very easy to work with.

And finally the finished product.


With the lights off.

Mostly red signals shown here with a few greens and yellows. All of these LEDs are the same bi-color device. The last step is to install the panel in the layout and wire all of the actual signal LEDs in parallel to the LEDs on this control panel. Once installed I will have pictures to show the final result.

Monday, November 17, 2008

New PIC Programmer

My new Microchip PIC programmer arrived today. I have been meaning to get a USB powered version for awhile now since my new bench machine only has two serial ports... causing the rs-232 real estate to be rather limited. (plus I can't use my ISA serial cards in machines now that the ISA bus is pretty much obsolete ). Instead of going the expensive option, I went the cheap Chinese option and ordered a PICkit2 compatible programmer off of eBay. It took about two weeks to arrive directly from Honk Kong, but it's here and it works.

Of course after opening the package I noticed that it was missing the ZIF sockets. :(



Looking back at the auction I see that this was stated in the description in a non-descriptive Chinese kind of way. Luckily the sockets are cheap and I ordered them from a reputable supplier today.

This will allow me to start using the surplus of samples I have been ordering for free and let me explore the PIC world a little more. I have been spending a lot of time in the AVR ATmega world for the past month or so (most ATmega's don't require a programmer) so it will be cool to compare and contrast the two micro families.

Wednesday, October 22, 2008

The best electronics find I have ever had: Intergraph Logic Boards

I have always had my eye out for surplus electronics and one of the best finds I have ever had was this:


A local business was throwing away a very old Intergraph computer. This was a very large, old, and massive computer. It consisted of several cabinets of hardware, each containing circuit boards of standard TTL logic. The best part about these boards is the fact that every single chip on each of them is socketed.


This board in particular which is labeled as a "High Speed Concentrator" has over 550 74S, 74LS, and a few other miscellaneous chips socketed.


I really wish I had more information about this machine. This board labeled as "MPCB191 Bit Slice 2903 16 Bit Processor" has over 300 socketed TTL chips along with Motorola 68000 series processors.

If anyone has information about what machine this came from, please leave a comment. I am very curious about it. My only regret is that I didn't grab more boards out of the cabinet...

Sunday, October 12, 2008

Tektronix TDS-420 oscilloscope external video display

A nice feature of the Tektronix TDS series of digital storage oscilloscopes is their external video display capability. Most (if not all) Tektronix scopes in the TDS series have an external video output (including my TDS-420) for hooking up an external display.

The internal display is very nice:


Sometimes it would be nice to have a larger display at my bench level while working...

Unfortunately this external video output is in a 9-pin form, unlike the standard DB15-pin connector we are familiar with on our VGA monitors. Because Tektronix labeled the connector as 'VGA compatible', I assumed it held to the VGA standard, and would be compatible with most modern multisync monitors.


To hook up an external display to your TDS series oscilloscope, you must perform the following. Obtain a standard 15-pin VGA connector cable and remove one end, replacing it with a standard 9-pin connector (preferably a metal connector to help with shielding). Wire the new 9-pin connector to the VGA cable as listed here. The 15-pin connector is on the left with pin assignment to the 9 pin on the right:

VGA DB15-S Female DB9 Female
15-pin, 9-pin
1, 1 Red
2, 2 Green
3, 3 Blue
4, - Monitor ID bit 2
5, - N/C
6, 6 GND
7, 7 GND
8, 8 GND
9, - N/C
10, - GND
11, - Monitor ID bit 0
12, - Minitor ID bit 1
13, 4 Horizontal Sync
14, 5 Vertical Sync
15, - N/C

I tied pin 6 on my 15 pin connector to all three grounds (6,7,8) on the 9 pin connector. After assembly of the connector, I gave it a try with success!



One of my Samsung Syncmaster 151v lcds on my bench sync'd up perfectly along with several other lcd monitors I have around. With the output being 640x480 there is plenty of resolution on the display giving the external monitor a very nice picture.

Friday, September 12, 2008

Freedatasheets.com :: my semiconductor datasheet library

So I have been frustrated lately. While working on a project... I will need to look up a datasheet for component n. I commonly turn to google with a search such as '[part number] datasheet' with sometimes good and sometimes bad results. I usually end up at one of many bad datasheet archive websites that will go unnamed. By bad, I refer to sites that have broken links, incorrect datasheets for the part described, mazes of links that I must click through, annoying pop-ups, and primarily wasted time.

Because of my frustrations, last weekend I threw together a site for my own collection of datasheets. It is now available for everyone at freedatasheets.com . I have done my best to collect datasheets from large semiconductor manufacturers (STMicroelectronics, National Semiconductor, Atmel, Freescale Semiconductor, Microchip, Xilinx, Maxim, Fairchild Semiconductor to name a few) and collected ALL of there datasheets into one source. I currently have about 30,000 datasheets organized, in a database, and fully text searchable for your component database needs. I plan to keep adding to this database, their are still many component manufacturers whose datasheets I would like to obtain.

Sunday, July 13, 2008

Plant watering system

For the past few years I have been growing various cayenne and habanero peppers in planters off of my condos balcony. The only issue with this besides lack of space has been watering. Previously I have been simply filling several large containers with water and carrying it out to the plants. This is fine in the beginning of the season, but by late July and August when the plants are large and consume much more water, this has been a chore. Multiple watering trips are necessary as well with watering them both in the morning and night. For a solution, I built a simple microcontroller based system that I could automatically water the plants on a set cycle. It also has a simple rain detector that preempts any further watering for a set amount of time after it has rained.


I designed the system around a Rabbit RCM3400 core 8-bit microcontroller. Realistically this microcontroller is rather overpowered for this system, ( a pic would have worked just fine) but I wanted to begin playing with the Rabbit's cooperative multitasking functionality... and I have a few of these micros laying around. There are a couple neat features of this micro as well such as the real-time clock and built in ADC's. For functionality, the rabbit drives a serial LCD for displaying current information on the system and has 5 microswitches along with a rain sensor for input. The system drives a latching relay which then turns on a 12v solenoid based electronic valve to start the water flow to the plants.

This is final stage of prototyping. It has been working fine for the past five days so I am beginning to build it into an enclosure this week.


The system has two adjustable parameters, frequency of the watering cycle and duration of the actual watering. The five microswitches will be placed under the lcd to allow the lcd to show the functionality of the buttons. I plan on adding a more robust menu setting that will allow control for multiple plants in the future. The left two adjust the watering frequency in hours, the next two can adjust the watering duration in seconds. For my small plants, 20 seconds or so of watering is enough to saturate the soil. The final button on the right is a forced watering function that allows me to provide a 15 second burst of water without resetting the current counters.

Once timing parameters are set, the micro begins counting down to the set watering time. The display shows how many minutes are remaining to the watering cycle. When the counter hits zero, one of the outputs fires for 250ms, enough to engage a latching relay which in turn opens the solenoid valve to start the water flow. Once the set watering duration is counted down to zero, the relay is fired for another 250ms to disengage it and cut power to the solenoid valve stopping the water flow. The process then starts over.

The rain detector is just two thin strips of aluminum foil spaced closely together on my balcony railing. When rain falls and closes the connection, a pin on the micro goes high letting it know rain is detected. The watering process is then put on hold for a set amount of time until watering begins again.


Now for a water source, I tapped into the cold water supply line underneath my sink. This is my only real option as I don't have any access to outside building watering on the top floor. The water is split with a tee fitting and ran to a solenoid valve. From here I ran a line out to my plants. Through a series of different tubing lengths and tees I was able to get an even watering distrubution among all three plants. The actual water is supplied to the plants through a polypropylene tube with a series of holes drilled through them.

The system works quite well.

Future upgrades will add control for multiple plants, and a better timing interface so I can set more precise watering cycles. If I want to go all out, I will enable the rabbit's ethernet interface to pull down real weather data automatically and have the micro set the watering cycles based on that day's conditions...

Tuesday, June 17, 2008

Homemade GPS Antenna

I needed a very small, lightweight passive GPS antenna for an ET-301 USGlobalSat GPS module, but didn't have anything to use on-hand. I started some research to make one but information on this topic is very limited... so I figured a good option would be to make my own. As far as passive antennas go, there doesn't look to be very much too them. I looked at lots of pictures of antennas online and reverse engineered them as best as I could. The result was an antenna made out of a thin piece of metal that is 24mm x24mm located 2mm over a 30mm x 30mm ground plane.

Now i'm not an RF engineer, and basic antenna math fails me on this antenna design (1/4 wavelength at a gps frequency on the L1 band of ~1.5Ghz would be 50mm) which is much larger than the antenna I designed mine after... but upon power up I had GPS lock.

So it works... which really shows how sensitive modern GPS receivers are. This is really amazing since this module is sitting inside, on my bench, located about 6 feet away from the nearest window... and I made the antenna by copying antenna designs I found online. The NMEA $GPGGA string shows that there are only 4 satellites in view (which is expected since I am indoors) so I am really looking forward to testing it outside.

At some point I hope to find a good resource for GPS antenna designs to really make a proper antenna the right way, but for now it works... and I am still impressed by the sensitivity of this receiver.