
TL;DR: In this project we simulate the behavior of a NOT logic gate using an Arduino, one slide switch, and an LED in Ayantrik Lab. The switch acts as input, the NOT gate inverts the logic, and the LED turns ON when the input is LOW and turns OFF when the input is HIGH.
The Problem / Why This Matters
Digital electronics works using logic gates, which are the fundamental building blocks of all digital systems.
Logic gates are used in:
- Computers
- Microcontrollers
- Embedded systems
- Robotics
- Digital circuits
Before learning advanced electronics, it is important to understand basic logic gates. One of the simplest logic gates is the NOT Gate.
The NOT gate is also called an Inverter, because it reverses the input signal.
In this tutorial, we simulate the NOT gate using Ayantrik Lab, so we can understand how inverted logic works without building the circuit physically. Try it here
Basic Theory of NOT Gate
A NOT Gate has:
- One input (A)
- One output (Y)
The output is always the opposite of the input.
Boolean Expression
Y = A'
This means output is NOT of A.
If input is 1 → output is 0 If input is 0 → output is 1
Truth Table of NOT Gate
| Input A | Output Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
Explanation:
- Input LOW → Output HIGH
- Input HIGH → Output LOW
In this project:
- Slide Switch → Input A
- NOT Gate → Logic processor
- LED → Output indicator
Prerequisites
Components used in this project:
- Arduino Uno
- Slide Switch
- NOT Gate
- LED
All components are available in Ayantrik Lab component library.
Steps to Create the Project in Ayantrik Lab
1. Open a New Project
Open Ayantrik Lab and create a new project.
Create New Project
2. Add Components
Click Add Components from the toolbar.
Toolbar
Search and drag the following components:
- Arduino Uno
- Slide Switch
- NOT Gate
- LED
Arrange them properly on the canvas.
3. Make the Circuit Connections
NOT Gate Connection
Slide Switch Connection
Switch:
Right→5VCOM→D2
This switch acts as digital input.
Arduino to NOT Gate
D12→ NOT Gate Input A
Arduino sends HIGH / LOW based on switch state.
NOT Gate to LED
- NOT Gate Output (Y) → LED Anode
- LED Cathode →
GND
LED shows the inverted output.
Code
Upload the following Arduino code.
cppconst int swt1 = 2; const int input1 = 12; int swt1State = 0; void setup() { pinMode(input1, OUTPUT); pinMode(swt1, INPUT); } void loop() { swt1State = digitalRead(swt1); if (swt1State == HIGH) { digitalWrite(input1, HIGH); } else { digitalWrite(input1, LOW); } }
After writing the code, click Run from the toolbar to start the simulation.
Expected Behavior
Try different switch positions.
| Switch | LED |
|---|---|
| OFF | ON |
| ON | OFF |
This confirms the correct working of the NOT logic gate.
Built-in Debugging in Ayantrik Lab
Ayantrik Lab provides a built-in debugging system that helps detect problems in both the circuit and the code.
Built-in debugging tool
The debugger can detect:
- Wrong connections
- Missing power or ground
- Incorrect pin mapping
- Code errors
This makes learning digital electronics easier, especially for beginners.
Conclusion
In this tutorial, we simulated a NOT Gate using Arduino in Ayantrik Lab.
You learned:
- Basic digital logic theory
- Truth table of NOT gate
- How inversion works
- Using switches as inputs
- Controlling output using logic gate
NOT gate is very important because it is used in almost every digital circuit.
Try building more logic circuits like:
- AND Gate
- OR Gate
- NAND Gate
- NOR Gate
- XOR Gate
Happy learning with Ayantrik Lab !

