I've recently started to work with electronics and I'm truly a beginner. Our teacher asked us to create an on/off indicator for a SPST button in a circuit. When the button is pressed the green light should glow, and when it is released, the red light should glow.

How would I do that?

  • \$\begingroup\$ The green light should be simple, for the red light you need what is called a "not logic gate". A google search will give you examples how to build one (there are different ways, but for your application it does not really matter what you choose). \$\endgroup\$
    – 0x6d64
    May 22 '15 at 7:46
  • \$\begingroup\$ What things have you used up to this point in your course? It would help us in guiding you to an answer. The folks here can come up with all kinds of answers, but they may be entirely unrelated to what your teacher is trying to get you to learn. \$\endgroup\$
    – JRE
    May 22 '15 at 10:03

This circuit will work regardless of the type of SPST switch

enter image description here

With the switch closed a current will pass through LED1 and R1 and turn the green LED ON indicating the switch is closed. R1 is chosen to limit the current through the green LED. In this case 1k0 will limit the current to about 7mA ((9 - 2)/1000).

This will also produce a voltage drop of about 2V across the green LED. R3 and R2 divide this voltage drop so that at Q1 the base - emitter voltage will be less than 0.6V (= 0.35V). The transistor Q1 will be turned OFF. If you find the transistor is not turned off you can always lower the value of R2.

As Q1 is OFF no current can flow through Q1 and the red LED will be OFF.

When the switch is OPEN no current can flow through the green LED so it is OFF. The base of Q1 is now connected through R1 to ground. The voltage at the base of Q1 is sufficient to turn the transistor ON (0.6V). Current now flows through the transistor Q1, R4 and the red LED which now lights up indicating the switch is open.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.