To make a radar using SRF sensors, I used @makerrobotics tutorial, here's the link, but I thought it will be awesome with status lights. So I changed the circuit and the codes a little and there it is!
The original project, offered analog distance write, dynamic-graphical and colored radar sheet by processing.
I added two LEDs as status lights, so if the object is as close as a meter, the red LED will turn on; Otherwise the green LED will be on.
you can change the red light turn on distance by changing the variable "led_turnon_dist"
; By default, it's on 100cm.
- attach negative pin of both LEDs and GND pin of the sensor to board's GND;
- attach VCC pin of the sensor to board's 5v;
- attach trigger pin to digital 10 and echo pin to digital 11;
- attach green LED's positive pin to digital 8 and red LED's positive pin to digital 9;
- As you possibly know, you'll need Arduino ide to compile and upload the codes to the board.
- Distance will be visible on serial monitor; But you're also able to use processing, a great graphical app to get warned by a colored radar shape. The processing source code is uploaded on this post.
note: You can't use processing and serial monitor at the same time.
An ultrasonic sensor uses mechanical waves(sound in this case) to measure the distance like a radar; But some objects are better in returning the wave. For example, The sensor is more sensitive to your phone's screen than your pillow. Because the screen of your phone, or laptop, returns the wave way better than a pillow; Actually, weather what you're pillow is made of, it may let the wave continue!
enjoy!
Comments