[go: up one dir, main page]

0% found this document useful (0 votes)
9 views6 pages

7 Segment

The document outlines a lab exercise for creating a 7-segment display controlled by a microcontroller, with IoT capabilities for remote operation via a web interface. It includes a list of materials needed, step-by-step wiring instructions, and sample code for controlling the display. Optional enhancements for more complex patterns and mobile app integration are also suggested.

Uploaded by

vamc1223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

7 Segment

The document outlines a lab exercise for creating a 7-segment display controlled by a microcontroller, with IoT capabilities for remote operation via a web interface. It includes a list of materials needed, step-by-step wiring instructions, and sample code for controlling the display. Optional enhancements for more complex patterns and mobile app integration are also suggested.

Uploaded by

vamc1223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Lab- Exercise-3 SEVEN SEGMENT DISPLAY

AIM:

create a 7-segment display in an IoT lab exercise, you can follow these steps. This exercise
typically involves controlling a 7-segment display using a microcontroller (like an Arduino or
ESP32), and you can also make it IoT-enabled for remote control via the internet.

Objective:

Control a 7-segment display using a microcontroller and make it IoT-enabled, so that the
number or message on the display can be changed via a web interface or an IoT platform.

Materials:

1. 7-segment display (Common cathode or common anode)

2. Microcontroller (Arduino, ESP32, etc.)

3. Jumper wires

4. Breadboard

5. Resistors (220 ohms, if needed)

6. Wi-Fi module (If not using a Wi-Fi-enabled board like ESP32)

7. Computer with Arduino IDE installed (or platform of choice)

Steps:

Step 1: Wiring the 7-segment Display

1. Identify Pins: A typical 7-segment display has 8 pins: 7 segments (label A to G) and 1
common pin (Common Anode or Common Cathode).

2. Connect Segments to GPIO Pins:

o Connect the 7 pins for segments A-G of the display to available GPIO pins on
the microcontroller.

o If using a Common Cathode display, connect the common pin to GND.

o If using a Common Anode display, connect the common pin to VCC (5V or
3.3V depending on the microcontroller).

3. Resistors:

o Place a 220-ohm resistor between each segment pin (A-G) and the
microcontroller GPIO to limit current.

Step 2: Wiring the Microcontroller (ESP32 or Arduino)


 ESP32/ESP8266:

o These microcontrollers come with Wi-Fi functionality, so you can control the
7-segment display remotely over the internet.

 Arduino:

o If using an Arduino, you can pair it with a Wi-Fi module (like ESP8266) to
make it IoT-enabled.

Step 3: Code the Microcontroller

1. Install Required Libraries:

o For Arduino: You may need a library for controlling the 7-segment display or
manually write the segment control logic.

o For ESP32/ESP8266: You’ll also need libraries for Wi-Fi and web server
functionality.

2. Control Logic for 7-Segment Display: You can write a function to control the
individual segments based on the number you want to display. Below is a sample
Arduino code for controlling a 7-segment display:

void setup() {

pinMode(2, OUTPUT);//A

pinMode(3, OUTPUT);//B

pinMode(4, OUTPUT);//C

pinMode(5, OUTPUT);//D

pinMode(6, OUTPUT);//E

pinMode(7, OUTPUT);//F

pinMode(8, OUTPUT);//G

void loop() {

// NO 0

digitalWrite(2, 0);

digitalWrite(3, 0);

digitalWrite(4, 0);

digitalWrite(5, 0);
digitalWrite(6, 0);

digitalWrite(7, 0);

digitalWrite(8, 1);

delay(1000);

// NO 1

digitalWrite(2, 1); // A

digitalWrite(3, 0);// B

digitalWrite(4, 0);// C

digitalWrite(5, 1);// D

digitalWrite(6, 1);// E

digitalWrite(7, 1);// F

digitalWrite(8, 1);// G

delay(1000);

// NO 2

digitalWrite(2, 0);// A

digitalWrite(3, 0);// B

digitalWrite(4, 1);// C

digitalWrite(5, 0);// D

digitalWrite(6, 0);// E

digitalWrite(7, 1);// F

digitalWrite(8, 0);// G

delay(1000);

// NO 3

digitalWrite(2, 0);// A

digitalWrite(3, 0);// B

digitalWrite(4, 0);// C

digitalWrite(5, 0);// D

digitalWrite(6, 1);// E
digitalWrite(7, 1);// F

digitalWrite(8, 0);// G

delay(1000);

// NO 4

digitalWrite(2, 1);// A

digitalWrite(3, 0);// B

digitalWrite(4, 0);// C

digitalWrite(5, 1);// D

digitalWrite(6, 1);// E

digitalWrite(7, 0);// F

digitalWrite(8, 0);// G

delay(1000);

// NO 5

digitalWrite(2, 0);// A

digitalWrite(3, 1);// B

digitalWrite(4, 0);// C

digitalWrite(5, 0);// D

digitalWrite(6, 1);// E

digitalWrite(7, 0);// F

digitalWrite(8, 0);// G

delay(1000);

// NO 6

digitalWrite(2, 0);// A

digitalWrite(3, 1);// B

digitalWrite(4, 0);// C

digitalWrite(5, 0);// D

digitalWrite(6, 0);// E

digitalWrite(7, 0);// F
digitalWrite(8, 0);// G

delay(1000);

// NO 7

digitalWrite(2, 0);// A

digitalWrite(3, 0);// B

digitalWrite(4, 0);// C

digitalWrite(5, 1);// D

digitalWrite(6, 1);// E

digitalWrite(7, 1);// F

digitalWrite(8, 1);// G

delay(1000);

// NO 8

digitalWrite(2, 0);// A

digitalWrite(3, 0);// B

digitalWrite(4, 0);// C

digitalWrite(5, 0);// D

digitalWrite(6, 0);// E

digitalWrite(7, 0);// F

digitalWrite(8, 0);// G

delay(1000);

// NO 9

digitalWrite(2, 0);// A

digitalWrite(3, 0);// B

digitalWrite(4, 0);// C

digitalWrite(5, 0);// D

digitalWrite(6, 1);// E

digitalWrite(7, 0);// F

digitalWrite(8, 0);// G
delay(1000);

Step 5: Test the Web Interface

 After uploading the code to your microcontroller, open the serial monitor to get the
IP address of your device.

 Open a browser, go to the displayed IP address, and enter the digit you want to
display.

 The 7-segment display should update based on your input.

Optional Enhancements:

 You can make the system display more complex patterns (e.g., letters or scrolling
text) on the 7-segment display.

 You can add more control features, such as a mobile app interface using platforms
like Blynk or Thing Speak.

CONCLUSION:

This exercise introduces both the basics of controlling hardware (7-segment display) and
building an IoT application. Let me know if you need further clarification or assistance.

You might also like