Go Down

Topic: Using high frequency output missing values (Read 747 times) previous topic - next topic

Chris_P_Bacon

Oct 27, 2015, 10:16 am Last Edit: Oct 27, 2015, 02:04 pm by Chris_P_Bacon
Hey,

im using an hc-sr04 ultrasonic sensor with an arduino mega. The sensor is checking the distance 20 times a second. No matter if the output is written on a sd card or just shown in the serial monitor values are missing. It looks like theres a pattern behind:
seconds - nr. of values
1 - 20
2 - 15
3 - 20
4 - 15
5 - 20
6 - 14
7 - 20
8 - 15
9 - 20
10 - 15
11 - 20
12 - 14
13 - 20
14 - 15
15 - 20
16 - 15
17 - 20
18 - 14
....

I tryed an increased baud rate. Saving the values on a pc using core term.

Im using the sketch from the link above. Im using a millis counter instead of the delay. Reason for this is that a delay takes to much time.

I didnt find any topic in the internet with a problem like mine. I hope someone has an explanation for that phenomenon. A solution would be awesome.

EDIT 1: I tryed the same frequency with another sensor (dht11) logging on sd card. It produced the same pattern as with the ultrasonic sensor.   

EDIT 2: Using CoreTerm instead of the sd card reader produces the same pattern

EDIT 3: Solution -> I used the sonic sensor with the dht11. Without the reading of the dht11 i get 20 values per second!

Go Up