0% found this document useful (0 votes)
30 views11 pages

IE-321L Instrumentation & Control (LAB)

The document outlines a lab experiment focused on controlling LEDs using an Arduino microcontroller and button inputs, implementing a binary control pattern. It details the objectives, working tools like Proteus 8 Professional, and the step-by-step procedure for circuit design, coding, and simulation. The conclusion emphasizes the hands-on experience gained in digital I/O principles and potential applications in various electronic projects.

Uploaded by

itiszubair99100
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)
30 views11 pages

IE-321L Instrumentation & Control (LAB)

The document outlines a lab experiment focused on controlling LEDs using an Arduino microcontroller and button inputs, implementing a binary control pattern. It details the objectives, working tools like Proteus 8 Professional, and the step-by-step procedure for circuit design, coding, and simulation. The conclusion emphasizes the hands-on experience gained in digital I/O principles and potential applications in various electronic projects.

Uploaded by

itiszubair99100
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/ 11

IE-321L Instrumentation & Control (LAB)

Open Ended Lab

Submitted By: Imaad Ullah Khan Yameen, 21JZIND0187


Essa Khattak, 21JZIND01
Hazrat Zubair, 21JZIND01
Fazyiab Buner, 21JZIND01
Department: Industrial Engineer
Semester 7th / Fall 2024
Submitted To: Engr. Muhammad Fayyaz

University of Engineering & Technology Peshawar, Jalozai Campus.

1
Contents
Open Ended Lab ................................................................................................................................................ 3
Objectives: ......................................................................................................................................................... 3
Introduction: ....................................................................................................................................................... 3
Arduino: ......................................................................................................................................................... 3
Key Components:....................................................................................................................................... 3
Common Uses: ........................................................................................................................................... 3
Working Tools: ................................................................................................................................................... 4
Proteus 8 Professional: ................................................................................................................................... 4
Key Features of Proteus 8 Professional: ........................................................................................................ 4
Benefits of using Proteus 8 Professional: .................................................................................................. 4
Applications of Proteus 8 Professional: ..................................................................................................... 4
Apparatus In Application: .............................................................................................................................. 5
Arduino IDE: ................................................................................................................................................. 5
Working Procedure: ........................................................................................................................................... 6
Data & Observation: .......................................................................................................................................... 9
Arduino IDE Code: ...................................................................................................................................... 10
Results & Discussion: ...................................................................................................................................... 11
Conclusion: ...................................................................................................................................................... 11

2
Open Ended Lab
"Implementing LED On/Off Control in Binary (0 & 1)
Pattern Using Button Input with Arduino Uno R3."

Objectives:
The main objectives of this lab are:

 To study the control of an LED's On/Off state using an Arduino microcontroller and button input.
 To implement a binary (0 & 1) pattern for LED control.
 To understand the interaction between digital input (button) and digital output (LED).

Introduction:
This experiment demonstrates the use of an Arduino microcontroller to control an LED using a button input,
following a binary (0 & 1) pattern. Binary patterns are fundamental in digital systems, representing the
simplest form of signal states—on (1) and off (0). In this experiment, a button serves as the digital input to
toggle the LED state, showcasing the basic functionality of a microcontroller's input-output (I/O) system. This
experiment serves as a foundation for understanding more complex digital systems involving user interaction
and real-time control.

Arduino:
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's designed for
anyone interested in creating interactive objects or environments.

Key Components:
 Hardware: Arduino boards are physical circuit boards containing a microcontroller, which is a
small computer on a chip. These boards have various inputs and outputs, allowing them to interact
with the world around them.
 Software: The Arduino IDE (Integrated Development Environment) is a software program used
to write and upload code to the Arduino board. It uses a simplified version of C/C++ for
programming.

Common Uses:
 Robotics: Building robots that can move, sense their environment, and interact with people.
 Home automation: Controlling lights, appliances, and other devices in your home.
 Internet of Things (IoT): Connecting everyday objects to the internet, allowing them to be
controlled remotely or monitored.
 Art and design: Creating interactive art installations and other creative projects.
 Education: Teaching electronics and programming concepts in schools and universities.

3
Working Tools:
Proteus 8 Professional:
Proteus 8 Professional is a powerful electronic design automation (EDA) software suite from Labcenter
Electronics. It's a comprehensive toolset used by engineers, educators, and hobbyists for designing, simulating,
and prototyping electronic circuits.

Key Features of Proteus 8 Professional:


 Schematic Capture (ISIS):
o Create and edit electronic schematics using a vast library of components.
o Hierarchical design for complex circuits.
o Advanced annotation and documentation features.
 PCB Layout (ARES):
o Design and route PCBs with powerful routing algorithms.
o 3D PCB visualization for improved design understanding.
o Extensive library of PCB footprints.
 Microcontroller Simulation:
o Simulate a wide range of microcontrollers with built-in compilers and debuggers.
o Co-simulate hardware and software in real-time.
o Develop and test embedded systems within the software.
 Virtual System Modeling (VSM):
o Simulate entire systems, including hardware, software, and peripherals.
o Test and debug designs before building physical prototypes.
o Analyze system behavior and performance.
 Mixed-Mode Simulation:
o Simulate both analog and digital circuits within the same environment.
o Analyze the interaction between different parts of your design.
 Extensive Component Libraries:
o Access a vast library of components, including passive components, active components,
microcontrollers, and more.
o Easily find and add components to your designs.

Benefits of using Proteus 8 Professional:


 Reduced Development Time: Simulate and test designs virtually, reducing the need for expensive
and time-consuming physical prototypes.
 Improved Design Quality: Identify and debug design issues early in the development process,
leading to more reliable and robust products.
 Increased Productivity: Streamline the design process with powerful tools for schematic capture,
PCB layout, and simulation.
 Enhanced Collaboration: Share designs and collaborate with other team members effectively.
 Cost-Effectiveness: Reduce development costs by minimizing the need for physical prototypes
and reducing the risk of design errors.

Applications of Proteus 8 Professional:


 Education: Teaching electronics and embedded systems design in universities and colleges.
 Research and Development: Designing and prototyping new electronic circuits and systems.

4
 Industrial Design: Developing and manufacturing electronic products for a wide range of
industries.
 Hobbyists: Designing and building electronic projects, such as robots, sensors, and other gadgets.

Figure 1,Proteus GUI.

Apparatus In Application:
a. Arduino Uno R3 (virtual component in Proteus)
b. 36 LEDs (virtual component in Proteus)
c. 2 Buttons
d. DC in (5V) and ground
e. Connecting wires (virtual components)

Arduino IDE:
The Arduino Integrated Development Environment - or Arduino Software (IDE) - contains a text editor for
writing code, a message area, a text console, a toolbar with buttons for common functions and a series of
menus. It connects to the Arduino hardware to upload programs and communicate with them.
Arduino Ide has the following main components:

 Sketchbook
 Serial monitor
 Libraries
 Compilers
 Uploading/Programming
 Board Supports
 Tools

5
Figure 2,Arduino IDE.

Working Procedure:
 Software Setup:
o Open Proteus 8 Professional and create a new project.
o From the component library, select and place the following components on the workspace:
 Arduino Uno
 LEDs
 Buttons
 Ground (GND) and VCC (if required for the simulation setup).

Figure 3,Library Option.

6
 Circuit Design in Proteus:
o Connect Three LEDs in parallel so that each have common Ground & VCC.
o Connect the anode of the LEDs to one end to a digital output pin (Pin 2) and the cathode to the
ground (GND) pin on the Arduino.
o Do the same for rest of LEDS (36 LEDs, 6 Connection (Pin 2 – 7)).
o Connect one terminal of the push button to the 5V pin on the Arduino and the other terminal to a
digital input pin (Pin 10). Do the same for second button but select Pin 11.
o Verify all connections and ensure the circuit design is error-free.

Figure 4,diagram In Proteus.

 Code Implementation:
o Open Arduino Ide and Start New Sketch.
o Write a code by including the basic Arduino Library, then declaring the pins for output and input.
o Then in setup write code for testing and initiating the program.
o And in the loop write the code as follows,
 Declare Input Pin 10 to be button 1 and Pin 11 to be button 2.
 then write,
 If button 1 is pressed so, power output to LED Pin output 2 and 3
 If button 2 is pressed so, power output to LED Pin output 2 – 7
 Else all output is 0.
 Delay 250 milliseconds.
o Save and compile the code to Proteus using the Arduino IDE.

7
Figure 5,Code In Arduino IDE

 Uploading Code to Proteus:


o Double-click the Arduino Uno R3 in Proteus to open its properties.
o Upload the compiled .hex file to the Arduino Uno in Proteus.
o Close the properties dialog box.

Figure 6,Component Dialogue Menu.

8
 Simulation:
o Run the simulation in Proteus.
o Press the Buttons and observe changes in the LEDs in real-time.

Data & Observation:

Figure 7,No Button Is Pressed.

Figure 8, Button 1 is Pressed.

9
Figure 9, Button 2 is pressed.

Arduino IDE Code:


#include <Arduino.h>
const int numLEDs = 6; // LEDs connected to pins 2-7
// Define button pins (Digital input pins)
const int buttonPins[] = {10, 11}; // Digital pins 1 and 2 for buttons
const int ledPins[] = {2, 3, 4, 5, 6, 7};// Define LED pins
void setup() { // Initialize LED pins as outputs and test them
for (int i = 0; i < numLEDs; i++) {pinMode(ledPins[i], OUTPUT);
digitalWrite(ledPins[i], HIGH); // Turn LEDs on for testing
delay(250); digitalWrite(ledPins[i], LOW); // Turn LEDs off after testing
} // Initialize button pins as inputs
for (int i = 0; i < 2; i++) {pinMode(buttonPins[i], INPUT); } }
void loop() { // Read the states of the buttons
bool button1State = digitalRead(buttonPins[0]); // Read digital pin 1
bool button2State = digitalRead(buttonPins[1]); // Read digital pin 2
// If button 1 (digital pin 1) is pressed
if (button1State == HIGH) { digitalWrite(ledPins[0], HIGH); // Turn on LED on pin 3
digitalWrite(ledPins[1], HIGH); // Turn on LED on pin 4
} else { digitalWrite(ledPins[0], LOW); // Turn off LED on pin 3

10
digitalWrite(ledPins[1], LOW); // Turn off LED on pin 4}
// If button 2 (digital pin 2) is pressed
if (button2State == HIGH) { for (int i = 0; i < numLEDs; i++) {digitalWrite(ledPins[i], HIGH);
} } else {for (int i = 0; i < numLEDs; i++) {digitalWrite(ledPins[i], LOW); // Turn all LEDs off
} } delay(250); // Short delay for stability}

Results & Discussion:


So, in this lab, The simulation demonstrated LEDs On/Off control using Buttons and programming in Proteus
8 Professional. The LEDs on/off values varies with the button input signal values.
Key Observations:

 Button 1 Control:
o When button 1 (connected to digital pin 10) is pressed (HIGH), it will turn on the first two LEDs
(connected to pins 2 and 3).
o When button 1 is released (LOW), these two LEDs will turn off.
 Button 2 Control:
o When button 2 (connected to digital pin 11) is pressed (HIGH), all six LEDs will turn on.
o When button 2 is released (LOW), all six LEDs will turn off.
Detailed View:

 Initialization:
o The code begins by defining the number of LEDs and their respective pins.
o It also defines the pins for the two buttons.
o In the setup() function, the LED pins are initialized as outputs, and a brief test sequence is
performed to verify their functionality.
o The button pins are initialized as inputs.
 Button Handling:
o In the loop() function, the code continuously reads the states of both buttons.
o If button 1 is pressed, it turns on the first two LEDs.
o If button 2 is pressed, it turns on all six LEDs.
o When either button is released, the corresponding LEDs are turned off.
 Delay:
o A short delay (250 milliseconds) is introduced at the end of the loop() function to provide some
stability and prevent rapid switching of the LED states.

Conclusion:
So, it is concluded that, This Arduino code demonstrates basic button-controlled LED illumination,
showcasing fundamental digital I/O principles. Two buttons independently control two lighting scenarios: the
first button activates two LEDs, while the second illuminates all six. This experiment provided valuable hands-
on experience with the Arduino platform, including pin initialization, digital input/output operations, and basic
coding. The acquired skills are applicable to various projects, such as home automation, robotics, and
interactive installations, laying a strong foundation for further exploration in the field of electronics and
embedded systems.

11

You might also like