Automatic Volume Adjuster for LOUD MOVIE MUSIC

11K7547

Intro: Automatic Volume Adjuster for LOUD MOVIE MUSIC

In this project I will solve one of the biggest problems I have with modern movies. The problem is that the conversation volume is way too low in comparison to the music volume. That is why I combined an Arduino microcontroller with a microphone and an IR LED in order to create an automatic volume adjuster. It basically detects when loud movie music starts playing, lowers the volume and then brings the volume back up when the music is over. Let's get started!

STEP 1: Watch the Video!


STEP 2: Order Your Components!

STEP 3: Build the Circuit!

Here you can find the schematic of the project along with pictures of my finished board. Use them as a reference when building your own.

STEP 4: Upload the Code to the Arduino!

Here you can find the code for the Arduino. Upload it with an FTDI breakout board. Make sure to use the 3.3V 8MHz setting.


You also need to download this library:

https://www.arduino.cc/reference/en/libraries/irremote/

STEP 5: Success!

You did it! You just created your own Automatic Volume Adjuster for LOUD MOVIE MUSIC!

Feel free to check out my YouTube channel for more awesome projects:

http://www.youtube.com/user/greatscottlab

You can also follow me on Facebook and Twitter for news about upcoming projects and behind the scenes information:

https://twitter.com/GreatScottLab

https://www.facebook.com/greatscottlab

35 Comments

can you make a BT version of this?
Hi Great Scott, this is a very interesting project. I have been wanting to do this for quite some time. As I very much like the design and idea, my question is: Can you take an audio signal from the output of the TV and sample the audio's level and keep the output within a desired level? This output would then be fed back to a soundbar or stereo. This would basically do the same thing as your design but with no microphone or infrared led. Please consider this and let me know if it's possible? Thank you very much.
Bill Patton.
hi great scott.
i have seen the video and all the schematics. Im in search of the initial amplifier circuit you created for the microphone for testing which doesn't seem to use an opamp. i have attached a screenshot from you video if that helps. Can you provide this circuit or a similar microphone amplifier circuit which doesn't use an opamp.
thank you. Big fan btw. Keepup the great work
I have a Sharp GA840WJSA remote and I'm trying to build this project. I've built my board and I'm trying to get the remote codes for up and down volumes. In your file you had the lines:
IrSender.sendSAMSUNG(0x3434E817, 32); //Vol+
IrSender.sendSAMSUNG(0x34346897, 32); //Vol-
Attached are the codes that I got from my remote when using a simple IR receiver and reading output from the Arduino serial monitor. (Left is Volume Up, Right is Down)
My question is, how do I use those remote codes in your MovieVolumeAdjust.ino file?


Why are you not manufactureing this as a stand alone project?.I haven't the arduino
Experience ,I have a few neighbours who
Would by one if they could due to advertisers volume, increasing during
Brakes.rgds Peter
Hi,
I changed the code to use millis instead manually setting timers interrupt which makes it compatible with non-avr boards, and implemented a finite state machine to make the code more clear, here is the github repo

https://github.com/cobrce/MovieVolumeAdjust
I just checked part of your code, until this line::
IrSender.sendSAMSUNG(IR_DATA_VOL_PLUS, 32);

Your code is more comprehensible and organized.

As a preliminary test, I checked if my Samsung TV will recognize the volume down command by manually alternating A1 between Vcc and GND (bypassing the mic and the amplifier). The TV did not recognize the command.

In IRremoteInt.h it says::

void sendSAMSUNG(unsigned long data, int nbits);
__attribute__ ((deprecated ("This old function sends MSB first! Please use sendSamsung().")));


So I knew why my Samsung TV did not recognize the commands, because when I took note of the commands (using an IR receiver with Arduino setup and the TV's remote control), it was clear the TV expects an LSB first format.

VOLUME UP:: Protocol=SAMSUNG Address=0x707 Command=0x7 Raw-Data=0xF8070707 32 bits LSB first
VOLUME DOWN:: Protocol=SAMSUNG Address=0x707 Command=0xB Raw-Data=0xF40B0707 32 bits LSB first


I used this one instead::

void sendSamsung(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false)

Here's the full code of the tester (it's not worth posting it on github :))
Note that I left some pin definitions and a few lines in the setup because I've tried it with the whole circuit still there, with the only difference being the A1 thingie described above::

Here's the full code of the tester (edited to include code from gist.github.com instead of posting the whole code here as @Cob suggested)::
https://gist.github.com/roger-tannous/429f848fd80ab2ba32b3a47ca297ecd3

Note that I left some pin definitions and a few lines in the setup because I've tried it with the whole circuit still there, with the only difference being the A1 thingie described above
Forgot to remove this line, as sendSamsung already calls it::

IrSender.enableIROut(IR_FREQUENCY);

so it was not necessary
Hi and thanks for the feedback,
I updated the code to use the new SendSamsung, I called it directly from IrSender with the parameters you provided.
And if you want to share snippets of code (not full projects) you can use gist.github.com, it supports code highlight and you just paste the code (no git/repo shenanigans)
Thanks for the tip Cob :)

Will surely remember to pull again from your repo.

I just read the modification you've made and the reason I did not replace the old implementations "in-place" is the same as when you'd rather make changes, for instance, to pin definitions instead of having to go again through all the code (especially if someone else will have to do it).

In fact, we have 2 brands of TVs at home. Mine is a Samsung. The other one is a Sony (with which I'm currently struggling with the IR thingie).
So I've added a few things to the code I've shared, but it's not finalized yet. My goal is to add a button (optionally with LEDs) to toggle between these 2 brands.

The weird thing about the Sony TV (a Sony Bravia model) is that when I dumped the IR codes, the address for the volume up/down commands was 0x1, too small of a value I guess ? So I'm suspecting there was something wrong at the time I was fetching the codes from the remote control.

I also didn't take full logs, I changed the code to check only for some protocols (samsung, sony, pulse distance, and pwm) and only printed the summaries. I did that because the receiver/dumper was capturing lots of noise and reporting unknown protocol stuff when nothing was being pressed on the remote control (no filter on the IR led, etc.)

Finally, I read somewhere that some TVs expect to get the same commands (address + command, etc.) multiple times in a timely fashion, I didn't have enough time to check if the IRremote library already does that (is it the repeat argument ?)

Sorry for the very long messages!
Hey Cob
your code seems to have the same problem as Scotts in my case. Somehow the volume gets lowered but never returns to normal sound. Did you rebuild the project?
Hi,
I didn't build the project but I did simulate it with proteus.

There are two bands of volume, the loud and quiet, and they're not adjacent, i.e the volume gets lowered when it's too loud (a loud music), then the volume stays like that until it gets quiet (a quiet dialog) where it's restored. Maybe in your case the volume didn't drop this much
I set the volume to 0 manually to see if it raises automatically but it doesnt.
I also tried to many different settings of the potentiometers ...
Check the serial output of the program, it tells you what state it is and the value of audio, in order to restore the volume the audio should be less than 540 and above 480 (and stays in that range for a while)
I already did that and it looked good. I set the the values to different variables and played a bit around with them. now it seems to work. 540 is now 600 and 480 is now 420.
I will see that tonight if it finally works in my "field test"
While doing your tests increase the volume until you read in the serial data "state : LoudCondirmed", let it reduce the volume until you read "state : WaitForSilence" now use your remote and lower the volume until your read that the audio is within the range of "IsQuiet()", at this point the sate becomes "SilenceFound", confirm that audio level stays in the said range for a while until the state becomes "SilenceConfirmed" and it should start increasing the volume.

Did anyone rebuild this Project?

I rebuild the the Adjuster with the following components instead of building them on my own.

IR Sender HX-53
MAXX4466

The ohter components are like in the instruction.

Now the probelm.
Somehow it only works once the controller is booted or the potentiometer is completely lowered but then it constantly changes the volume.

The values are the look the same as in the video and i dont think i made an mistake :-)

Would be great if someone has an idea

Also, please specify which potentiometer are you talking about.
A few things to note::

1. the project uses an inverting amplifier, check that yours is of the same type.
2. Also take note of the following excerpt from your mic amplifier's page on Adafruit::

"The output will have a DC bias of VCC/2 so when its perfectly quiet, the voltage will be a steady VCC/2 volts (it is DC coupled). If the audio equipment you're using requires AC coupled audio, place a 100uF capacitor between the output pin and the input of your device."
Did you use linear or logarithmic potentiometers?
More Comments