Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Review/Questions regarding design using a 4-16 line decoder

Not open for further replies.


New Member
Basic Outline
The purpose of this circuit is to switch points on a model railway layout using a computer. Each point has a solenoid that only needs to be activated momentarily when the point needs to change direction.

Switches S2-S5 are used to create a binary number in the range 0 – 15. This indicates the point to be changed.

Switch S5 is used to select the direction of the change. I.e. Left or Right.

Switch S6 is activated for approximately half a second in order to send power to the point to implement the change.

This circuit is attached to a general purpose parallel interface circuit which is attached to the parallel port of the computer. It was a hobby kitset that I assembled previously.

It was intended to be used to switch relays or lights on and off. So S2-7 of this circuit are attached to another 8 Way Darlington Driver in a similar fashion to IC 4-7. So there is a path to ground when the switches are enabled.

I also take a +5 volt feed from the general purpose parallel circuit to power the digital circuit.

This is the first design that I have created and I was not too sure about a few things. Having some form of Electrical Engineering Skills probably would have helped as well J.

My Questions

1. Is the method that I used to use the switches correct – effectively a 100K resistor from +5v? I tried a 10K resister and this also seems to work ok. Having no resistor does not work correctly.

2. I had a bit of fun with S6 that was intended to select either IC2 or IC3. I found that I could not attach it directly to the Enable pin of IC2. Strangely (to me) this technique worked ok for the S2-5. I was going to try to use a transistor as a NOT gate rather than IC1 which contains 6 NOT gates. By experimenting I discovered that S6 would work correctly with IC1 but not with the Enable pin of IC2 or IC3.
o Is there an explanation for this behaviour that I can learn from?
o What would be a simple way to use a transistor to achieve the same purpose?

3. I read somewhere that if you do not use pins on an IC you must connect them either to Ground or +5v. In the case of IC1 where I am not using all of the circuits can all of the unused A and /Ys’ all go to Ground or should the As’ go to Ground and the /Ys’ go to +5v – i.e because the /Ys should all be High if the As’ are Low?

4. I found an example of using a transistor as a switch (Q1, R1, R2) and have used it to activate the power to the solenoids rather than a relay. Is there any drawbacks to this design? And do I need to put any capacitors into the circuit?

5. IC2 and 3 are 4-16 decoders. They have a Latch Enable pin. For this circuit design it does not matter to me if the outputs fluctuate during any transition during point selection. So I thought that I could permanently wire it to High to avoid the use of another input switch. Again it seemed to require a resistor so that it behaved correctly. Is this approach OK?

6. The Zener Diodes and 100Ohm resistor were used within the parallel interface design in case someone attached wires the wrong way around. I just reused this technique verbatim in my design. It seems to work ok . . . so far. And the Darlington drivers work like relays and look like they can handle the extra voltage and current. Do capacitors need to be added to this section?


  • Circuit_Design-_Point_Controller_BW.gif
    24.8 KB · Views: 440
I probably won't answer all your questions here, but I have some comments:
1. Don't leave unused CMOS inputs floating (e.g., 74C04), even on unused gates. Connect them to Vcc or GND.
2. Your PNP will not work reliably if you try to control it directly from S7, unless S7 is from an open drain or open collector output (I don't have the specs on your interface circuit). If it is open drain (collector), it should work. I hope your solenoid draws less than 100ma, because that's all the BC559 can handle. You should have a 1N4001 rectifier connected from collector to GND (anode to GND). This protects the BC559 from flyback voltage damage when the solenoid current is interrupted.
3. In most digital circuits, you will need at least one multi-microfarad capacitor (10-100uF) from Vcc to GND, and a 0.1uF ceramic cap from each IC's Vcc pin to GND. This circuit shouldn't be sensitive to power supply spikes except as described in (4).
4. You shouldn't need R8 and R9 if you decouple the supply as described above, but they certainly won't hurt anything.
5. If you are using 12 volt solenoids, I would eliminate R10-R13 and the zeners. Connect all the GND pins on the 2803s to GND, and all the Vcc pins on the 2803s to +12v. You should definitely have a 0.1uF cap from Vcc to GND on each of the 2803s.
Thank you but could you please clarify some things

Thank you for reviewing my circuit. But a few questions.

Adding capacitors has enabled me to lose the two resistors R7 and R8 as you stated.

When you say that you should not leave inputs floating does this apply to the outputs as well? Technically I only required one of the Not gates so I would ground the remaining inputs. Is it necessary to attach the outputs of those gates to anything? If so does it matter if they are all attached to +ve or ground - i.e. the same as the inputs.

Finally thank you for your comments regarding the pnp transistor. After a bit of research I determined that it is an open collector output - so this is why it is working. But your comment regarding the rectifier and current was useful - to date I was testing the circuit with diodes instead of the solenoids. I will substitute a medium power transistor instead (or I will use the output of the existing one to power the heavier transistor).
You can leave the unused outputs floating. The reason that inputs need to be tied to a rail is that floating inputs tend to float midway between logic 0 and logic 1, causing a lot of unnecessary current to flow between Vcc and GND. Floating inputs are also more susceptible to damage from static discharge. See the schematic below.
Regarding the PNP, your base drive current should be Ic/10 (you can probably get away with Ic/20). So, if you have 500ma solenoids, you need 25-50ma of base drive. Under this scenario, you need to make sure your open collector driver (S7) can provide adequate current.

BTW, if this is truly your first design, I'm impressed.


  • floating_inverter.GIF
    4.2 KB · Views: 291
Thanks again.

That is excellent. I will run off to the electronics shop in the weekend and make those changes.

Yes it is my first attempt at Electronics. My qualifications are in computer software design and accountancy - but I have a lean towards the technical aspects of life.

My next project is a little more ambitious. The parallel port interface that I am using also has 2 digital to analog outputs that can supply a variable voltage up to about 5 volts. My plan is to use the 2 remaining digital switches as direction controllers and the 2 variable voltages to make 2 digital speed controllers for the electric trains - so basically bump 5 volts up to about 10 volts with some form of amplifier.

And then use voice control and/or the mouse (via the computer) to control the switches and trains - that is the easy bit for me - the digital electronics is a bit trickier.

Thank you again.
Sounds like fun! You might want to consider pulse width modulation (PWM) for you speed control, as opposed to variable DC voltage. I think you will get much better starting torque from PWM. There are guys on this forum with way more motor control experience than I have.
Food for thought. I have heard the expression PWM before with regards to remote controls for model planes.

I will finish of this project first and then do some more research. You might see me post another design in a few weeks for review - complete with capacitors and surge protection!
confuzed said:
Food for thought. I have heard the expression PWM before with regards to remote controls for model planes.

I would have thought you would have heard of it with model trains, it's commonly used for controlling them (instead of the crude rheostats used in the past). Although it's always possible that the manufacturers don't tell you that's what it is?.
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips