Professional Documents
Culture Documents
LECTURER : 2.
3.
GROUP MEMBERS NAME REGISTRATION NUMBER
STUDENT 1 1.
STUDENT 2 2.
STUDENT 3 3.
STUDENT 4 4.
80%
@Sesi 2:2022
B. LAB REPORT ASSESSMENT
SCORE
Excellent Good Average Weak Very Weak
SCALE SCORE
ASPECT 5 4 3 2 1
Able to write Able to write Able to write Write discussion Discussion was
discussion discussion with discussion with not related not written
clearly related clearly related to related to to practical work clearly and was X1
to practical work practical work practical work objective unrelated to
Discussion objective. Use objective objective the practical
good and work
appropriate objective.
language in
writing
Accurate Accurate A statement of A statement of No conclusion
statement of the statement of the the results of the the results of the included or
results of the lab results of the lab lab indicates lab indicates shows little X1
Conclusion indicates indicates whether results whether results effort and
whether results whether results support the support the reflection on
support the support the hypothesis hypothesis the lab
hypothesis hypothesis
Excellent. All- Almost of the Almost of the Some of the Incomplete/
important results have results have results are incorrect
trends have been correctly been correctly misinterpreted interpretation.
been interpreted and interpreted and and there is no Not answer
interpreted discussed. some correctly clear answer to the question
Question X2
correctly and Answer the answer the the question
discussed. question question
Answer the correctly
question
correctly.
20%
STUDENTS S1 S2 S3 S4
CLO3, P4
OUTCOMES : Upon completion the task, students should be able to:
i) Construct circuit in Proteus simulation software
ii) Build Arduino sketch to controlling LED, buzzer/sounder and Ultrasonic
sensor
EQUIPMENTS / COMPONENTS:
Laptop/PC
THEORY :
Proteus is used to simulate, design and drawing of electronic circuits. It was invented by the
Labcenter electronic. With the use of this engineering software, we can construct and simulate
different electrical and electronic circuits on personal computers or laptops.
Designing of circuits on the proteus takes less time than practical construction of the circuit.
The possibility of error is less in software simulation such as loose connection that takes a lot of time
to find out connections problems in a practical circuit. Furthermore, there is zero possibility of burning
and damaging of any electronic component in proteus.
There are 2 main parts of proteus first is used to design and draw different circuits and the
second is for designing of PCB layout. First is ISIS that used to design and simulate circuits. And second
is ARES that used for designing of a printed circuit board.
Arduino is an open-source platform used for building electronics projects. Arduino consists of
both a physical programmable circuit board (often referred to as a microcontroller) and a piece
of software, or IDE (Integrated Development Environment) that runs on your computer, used to write
and upload computer code to the physical board.
Arduino board contains 14 digital input/output pins and 6 analog pins, USB and power jack.
5V pin supply 5V voltage from the on board regulator, while 3.3V pin supply 3.3 V voltage from on
board regulator. At the same time time maximum current is 50mA.
1
Figure 1 : Arduino board pinout
Digital pins of the board can be used as inputs or outputs, and use three functions:
pinMode(), digitalWrite(), digitalRead() and analogWrite () function, the last one works with the pins
that marked ~PWM symbol.
These pins operate with 5V voltage, maximum 40mA current and contains 20-50kOhm
internal resistors. Some pins however has specified functions:
2
3.0 PROCEDURE :
b). “Pick device” window will appear. Type the component that you want to use in “Keywords”
box. The related component will appear in the Result box as shown below.
e). Click the component, then click again in the Proteus design sheet. The component will
appear and ready to use.
4
10. Step to change component value or label :
a). Right click the component. Select “Edit Properties”.
b). Type the label in part reference box and the value in resistance box (if the component
is resistor).
5
PART B : ARDUINO SKETCH FOR LED SIMULATION
1. Open the Arduino software. Click on the ‘File’ menu and select ‘Preferences’. Click on
the checkbox like below (Figure 9).
//Name :
//Reg.Num :
int RED_LED= 7;
int YEL_LED= 8;
int GRE_LED=9;
void setup() {
pinMode(RED_LED,OUTPUT);
pinMode(YEL_LED,OUTPUT);
pinMode(GRE_LED,OUTPUT);
void loop() {
digitalWrite (YEL_LED,HIGH);
digitalWrite (GRE_LED,HIGH);
delay(1000);
6
digitalWrite (RED_LED,LOW); //LED's OFF for 1 sec
digitalWrite (YEL_LED,LOW);
digitalWrite (GRE_LED,LOW);
delay(1000);
digitalWrite (YEL_LED,HIGH);
digitalWrite (GRE_LED,HIGH);
delay(1000);
digitalWrite (YEL_LED,LOW);
digitalWrite (GRE_LED,LOW);
delay(1000);
delay(1000);
delay(1000);
delay(1000);
delay(1000);
digitalWrite (YEL_LED,LOW);
digitalWrite (GRE_LED,LOW);
delay(2000);
digitalWrite (YEL_LED,HIGH);
digitalWrite (GRE_LED,LOW);
delay(2000);
digitalWrite (YEL_LED,LOW);
digitalWrite (GRE_LED,HIGH);
delay(2000);
7. Select “Verify” at the top of Arduino window. Wait until “Done Compiling” appear at the bottom
of the window.
8. After the window shows “Done Compiling”, find the hex file as shown below. Highlight and copy
the file.
8
PART C : ULTRASONIC SENSOR SIMULATION PROCESS
2. Double click on Arduino diagram in Proteus. Edit component window will appear.
3. Paste the hex file in Program file box. Then, Click OK.
9
3.2 ULTRASONIC SENSOR SIMULATION BY USING PROTEUS
3. Select : This PC > Local disk (C) > Program Files (x86) > Labcenter Electronics >
Proteus 8 Professional > Library
6. Open the Proteus software. Select “New Project”. Save as <Labwork1b_X>. ‘X‘ indicate your
name.
7. Select the following part from library
a). Arduino Uno R3
b). Ultrasonic Sensor
c). Virtual Terminal
8. Drag all component into schematic layout, and use your own creativity for component
arrangement and pin connection. Use below schematic diagram in Figure 11 for guideline.
11. Find your “Ultrasonic Sensor Library” Location. Select UltrasonicTEP.HEX folder. Then, click ok.
1. Open Arduino software. Create new file, naming it as <Labwork1b_X>. ‘X’ indicate your name.
2. Copy Arduino Sketch as shown below. Then, insert your name and registration number.
//Name :
//Reg.Num :
const int echoPin = 2; // Echo Pin of Ultrasonic Sensor
const int pingPin = 3; // Trigger Pin of Ultrasonic Sensor
void setup()
{
Serial.begin(9600); // Starting Serial Communication
pinMode(pingPin, OUTPUT); // initialising pin 3 as output
pinMode(echoPin, INPUT); // initialising pin 2 as input
}
void loop()
{
long duration, inches, cm;
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
duration = pulseIn(echoPin, HIGH); // using pulsin function to determine total time
inches = microsecondsToInches(duration); // calling method
cm = microsecondsToCentimeters(duration); // calling method
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}
long microsecondsToInches(long microseconds) // method to covert microsec to inches
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) // method to covert microsec to centimeters
{ 11
return microseconds / 29 / 2;
}
3. Save your sketch.
5. Select “Verify” at the top of Arduino window. Wait until “Done Compiling” appear at the bottom
of the window.
6. After the window shows “Done Compiling”, find the hex file. Highlight and copy the file.
4. Run the Simulation Button. The Ultrasonic reading will appear on the Virtual Terminal window.
5. The distance shown in the Virtual Terminal window will vary, based on how we set the
adjustable potentiometer in the circuit.
12
4.0 QUESTION :
1. a). Connect Green LED to GPIO 4, Red LED to GPIO 5 and sounder to GPIO 3 in Proteus. Build an
Arduino sketch to light up the Green LED for 2 seconds. Then, the Red LED will light up in 3
seconds. After that let the sounder ON in 2 seconds.
b). Write while(1); command at the end of the sketch in question 1(i) in Arduino. Observe and
explain what will happen to the circuit operation in Proteus.
2. Base on the virtual terminal display, explain what will happen if the potentiometer in Figure 14
was change to :
a). 25%
b). 50%
c). 75%
(3 marks)
5.0 DISCUSSION :
6.0 CONCLUSION :
13