Instructables

What is this?
NovaIdle is monitoring amplifier for idle time (no music played) and turns off the amplifier with IR command  It is written and tuned for the Peachtree Nova amplifier that has a tube. I wrote this program as I tend to forget the amplifier on and given the tube has limited ifetime, I am always feeling bad when I see it still on few hours later. Not to mention of course that we can be a bit more green by preserving power.
I published another version of this (for a Kenwood amplifier too)

 What You need to build this?
1x Arduino (any type will do)
1x IR LED (950nm Wavelength)
1x 200 Ohm Resistor
Donwnload and install the Arduino IR library (http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html)

Optional Components:
1x Blue LED
1x Yellow LED
1x Green LED
3x 330 Ohm Resistor (anything from 220 to 330 will do)
1x Prototype board to solder and connect the above
1x 3.5mm Earphone Stereo Jack
1x RCA to 3.5mm Stereo cable
1x USB Power supply (or you can feed it from other source)

How it works:
The program is written for Arduino, basically reading left and right signals on Analog inputs (A0 and A1) from a line level out of the Nova (connector 16 on the Peachtree user manual diagram). If no music is detected for some time (constant idleTimeToTurnOff) then the Arduino will send a power-off IR command that will turn the Nova amplifier off. Gladly the Nova has an actual power-off and not only power toggle code.

Sampling the audio in every 2 secods and the idle time is set to 5 minutes (you can change it in the code), enough time to swap CD's or to tell my Sonos which album to play next. The audio sampling is not done in one shot, as we can randomly find the Arduino ADC measuring 0, so we sample 10 consequential on each channel (left and right). The detection uses simple max on all samples.

Technical Notes:
I found it mandatory to use a load resistor on the A0 and A1 since when the Nova amplifier is off, the ADC on the Arduino is reading very random numbers. Using the load resistor to ground (10K Ohm) made the samples when amplifier is off to 0 (good!).

Overall, using Arduino for something as simple as this, is a bit of an overkill I admit, but would you like to solder and program ATTiny13 or something like that without a boot loader, spend hours on the SW deployment and HW side when with few extra dollars you get it easily with the Arduino? I decided to use the Aduino Nano for this purpose, simple small and nice one. The Arduino have enough IO ports still, so I am taking some of the internal state and expose it with LEDs, please see below. These LEDs are optional and connect/assembly only if you like. These are the LEDs that I used:
 Pin  Meaning  LED
  ------- ----------- -----------------
 13  Power  (on-board)
 12  Playing  Green
 11  Idle  Yellow
 10  Amplifier Blue

 The Blue LED will light up if the unit will detect the amplifier is on.
 The Yellow LED will light up if the unit will not detect any music.
 The Green LED will light up if the unit will detect music is playing.
 The Power LED will be on by default and blink off on each sample.

The IR LED needs to be 950 nMeter LED. You can find these pretty easily. I am using 2x100 Ohm resistors in series for this LED (200 Ohm) as I want some power when transmitting. This will drive about 18mA through the IR LED which is good and safe. Do note the polarity of the LED (long leg is positive (throough resistor to the Arduino) and short leg to ground.

The Nova does have IR Input jack and IR Output Jack that in theory I could use for this application, however when you plug in the IR Input jack it disconnectes the IR decoder internally so that the remote will stop working and to revive it I would have to pole IR from remote using an IR sensor and send it through the Arduino to the Nova. I think this is way too complicated and not really necessary.

 Nova IRC odes as recorded by IRemote library
 ---------------------------------------------
 Off   FF6897
 Mute  FF28D7
 USB  FF708F
 Coax1 FFB04F
 Coax2 FF30CF
 Opt1  FF50AF
 Opt2  FF906F
 Aux1  FF10EF
 Aux2  FF609F
 Aux3  FFA05F
 Tube  FF20DF
 Vol-  FF807F
 Vol+  FF00FF
 
 
Novar IR Codes as reported by Peachtree
 ---------------------------------------------
 Nova
 ====
 NEC uPD6121 protocol
 custom code 00FFh
 
USB  0Eh
COAX1 0Dh
COAX2 0Ch
OPT1  0Ah
OPT2  09h
AUX1  08h
AUX2  06h
AUX3  05h
TUBE  04h
VOL+  00h
VOL-  01h
MUTE  14h
STBY  16h
STBY_OFF F0h
STBY_ON F1h
MUTE_OFF F2h
MUTE_ON F3h
TUBE_OFF F4h
TUBE_ON F5h

Inspecting the codes, it is clear either Peachtree or the IRemore library are reversing the LSb and MSb of each byte, but who cares :-)  I took the STBY_OFF code and fixed it according to how the library actually works.

Last, but not least, I want to thank the Peachtree support for giving me the IR codes and wavelength information and being very prompt in sending replies. Good service always deserve mentioning.

zmashiah (author) 1 year ago
To the best of my knowledge it is.
I came across many schematics for Amps in my life, and in all cases the Speaker - was common GND for both Left and Right speakers (and also for the 5.1 and 7.1 Amps too).
Having said that I CAN't guarantee that it is the case in your amp. I can suggest though that you will turn your Amp off, use a Ohm meter to check the resistance between the the Left and Right speaker - wires. If it is 0 Ohm, you are fine to go. Alternatively you can search for the schematics on the net... sometimes you can get lucky with that.
MarioCarta1 year ago
Hi zmashiah!

Sorry to be bothering you again with this... the right relay's board has just arrive from DealExtreme (they sent me a 24V instead of a 5V at the first time) and now it's time to get back to work!

I know it sounds a little bit silly question, but I'm not willing to try it with my receiver without knowing:
I was doing the schematics and both L- and R- will end up shorted via the GND. Any problem? I know that if it's line or phones level, there is no problem, since both GNDs are carried via the sleeve on a P2 cable. But since I'm dealing with the unknown for me, speaker amps, is it right?

Cheers!
MarioCarta1 year ago
My Amp doesn't have a line out. I am wondering if there is some kind of adaptation that I could do to use the amped signal direct from the speakers' output without burning neither the arduino nor the amp... Do you think this is possible?
zmashiah (author)  MarioCarta1 year ago
Hi Marcio,
Amplifiers that driving speakers may have quite significant power compared to what I expect in the Arduino. What I need is around 1 to 3 Volts to detect something is playing. An Amplifier of 50W drives about 20V through the speakers...
You can design a circuit with voltage limitation output for that. As we are only interested in having "1" for music is playing and "0" for no music is playing, such a circuit can be non-linear with a lot of distortion. You can design it in such a way it will not be noticed by your amplifier at all.

One option of such a circuit is a resistor and zener diode while the Arduino sees the Zener only, and the Zener is for something like 3.7 Volts. The resistor can be something like 2KOhm if you have 50W amplifier. Something like the below:

2K
Speaker + ----/\/\/\/\/\----*---------- Arduino Input
|
\ _
/_\ \ 3.7V Zener
|
Speaker - -----------------*---------- Arduino GND
(removed by author or community request)
zmashiah (author)  MarioCarta1 year ago
The Zener should be connected where the * marks are.
Somehow the blanks in the beginning of the lines did not work to move the Zener diode to there.

Sounds like pretty cool room you got!
I love automation
Thanks! Good to know, I was thinking that the zener was before the resistor. I'll make a scheme so I don't forget these things. Doing this way with my 50W/ch amp there are no risks, right?

If you want to see my automation system there's a video with brazilian portuguese audio only, but with english desciption bellow:

http://mariocarta.tumblr.com/

Cheers!


zmashiah (author)  MarioCarta1 year ago
Thank you Mario. No risk to the amp.
Strange, I was testing the voltage (DC) with my multimeter and only got 10mV tops with full volume. You said it would be about 20V. Does this have something to do with the fact that the channel I'm using for testing is the Front Right satellite (thus without the sub)? When connected to the amp everything sounds OK.

Thank you again!
zmashiah (author)  MarioCarta1 year ago
Set your Multi-Meter to AC: Audio is not AC.
When testing with DC meter, the average should indeed be 0, as the magnitudes suppose to be equivalent.
OK, today I've got time to do the shoppings. I've got all the resistors. But the Zener, they had the 3.6v/0.5W and 3.6v/1W. I bought both just in case. Which one should I use? And just to be clear: this circuit goes in parallel with the speaker, righ?

Thanks!
Oh, and if I want to evaluate the signal from both left and right speakers, will I have to use two pins on Arduino or can I couple them at the end?
zmashiah (author)  MarioCarta1 year ago
Yes, that is correct.
I was doing the schematics and both L- and R- will end up shorted via the GND. Any problems? I know that if it's line or phones level, there is no problem, since both are carried via the sleeve on a P2 cable. But since I'm dealing with the unknown for me, speaker amps, is it right?

Cheers!
zmashiah (author)  MarioCarta1 year ago
Mario,
You can use the 0.5W easily (see below).
Yes, the circuit should go in parallel to the speakers.

To get to 0.5W on the Zener, it needs to take current of 0.5 / 3.6 = 0.138A (138mA). To have such current through the 2KOhm resistor, that means over 200 Volts. Not a chance something like that will happen.



Got it working!!! Just have to figure out now a function to handle the great amount of zeros (I belive it's because the zero crossing, right?) between the number that goes up to the hundreds. Maybe sampling a window of time to an array and taking the arithmetic mean....
I'm looking at your code now and I can see that's more or less what you done here! I think I'm on the right way!
zmashiah (author)  MarioCarta1 year ago
My code uses some sort of averaging.
Yeah, sorry. I was thinking in portuguese, I meant averaging. Arithmetic mean is way too formal! :)
But I try it and worked like a charm!

Thanks! Now my project will thrive! When I have something to show, I will post it to you here!
OK! Not all sites have right information! Now I got peaks up to 8V. Thanks as usual! :)
zmashiah (author)  MarioCarta1 year ago
You are welcome
Thank you!
The 2k is for the resistor between the Speaker + and Arduino input, right? And then, with the Zener, it would be inside the 5V logic level so I could use a Digital Pin instead of a Analog one?

I'm making an arduino controlled Switcher to invert my Front Speakers with the Surround Speakers (that are on the top of my bed) to listen some music when laying in bed. There will be 8 NO/NC relays two for each speaker (+/-) and I was thiking why not add some extra functionality with the extra pins? (I've alread done this with 4 manual switchers which are pretty boring to tweak - I want to be able to do this by IR, RF (as my room is all automated with Arduinos and RF modules) or Voice Recognition - Easy VR Shield).

And today I found your tutorial while browsing Hack-a-day. That's the extra function! Lucky day!
zmashiah (author)  MarioCarta1 year ago
Use Analog input not Digital one.
Not sure what the threshold for the digital inputs is, but am sure it is not low enough.

P.S.
You could also use another resistor, say 200 Ohm in parallel to the Zener, if it is not working great for you.
MarioCarta1 year ago
Today i found this: http://www.epanorama.net/circuits/speaker_to_line.html But it don't know how to couple with your system since there is a 1k on that scheme and 10k on yours between L+ (or R+) and GND.
Can you help me, please?
zmashiah (author)  MarioCarta1 year ago
Pretty much the same way I replied with my circuit.
The Line Out from the circuit to Arduino analog input.
The Line GND to Arduino GND.

I still think the Zener diode is more protective than the simple resistor voltage divider seen in the link you sent me.
zmashiah (author) 3 years ago
Some updates to the project:
   Auto Turn ON Amplifier
If there is signal from the source (Sonos) and amplifier is off, then the Arduino will turn ON the amplifier and move it to the right Input (Coax1 in my case). 
 
   Friendlier to adotpt by others

Added more comments to make it easier for other people to adopt it to their home appliances.
static3 years ago
Nice one page/view instructable. However, best I can tell it's use is specific to one product. Not there's anything wrong with that. but if I'm correct persons should be alerted to that fact, and this could be adopted for use with other products as well.
zmashiah (author)  static3 years ago
As I wrote it is tuned for the Peachtree amplifier, but can be easily ported and used with other products. All is needed is set the right IR code to your amplifier, and the IR Library used supports a breath of different IR commands and products.