Deshbot Logic Gate Tester Using Arduino and OLED

by devkrishnavhora in Circuits > Arduino

37 Views, 0 Favorites, 0 Comments

Deshbot Logic Gate Tester Using Arduino and OLED

The Deshbot Logic Gate Tester is an Arduino-based project that demonstrates the working of different digital logic gates using an OLED display, two push buttons, and the Arduino's built-in LED.

The project allows the user to select different logic gates from a menu and change the input values using buttons. The Arduino calculates the logic output and displays the gate name, inputs, output, and LED status on the OLED display.

The project includes seven common logic gates:

  1. AND
  2. OR
  3. NOT
  4. NAND
  5. NOR
  6. XOR
  7. XNOR


Supplies

Components Required

Deshbot Shield

Arduino Uno

128×64 OLED Display

Push Button

Pin Connections


OLED Display

OLEDArduino Uno

SDA - A4

SCL - A5

VCC - 5V

GND - GND

Push Buttons

ButtonArduino PinFunction

Button A - D10

Next / Input A - Button B

D12 - Select / Input B

Output

OutputArduino Pin

Built-in LED = LED_BUILTIN

Working Principle


When the Arduino starts, the OLED displays the DESHBOT LOGIC GATES screen.

The user can use D10 to move through the available logic gates.

Pressing D12 selects the currently displayed gate.

After selecting a gate:

  1. D10 changes Input A
  2. D12 changes Input B
  3. The Arduino calculates the logic result
  4. The result is shown on the OLED
  5. The built-in LED turns ON when the output is 1
  6. The built-in LED turns OFF when the output is 0

For the NOT gate, only Input A is used.

Logic Gates

AND Gate

The output is 1 only when both inputs are 1.

ABOutput

0

0

0

0

1

0

1

0

0

1

1

1

OR Gate

The output is 1 when at least one input is 1.

NOT Gate

The NOT gate reverses Input A.

0 → 1
1 → 0

NAND Gate

NAND is the opposite of AND.

NOR Gate

NOR is the opposite of OR.

XOR Gate

The output is 1 when the two inputs are different.

XNOR Gate

The output is 1 when the two inputs are the same.

Program Flow

START
↓
Initialize OLED
↓
Display DESHBOT
LOGIC GATES MENU
↓
D10 → Select Gate
↓
D12 → Enter Gate
↓
Set Input A / Input B
↓
Calculate Logic Output
↓
Display Result on OLED
↓
Built-in LED = Output
↓
Repeat

OLED Menu

The OLED displays the available gates as a scrolling menu.

Example:

DESHBOT LOGIC GATE
------------------
AND
> OR
NOT

D10:NEXT D12:SELECT

The > symbol indicates the currently selected gate.

Gate Display

After selecting a gate, the OLED displays its inputs and output.

Example:

AND
----------------
INPUT A: 1 OUTPUT
INPUT B: 1 1

LED ON

Button Functions

Menu Mode

D10

Moves to the next logic gate.

D12

Selects the current logic gate.

Gate Mode

D10

Changes Input A between 0 and 1.

D12

Changes Input B between 0 and 1.

Both buttons together

Returns to the logic-gate selection menu.

Programming Concepts Used

Arrays

The names of the gates are stored in an array:

const char* gates[] = {
"AND",
"OR",
"NOT",
"NAND",
"NOR",
"XOR",
"XNOR"
};

switch-case

A switch-case statement is used to calculate the selected logic gate.

Boolean Logic

The program uses logical operators such as:

&&
||
!
^

OLED Display

The Adafruit_SSD1306 and Adafruit_GFX libraries are used to display the menu and logic-gate information.

Button Input

The buttons use:

INPUT_PULLUP

so an unpressed button reads HIGH and a pressed button reads LOW.

Features

  1. Seven logic gates
  2. OLED-based menu
  3. Two-button control
  4. Real-time logic calculation
  5. Built-in LED output
  6. Input A and Input B control
  7. NOT gate support
  8. Easy-to-understand interface
  9. Useful for learning digital electronics


Conclusion


The Deshbot Logic Gate Tester provides a simple practical way to understand how digital logic gates work.

Using an Arduino, OLED display, and two buttons, the user can select different gates, change their inputs, and observe the calculated output. The built-in LED provides a physical indication of the logic result.

This project combines Arduino programming, Boolean logic, digital electronics, button control, and OLED display programming into one practical learning project.