A ping sensor would see them, no matter what color they are.
That's because black absorbs IR (and a whole host of other frequencies in the visible range - hence, black); a ping-style ultrasonic sensor likewise has issues with non-uniform surfaces, and more seriously with soft objects like pillows (or other sound-absorbing material).
There is no one "do it all" sensor for ranging, unfortunately (with the exception of possibly LIDAR coupled with extensive mapping and processing - not something that is cheap or even doable with only an Arduino). So you need to combine sensors and then integrate the data that they produce so your system can gain a better idea of what is "out there".
As far as "cheapest":
Maybe not for the time it would take you to modify, but one of the best ultrasonic sensors you can get for very low cost is the Polaroid ranging module. Acroname sells these as kits, and they aren't cheap - but the same type of sensor was used in the old Polaroid cameras, and they were a favorite of hobbyist robot builders in the 1980s. You can still pick up such cameras in thrift stores if you look carefully, for generally a few (USD) dollars. Look for "Sun 660" or "Spectra" (there are other models that used them).
As I said, though, you have to do a bit of work to hack them to work with the Arduino; you can find articles on the Seattle Robotics Society website that detail this process, but the process won't work for the Arduino. The author of those articles, though, recently wrote an article for Servo Magazine (I think it was the June issue?), detailing how he converted his original hack to work with the Arduino. The only other issue with these units is that they tend to use a lot of power when pinging; up around 1A of current or so. They are meant for distance and accuracy, though, like what you would see when taking a photo. They have a fairly narrow cone (about 15 degrees to either side), too.
The URM ultrasonic range finder by DFRobot is a nice one. Good distance (~10cm upto 3~4 meters).
You talk to it over serial, but it offers digital triggering and even interupt triggered response (it will pull a pin high when something comes in a pre-set range).
Also, it is able to control its own servo when used through its serial interface.
I love this module to bits, the one I purchased was around $15 USD, so it appears to be on the same price level as the ping sensor.. just has more fun stuff.
PS: it is also capable of making temperature measurements, though I haven't been able to find out what type of values this returns.
I am using them on my wifitank, and it had problems seeing black things, and allowed the children (must be under aged people who enjoy destroying other peoples things) to drive it into things.
Oh I dunno, I was trying to drive it over your shoes backwards
Oh I dunno, I was trying to drive it over your shoes backwards
Yeah, they only had two when I ordered them so only got some in front of it, but it will have one of those in each corner, plus a ping sensor in front and back... So it is going to be pretty safe...
Worst case I had was one driving it into the cat's food, then made a mess on the floor with it...
But for now, the tank is offline... working on the pan/tilt stuff for the camera, and adding 4 white leds so it can see in the dark...
Yeah, they only had two when I ordered them so only got some in front of it, but it will have one of those in each corner, plus a ping sensor in front and back... So it is going to be pretty safe...
That's what I guessed...
That's why I was doing it backwards
working on the pan/tilt stuff for the camera, and adding 4 white leds so it can see in the dark...
Cool, gonna need some bigger batteries at this rate!
thought about making your own? its a 6$ per pair part with some simple electronics
Everything I have seen about homebrewing your own "ping" style sensor tends to reccommend having both a frequency generator and an oscilloscope in order to properly "tune" the emitter (for the frequency of the transducer); the same for the receiver (for optimum accuracy and distance).
I am sure you could "eyeball" it with minimal test equipment, but I don't know how well it would work...
getting it to resonate "right" is easy.
it is like worrying about the sound of a tuning fork, no matter how you hit it, it resonates at it's natural frequency.
"about 40 kHz" is all you need to know to work effectively with them.
I tried a long time to produce varying frequency chirps using piezo, to no avail. what you receive back is the resonance frequency with a varying amplitude.
that reduces the optimisation to easy testing like "from how far you still detect an echo".
If anybody else has better info, I'd love to hear it !
ps I do have an oscilloscope, and indeed that comes in handy.
the arduino itself is usable as a frequency generator. maybe even as a replacement scope. using the adc is a challenge, but there is another way :
detect whether the signal is above a threshold voltage using the comparator, and compile a few runs at varying threshold values.
Sampling this way can be done at about 2 Mhz in a 16 Mhz Arduino.
you have about 512bytes = 512 samples x 8 runs. Aiming at about 10 samples per wave the max frequency would be 200 khz.
This assumes that the arduino knows when to start measuring, but that is easy when it is generating the chirp itself...