Go Down

Topic: sound playing with arduino through computer or to light LED with wifi (Read 401 times) previous topic - next topic

So for my school project this semester, I am looking to try something for my room with Arduino.

When someone comes in my room they are behind me, and most of the time my dad scares the shit out of me.

I am looking for guidance/project component lists/tutorials on how I can do what I want. My two project ideas are to either have a button or ringer outside my door and uses wifi to send a signal to a arduino on my computer to play a sound into my headset or speakers, telling me when someone is here. The second idea is to do the same thing with the ringer/button, but instead of a sound playing, it lights a decently large LED above my monitors showing someone is at my door.

I would like any input/info on what it is I need and what I need to do. From the bit of reasearch I have done, I have found that I need a waveboard and maybe a wifi dongle on both sides? Also, would I need two arduino boards to do so? 1 outside the door, one at my computer or what?

Thanks! Please reply!

Pauly

Check out this project.  Does exactly what you want, no PC needed.
Basically it makes a noise when the distance sensor changes dramatically.
  http://electricprojects.wordpress.com/2011/05/08/sheep-doorbell/
Parts used.
Arduino Uno
Speaker
WAV shield
SD card
Sharp distance sensor
Stuffed sheep


Check out this project.  Does exactly what you want, no PC needed.
Basically it makes a noise when the distance sensor changes dramatically.
  http://electricprojects.wordpress.com/2011/05/08/sheep-doorbell/
Parts used.
Arduino Uno
Speaker
WAV shield
SD card
Sharp distance sensor
Stuffed sheep


The only issue with this is that I have my headset in for games/music almost 95% of the time. So most of the time I cannot hear anything around me. This is 1 of the reasons why I get scared when my parents walk into the room.

I think I need it hooked up to the computer so that the sound will play in what ever device I am using on my computer to output sound (headset or speakers).

Is there a way to do this? Or any tutorials?

-B

Pauly

Well, you could put the sensor near  the door and use long wires to put the
Arduino and speaker on your desk.
Or use long wires and make an led light up instead of using sound.

Or  try turning down the volume on your headphones.

I rather not do it using "alternate methods.

The issue with a sensor is people aren't always coming into my room when they are in the hallway. so having a sound play when ever someone is in the distance of the sensor would be annoying. I just a way to transmit a signal to my computer through an arduino board to play a sound in my headset. Plus no wires would be needed. I want to do it through wifi.


Update: I found a few tutorials but nothing to what I want. I can modify what they do a bit but I just don't know what to do to actually modify them to fit my needs.

Can anyone else help please???

Bresser

I don't understand why this is that hard. It's just when there is a change in the distance on the distance sensor put the led HIGH.
Code: [Select]

/*
LED PIN distance and shit
Bresser
Some code is from public domain
This link to some of distance sensor code:
http://arduino.cc/en/Tutorial/Ping?from=Tutorial.UltrasoundSensor#.UxS82-NdWSo
*/

const int hugeAssLedPin = 13;

void setup()
{
     serial.begin(9600);
     pinMode(hugeAssLedPin, OUTPUT)
}

void loop()
{
     long duration, currentInches, curentCm, lastInches, lastCm;
     pinMode(pingPin, OUTPUT);
     digitalWrite(pingPin, LOW);
     delayMicroseconds(2);
     digitalWrite(pingPin, HIGH);
     delayMicroseconds(5);
     digitalWrite(pingPin, LOW);
     pinMode(pingPin, INPUT);
     duration = pulseIn(pingPin, HIGH);
     currentInches = microsecondsToInches(duration);
     currentCm = microsecondsToCentimeters(duration);
     Serial.print(currentInches);
     Serial.print("in, ");
     Serial.print(currentCm);
     Serial.print("cm");
     Serial.println();
     
     delay(100);
     lightLed();
     currentInches = lastInches;
     currentCm = lastCm;
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

void lightLed()
{
     if (currentInches < lastInches || currentCm < lastCm)
    {
         digitalWrite(hugeAssLedPin, HIGH);
    }
    else
    {
         digitalWrite(hugeAssLedPin, LOW);
    }
}


Correct  me if my code brings up errors or anything as I am still a beginner in my work with arduino, but I usually am pretty good at basic code and I do believe that this code is right. But I digress.

Please give me input on my code


I don't understand why this is that hard. It's just when there is a change in the distance on the distance sensor put the led HIGH.
Code: [Select]

/*
LED PIN distance and shit
Bresser
Some code is from public domain
This link to some of distance sensor code:
http://arduino.cc/en/Tutorial/Ping?from=Tutorial.UltrasoundSensor#.UxS82-NdWSo
*/

const int hugeAssLedPin = 13;

void setup()
{
     serial.begin(9600);
     pinMode(hugeAssLedPin, OUTPUT)
}

void loop()
{
     long duration, currentInches, curentCm, lastInches, lastCm;
     pinMode(pingPin, OUTPUT);
     digitalWrite(pingPin, LOW);
     delayMicroseconds(2);
     digitalWrite(pingPin, HIGH);
     delayMicroseconds(5);
     digitalWrite(pingPin, LOW);
     pinMode(pingPin, INPUT);
     duration = pulseIn(pingPin, HIGH);
     currentInches = microsecondsToInches(duration);
     currentCm = microsecondsToCentimeters(duration);
     Serial.print(currentInches);
     Serial.print("in, ");
     Serial.print(currentCm);
     Serial.print("cm");
     Serial.println();
     
     delay(100);
     lightLed();
     currentInches = lastInches;
     currentCm = lastCm;
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

void lightLed()
{
     if (currentInches < lastInches || currentCm < lastCm)
    {
         digitalWrite(hugeAssLedPin, HIGH);
    }
    else
    {
         digitalWrite(hugeAssLedPin, LOW);
    }
}


Correct  me if my code brings up errors or anything as I am still a beginner in my work with arduino, but I usually am pretty good at basic code and I do believe that this code is right. But I digress.

Please give me input on my code


I am not wanting to use sensors. Please read the OP. I want to be able to use a button or doorbell of sorts to activate a LED on my desk or play a sound through my computer to my headset.

Anyone else have advice/tutorials/help to lend and give?

PeterH


Please read the OP.


Based on the OP all you need is a switch at the door which turns on a lamp of some sort which is in your field of view.

If you want it to play a sound through your headset (and assuming the headset needs to be connected to the PC) then you can use an Arduino to detect a button press and send a command to the PC; at the PC some application would monitor the Arduino serial port and play a sound track on command. If the PC is running Windows then that application could be Gobetwino. For other platforms you'd need to write your own equivalent, but it would be quite simple to do.

The first solution is utterly trivial compared to the second one.

A third solution which would be simpler still would be to buy a wireless doorbell and put the bell somewhere near your computer. They only cost a few quid, give you a nice smart and reliable pushbutton unit and you could have a solution off the shelf.
I only provide help via the forum - please do not contact me for private consultancy.

Bresser

[quote author=bmanbman28 link=topic=221627.msg1617369#msg1617369 date=1393878824

I am not wanting to use sensors. Please read the OP. I want to be able to use a button or doorbell of sorts to activate a LED on my desk or play a sound through my computer to my headset.

Anyone else have advice/tutorials/help to lend and give?
[/quote]
I'm sorry, reading back I realize that they were freaking you out because they wanted to get your attention but you cannot hear them.  I thought they were sneaking up on you and scaring you, so you wanted them to not be able to.

Go Up