(Solved) Turn off sound system using Uno and a Relay

I like to challenge myself. Today I decided to figure out how to convert This high school project aka School lock-down system into a useful technology.

If I understand correctly, one of the possibilities of pursuing this project involved detecting sound and if the sound is so loud it will cut on lights. However, the technology I have in mind is a completely different concept therefore starting a new thread was in order.

As many of you probably already know from previous college experience, to much sound (and/or cars parked in the center of the street) will attract undesired attention "police". You have also probably noticed when people start drinking they tend to become louder and louder which typically results in someone turning up the music so people can hear it.

I know this because I lived in a frat house for a few years and I was the one in charge of keeping everyone out of trouble. I ended up rigging the houses sound system so that the speaker wires went under the house, then up through my room and cross two light switches located in my room, then went back under the house and to the speakers. If things got to loud I could flip the switches and no one could do anything about it, and few knew what the cause of the sound outage was caused by. Most thought it was a power overload in our sound system. I would then flip them back on after 5 minutes or so which would result in people restraining from the urge of turning the music up to loud.

But if I had the system that this group is interested in designing I would have installed the sound detector outside (probably in the shed where it would always stay dry) and have it communicate wireless to another arduino which would act as the arduino that controls the light system in their case. Instead of turning on lights, why not have it turn on the wire that leads to a PnP transistor? That little bit of current from the arduino would flip the transistor to open (break the connection) to the sound wires so it would cut the sound off. You could then install a 5 minute timer program that way the system would automatically turn itself back on, and besides the few brothers living in the house, everyone would assume the system overloads itself if the music is turned to high.

What I am now curious about is not the way the arduino detects sound, but rather if this PnP transistor would be able to take the current from pin 2 of an arduino Uno when high, and open the switch to a speaker wire, or a lamp even to turn it off? For practicability sake well say the arduino is controlled by a webserver phone app rather than a volume identifier.

Is it possible? Would this PnP transistor work?

You can't use a transistor to switch the audio itself, not like you're proposing at least. I'd use it to drive a relay to disconnect the audio. (alt - just disconnecting the ground will result in horrifying broken audio noise, that will likely motivate even drunks to turn down the volume.

To really complete the illusion, what you really want is some dimmers on the lights that you can control, and when the noise is near the cap, start dimming the lights in time with the bass, so it looks like you're overloading the house power. Then you could turn the lights out at the same time, and everyone stands in the dark like stunned cattle, and then a minute or two later, everything comes back on (and they assume someone found the breaker)

That said - is the problem the volume of the speakers? Couldn't you hack the sound system to simply limit the volume output? At most parties I've seen, the drunk people yelling was louder.

At a certain house in college - of course not mine, I'm a law-abiding citizen - people would gather in a room on the top floor, in the back, to smoke those hand rolled cigarettes during parties. For obvious reasons, in the event of attention from the constabulary, those people wanted some warning. The people who lived there had "panic buttons" to dramatically change the lighting upstairs remotely, giving the upstairs people time to open the window, throw on the air purifier, light up some normal smokes for cover, and hide anything untoward. AFAIK it never had to be used - they ran a pretty tight ship.

just disconnecting the ground will result in horrifying broken audio noise, that will likely motivate even drunks to turn down the volume.

Using the light switch works well. Would a PnP transistor be any different that a light switch? I'm just trying to understand how they work

Couldn't you hack the sound system to simply limit the volume output?

I'm new to electronics, That seems like it would require a much broader level of understanding electronics.

Could the PnP resistor be used to simply turn off the power of the system itself rather than opening a switch the audio passes through?

Will the PnP transistor not work because the audio won't exceed 0.6Volts?

If it comes down to it, i'll use a servo motor to flip a physical light switch to break the connection. I would much rather experiment with something new that I haven't had the privilege of working with yet though.

Can a PnP transistor be used like this?

You are interrupting the power from the amplifier to the speakers? Then No, a simple PnP transistor will not work. A relay, or solid state relay, is needed to handle the higher voltage and current going out to the speakers without distorting the sound.

Thank you for the advice,

I went to Radio Shack and purchased a SPDT Micromini 5VDC Relay Rated 1A at 120AC/24VDC The guy at Radio Shack told me this would work.

I have a question about how to hook it up. I attached a drawing I made in the attachment that shows the setup of the Relay.

Do I hook E to the 5V output of the arduino, D to the ground of the arduino, C to the speaker wire/or house power, and A to the line that should be normally on? I’ve never used a relay before and though I watched a few youTube Videos At 4:05 of this video It appears the guy hooks a diode to connect A to E which I don’t really understand why so I wanted to double check to make sure I don’t send 120V from the house into the arduino by mistake.

The ratings for the relay are:
Coil Voltage Nominal-5VDC maximum - 6.5VDC (if i understand correctly this means to flip the switch the Voltage must be within these perimeters.

Nominal coil current 89.3mA (I don’t know what this means)

PickUp/dropout voltage 3.5/0.25VDC (I think this means by using this relay, I will loose that much voltage)

Coil resistance 56omhs +/- 10% (basically the coil is a resistor)

Do I have everything right on the setup? Am I safe to continue?

Relay.jpg

So , basically, you want to build a TEENAGER DETECTOR ?

So , basically, you want to build a TEENAGER DETECTOR ?

Haha no, the bottom line is I want to learn how to use a relay, and other technologies that I haven’t had the privileged of working with yet. I learn best by doing hands on experiments.

I wanted to incorporate the experiment into something useful to make it more interesting. The idea of the scenario I gave was not to detect Teenagers but rather give a college student a project would be beneficial to them, as well spark their interest to learn how to use new technology.

Detecting sound by itself is useless and boring. Learning how to use it to keep yourself, your friends, and other people that are wanting to release some stress after working so hard to keep their scholarships after acing an exam is an excellent two in one knockout for motivation to experiment.

A music complaint from a neighbor can cause the police to show up. The results of this could mean a poor 20 year old with a 3.5 GPA gets a ticket for Underage drinking. Regardless of how you feel about kids in college having a drink, a ticket like that will cause them to loose their scholarship. The smart ones find ways of using their intelligence to their advantage. Little projects like this get people interested in become engineers because it actually has useful applications that relate to them.

But that scenario aside, I’m trying to figure out why this relay isn’t working. Looking at the previous attachment I hooked E to pin 9 on the arduino, and D to ground. When I press button2 the power is sent to the relay and I hear a “click” which I believe is the mechanical relay switching.

However, when I activate pin 6 which when hooked directly to the led the led works to C on the relay, and A on relay to the led, it does not work.

Is this because the 5 volts coming from arduino pin 6 isn’t enough to cross the relay? Or do I have the relay hooked up improperly?

SetUp.jpg

Could it have anything to do with the fact that you wired the led to the N.C. (normally closed) relay contact so it is only connected to pin-6 when the relay is OFF ?

A music complaint from a neighbor can cause the police to show up. The results of this could mean a poor 20 year old with a 3.5 GPA gets a ticket for Underage drinking.

I think in this particular case we should just ignore your motive and focus on your technical issues. Helping people get away with things they shouldn't be doing is , in general, not a noble motive, IMO.

Do you have meter to take voltage or resistance measurements ?

Could it have anything to do with the fact that you wired the led to the N.C. (normally closed) relay contact
so it is only connected to pin-6 when the relay is OFF ?

Doubtful, the reason is because I set it up so when the button is pressed it should flip the Relay. I pressed the button and held it for 5 seconds, then I released it for 5 seconds, then I pressed it again for 5 seconds. Regardless if normally open, or normally closed, that should have addressed both possibilities and one of them would have worked.

Helping
people get away with things they shouldn’t be doing is , in general, not a noble motive, IMO.

Different people from different parts of the world view this differently. I know reaching out to hard to reach targets (college students) to get them interested in going out on their own to learn and do projects themselves without someone requiring them to isn’t the easiest thing in the world to do. Sometimes, the best thing you can do for a person is to get them interested in something. In this particular scenario, one year later it wouldn’t matter what the cause of the interest was because they will then be 21 which is legal. However, what they learned, and the technology they acquired an interest in will matter and that makes a difference.

Do you have meter to take voltage or resistance measurements ?

Yes I do, I forgot to cut it off last night so I need to go get a new battery. I’m going to go get that now, i’ll be back with it in 15 minutes.

Something is wrong with your code or something. Measure the voltage at the led and at both ends of the relay contacts . Are you sure the led is connected correctly ? Have you tried jumpering it to 5V directly or running the Blink example. This is an extremely simple circuit to troubleshoot if you have a (working) meter.

This is an extremely simple circuit to troubleshoot if you have a (working) meter.

Absolutely correct. The pins of Relay are very small. The Relay was apparently slanted and so the pins on the right side of the relay we're connected to the breadboard. I got it to work with the music, and the led.

Thanks for working with me to figure it out!

Thanks for working with me to figure it out!

Basic troubleshooting. Don't make assumptions. Nothing is true unless you have verified it. The breadboard/pin connection issue occurs with RGB led pins too. It is best to do continuity checks point to point to verify the pins plugged in are actually connected.