Final Espua 5 Assignment - Removed

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 52

ESAP LAB

ASSIGNMENT
Integrating Display Systems with ESP32
Microcontroller for Embedded System
05 Projects: Understanding Compatibility
and Integration with LCD, OLED, and
Seven-Segment Displays

Aim:
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects:
Understanding Compatibility and Integration with LCD, OLED, and Seven-Segment
Displays

Objectives:
1) Introduce the ESP32 microcontroller and its features.

1.1 Discuss the key features and capabilities of the ESP32 microcontroller, such as its
processing power, wireless connectivity, and peripheral support.

✓ Explain the architecture of the ESP32 microcontroller and its different


components
✓ Describe the processing power of the ESP32 and compare it with other
microcontrollers
✓ Discuss the wireless connectivity options available on the ESP32, including Wi-Fi
and Bluetooth
✓ Explain the peripheral support of the ESP32 and its compatibility with various
sensors and actuators
✓ Evaluate the advantages and limitations of the ESP32 microcontroller in
comparison to other microcontrollers available in the market.
✓ Identify the applications of the ESP32 microcontroller in embedded systems.
✓ Write an Arduino sketch to blink the onboard LED of ESP32 microcontroller
board.
1.2 Understand the basics of different display systems, including LCD, OLED, and
seven-segment displays.

✓ Explain the fundamental principles of operation of each display type, including


the components involved.
✓ Compare and contrast the characteristics and applications of each display type in
embedded systems.
✓ Discuss the advantages and limitations of using each display type in embedded
systems.
2) Comprehensive Guide to Interface and Control LCD Displays with ESP32: Including
Testing, Customization, Calculator Functionality, and Sensor Integration.

2.1 Understand the concept of LCD displays and their applications in embedded
systems.

✓ Define the basic principles of 16 x 2-character LCD display operation and its
components/pinout.
✓ Discuss the advantages and limitations of using LCD displays in embedded
systems.
✓ Identify the common applications of LCD displays in various projects.
2.2 Test and adjust the LCD display for optimal performance.

✓ Demonstrate the process of connecting and powering the LCD display with
ESP32.
✓ Perform testing procedures to ensure the LCD display is functioning correctly.
✓ Adjust the contrast settings using a potentiometer to achieve optimal readability
of the LCD display.
2.3 Displaying text such as 'Hello World!' and 'ESPUA LCD' on a 16x2 Character LCD:
Arduino Sketch Implementation using ESP32 Microcontroller.

✓ Demonstrate how to include the LiquidCrystal library in the sketch for LCD
control.
✓ Initialize the LCD display and set the appropriate configuration parameters for a
16x2 character display.
✓ Write code to display the message "Hello World!" on the first line of the LCD
display.
✓ Write code to display the message "ESPUA LCD" on the second line of the LCD
display.
✓ Upload the sketch to the ESP32 microcontroller and verify that the messages are
correctly displayed on the LCD.
2.4 Implement calculator functionality on the LCD display.

✓ Introduce the concept of a simple calculator (addition, subtraction, multiplication


and division) and its functionality.
✓ Design and implement the necessary logic and user interface on the LCD display
for calculator operations.
✓ Demonstrate the ability to perform basic mathematical calculations using the
LCD display and ESP32.
3) Configuring and interfacing an I2C LCD Display with ESP32: Addressing, Wiring,
Contrast Adjustment, Library Installation, and 'Hello World!' Example.

3.1 Introducing Configure and interface an I2C LCD display with ESP32

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
✓ Explain the concept of an I2C LCD adapter and its role in simplifying the
connection between ESP32 and the LCD display.
✓ Identify the I2C address of the LCD display and discuss the significance of
addressing in I2C communication.
✓ Provide the pinout information for wiring an I2C LCD display to the ESP32
microcontroller.
✓ Demonstrate the correct wiring connections between the I2C LCD adapter,
ESP32, and the LCD display.
✓ Adjust the LCD contrast settings for optimal visibility.
✓ Install the required library for controlling the I2C LCD display in the Arduino
IDE.
✓ Determine the I2C address of the LCD display using code or other methods.
✓ Implement a basic example code, such as "Hello World!" and "ESPUA LCD", to
test the communication and functionality of the I2C LCD display.
3.2 Customize the I2C LCD display for specific project requirements.

✓ Demonstrate how to create and display custom characters on the I2C LCD
display.
✓ Implement graphical elements and symbols (such as Heart, Bell, Alien, Check,
Speaker, Sound, Skull, and Lock) on the I2C LCD display as per needs.
4) Interfacing the DHT11 Temperature and Humidity Sensor with ESP32 and I2C LCD:
Familiarization, Wiring, and Real-Time Data Display.

4.1 Familiarization with the Temperature and Humidity Sensor (DHT11):

✓ Explain the working principle of the DHT11 sensor and its ability to measure
temperature and humidity.
✓ 1.2 Describe the key features and specifications of the DHT11 sensor, including
its measurement range and accuracy.
✓ 1.3 Discuss the applications and uses of the DHT11 sensor in various embedded
systems.
4.2 Interfacing the Temperature and Humidity Sensor (DHT11) with ESP32:

✓ Explain the process of connecting the DHT11 sensor to the ESP32 microcontroller.
✓ Identify the necessary pins on the ESP32 for interfacing with the DHT11 sensor.
✓ Demonstrate the correct wiring connections between the DHT11 sensor and the
ESP32 microcontroller.
✓ Discuss the communication protocol or library required for retrieving data from
the DHT11 sensor.
4.3 Interfacing the Temperature and Humidity Sensor (DHT11) with ESP32 and I2C
LCD:

✓ Explain the process of connecting both the DHT11 sensor and the LCD display to
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
the ESP32 microcontroller.
✓ Discuss the necessary wiring connections and pin assignments for simultaneous
interfacing of the DHT11 sensor and I2C LCD display.
✓ Describe any additional considerations or modifications required to
accommodate both the DHT11 sensor and I2C LCD display simultaneously.
✓ Demonstrate the integration of the DHT11 sensor and I2C LCD display by
displaying temperature and humidity readings on the LCD.
5) Exploring OLED Display Modules: Wiring, Library Installation, 'Hello World!'
Example, Advanced Functionality, and Graphic Capabilities with ESP32.

5.1 OLED Display Module Overview

✓ Explain the concept and working principle of OLED (Organic Light-Emitting


Diode) display modules.
✓ Discuss the advantages and features of OLED displays, such as high contrast,
wide viewing angles, and low power consumption.
✓ Describe the structure and components of an OLED display module, including
the display panel and driver circuitry.
✓ Introduce the concept of the OLED memory map and its role in organizing and
controlling display content.
5.2 Interfacing an OLED Display Module to an ESP32.

✓ Identify the necessary pins on the ESP32 for connecting an OLED display module.
✓ Explain the wiring connections between the OLED display module and the ESP32
microcontroller.
✓ Discuss any additional components or resistors required for proper operation.
✓ Provide guidance on avoiding common wiring mistakes and ensuring reliable
connections.
✓ Identify the appropriate library for controlling the OLED display module with an
ESP32.
✓ Demonstrate the process of installing the OLED library in the Arduino IDE.
✓ Explain the purpose of the library and the functions it provides for controlling
the display.
5.3 Displaying Text on an OLED Display Module: "Hello World!" and “ESPUA
OLED” Example with different font size.

✓ Write an Arduino sketch to display the message “!Hello World!" and “ESPUA
OLED” on the OLED display with different font size in center position of OLED
screen also.
✓ Explain the code structure and key functions used to control the OLED display
module.
✓ Upload the sketch to the ESP32 microcontroller and verify the successful display
of the message on the OLED.
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
5.4 Exploring Advanced Functionality of OLED Displays: Numeric Bases, ASCII
Symbols, Text Scrolling, and Partial Display Scrolling with ESP32.

5.4.1 Display Numbers with Different Bases (Hex, Dec):

✓ Explain how to configure the OLED display to output numbers in different


numerical bases, such as hexadecimal (Hex) and decimal (Dec).
✓ Demonstrate the conversion and display of numeric values, showcasing
the differences between the bases.
5.4.2 Display ASCII Symbols on the OLED:

✓ Discuss the concept of ASCII (American Standard Code for Information


Interchange) and its representation of characters using numeric codes.
✓ Demonstrate how to display ASCII symbols and characters on the OLED
display, including special characters and extended character sets.
5.4.3 Horizontal and Vertical Text Scrolling:

✓ Explain the methods and techniques for scrolling text horizontally on the
OLED display, allowing longer messages to fit within the limited screen
width.
✓ Demonstrate the implementation of horizontal text scrolling in an
Arduino sketch, showcasing the smooth transition and readability of the
scrolling text.
✓ Discuss the considerations and limitations when scrolling text vertically
on the OLED display, including potential memory constraints and visual
effects.
5.4.4 Partial Display Scrolling:

✓ Explain the concept of partial display scrolling, allowing specific sections


or areas of the OLED display to scroll independently.
✓ Discuss the advantages and applications of partial display scrolling in
scenarios where only a portion of the display needs to be updated or
highlighted.
✓ Provide guidance on implementing partial display scrolling in code,
including specifying the scrolling area and controlling the scrolling speed.
5.5 Exploring Graphic Capabilities of OLED Displays: Drawing Rectangles, Circles,
Triangles, and Round Rectangles with ESP32.

5.5.1 Drawing Rectangles and filled rectangles:

✓ Explain the process of drawing rectangles on the OLED display using


specified coordinates, width, and height.
✓ Demonstrate how to draw both outlined rectangles and filled rectangles
on the OLED display.
✓ Discuss the application of rectangles in graphical user interfaces (GUIs)
and visual representation.
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
5.5.2 Drawing Round Rectangles and filled round rectangles:

✓ Explain the concept of round rectangles and their distinctive rounded


corners.
✓ Demonstrate how to draw both outlined round rectangles and filled round
rectangles on the OLED display.
✓ Discuss the aesthetic appeal and usage of round rectangles in graphical
interfaces and design.
5.5.3 Drawing Circles and filled Circles:

✓ Explain the method for drawing circles on the OLED display, utilizing a
center point and radius.
✓ Demonstrate how to draw both outlined circles and filled circles on the
OLED display.
✓ Discuss the usage of circles in various applications, such as visual
indicators and circular representations.
5.5.4 Drawing Triangles and filled triangles:

✓ Discuss the process of drawing triangles on the OLED display using three
specified points or coordinates.
✓ Demonstrate how to draw both outlined triangles and filled triangles on
the OLED display.
✓ Highlight the application of triangles in geometric representations and
graphical elements.
6) Mastering 7-Segment Displays with ESP32: Wiring, Library Integration, Sequential
Counting from 0 to 9 and Electronic Dice Roller Project.

6.1 Understanding the Working Principle of a 7-Segment Display:

✓ Explain the basic structure and functionality of a 7-Segment display, including its
arrangement of individual segments and common pin configurations.
✓ Differentiate between Common Cathode (CC) and Common Anode (CA) types
of 7-Segment displays, highlighting their electrical characteristics and wiring
requirements.
✓ Describe how a 7-Segment display works, including the concept of segment
activation and decoding to display different numbers and characters.
✓ Discuss the importance of current-limiting resistors in controlling the brightness
and preventing excessive current flow through the display.
6.2 Interfacing a 7-Segment Display Module to an ESP32 and Writing an Arduino
Sketch to Count from 0 to 9.

✓ Provide a step-by-step guide on how to physically connect a 7-Segment display


to the appropriate pins on an ESP32 board.
✓ Highlight the significance of current-limiting resistors in the wiring setup to
ensure safe operation and optimal display brightness.
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
✓ Introduce the SevSeg library, which simplifies the process of controlling 7-
Segment displays with ESP32.
✓ Explain the features and functionalities offered by the SevSeg library, such as
segment mapping, decimal point control, and multiplexing.
✓ Demonstrate how to write an Arduino sketch utilizing the SevSeg library to count
sequentially from 0 to 9 on the 7-Segment display.
✓ Discuss the programming concepts involved, such as loop structures and
controlling segment activation.
6.3 Building an Electronic Dice Roller with 7-Segment Display and ESP32:
Automating Dice Rolls for Fun Games.

6.3.1 Understanding the Electronic Dice Roller Project:

✓ Explain the concept and purpose of the electronic dice roller project, which
automates the dice rolling process for fun dice games.
✓ Discuss the advantages and convenience of using an electronic dice roller
compared to traditional dice.
6.3.2 Triggering the Dice Roll with the Tactile Switch:

✓ Connect the 7-Segment display to the appropriate ESP32 pins based on the
defined segment pins in the code.
✓ Establish the wiring connections for the tactile switch (push button) and
assign it to the specified pin in the code.
✓ Read the state of the tactile switch using the digitalRead() function within
the loop().
✓ If the button state is HIGH (pressed), generate a random number between
1 and 6 using the random() function.
✓ Set the generated number as the new value to be displayed on the 7-
Segment display using sevseg.setNumber().
✓ Refresh the display to show the rolled dice number using
sevseg.refreshDisplay().

Summary of Experiment - 5 Goals and Outcomes


This experiment focused on various goals and outcomes related to the ESP32 microcontroller
and its integration with different display systems, including LCD, OLED, and 7-segment
displays. The experiment aimed to introduce the ESP32 microcontroller and its features, discuss
the basics of display systems, guide the interface and control of LCD displays, configure and
interface I2C LCD displays, interface the DHT11 temperature and humidity sensor with ESP32
and LCD, explore OLED display modules, and master 7-segment displays.

The experiment covered topics such as the features and capabilities of the ESP32 microcontroller,
display system principles, LCD and I2C LCD display configuration, interfacing sensors with
ESP32 and LCD, exploring OLED display functionalities, and understanding the working
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
principle of 7-segment displays. Practical examples and Arduino sketches were provided to
demonstrate the implementation and usage of these components.

One of the specific projects covered in the experiment was the construction of an electronic dice
roller using a 7-segment display and ESP32. The project aimed to automate dice rolls for fun
games, utilizing a tactile switch to trigger the roll. When the switch was pressed, a random
number between 1 and 6 was generated, and the corresponding value was displayed on the 7-
segment display.

Overall, the experiment provided a comprehensive guide to working with ESP32, different
display systems, sensors, and specific projects, offering a range of outcomes such as
understanding microcontroller features, configuring and controlling displays, integrating
sensors, and building interactive applications.

Pre-Lab Questionnaire:
1) What are the key features and capabilities of the ESP32 microcontroller?

2) Explain the architecture of the ESP32 microcontroller and its different components.

3) How does the processing power of the ESP32 compare to other microcontrollers?

4) What wireless connectivity options are available on the ESP32?

5) Describe the peripheral support of the ESP32 and its compatibility with sensors and
actuators.

6) Discuss the advantages and limitations of the ESP32 microcontroller compared to other
microcontrollers.

7) Identify some applications of the ESP32 microcontroller in embedded systems.

8) Briefly explain the basics of LCD, OLED, and seven-segment displays.

9) Compare and contrast the characteristics and applications of LCD, OLED, and seven-
segment displays.

10) What are the advantages and limitations of using LCD, OLED, and seven-segment
displays in embedded systems?

11) What is the role of an I2C LCD adapter in interfacing an LCD display with the ESP32
microcontroller?

12) Explain the significance of addressing in I2C communication and how it is relevant to
the configuration of an I2C LCD display with ESP32.

13) What is the working principle of the DHT11 sensor?

14) How does the DHT11 sensor measure temperature and humidity?
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
15) What are the key features of the DHT11 sensor?

16) Name some applications where the DHT11 sensor is commonly used in embedded
systems.

17) Which pins on the ESP32 are used for interfacing with the DHT11 sensor?

18) What communication protocol or library is required to retrieve data from the DHT11
sensor?

19) Explain the working principle of OLED display modules.

20) Discuss three advantages of OLED displays.

21) Name two components of an OLED display module.

22) What is the role of the OLED memory map?

23) Identify two necessary pins on the ESP32 for connecting an OLED display module.

24) Name the appropriate library for controlling the OLED display module with an ESP32.

25) What function is used to display text on the OLED display module?

26) Explain the basic structure of a 7-Segment display and how individual segments are
arranged to form numbers or characters.

27) Differentiate between Common Cathode (CC) and Common Anode (CA) types of 7-
Segment displays in terms of their electrical characteristics and wiring requirements.

28) Describe the concept of segment activation and decoding in a 7-Segment display to
display different numbers or characters.

29) Discuss the role of current-limiting resistors in controlling brightness and preventing
excessive current flow through the display.

30) Explain the concept and purpose of the electronic dice roller project and its advantages
over traditional dice for fun dice games.

31) Explain the process of generating a random number between 1 and 6 using the random()
function when the button is pressed.

32) Demonstrate how to set the generated number as the value to be displayed on the 7-
Segment display using the SevSeg library's setNumber() function.

33) Explain how to refresh the display to show the rolled dice number using the SevSeg
library's refreshDisplay() function.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Components/Equipment Required:
Sl. Name of the Specification Quantity
No. Component / Equipment
1) ESP32 Dev kit V1 1
2) ESP32 Dev kit cable USB Type A to micro B 1
3) Trimmer Potentiometer 10k, Preset 1
4) LCD module 16 x 2 1
5) I2C LCD adapter PCF8574 1
6) Temperature and Humidity Sensor DHT 11 1
7) OLED module 0.96 inch, SSD1306 (I2C 1
Display)
8) Push Button 5mm, Tactile Switch 1
9) 7-Segment Display Common Cathode 1
Resistors (carbon type) ¼ watt (330Ω) 7
10) ¼ watt (10kΩ) 1
11) Breadboard 840 Tie points 1
12) Digital Multimeter ---------------------------- 1
13) Jumper Wire --------------------------- As per requirement

Objective 1
Introduce the ESP32 microcontroller and its features.

1.1 Discuss the key features and capabilities of the ESP32 microcontroller, such as its
processing power, wireless connectivity, and peripheral support.

✓ Explain the architecture of the ESP32 microcontroller and its different


components
✓ Describe the processing power of the ESP32 and compare it with other
microcontrollers
✓ Discuss the wireless connectivity options available on the ESP32, including Wi-Fi
and Bluetooth
✓ Explain the peripheral support of the ESP32 and its compatibility with various
sensors and actuators
✓ Evaluate the advantages and limitations of the ESP32 microcontroller in
comparison to other microcontrollers available in the market.
✓ Identify the applications of the ESP32 microcontroller in embedded systems.
✓ Write an Arduino sketch to blink the onboard LED of ESP32 microcontroller
board.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Circuit / Schematic Diagram

Figure 1.1: Schematic of blink the onboard LED of ESP32 microcontroller board.

Code
1.1 Blink the onboard LED of ESP32 microcontroller board.

void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Set built-in LED pin as an output
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // Turn on the LED
delay(1000); // Wait for 1 second
digitalWrite(LED_BUILTIN, LOW); // Turn off the LED
delay(1000); // Wait for 1 second
}

Observation

Figure 1.1.1: Simulation based blink the onboard LED of ESP32 microcontroller board.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 1.1.2: Hardware Implementation based blink the onboard LED of ESP32 microcontroller board.

Objective 2
Comprehensive Guide to Interface and Control LCD Displays with ESP32: Including Testing,
Customization, Calculator Functionality, and Sensor Integration.

2.1 Understand the concept of LCD displays and their applications in embedded
systems.

✓ Define the basic principles of 16 x 2-character LCD display operation and its
components/pinout.
✓ Discuss the advantages and limitations of using LCD displays in embedded
systems.
✓ Identify the common applications of LCD displays in various projects.
2.2 Test and adjust the LCD display for optimal performance.

✓ Demonstrate the process of connecting and powering the LCD display with
ESP32.
✓ Perform testing procedures to ensure the LCD display is functioning correctly.
✓ Adjust the contrast settings using a potentiometer to achieve optimal readability
of the LCD display.
2.3 Displaying text such as 'Hello World!' and 'ESPUA LCD' on a 16x2 Character LCD:
Arduino Sketch Implementation using ESP32 Microcontroller.

✓ Demonstrate how to include the LiquidCrystal library in the sketch for LCD
control.
✓ Initialize the LCD display and set the appropriate configuration parameters for a
16x2 character display.
✓ Write code to display the message "Hello World!" on the first line of the LCD
display.
✓ Write code to display the message "ESPUA LCD" on the second line of the LCD
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
display.
✓ Upload the sketch to the ESP32 microcontroller and verify that the messages are
correctly displayed on the LCD.
2.4 Implement calculator functionality on the LCD display.

✓ Introduce the concept of a simple calculator (addition, subtraction, multiplication


and division) and its functionality.
✓ Design and implement the necessary logic and user interface on the LCD display
for calculator operations.
✓ Demonstrate the ability to perform basic mathematical calculations using the
LCD display and ESP32.

Circuit / Schematic Diagram

Figure 2.1: Schematic of test and adjust the LCD display for optimal performance.

Figure 2.2: Schematic of Interface and Control LCD Displays with ESP32: Including Customization,
Calculator Functionality, and Sensor Integration.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Code
2.2 Test and adjust the LCD display for optimal performance.

#include <LiquidCrystal.h> const int rs=2;


const int en=3; const int d4=4; const int d5=5; const int d6=6; const int d7=7;
LiquidCrystal lcd1(2,3,4,5,6,7); void setup(){
lcd1.begin(16,2);
lcd1.clear();}

void loop(){ lcd1.setCursor(2,0); lcd1.print("ITER,SOA"); lcd1.setCursor(4,1);


lcd1.print("Bhubaneswar");
}
2.3 Displaying text such as 'Hello World!' and 'ESPUA LCD' on a 16x2 Character LCD:
Arduino Sketch Implementation using ESP32 Microcontroller.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define LCD_ADDRESS 0x27
#define LCD_COLUMNS 16
#define LCD_ROWS 2
LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS);
void setup() {
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight (if available)
// Print "Hello World!" on the first line of the LCD
lcd.setCursor(0, 0);
lcd.print("Hello World!");
lcd.setCursor(0, 1);
lcd.print("ESPUA LCD");
}
void loop() {
// Nothing to do in the loop, the message will remain displayed
}
2.4 Implementing calculator functionality on the LCD display.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define LCD_ADDRESS 0x27
#define LCD_COLUMNS 16
#define LCD_ROWS 2
LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS);
int num1 = 0;
int num2 = 0;
char operation;
bool isNum1Set = false;
bool isNum2Set = false;
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
lcd.setCursor(0, 0);
lcd.print("Calculator:");
}
void loop() {
if (!isNum1Set) {
getInput(&num1, "Num1:");
isNum1Set = true;
}
if (!isNum2Set) {
getInput(&num2, "Num2:");
isNum2Set = true;
}
getResult();
}
void getInput(int* num, String prompt) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(prompt);
while (!Serial.available()) {} // Wait for input
*num = Serial.parseInt(); // Read input as integer
lcd.setCursor(0, 1);
lcd.print(*num);
}
void getResult() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Result:");
int result;
switch (operation) {
case '+':
result = num1 + num2;
break;
case '-':
result = num1 - num2;
break;
case '*':
result = num1 * num2;
break;
case '/':
result = num1 / num2;
break;
default:
lcd.print("Invalid operation");
return;}
lcd.setCursor(0, 1);
lcd.print(result);
}

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Observation

Figure 2.2.1: Simulation based test and adjust the LCD display for optimal performance.

Figure 2.2.2: Hardware Implementation based test and adjust the LCD display for optimal performance.

Figure 2.3.1: Simulation based displaying text such as 'Hello World!' and 'ESPUA LCD' on a 16x2
Character LCD: Arduino Sketch Implementation using ESP32 Microcontroller.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 2.3.2: Hardware Implementation based displaying text such as 'Hello World!' and 'ESPUA LCD'
on a 16x2 Character LCD: Arduino Sketch Implementation using ESP32 Microcontroller.

Figure 2.4.1: Simulation based implementing calculator functionality on the LCD display.

Figure 2.4.2: Hardware Implementation based implementing calculator functionality on the LCD
display.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Objective 3
Configuring and interfacing an I2C LCD Display with ESP32: Addressing, Wiring, Contrast
Adjustment, Library Installation, and 'Hello World!' Example.

3.1 Introducing Configure and interface an I2C LCD display with ESP32

✓ Explain the concept of an I2C LCD adapter and its role in simplifying the
connection between ESP32 and the LCD display.
✓ Identify the I2C address of the LCD display and discuss the significance of
addressing in I2C communication.
✓ Provide the pinout information for wiring an I2C LCD display to the ESP32
microcontroller.
✓ Demonstrate the correct wiring connections between the I2C LCD adapter,
ESP32, and the LCD display.
✓ Adjust the LCD contrast settings for optimal visibility.
✓ Install the required library for controlling the I2C LCD display in the Arduino
IDE.
✓ Determine the I2C address of the LCD display using code or other methods.
✓ Implement a basic example code, such as "Hello World!" and "ESPUA LCD", to
test the communication and functionality of the I2C LCD display.
3.2 Customize the I2C LCD display for specific project requirements.

✓ Demonstrate how to create and display custom characters on the I2C LCD
display.
✓ Implement graphical elements and symbols (such as Heart, Bell, Alien, Check,
Speaker, Sound, Skull, and Lock) on the I2C LCD display as per needs.

Circuit / Schematic Diagram

Figure 3.1: Schematic of configuring and interfacing an I2C LCD Display with ESP32: Addressing,
Wiring, Contrast Adjustment, Library Installation, and “! Hello World!” and “ESPUA LCD”.
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Code

3.1 Implementing a basic example code, such as "Hello World!" and "ESPUA LCD", to test
the communication and functionality of the I2C LCD display

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address
#define LCD_ADDRESS 0x27
#define LCD_COLUMNS 16
#define LCD_ROWS 2
// Initialize the LCD object with the LCD address and dimensions
LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS);
void setup() {
// Initialize the serial communication for debugging
Serial.begin(9600);
// Initialize the LCD display
lcd.init();
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0); // Set cursor to the first row
// Print "Hello World!" on the LCD
lcd.print("Hello World!");
// Wait for 2 seconds
delay(2000);
// Clear the LCD display
lcd.clear();
// Print "ESPUA LCD" on the LCD
lcd.setCursor(0, 0); // Set cursor to the first row
lcd.print("ESPUA LCD");
// Wait for 2 seconds
delay(2000);
}
void loop() {
// No action needed in the loop
}

3.2 Implementing graphical elements and symbols (such as Heart, Bell, Alien, Check,
Speaker, Sound, Skull, and Lock) on the I2C LCD display as per needs.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define LCD_ADDRESS 0x27
#define LCD_COLUMNS 16
#define LCD_ROWS 2
LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS);
void setup() {
lcd.init();
lcd.backlight();
// Create custom characters
byte heartSymbol[8] = {

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
B00000,
B01010,
B11111,
B11111,
B11111,
B01110,
B00100,
B00000
};
byte bellSymbol[8] = {
B00100,
B01110,
B01110,
B01110,
B11111,
B00000,
B00100,
B00000
};
byte alienSymbol[8] = {
B00100,
B01110,
B01110,
B11111,
B10101,
B11111,
B01010,
B10001
};
byte checkSymbol[8] = {
B00001,
B00011,
B00111,
B11111,
B11111,
B00111,
B00011,
B00001
};
byte speakerSymbol[8] = {
B00000,
B00000,
B00000,
B01110,
B01110,
B01110,
B11111,
B11111
};
byte soundSymbol[8] = {
B00000,
B10000,

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
B11000,
B11100,
B11110,
B11100,
B11000,
B10000
};
byte skullSymbol[8] = {
B01110,
B10001,
B01110,
B10101,
B10001,
B10001,
B01110,
B00000
};
byte lockSymbol[8] = {
B11111,
B10001,
B10101,
B10101,
B10101,
B10101,
B10101,
B11111
};
// Define custom characters
lcd.createChar(0, heartSymbol);
lcd.createChar(1, bellSymbol);
lcd.createChar(2, alienSymbol);
lcd.createChar(3, checkSymbol);
lcd.createChar(4, speakerSymbol);
lcd.createChar(5, soundSymbol);
lcd.createChar(6, skullSymbol);
lcd.createChar(7, lockSymbol);

// Display custom characters


lcd.setCursor(0, 0);
lcd.write(0); // Heart
lcd.write(1); // Bell
lcd.write(2); // Alien
lcd.write(3); // Check
lcd.setCursor(0, 1);
lcd.write(4); // Speaker
lcd.write(5); // Sound
lcd.write(6); // Skull
lcd.write(7); // Lock
}
void loop() {
// No action needed in the loop
}

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Observation

Figure 3.2.1: Simulation based implementing a basic example code, such as "Hello World!" and "ESPUA
LCD", to test the communication and functionality of the I2C LCD display

Figure 3.2.2: Hardware Implementation based implementing a basic example code, such as "Hello
World!" and "ESPUA LCD", to test the communication and functionality of the I2C LCD display

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 3.3.1: Simulation based implementing graphical elements and symbols (such as Heart, Bell,
Alien, Check, Speaker, Sound, Skull, and Lock) on the I2C LCD display as per needs.

Figure 3.3.2: Hardware Implementation based implementing graphical elements and symbols (such as
Heart, Bell, Alien, Check, Speaker, Sound, Skull, and Lock) on the I2C LCD display as per needs.

Objective 4
Interfacing the DHT11 Temperature and Humidity Sensor with ESP32 and I2C LCD:
Familiarization, Wiring, and Real-Time Data Display.

4.1 Familiarization with the Temperature and Humidity Sensor (DHT11):

✓ Explain the working principle of the DHT11 sensor and its ability to measure
temperature and humidity.
✓ 1.2 Describe the key features and specifications of the DHT11 sensor, including
its measurement range and accuracy.
✓ 1.3 Discuss the applications and uses of the DHT11 sensor in various embedded
systems.
4.2 Interfacing the Temperature and Humidity Sensor (DHT11) with ESP32:

✓ Explain the process of connecting the DHT11 sensor to the ESP32 microcontroller.
✓ Identify the necessary pins on the ESP32 for interfacing with the DHT11 sensor.
✓ Demonstrate the correct wiring connections between the DHT11 sensor and the
ESP32 microcontroller.
✓ Discuss the communication protocol or library required for retrieving data from
the DHT11 sensor.
4.3 Interfacing the Temperature and Humidity Sensor (DHT11) with ESP32 and I2C
LCD:
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
✓ Explain the process of connecting both the DHT11 sensor and the LCD display to
the ESP32 microcontroller.
✓ Discuss the necessary wiring connections and pin assignments for simultaneous
interfacing of the DHT11 sensor and I2C LCD display.
✓ Describe any additional considerations or modifications required to
accommodate both the DHT11 sensor and I2C LCD display simultaneously.
✓ Demonstrate the integration of the DHT11 sensor and I2C LCD display by
displaying temperature and humidity readings on the LCD.

Circuit / Schematic Diagram

Figure 4.1: Schematic of interfacing the Temperature and Humidity Sensor (DHT11) with ESP32

Figure 4.2: Schematic of interfacing the Temperature and Humidity Sensor (DHT11) with ESP32 and
I2C LCD

Code

4.2 Interfacing the Temperature and Humidity Sensor (DHT11) with ESP32

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
#include <DHT.h>
#define DHTPIN 4 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(2000); // Wait 2 seconds between measurements
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("%, Temperature: ");
Serial.print(temperature);
Serial.println("°C");
}

4.3 Interfacing the Temperature and Humidity Sensor (DHT11) with ESP32 and I2C LCD
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 4 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address to 0x27 for a 16 chars and 2 line
display
void setup() {

Serial.begin(9600);
dht.begin();
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
}
void loop() {
delay(2000); // Wait 2 seconds between measurements
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
lcd.clear(); // Clear the LCD display
lcd.setCursor(0, 0); // Set cursor to the first row
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print("C");
lcd.setCursor(0, 1); // Set cursor to the second row
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print("%");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("%, Temperature: ");
Serial.print(temperature);
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Serial.println("°C");
}

Observation

Figure 4.2.1: Simulation based interfacing the Temperature and Humidity Sensor (DHT11) with ESP32

Figure 4.2.2: Hardware Implementation based interfacing the Temperature and Humidity Sensor
(DHT11) with ESP32

Figure 4.3.1: Simulation based interfacing the Temperature and Humidity Sensor (DHT11) with ESP32
and I2C LCD

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 4.3.1: Hardware Implementation based interfacing the Temperature and Humidity Sensor
(DHT11) with ESP32 and I2C LCD

Objective 5
Exploring OLED Display Modules: Wiring, Library Installation, 'Hello World!' Example,
Advanced Functionality, and Graphic Capabilities with ESP32.

5.1 OLED Display Module Overview

✓ Explain the concept and working principle of OLED (Organic Light-Emitting


Diode) display modules.
✓ Discuss the advantages and features of OLED displays, such as high contrast,
wide viewing angles, and low power consumption.
✓ Describe the structure and components of an OLED display module, including
the display panel and driver circuitry.
✓ Introduce the concept of the OLED memory map and its role in organizing and
controlling display content.
5.2 Interfacing an OLED Display Module to an ESP32.

✓ Identify the necessary pins on the ESP32 for connecting an OLED display module.
✓ Explain the wiring connections between the OLED display module and the ESP32
microcontroller.
✓ Discuss any additional components or resistors required for proper operation.
✓ Provide guidance on avoiding common wiring mistakes and ensuring reliable
connections.
✓ Identify the appropriate library for controlling the OLED display module with an
ESP32.
✓ Demonstrate the process of installing the OLED library in the Arduino IDE.
✓ Explain the purpose of the library and the functions it provides for controlling
the display.
5.3 Displaying Text on an OLED Display Module: "Hello World!" and “ESPUA
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
OLED” Example with different font size.

✓ Write an Arduino sketch to display the message “!Hello World!" and “ESPUA
OLED” on the OLED display with different font size in center position of OLED
screen also.
✓ Explain the code structure and key functions used to control the OLED display
module.
✓ Upload the sketch to the ESP32 microcontroller and verify the successful display
of the message on the OLED.
5.4 Exploring Advanced Functionality of OLED Displays: Numeric Bases, ASCII
Symbols, Text Scrolling, and Partial Display Scrolling with ESP32.

5.4.1 Display Numbers with Different Bases (Hex, Dec):

✓ Explain how to configure the OLED display to output numbers in different


numerical bases, such as hexadecimal (Hex) and decimal (Dec).
✓ Demonstrate the conversion and display of numeric values, showcasing
the differences between the bases.
5.4.2 Display ASCII Symbols on the OLED:

✓ Discuss the concept of ASCII (American Standard Code for Information


Interchange) and its representation of characters using numeric codes.
✓ Demonstrate how to display ASCII symbols and characters on the OLED
display, including special characters and extended character sets.
5.4.3 Horizontal and Vertical Text Scrolling:

✓ Explain the methods and techniques for scrolling text horizontally on the
OLED display, allowing longer messages to fit within the limited screen
width.
✓ Demonstrate the implementation of horizontal text scrolling in an
Arduino sketch, showcasing the smooth transition and readability of the
scrolling text.
✓ Discuss the considerations and limitations when scrolling text vertically
on the OLED display, including potential memory constraints and visual
effects.
5.4.4 Partial Display Scrolling:

✓ Explain the concept of partial display scrolling, allowing specific sections


or areas of the OLED display to scroll independently.
✓ Discuss the advantages and applications of partial display scrolling in
scenarios where only a portion of the display needs to be updated or
highlighted.
✓ Provide guidance on implementing partial display scrolling in code,
including specifying the scrolling area and controlling the scrolling speed.
5.5 Exploring Graphic Capabilities of OLED Displays: Drawing Rectangles, Circles,

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Triangles, and Round Rectangles with ESP32.

5.5.1 Drawing Rectangles and filled rectangles:

✓ Explain the process of drawing rectangles on the OLED display using


specified coordinates, width, and height.
✓ Demonstrate how to draw both outlined rectangles and filled rectangles
on the OLED display.
✓ Discuss the application of rectangles in graphical user interfaces (GUIs)
and visual representation.
5.5.2 Drawing Round Rectangles and filled round rectangles:

✓ Explain the concept of round rectangles and their distinctive rounded


corners.
✓ Demonstrate how to draw both outlined round rectangles and filled round
rectangles on the OLED display.
✓ Discuss the aesthetic appeal and usage of round rectangles in graphical
interfaces and design.
5.5.3 Drawing Circles and filled Circles:

✓ Explain the method for drawing circles on the OLED display, utilizing a
center point and radius.
✓ Demonstrate how to draw both outlined circles and filled circles on the
OLED display.
✓ Discuss the usage of circles in various applications, such as visual
indicators and circular representations.
5.5.4 Drawing Triangles and filled triangles:

✓ Discuss the process of drawing triangles on the OLED display using three
specified points or coordinates.
✓ Demonstrate how to draw both outlined triangles and filled triangles on
the OLED display.
✓ Highlight the application of triangles in geometric representations and
graphical elements.

Circuit / Schematic Diagram

Figure 5: Schematic of exploring OLED Display Modules: Wiring, Library Installation, 'Hello World!'
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Example, Advanced Functionality, and Graphic Capabilities with ESP32.

Code

5.3 Displaying Text on an OLED Display Module: "Hello World!" and “ESPUA OLED”
Example with different font size.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
// Define screen dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Set text size, color, and cursor position for "Hello World!"
display.setTextSize(2); // Set text size to 2

display.setTextColor(SSD1306_WHITE); // Set text color to white


display.setCursor((SCREEN_WIDTH - 12 * 2 * 6) / 2, (SCREEN_HEIGHT - 2 * 8) / 2 - 16); //
Center "Hello World!" text
display.print(F("Hello World!")); // Print "Hello World!"
// Display the text
display.display();
delay(2000); // Wait for 2 seconds
// Clear the display buffer
display.clearDisplay();
// Set text size, color, and cursor position for "ESPUA OLED"
display.setTextSize(1); // Set text size to 1
display.setTextColor(SSD1306_WHITE); // Set text color to white
display.setCursor((SCREEN_WIDTH - 8 * 9) / 2, (SCREEN_HEIGHT - 8) / 2 + 8); // Center
"ESPUA OLED" text
display.print(F("ESPUA OLED")); // Print "ESPUA OLED"
// Display the text
display.display();
}
void loop() {
// No actions needed in loop
}

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
5.4 Exploring Advanced Functionality of OLED Displays: Numeric Bases, ASCII Symbols,
Text Scrolling, and Partial Display Scrolling with ESP32.

5.4.1 Display Numbers with Different Bases (Hex, Dec)


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
// Define screen dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Example number
int number = 255;
// Set text size and color
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
// Display number in decimal
display.setCursor(0, 0);
display.print(F("Decimal: "));
display.print(number, DEC);
// Display number in hexadecimal
display.setCursor(0, 16);
display.print(F("Hexadecimal: "));
display.print(number, HEX);
// Display number in binary
display.setCursor(0, 32);
display.print(F("Binary: "));
display.print(number, BIN);
// Display number in octal
display.setCursor(0, 48);
display.print(F("Octal: "));
display.print(number, OCT)
// Update the display
display.display();
}
void loop() {
}
5.4.2 Display ASCII Symbols on the OLED

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
// Define screen dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Set text size and color
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
// Display ASCII characters from 32 to 126
int x = 0;
int y = 0;
for (int i = 32; i < 127; i++) {
display.setCursor(x, y);
display.write((char)i); // Write ASCII character
x += 6; // Move cursor to next position
if (x + 6 > SCREEN_WIDTH) {
x = 0;
y += 8; // Move to next line
if (y + 8 > SCREEN_HEIGHT) {
break; // Stop if out of display area
}
}
}
// Update the display
display.display();
}
void loop() {
// No actions needed in loop
}
5.4.3 Horizontal and Vertical Text Scrolling
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
// Define screen dimensions

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Message to scroll
const char* message = "This is a long message scrolling horizontally on the OLED display.";
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
}
void loop() {
// Scroll the text horizontally
for (int x = SCREEN_WIDTH; x > -6 * strlen(message); x--) {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(x, (SCREEN_HEIGHT - 8) / 2);
display.print(message);
display.display();
delay(30);
}
}

5.4.4 Partial Display Scrolling


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
// Define screen dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Message to scroll
const char* scrollingMessage = "Scrolling section of the display! ";
const char* staticMessage = "Static Area";
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
display.clearDisplay();
// Display the static message at the top
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.print(staticMessage);
display.display();
}
void loop() {
// Scroll the message horizontally in the lower part of the display
for (int x = SCREEN_WIDTH; x > -6 * strlen(scrollingMessage); x--) {
display.fillRect(0, 16, SCREEN_WIDTH, 16, SSD1306_BLACK); // Clear the scrolling
area
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(x, 16); // Set cursor to the scrolling area
display.print(scrollingMessage);
display.display();
delay(30);
}
}
5.5 Exploring Graphic Capabilities of OLED Displays: Drawing Rectangles, Circles,
Triangles, and Round Rectangles with ESP32.

5.5.1 Drawing Rectangles and filled rectangles


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Draw an outlined rectangle
drawOutlinedRectangle(10, 10, 50, 30);
// Draw a filled rectangle
drawFilledRectangle(70, 10, 50, 30);
// Display the drawn shapes
display.display();
}
void loop() {
// Nothing to do in the loop
}
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
// Function to draw an outlined rectangle
void drawOutlinedRectangle(int x, int y, int width, int height) {
display.drawRect(x, y, width, height, SSD1306_WHITE);
}
// Function to draw a filled rectangle
void drawFilledRectangle(int x, int y, int width, int height) {
display.fillRect(x, y, width, height, SSD1306_WHITE);
}
5.5.2 Drawing Round Rectangles and filled round rectangles:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Draw an outlined round rectangle
drawOutlinedRoundRectangle(10, 10, 50, 30, 10);
// Draw a filled round rectangle
drawFilledRoundRectangle(70, 10, 50, 30, 10);
// Display the drawn shapes
display.display();
}
void loop() {
// Nothing to do in the loop
}
// Function to draw an outlined round rectangle
void drawOutlinedRoundRectangle(int x, int y, int width, int height, int radius) {
display.drawRoundRect(x, y, width, height, radius, SSD1306_WHITE);
}
// Function to draw a filled round rectangle
void drawFilledRoundRectangle(int x, int y, int width, int height, int radius) {
display.fillRoundRect(x, y, width, height, radius, SSD1306_WHITE);
}
5.5.3 Drawing Circles and filled Circles
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// Define the OLED reset pin


#define OLED_RESET -1

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Draw an outlined circle
drawOutlinedCircle(30, 30, 20);
// Draw a filled circle
drawFilledCircle(90, 30, 20);
// Display the drawn shapes
display.display();
}
void loop() {
// Nothing to do in the loop
}
// Function to draw an outlined circle
void drawOutlinedCircle(int x, int y, int radius) {
display.drawCircle(x, y, radius, SSD1306_WHITE);
}
// Function to draw a filled circle
void drawFilledCircle(int x, int y, int radius) {
display.fillCircle(x, y, radius, SSD1306_WHITE);
}

5.5.4 Drawing Triangles and filled triangles


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED reset pin
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
// Clear the display buffer
display.clearDisplay();
// Draw an outlined triangle
drawOutlinedTriangle(20, 10, 50, 50, 80, 10);
// Draw a filled triangle
drawFilledTriangle(20, 60, 50, 100, 80, 60);
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
// Display the drawn shapes
display.display();
}
void loop() {
// Nothing to do in the loop
}
// Function to draw an outlined triangle
void drawOutlinedTriangle(int x0, int y0, int x1, int y1, int x2, int y2) {
display.drawTriangle(x0, y0, x1, y1, x2, y2, SSD1306_WHITE);
}
// Function to draw a filled triangle
void drawFilledTriangle(int x0, int y0, int x1, int y1, int x2, int y2) {
display.fillTriangle(x0, y0, x1, y1, x2, y2, SSD1306_WHITE);
}

Observation

Figure 5.3.1: Simulation based displaying Text on an OLED Display Module: "Hello World!" and
“ESPUA OLED” Example with different font size.

Figure 5.3.2: Hardware Implementation based displaying Text on an OLED Display Module: "Hello
World!" and “ESPUA OLED” Example with different font size.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 5.4.1.1: Simulation based displaying Numbers with Different Bases (Hex, Dec)

Figure 5.4.1.2: Hardware Implementation based displaying Numbers with Different Bases (Hex, Dec)

Figure 5.4.2.1: Simulation based displaying ASCII Symbols on the OLED

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 5.4.2.2: Hardware Implementation based displaying ASCII Symbols on the OLED

Figure 5.4.3.1: Simulation based displaying Horizontal and Vertical Text Scrolling

Figure 5.4.3.2: Hardware Implementation based displaying Horizontal and Vertical Text Scrolling

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 5.4.4.1: Simulation based displaying partial Display Scrolling

Figure 5.4.4.2: Hardware Implementation based displaying partial Display Scrolling

Figure 5.5.1.1: Simulation based drawing Rectangles and filled rectangles

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 5.5.1.2: Hardware Implementation based drawing Rectangles and filled rectangles

Figure 5.5.2.1: Simulation based drawing Round Rectangles and filled round rectangles

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 5.5.2.2: Hardware Implementation based drawing Round Rectangles and filled round rectangles

Figure 5.5.3.1: Simulation based drawing Circles and filled Circles

Figure 5.5.3.2: Hardware Implementation based drawing Circles and filled Circles

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 5.5.4.1: Simulation based drawing Triangles and filled triangles

Figure 5.5.4.2: Hardware Implementation based drawing Triangles and filled triangles

Objective 6
Mastering 7-Segment Displays with ESP32: Wiring, Library Integration, Sequential Counting
from 0 to 9 and Electronic Dice Roller Project.

6.1 Understanding the Working Principle of a 7-Segment Display:

✓ Explain the basic structure and functionality of a 7-Segment display, including its
arrangement of individual segments and common pin configurations.
✓ Differentiate between Common Cathode (CC) and Common Anode (CA) types
of 7-Segment displays, highlighting their electrical characteristics and wiring
requirements.
✓ Describe how a 7-Segment display works, including the concept of segment
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
activation and decoding to display different numbers and characters.
✓ Discuss the importance of current-limiting resistors in controlling the brightness
and preventing excessive current flow through the display.
6.2 Interfacing a 7-Segment Display Module to an ESP32 and Writing an Arduino
Sketch to Count from 0 to 9.

✓ Provide a step-by-step guide on how to physically connect a 7-Segment display


to the appropriate pins on an ESP32 board.
✓ Highlight the significance of current-limiting resistors in the wiring setup to
ensure safe operation and optimal display brightness.
✓ Introduce the SevSeg library, which simplifies the process of controlling 7-
Segment displays with ESP32.
✓ Explain the features and functionalities offered by the SevSeg library, such as
segment mapping, decimal point control, and multiplexing.
✓ Demonstrate how to write an Arduino sketch utilizing the SevSeg library to count
sequentially from 0 to 9 on the 7-Segment display.
✓ Discuss the programming concepts involved, such as loop structures and
controlling segment activation.

6.3 Building an Electronic Dice Roller with 7-Segment Display and ESP32:
Automating Dice Rolls for Fun Games.

6.3.1 Understanding the Electronic Dice Roller Project:

✓ Explain the concept and purpose of the electronic dice roller project, which
automates the dice rolling process for fun dice games.
✓ Discuss the advantages and convenience of using an electronic dice roller
compared to traditional dice.
6.3.2 Triggering the Dice Roll with the Tactile Switch:

✓ Connect the 7-Segment display to the appropriate ESP32 pins based on the
defined segment pins in the code.
✓ Establish the wiring connections for the tactile switch (push button) and
assign it to the specified pin in the code.
✓ Read the state of the tactile switch using the digitalRead() function within
the loop().
✓ If the button state is HIGH (pressed), generate a random number between
1 and 6 using the random() function.
✓ Set the generated number as the new value to be displayed on the 7-
Segment display using sevseg.setNumber().
✓ Refresh the display to show the rolled dice number using
sevseg.refreshDisplay().

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Circuit / Schematic Diagram

Figure 6.2: Schematic of interfacing a 7-Segment Display Module to an ESP32 and Writing an Arduino
Sketch to Count from 0 to 9.

Figure 6.3: Schematic of building an Electronic Dice Roller with 7-Segment Display and ESP32:
Automating Dice Rolls for Fun Games.

Code
6.2 Interfacing a 7-Segment Display Module to an ESP32 and Writing an Arduino Sketch to
Count from 0 to 9.
#include "SevSeg.h"
const int segmentPins[] = {13, 12, 14, 27, 26, 25, 33}; // Segment pins A to G
const int commonPin = 32; // Common pin
EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)
Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
SevSeg sevseg; // Create SevSeg object
void setup() {
sevseg.begin(COMMON_CATHODE, 1, segmentPins, commonPin); // Initialize display type
and pins
sevseg.setBrightness(90); // Set display brightness
}
void loop() {
for (int i = 0; i <= 9; i++) {
sevseg.setNumber(i); // Display number i
sevseg.refreshDisplay(); // Refresh the display
delay(1000); // Wait for 1 second
}
}
6.3 Building an Electronic Dice Roller with 7-Segment Display and ESP32: Automating Dice
Rolls for Fun Games.

6.3.2 Triggering the Dice Roll with the Tactile Switch


#include "SevSeg.h" // Include the SevSeg library
const int segmentPins[] = {13, 12, 14, 27, 26, 25, 33}; // GPIO pins for segments A to G
const int commonCathodePin = 32; // Common cathode pin
const int buttonPin = 15; // GPIO pin for the tactile switch
SevSeg sevseg; // Create a SevSeg object
void setup() {
pinMode(buttonPin, INPUT); // Set button pin as input
for (int i = 0; i < 7; i++) {
pinMode(segmentPins[i], OUTPUT); // Set segment pins as output
}
// Configure the 7-segment display
sevseg.begin(COMMON_CATHODE, 1, segmentPins, commonCathodePin);
sevseg.setBrightness(90); // Set display brightness
}
void loop() {
int buttonState = digitalRead(buttonPin); // Read the state of the button
if (buttonState == HIGH) { // If the button is pressed
int diceNumber = random(1, 7); // Generate a random number between 1 and 6
sevseg.setNumber(diceNumber); // Set the number to the display
}
sevseg.refreshDisplay(); // Refresh the display to show the current number
}

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Observation

Figure 6.2.1: Simulation based interfacing a 7-Segment Display Module to an ESP32 and Writing an
Arduino Sketch to Count from 0 to 9.

Figure 6.2.2: Hardware Implementation based interfacing a 7-Segment Display Module to an ESP32
and Writing an Arduino Sketch to Count from 0 to 9.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Figure 6.3.2.1: Simulation based triggering the Dice Roll with the Tactile Switch

Figure 6.3.2.2: Hardware Implementation based triggering the Dice Roll with the Tactile Switch

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Conclusion:

Precautions:

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
Post Experiment Questionnaire:
1) Which library is used for LCD control in Arduino sketches? How do you include and utilize this
library?

2) What is the I2C address of the LCD display used in the experiment?

3) How many wires are required to connect an I2C LCD display to the ESP32?

4) What is the range of I2C addresses available for an I2C device?

5) If the contrast of the I2C LCD display is too low, what component should be adjusted?

6) How many custom characters can be created on a standard 16x2 I2C LCD display?

7) How many bytes of RAM does each custom character occupy on an I2C LCD display?

8) If an I2C LCD display has an address of 0x3F, what is the decimal equivalent of this address?

9) What is the voltage level required for the VCC pin of the I2C LCD display?

10) If the I2C LCD display has an operating current of 2mA and is powered by a 5V source, what is
the power consumption of the display?

11) The I2C bus supports a maximum data rate of 400kHz. If the bus clock frequency is 1MHz, what
is the duty cycle of the clock signal?

12) How many wires are required to connect multiple I2C devices to the same I2C bus?

13) If an I2C LCD display operates at an I2C bus speed of 100kHz and has an I2C address of 0x27,
what is the time required to transmit a single byte of data?

14) The I2C protocol supports a maximum of 8 bits for addressing. How many different devices can
be connected to a single I2C bus using the 8-bit addressing scheme?

15) The I2C bus allows for multi-master communication. If two devices simultaneously try to transmit
data on the bus, causing a collision, what mechanism is used to resolve the collision?

16) What is the measurement range of the DHT11 sensor for temperature and humidity?

17) What is the accuracy of the DHT11 sensor for temperature and humidity measurements?

18) The DHT11 sensor provides a temperature reading of 25.6 degrees Celsius. Convert this
temperature to Fahrenheit.

19) The DHT11 sensor reports a humidity level of 62%. Express this humidity as a decimal.

20) The DHT11 sensor has an accuracy of ±2°C for temperature measurements. If the actual
temperature is 28°C, what is the maximum and minimum possible temperature reading by the
sensor?

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
21) The DHT11 sensor has a measurement range of 0°C to 50°C for temperature readings. If the sensor
reports a temperature of 55°C, is it within the measurement range?

22) The DHT11 sensor has a power supply voltage of 3.3V. If the sensor draws a current of 2.5mA,
what is the power consumption?

23) The DHT11 sensor takes 2 seconds to provide a stable reading after power-up. If the sensor is
powered on at 10:00 AM, at what time will the reading be stable?

24) The I2C LCD display operates at an I2C bus speed of 400kHz. Calculate the time required to
transmit 1 byte of data.

25) The DHT11 sensor has a response time of 1 second. If the sensor is queried every 5 seconds, what
percentage of the time is the sensor actively providing readings?

26) The DHT11 sensor reports a temperature of 20.5°C and a humidity of 42.8%. Convert the
temperature to Fahrenheit and round it to the nearest whole number.

27) The DHT11 sensor has an accuracy of ±5% for humidity measurements. If the actual humidity is
60%, what is the maximum and minimum possible humidity reading by the sensor?

28) The DHT11 sensor has a measurement range of 20°C to 40°C for temperature readings. If the
sensor reports a temperature of 18°C, is it within the measurement range?

29) The DHT11 sensor requires a pull-up resistor of 10kΩ for communication. If a 5V power supply
is used, what is the power dissipated by the pull-up resistor?

30) The I2C LCD display has an operating voltage of 5V and draws a current of 20mA. What is the
power consumption of the LCD display?

31) The DHT11 sensor has a sampling rate of 1Hz. If the sensor has been running for 2 minutes, how
many readings has it taken?

32) The I2C LCD display has a display size of 16x2 characters. If each character is represented by 5x8
pixels, how many pixels are there on the display?

33) Calculate the total number of pixels in an OLED display module with a resolution of 128x64.

34) Interfacing an OLED Display Module to an ESP32: a) If the VCC pin of the OLED display module
requires a voltage of 3.3V and the ESP32 provides 5V, calculate the value of the resistor required
for voltage level conversion using Ohm's Law (V = IR).

35) Displaying Text on an OLED Display Module: a) If the OLED display module has a screen size of
128x32 pixels and the desired text is "Hello, World!", calculate the maximum number of characters
that can fit on a single line, assuming each character occupies 8 pixels.

36) Suppose you want to display a hexadecimal value "0xDEAD" on the OLED display. Convert this
value to decimal and display it.

37) Exploring Graphic Capabilities of OLED Displays: a) Calculate the circumference of a circle with
a radius of 10 pixels.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays
38) If an OLED display module has a display panel size of 0.96 inches and a resolution of 128x64
pixels, calculate the pixel density in pixels per inch (PPI).

39) Interfacing an OLED Display Module to an ESP32: a) The OLED display module requires a current
of 20mA for proper operation. If the supply voltage is 3.3V, calculate the value of the current-
limiting resistor using Ohm's Law (R = V/I).

40) Displaying Text on an OLED Display Module: a) If the OLED display module supports a font size
of 8x16 pixels per character and you want to display the message "Hello" on the screen, calculate
the width and height required to display the entire message.

41) Suppose you want to display the ASCII code of the character 'A' on the OLED display. Calculate
the decimal ASCII value of 'A' and display it.

42) Calculate the area of a rectangle with dimensions 20 pixels (width) and 10 pixels (height).

43) The ESP32 is connected to a Common Cathode (CC) 7-Segment display. The forward voltage drop
across each segment is 2.1V, and the desired segment current is 10mA. The power supply voltage
is 5V. Calculate the value of the current-limiting resistor required for each segment.

44) The 7-Segment display is connected to an ESP32 using multiplexing. The display is multiplexed
at a frequency of 500Hz. Calculate the time duration for each segment to be ON in one complete
cycle.

45) The 7-Segment display is multiplexed with a refresh rate of 1kHz. Each digit consists of 7
segments. Calculate the time it takes to refresh all the digits on the display.

46) Write an Arduino sketch to display a floating-point number, such as 3.14, on a 7-Segment display
using the SevSeg library. Ensure that the decimal point is properly displayed.

47) The 7-Segment display is multiplexed with a frequency of 1kHz. Each digit consists of 7 segments.
Calculate the duty cycle of each segment.

48) A Common Anode (CA) 7-Segment display is used, and the supply voltage is 3.3V. Determine the
voltage levels required to turn ON a segment and turn OFF a segment.

49) A Common Cathode (CC) 7-Segment display is used, and the supply voltage is 5V. The forward
voltage drop across each segment is 1.8V, and the current flowing through each segment is 15mA.
Calculate the value of the current-limiting resistor required for each segment.

EMBEDDED SYSTEM ARDUINO PROJECT (MEL 4109)


Integrating Display Systems with ESP32 Microcontroller for Embedded System Projects: Understanding Compatibility and
Integration with LCD, OLED, and Seven-Segment Displays

You might also like