We are 2 students and in our practical project we need to implement Pololu 4079 sensors for distance measurement with a Rasberry Pi 3b+ in C or C++.
Would you have examples of this type because we have difficulties in translating the example given on Arduino on Pi in the description page of the site.
Thanks for your help.
I don’t think you’ll get any such example that you can use directly. Pololu distance sensor gives digital output. So, you’ll have to connect the output of the distance sensor with one GPIO pin of the Raspberry pi. Now, the concern is how to read a Raspberry Pi’s GPIO pin with C. Here is a tutorial that may help you regarding this topic: Learn C Programming on Raspberry Pi - 09 - Reading GPIO Inputs - YouTube
Thanks for that, we’ll try that.
rpiloverbd is a little mistaken; while we do carry digital distance sensors, the #4079 distance sensor has a pulse width output (like a hobby RC servo signal). Unfortunately, the Raspberry Pi is not very good at timing sensitive applications like measuring this kind of signal. Probably the most reliable solution would be to use a separate microcontroller to measure read the sensors and communicate the measurements to the Raspberry Pi through Serial or I2C.
Oh no! Is there any way to convert the pulse output to digital output anyway?
Yes, you can convert the #4079 module into a digital sensor by changing the configuration jumpers on the board. This is described at the bottom of the #4079 product page with a table to specify what jumper configurations correspond to which operation mode.
However, please note that unlike the pulse width output versions, the digital output simply detects the presence of an object and not the distance to it.
Thanks a lot Mr. BrandonM. Hope your answer will help many who want to use this sensor.