The code works perfectly. Thank you very much!
Library for HC_SR04 Ultrasonic Rangefinder
#21
Posted 30 May 2013 - 11:44 PM
#22
Posted 14 June 2013 - 02:21 AM
This looks really cool.
Could 4 sensors be connected to a single Netduino Plus 2? I am thinking of using a set to collect simultaneous data at the same time; 4 are lined up within 1" of each other, pointing at the sky, and when something rolls over each one, the Datetime could be saved/displayed for each acquisition.
#23
Posted 31 July 2013 - 04:04 AM
This is awesome, thanks so much for sharing!
#24
Posted 27 September 2013 - 05:09 PM
Someone might find this code useful. I found these HC SR04 ultrasonic rangefinders on amazon for $15 but they had no code. I found some Arduino code, but was pretty useless for Netduino because it used blocking for the timing. So I wrote my own that uses interrupts for the timing. We used this successfully on a mobile robot for detecting obstacles. Accurate to sub-inch against hard surfaces. It is calibrated for my altitude and climate, you may need to adjust the InchConversionFactor and LatencyTicks for your environment. If you want it to read centimeters, just add your own TicksToCentimeters function. Enjoy and feel free to improve it. 2012/04/03 - Corrected pin documentation on constructor
Thank you sir for sharing this,
But your code seem to be not working when 4 sonar sensors are connected together, When I try it using 3 sonars it works fine, But for 4 sonar sensors I gives false value in a one sonar. Does anyone have any idea why?
#25
Posted 24 December 2013 - 10:26 PM
Thanks
Someone might find this code useful. I found these HC SR04 ultrasonic rangefinders on amazon for $15 but they had no code. I found some Arduino code, but was pretty useless for Netduino because it used blocking for the timing. So I wrote my own that uses interrupts for the timing. We used this successfully on a mobile robot for detecting obstacles. Accurate to sub-inch against hard surfaces. It is calibrated for my altitude and climate, you may need to adjust the InchConversionFactor and LatencyTicks for your environment. If you want it to read centimeters, just add your own TicksToCentimeters function. Enjoy and feel free to improve it. 2012/04/03 - Corrected pin documentation on constructor
Thanks! Works just fine.
#26
Posted 31 December 2013 - 09:28 PM
Anyone got any other calibration numbers? If so, how did you do it?
I've no idea where the exact zero point is (presumably the center of the cones behind the mesh. I presume I put a ruler there and placed an object at x-inches, I could determine the error
#27
Posted 22 June 2014 - 09:19 PM
thnx your code works perfectly well. but i have another sensor this time not HC - SR04 but mb 1260 from maxbotix can i have its class library to work with it. thx
#28
Posted 08 October 2014 - 10:17 AM
maybe this is usefully too someone if u want Centimeters add:
public double TicksToCentimeters(long ticks) { return ((double)ticks / inchConversion) * 2.54; }
to the class.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users