Go Down

Topic: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7 (Read 575556 times) previous topic - next topic

jensgutsche

Hi,

thanx for the library. It makes the usage of ultrasonic sensors much easier.

How can i calculate tempature compensated ping times with this library?
If not, can you implement a function with temp parameter like ping_cm(25.3)?

Thanx Jens

teckel

Hi,

thanx for the library. It makes the usage of ultrasonic sensors much easier.

How can i calculate tempature compensated ping times with this library?
If not, can you implement a function with temp parameter like ping_cm(25.3)?

Thanx Jens
Some sensors include a temp sensor and already compensate. The default for the library is set for the speed of sound at typical indoor Temps (something like 75 degrees). It typically isn't required to make temp adjustments because the difference is slight and the sensors are not very accurate to begin with. They're better for detecting something "getting closer" or "getting further away" than actually using it for measurement.

But if you'd like to do whatever with the results, just get the ping time and then do whatever math you'd like based on temp, altitude, humidity, etc. But don't expect it to be anymore accurate for measurement reasons. That's the reason it's not included in the library, in practice it doesn't yield better results, just different ones.

Tim
My platforms Arduino, Teensy 3.2, Arduino Pro Mini, ATmega328
My libraries: NewPing, LCDBitmap, toneAC, toneAC2, NewTone, TimerFreeTone
My projects: https://dogblocker.com & https://baconorbeer.com
My beer: Great Lakes Brewing Co. Lake Erie Monster

Eric_San

Hi

I am creating a robot for a school project which uses 3 ultrasonic sensors and 2 infrared sensors but I only have an arduino uno board, so I was wondering if I could use a sketch that pings those 3 sensors using only one pin for each.

Thanks for everything and sorry if somenthing is not too clear, English is not my native language and this is my first program.

meltDown

project which uses 3 ultrasonic sensors and 2 infrared sensors but I only have an arduino uno board,
By my count that's only 8 pins: 3x2 for the ultrasonic and 2x1 for the infrared. Uno has loads of room for that....


teckel

Hi

I am creating a robot for a school project which uses 3 ultrasonic sensors and 2 infrared sensors but I only have an arduino uno board, so I was wondering if I could use a sketch that pings those 3 sensors using only one pin for each.

Thanks for everything and sorry if somenthing is not too clear, English is not my native language and this is my first program.
Yes, as long as your sensors work with the one pin method. Try one sensor and see. You can also install a cap as sometimes that works (see the official page for details).

Tim
My platforms Arduino, Teensy 3.2, Arduino Pro Mini, ATmega328
My libraries: NewPing, LCDBitmap, toneAC, toneAC2, NewTone, TimerFreeTone
My projects: https://dogblocker.com & https://baconorbeer.com
My beer: Great Lakes Brewing Co. Lake Erie Monster

Go Up