This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

connecting an ultrasonic distance sensor to nRF52

Hello,

Have been reading the example codes and documentation in order to connect an ultrasonic sensor to nRF52. The goal is to read in the value and then send it over BT to a mobile.

So I'll need a soft device running. Basically the usage of the sensor is very simple. I trigger it to do the measurement, by pulling up a GPIO pin for 10us and the sensor will report the distance as pulse to the input pin. The width of this pulse equals to the time the ultrasonic pulse needs to travel back and forth, between the sensor and the object to be recognized. This means that I need to be able to measure the width of the pulse with accurancy of say +/- few dozen us. I can do this easily with gpiote framework and creating an object that statically stores the timestamp for high and low edges of the pulse... But the question remains; How to make this work well together with the softdevice? Please advice.

Best Regards, Sampo

Related