Heart Lamp With Ultrasonic and Sound Sensors

Introduction: Heart Lamp With Ultrasonic and Sound Sensors

About: My name is Sabina Stan. I am a visual artist based in Romania. I work with rope, paper and recycled aluminium cans and I can do just about anything (figurative or abstract) in the technique I use, which is an …

My new project is called "Heavy heart" and as a first step, I will make a series of lamps that react to the environment - this one reacts to someone getting close or to sound.

I want to document this project as I develop it.

Here is the prototype circuit and code for this first lamp.

Initially, I wanted to make it with a pir sensor, but I figured it reacts to easily to movement. More than this, the ultrasound gives more options as it could react to movement coming from different sides in a different way, as well as from different distances.

Supplies

  • Arduino Uno
  • Jumper wires
  • Bread board
  • Sensor ultrasonic HC-SR04
  • Voltage regulator LM317
  • Sound Sensor LM393
  • G4 sockets
  • 12V Battery
  • 12V LEDs

Step 1: Connecting the 12V LEDs

I use three LEDs for this lamp.

Normally, each LED voltage regulator connects to the battery source, but I connected each of them together and only one to the battery source.

  • VIN - battery source
  • IN - Arduino PINs, in my case 5,6,7
  • the two GND connect to the battery and Arduino ground, respectively

On the other side of the voltage regulator are two connection for the LED. My 12V LEDs are not polarity sensitive so it doesn't matter how I connect them.

Step 2: Connect the Sound Sensor

  • OUT to Arduino PIN, 2 in my case
  • GND - Arduino ground
  • VCC - Arduino 5V

You can adjust the sensitivity of the sensor using the build-in potentiometer.

Step 3: Connect the Ultrasound Sensor

  • GND - Arduino ground
  • Echo - Arduino PIN, 4 in my case
  • Trig - Arduino PIN, 3 in my case
  • VCC - Arduino 5V

Step 4: Code

int trigPin = 3;
int echoPin = 4; long duration, distance; int sensor2 = 2; int val1 = 0; int led1 = 5; int led2 =6; int led3 =7; void setup() { pinMode(sensor2, INPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); } void loop(){ digitalWrite(trigPin, HIGH); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance > 0 && distance <= 100) { digitalWrite (led3,LOW); digitalWrite (led1, HIGH); delay(1000); } else { digitalWrite (led1, LOW); digitalWrite (led3,HIGH); delay(500); } val1 =digitalRead(sensor2); if(val1==0){ digitalWrite (led3, LOW); digitalWrite(led2,HIGH); delay(1000); } else { digitalWrite(led3,HIGH); digitalWrite (led2, LOW); delay(500); } }

One can add different combinations the LEDs may light in depending on the distance detected by the ultrasound sensor

Make sure to select the right board (Arduino Uno), Serial port (ACM0) and Programmer (AVRISP mkll).

Step 5: Final Result

Enjoy!

Make it Glow Contest

Participated in the
Make it Glow Contest

Be the First to Share

    Recommendations

    • Plastic Challenge

      Plastic Challenge
    • Robots Contest

      Robots Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge

    Comments