How to Add And Simulate Ultrasonic Sensor Library in Proteus ? | 2018 Edition




The Ultrasonic Sensor also called “Ping Sensor” is used to detect the objects in front and measure the distance between sensor and object.

Check out project on Ultrasonic Sensor:  “How to measure distance using Ultrasonic Sensor


How to add Ultrasonic Sensor Library to Proteus?


You can also watch this video for easy reference:


STEP 1: First of all download Arduino Library from the link given below:


Ultrasonic Sensor Library For Proteus (Ed. 2018)


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



STEP 2: Download the file to desktop



STEP 3: Unzip the .zip file to desktop



STEP 4: You will obtain these three files:

 (A) 1.UltrasonicTEP.LIB


 (B) 3.UltraSonicTEP.HEX



STEP 5: Cut first two files and paste them in:

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

                 Cut  .HEX file and paste it in:

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


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


STEP 7: Search for “ultrasonic”, you will see ultrasonic sensor. Select it and then place it anywhere on the front panel!


STEP 8: Double-click on sensor and then click on Ultrasonicsensor.HEX as shown in figure.










STEP 9: Select “UltraSonicTEP.HEX” file from BIN and hit enter as shown in figure.










STEP 10: Now you are good to go!  You can Start simulating Ultrasonic Sensor right away.


How to simulate Ultrasonic Sensor with Arduino in Proteus?


Before going further be sure to check out ” How to add and simulate Arduino in Proteus?


PROJECT:  Measuring distance using Ultrasonic Sensor Library with Arduino Library in Proteus.


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

Ultrasonic Sensor With Arduino in Proteus














STEP 2:  Download this “UltraSonic ” program to your Arduino IDE:

const int echoPin = 2; // Echo Pin of Ultrasonic Sensor
const int pingPin = 3; // Trigger Pin of Ultrasonic Sensorvoid 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 methodSerial.print(inches);
Serial.print(“in, “);
}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
















STEP 4: Check “Compilation” CheckBox










STEP 5:  Click on verify (compile)












STEP 6: After compilation is complete copy HEX file path from the bottom corner:


STEP 7: Open Proteus and double click on Arduino. Paste the file path and click ok
















STEP 8: Double-click on sensor and then click on Ultrasonicsensor.HEX as shown in figure.











STEP 9: Select “UltraSonicTEP.HEX” file from BIN and hit enter as shown in figure.










STEP 10: Run the simulation! Change potentiometer’s wiper terminal position to test the distance value on virtual terminal


No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: