I'm trying to figure out what logic gate to use

Hello,

I'm a college student starting an electronic systems engineering program and I'm in my first week of learning about logic gates. In a weekly discussion I was asked to think of a statement that can be translated into a logic circuit.

I came up with "If the headlights are on and the ignition is turned off, then the headlights will turn off after 30 seconds"

In our textbook it shows example logic diagrams using AND, OR, NAND and NOR gates.

My question is, can that statement be drawn into a simple logic diagram and which logic gate would I need? Would I need a NAND gate?

by duanee43
December 20, 2022

Can be a NAND.

Is turning off a light already off acceptable? We then have a NAND. Here is why:

Input A : Is the light on?

Input B : Is the engine on?

Result of: A NAND B

The result being TRUE means: Do turn the headlight off

and the result being FALSE means: Do nothing.

The fact that turning off a light already off being acceptable opens the door to many solutions, including this simple single gate, a NAND.

As for the delay, you will have to implement it in a different way since logical gates do not supply you with a delay, unless you use a clock and count the ticks. Which is more complex since you need a "counting" circuit.

by vanderghast
December 20, 2022

There are three complexities in the system you describe that can't be modelled in simple "combinatorial" logic. (You haven't actually specified combinatorial logic, but I'm assuming that is what is expected here, since you're referring to individual gates rather than more complex logic elements like flip-flops.)

These are: (a) state (are the lights currently on?); (b) timing elements (take this action after 30 seconds); (c) edges / state transitions (I'm reading "the ignition is turned off" as "the ignition transitions from on to off" rather than just "the state of the ignition is off").

You might be able to get away with a bit of a hand-wave by defining some of your state as both an input and an output (such as the lights being on), but the timer is a bigger problem, and detecting the state transition on the ignition also introduces a time and/or state component.

A better example in a car might be the warning that sounds to remind you to turn the lights off when leaving the car: "lights on" AND NOT "ignition on" AND "driver's door open", where the output is a warning buzzer. This could be implemented as a 3-input AND (or 2x 2-input AND), plus a NOT (aka inverter).

by mdfrost
December 24, 2022

No Answers

No answers yet. Contribute your answer below!


Your Answer

You must log in or create an account (free!) to answer a question.

Log in Create an account


Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

Search Questions & Answers


Ask a Question

Anyone can ask a question.

Did you already search (see above) to see if a similar question has already been answered? If you can't find the answer, you may ask a question.


About This Site

CircuitLab's Q&A site is a FREE questions and answers forum for electronics and electrical engineering students, hobbyists, and professionals.

We encourage you to use our built-in schematic & simulation software to add more detail to your questions and answers.

Acceptable Questions:

  • Concept or theory questions
  • Practical engineering questions
  • “Homework” questions
  • Software/hardware intersection
  • Best practices
  • Design choices & component selection
  • Troubleshooting

Unacceptable Questions:

  • Non-English language content
  • Non-question discussion
  • Non-electronics questions
  • Vendor-specific topics
  • Pure software questions
  • CircuitLab software support

Please respect that there are both seasoned experts and total newbies here: please be nice, be constructive, and be specific!

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.