why iam getting inconsistent ultraonic sensor readings for the HC-SRO4
hullo have tried several ultrasonic code using basic code of pulseln() function , tried new ping library iam still getting erroneous distances readings.
whether put obstacle or not, still these sets of results. iam desperate advice or might problem. hc-sro4 sensors or confined in room.
the results below using new ping library
https://bitbucket.org/teckel12/arduino-new-ping/wiki/home#!issue-tracking
ping: 0cm
ping: 129cm
ping: 128cm
ping: 127cm
ping: 127cm
ping: 129cm
ping: 129cm
then when not using library pulseln() function calculate duration before calculate distance of sound.
these results.
distance: 123
distance: 123
distance: 123
distance: 122
distance: 122
distance: 124
distance: 124
whether put obstacle or not, still these sets of results. iam desperate advice or might problem. hc-sro4 sensors or confined in room.
the results below using new ping library
https://bitbucket.org/teckel12/arduino-new-ping/wiki/home#!issue-tracking
ping: 0cm
ping: 129cm
ping: 128cm
ping: 127cm
ping: 127cm
ping: 129cm
ping: 129cm
then when not using library pulseln() function calculate duration before calculate distance of sound.
code: [select]
digitalwrite(trigpin, low); //clear trigpin
delaymicroseconds(2);
digitalwrite(trigpin, high);
digitalwrite(trigpin, low);
//once received echo calculate distance duration
duration = pulsein(echopin, high);
distance = (duration/2)/29.1 ; //distance in inches..
//distance = duration/58.2; ////calculate distance (in cm) based on speed of sound.
delay(300); //for stability used 300
these results.
distance: 123
distance: 123
distance: 123
distance: 122
distance: 122
distance: 124
distance: 124
i have had no problems newping library.
- sure wires device ok? worth swapping them dfferent set try.
- have got sensor try hardware problem
- sure wires device ok? worth swapping them dfferent set try.
- have got sensor try hardware problem
Arduino Forum > Using Arduino > Sensors > why iam getting inconsistent ultraonic sensor readings for the HC-SRO4
arduino
Comments
Post a Comment