Heart Lamp With Ultrasound and Sound Sensors

Introduction: Heart Lamp With Ultrasound and Sound Sensors

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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

This is an entry in the
Make it Glow Contest

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions