Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based IR LED Control and Keypad Input with LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based IR LED Control and Keypad Input with LCD Display

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller interfacing with an IR LED, a 4x4 Keypad, and a 16x2 I2C LCD screen. The Arduino UNO controls the IR LED, reads input from the keypad, and displays messages on the LCD screen. The circuit is designed to demonstrate basic input and output operations using these components.

Component List

Arduino UNO

IR LED

4x4 Keypad (Simulator)

LCD screen 16x2 I2C

Wiring Details

Arduino UNO

IR LED

4x4 Keypad (Simulator)

LCD screen 16x2 I2C

Code Documentation

Included Libraries

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>

IR LED Control

Setup Function:

void setupIR() {
  pinMode(9, OUTPUT); // Initialize the digital pin as an output.
}

Loop Function:

void loopIR() {
  digitalWrite(9, HIGH); // Turn the IR LED on
  delay(1000); // Wait for a second
  digitalWrite(9, LOW); // Turn the IR LED off
  delay(1000); // Wait for a second
}

Keypad Input

Keypad Configuration:

const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns
char keys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {2, 3, 4, 5}; // Row pins
byte colPins[COLS] = {6, 7, 8, 10}; // Column pins
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

Setup Function:

void setupKeypad() {
  Serial.begin(9600);
}

Loop Function:

void loopKeypad() {
  char key = keypad.getKey();
  if (key) {
    Serial.println(key);
  }
}

LCD Display

LCD Configuration:

LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address to 0x27

Setup Function:

void setupLCD() {
  lcd.init(); // Use init instead of begin
  lcd.backlight(); // Turn on the backlight
  lcd.setCursor(0, 0); // Set cursor to column 0, line 0
  lcd.print("Hello, World!"); // Print message
  lcd.setCursor(0, 1); // Set cursor to column 0, line 1
  lcd.print("LCD 16x2 I2C"); // Print message
}

Loop Function:

void loopLCD() {
  // LCD does not require continuous updates in the loop
}

Main Setup and Loop

Setup Function:

void setup() {
  setupIR();
  setupKeypad();
  setupLCD();
}

Loop Function:

void loop() {
  loopIR();
  loopKeypad();
  // loopLCD is not required since no dynamic updates are happening
}