Timeline for Reading HC-SR04 echo with wiringPiISR()
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 7, 2015 at 17:00 | comment | added | Spiked3 | The easiest way to measure a SR04 is to record the time of rises and falls, constantly. The when you do a trigger, wait some time, it doesn't matter as long as its more than the max, and compare time of fall to time of rise. as long as fall > rise, it is good, pulse width (fall - rise) will be your echo value. joan's library seems to provide that kind of thing. | |
Aug 10, 2014 at 17:29 | comment | added | joan | I'd use my own pigpio library as its likely to give the most accurate and repeatable results. There is nothing wrong with busy loops if the software isn't going to be do something else, you'd just get more accurate results leaving the busy loop in-line rather than in the callback which adds another unknown. The callback on average will be called 430 micros after the rising edge so you could factor that in to your calculations. | |
Aug 10, 2014 at 15:52 | comment | added | Eric Turner | Can you recommend an approach to recording an accurate echo time without consuming CPU cycles in a busy loop? | |
Aug 9, 2014 at 19:09 | comment | added | joan | The overall result is the busy loop has moved and will be under recording the echo time. | |
Aug 9, 2014 at 17:34 | history | answered | Eric Turner | CC BY-SA 3.0 |