0% found this document useful (0 votes)
11 views8 pages

Suzan

The document is a lab manual for simulating an ultrasonic sensor using Proteus software, detailing steps to add the ultrasonic sensor library and connect it with Arduino. It includes instructions for downloading necessary libraries, setting up the simulation, and writing code to measure distance. The manual is intended for students in the Computer Engineering department at Waziri Umaru Federal Polytechnic, Birnin Kebbi.
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)
11 views8 pages

Suzan

The document is a lab manual for simulating an ultrasonic sensor using Proteus software, detailing steps to add the ultrasonic sensor library and connect it with Arduino. It includes instructions for downloading necessary libraries, setting up the simulation, and writing code to measure distance. The manual is intended for students in the Computer Engineering department at Waziri Umaru Federal Polytechnic, Birnin Kebbi.
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/ 8

WAZIRI UMARU FEDERAL POLYTECHNIC,

BIRNIN KEBBI

Department of Computer Engineering

INTRODUCTION TO MICRO AND ASSEMBLY LANGUAGE


LAB MANUAL (CTE 241)

TOPIC: HOW TO ADD AND SIMULATE ULTRASONIC


SENSOR LIBRARY IN PROTEUS

BY:
Engr. Umar Yahaya
Department of CTE

Name of the Student: ILIYA SUSAN

Matric No: NCT/23/0031

Year/Sem/Class: 2025/2ND SEMISTER/ND 2

1
The Ultrasonic Sensor also called “Ping Sensor” is used to detect the objects in
front and measure the distance between the sensor and object. In this post, I will
show you how you can simulate an ultrasonic sensor in Proteus and how to use
it to measure the distance. But first, let’s see how to add and simulate Ultrasonic
Sensor library in Proteus.

How to add Ultrasonic Sensor Library to Proteus?

STEP 1: First of all have your Proteus application on your desktop

Don’t have Proteus application on your desktop? Click here to download the
.zip file

STEP 2: Download Arduino library (ARDUINO.LIB) and Ultra Sensor Library

***Don’t have an Arduino library? Click here to download.

***Don’t have an Ultra Sensor Library? Click here to download

STEP 3: Unzip the .zip file to the desktop

STEP 4: You will obtain these three files(from the ultrasonic library):

1. UltrasonicTEP.LIB
2. UltrasonicTEP.IDX
3. UltraSonicTEP.HEX

STEP 5: Copy the first two files(1 & 2) and paste them in:

2
“C:\Program Files (x86)\Labcenter Electronics\Proteus 7
Professional\LIBRARY”

Next Copy the “.HEX” file and paste it in:

“C:\Program Files (x86)\Labcenter Electronics\Proteus 7 Professional\BIN”

STEP 6: Open Proteus and click on “pick from libraries” :

1. And search for ultrasonic in the tab, you will see ultrasonic sensor, select
it and paste anywhere in the panel
2. Double click on the sensor and the add the ultrasonic sensor HEX file and
add to the it as shown below

NOW WE ARE READY FOR STIMULATION

How to simulate Ultrasonic Sensor with Arduino in Proteus?

PROJECT: Measuring distance using Ultrasonic Sensor Library with


Arduino Library in Proteus.

3
STEP 1: Connect all components as shown in the simulation figure below.

Ultrasonic Sensor With Arduino in Proteus

STEP 2: Open your Arduino IDE

Write a code “C programming” or download and paste it in your it in the IDE

SAMPLE CODE TO USE FOR EASE

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);

4
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
{
return microseconds / 29 / 2;
}

STEP 3: Go to preferences

5
 Check “Compilation” CheckBox

STEP 4: Click on verify (compile)

STEP 5: After compilation is complete copy the HEX file path

6
STEP 5: Go back to proteus application

1. Double
2. Click on the arduino
3. And paste the hex file

STEP 6: Run the simulation, change the connector to potentiometer to see the
different reading.

7
8

You might also like