pcbway

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor codeHello friends, few days ago I have posted an Ultrasonic Sensor Library for Proteus, using which one can easily simulate ultrasonic sensor in Proteus. The post was highly praised by the reader and I have received quite good feedback from the followers. So, I thought of sharing some more examples related to it so that user can get a complete understanding of how to use Ultrasonic Sensor in Proteus. Today, we are gonna have a look on different Ultrasonic Sensor Simulation in Proteus. If you haven’t read the previous post then first have a look at it because without the installation of Ultrasonic Sensor Library in Proteus, you won’t be able to use these examples. Ultrasonic Sensor is used widely in Embedded Systems.

Today, I am gonna share three examples of Ultrasonic Sensor Simulation in Proteus, which will be enough for you guys to get the overview of this sensor. I have also attached these simulations below and you can easily download them but as I normally advise, its better to design these simulations by yourself and write your own code as it will help you in understanding it more clearly. If you don’t make mistakes, you won’t learn from it. I am gonna share below three examples of Ultrasonic Sensor:

  • Button
  • Proximity
  • Switch

Note:

Ultrasonic Sensor Simulations in Proteus using Button

  • In this tutorial, we are gonna use three buttons and using these buttons we will control our ultrasonic sensor.
  • Think of these buttons as three obstacles, which are placed at different distances, if we hit the first button then first obstacle is reached, if we hit second then second obstacle and same as for third.
  • So, open your Proteus ISIS and if you have already installed ultrasonic library for Proteus then design your Ultrasonic Sensor Simulation in Proteus as shown in below figure:

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor code

  • Now open your Arduino software and paste below code in it and get your hex file to upload in this simulation.

Note:

 

  • After adding the hex file in this simulation, hit the RUN button and if everything goes as expected then you will get a simulation as shown in the below figure:

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor code

  • You can download this simulation along with Arduino code and the hex file by clicking below button:

Download Ultrasonic Sensor simulation in Proteus Using Button

Ultrasonic Sensor Simulations in Proteus as Proximity Switch

  • I have explained the first example in detail so I am not gonna much explain this one.
  • In this example, we are using the Ultrasonic Sensor as a Proximity Switch, whenever any obstacle comes in the way of ultrasonic sensor, it will automatically give an indication.
  • As you can see from the figure below that we are using a variable voltage source for the analog pin of ultrasonic sensor.
  • So, first of all design a simulation as shown in the below figure:

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor code

  • Now upload the Arduino hex file for this example, which is attached below along with the code and this simulation.
  • After uploading the hex file, hit the RUN button and if everything is in your favor, then you will see results similar to below figure:

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor code

  • As you can see in the above figure, we are sending a Ping from Ultrasonic Sensor and in the programming code we have placed an alarm at a specified distance, so whenever any object comes in that range, our program will give us Alarm.
  • You can download this Proteus Simulation along with Arduino Code and hex file by clicking on this below button:

Download Ultrasonic Sensor Simulation in Proteus As Proximity

Ultrasonic Sensor Simulations in Proteus using Switch

  • Here’s the third and last example of Ultrasonic Sensor simulation in Proteus.
  • In this simulation, we are using a switch and controlling the Ultrasonic with that Switch.
  • There are total four states for that Switch, which determines what should be the voltage on the analog pin of Ultrasonic Sensor.
  • I have also placed a oscilloscope in this simulation which will give you the voltage state for this switch, to get you an idea what’s the voltage pattern coming to ultrasonic sensor, its mainly just for understanding and testing.

Note:

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor code

  • Now upload your Arduino hex file in it and hit the RUN button and you will see something like this:

Ultrasonic Sensor in Proteus,Ultrasonic Sensor Library for Proteus,ultrasonic proteus simulation,ultrasonic sensor code

  • As you can see above, the virtual terminal is showing the distances while the oscilloscope is giving us state of switch, play with it and you will learn more and if still confused then ask in comments.
  • You can download the Proteus simulation of this example along with Arduino hex file and code by clicking on the below button.

Download Ultrasonic Sensor Simulation in Proteus Using Switch

That’s all for today, hope you guys have learn something today, if you have any problem or question, do ask in comments and I will try my best to resolve them. Take care 🙂

15 Comments

    • I have explained the function of SimPin in my previous post, in simulation you can’t place any object in front of this ultrasonic sensor so using this pin you can do this virtually, The output of ultrasonic will depend on the voltage at this pin.

      • hi, I have a problem, I typed the same code and I did the same schematic, but when I run the simulation on isis a message “External DLL model” picEX16 “not found GLE = 0 * 0000007E “can anyone help me please

    • You can design the complete simulation, but instead of placing some parking object in front of the sensor you have to change voltages on the SIMPin and it will work the same.

      • Am simulating the circuit and am geting an eeror ” Internal Exception access violation in module ‘UNKNOWN'(00000000). What may be a broblem.? Is there anything I have to do in the ultrasonic sensor like pasting a file or other spesfications

  1. Sir, could you learn me about your C language that you insert to Ultrasonic sensor ( C language of Ultrasonic sensor.hex) every your example

    Thanks very much, before

    I am

    Siswanto

  2. Sir, could you learn me about your C code that you insert to Ultrasonic sensor ( C code of Ultrasonic sensor.hex) every your example

    Thanks very much, before

    I am

  3. hello, thank for your contribution toward those that want to follow your footstep in the field of programming.
    I tried to simulate the ultrasonic sensor with atemga16 using the library you post. but i’am unable to. but the program work correctly when it was implemented in the hardware. pls help.
    thank you.

    • I don’t knowwhere you are having problems, you can download the examples above and can test them, they are working perfectly.

  4. hello, pls is it possible to simulate ultrasonic sensor with avr instead of using arduino board? if yes pls how? because i have been trying but i have never achieved it.

  5. Asalam O Alaikum Syed Zain Nasir Bhai,
    Hope you are doing well and prayers for your hardworking upon sharing the knowledge to mankind.
    I am in search of a simple Ultrasonic Sensor Used to detect Only and Only ultrasonic sounds not made by PIC, Can you guide me about it please? Hope for a favorable action. Thanks!

Leave a Reply

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

Post comment