harvie
Full Member level 1
Hello, i want to design circuit that will automatically switch my amplifier on and off according to signal at the input. I'd like it to be quite sensitive even for quiet music across wide frequency spectre. But in some cases where audio cable is too long there is 50Hz (EU) mains hum, it's not very loud, but it's close to treshold of sensitivity that i want to use. Also when cable is disconnected and left loose without ground on other end it gets even louder, but obviously in such case i want my amp to shut down too.
I've been thinking about some simple analog circuit, but then i realized that this will be much more simple if done using arduino (and attiny once proved to work later). MCU seems to be easier for tuning timeouts and hysteresis than analogue circuits. I Also tought that i can use simple RLC bandstop filter to get rid of mains hum. But then i realized that i can possibly implement it on MCU itself. This is good idea, because such filter can be easily modified to filter 60Hz mains in US or any other site-specific noise that can be present in various places.
So what i need: If there is signal (anything in audible range except for 49-51 Hz) on at least one of two ADCs (i need stereo) then arduino should set output pin HIGH. If there is no such signal for some time (eg.: 5-60 seconds) then arduino should set output pin LOW again. It should react even on relatively quiet signals (so there is place left to decrease sensitivity to needed level using pot).
Maybe there is even no need to use filter and i can use FFT, Goertzel or something like that. I know that i can easily use goertzel algorithm to detect presence of 50Hz signal, so i wonder if there is some similar algorithm that can detect presence of any non-50Hz signal.
I've never done DSP on arduino/attiny, i know that bit depth and samplerate is crappy for music, but i guess it's reasonably good for task like this. It would be great if you can show me your code implementing such filters/algos on arduino. Sometimes it's hard for me to figure how to make theoretical principles into working code.
I've been thinking about some simple analog circuit, but then i realized that this will be much more simple if done using arduino (and attiny once proved to work later). MCU seems to be easier for tuning timeouts and hysteresis than analogue circuits. I Also tought that i can use simple RLC bandstop filter to get rid of mains hum. But then i realized that i can possibly implement it on MCU itself. This is good idea, because such filter can be easily modified to filter 60Hz mains in US or any other site-specific noise that can be present in various places.
So what i need: If there is signal (anything in audible range except for 49-51 Hz) on at least one of two ADCs (i need stereo) then arduino should set output pin HIGH. If there is no such signal for some time (eg.: 5-60 seconds) then arduino should set output pin LOW again. It should react even on relatively quiet signals (so there is place left to decrease sensitivity to needed level using pot).
Maybe there is even no need to use filter and i can use FFT, Goertzel or something like that. I know that i can easily use goertzel algorithm to detect presence of 50Hz signal, so i wonder if there is some similar algorithm that can detect presence of any non-50Hz signal.
I've never done DSP on arduino/attiny, i know that bit depth and samplerate is crappy for music, but i guess it's reasonably good for task like this. It would be great if you can show me your code implementing such filters/algos on arduino. Sometimes it's hard for me to figure how to make theoretical principles into working code.