Arduino Project : UltraSonic Motion Sensor to Control LED Light
This is a simple Arduino project that will smoothly light up a RGB LED light when a Ping))) UltraSonic motion sensor detects an object in front of it. The LED light will stay at its highest brightness (RGB color) as long the object stays in front of the UltraSonic sensor, or else it will smoothly fade out and go back to its off state. Since the UltraSonic range finder can measure the distance of an object that is front of it’s sensor, it is possible to set a distance (in centimeter or inch) range to fire up the LED light in this project.
UltraSonic Sensor LED Light Controller Project Requires:
- 1 Arduino Board
- 1 Ping))) UltraSonic Sensor
- 1 RGB LED light
- 3 Resistors of 330 Ohms - 0.25W
- Jumper wires and Bread Board for connection
Here is the project circuit
RGB LED light has 4 pins, one anode and three cathode. The longest of the four leads Pins is the negative anode (ground) connection of the LED package. In one side of the longest pin is the single short Red cathode pin and to its other side the Green and Blue short cathode pins are placed. (note: in this project, the RGB LED light’s blue and green Pins are not in RGB sequence, it’s in Red, Blue, and Green sequence).
- Connect the RGB LED’s Red Pin to a Resistors on Bread Board that is connected to Arduino 9 pin (Red wire in the circuit).
- Connect its longest Pin to a Bread Board as shown in circuit, Yellow wire.
- Connect RGB LED’s Blue Pin to a Resistors on Bread Board that is connected to Arduino 10 pin (Blue wire in circuit).
- Connect RGB LED’s Green Pin to a Resistors on Bread Board that is connected to Arduino 11 pin (Green wire in the circuit).
Ping))) UltraSonic Sensor has 3 pins – Signal, 5 volt and Ground (left to right from front).
- Connect the UltraSonic sensor’s Signal pin to Arduino 7 pin (Orange wire in the circuit).
- Connect its 5v pin to a Bread Board as shown in circuit, Yellow wire.
- Connect the ground pin to Arduino GND (Ground) pin as shown in the circuit, Black wire.
Code: The Arduino code will contain a Ultrasonic Sensor function ping_ultrasonic(), that will constantly scan the distance and if any object found in the given range it will fire up the color_morph() function, which will change the value of RGB LED light and update all analog pins. It has the function to convert Ultrasonic Sensor microseconds to inches and centimeters. Additionally ping_ultrasonic() has the code that will show the Ultrasonic Sensor scan distance in serial monitor. Here is the code you can download from Codebender.
Arduino Project - UltraSonic Sensor to Control RGB LED Related:
Google Chrome Roll It – Phone Motion Controller
Kinect Hand Gesture Recognition for Windows Touch
Browsing Web with Gesture: Webcam-Based Navigation System