Greg
Hi to everyone , i would like to use ultrasonic sensor but i don't know how . Which blocks have i to use in ladder  ? Can you give me a simple exmple of controling  an output depending on the distance ?
Reply 0 0
Chas
First you must know how the ultrasonic sensor is goibng to measure distance. Typically they send out an echo pulse and then you measure the time for the sound wave to return. By using the difference in time and a constant then you can equate this to a distance. Do you already have an ultrasonic sensor- if so let us know the part number and we can determine the constant that is required to measure the distance. Hope this helps you.
Reply 0 0
Greg
I have two of them  IMG_20230107_201341.jpg
Reply 0 0
Greg
I would like a simple example for OpenPlc 
Reply 0 0
thiagoralves
This is not something you can do with ladder logic due to the cyclic nature of the language. For this sensor you need something with fast response that can read the time interval between pulses. You will have to modify the Arduino firmware to be able to read a sensor like that or implement a new ladder block for the OpenPLC Editor that does it under the hood. Not an easy task...
Reply 0 0
Chas
I agree it will be difficult to get an accurate reading since the scan time is typically too long. To measure the distance is not too difficult using the Arduino microprocessor if you are still interested. I have used HC_SR04 module in the past and the code is fairly straight forward- do you want to still see how to do this using the Arduino IDE?
Reply 0 0
Greg
thank you very much , i already know how i can use it in arduino ide.
Reply 0 0
Reply