I own a vintage audio amplifier from Luxman for which I plan to build an upgrade kit, controlled by an Arduino or an Esp DB. One function to include in this upgrade kit is an auto power-off system: if the speaker output doesn't receive an audio signal during 10 minutes, the Arduino or Esp shuts down the power to the amplifier. My question: what sensor can I use to tell the arduino there is no audio signal? I have been looking at the ACS 712 5A current sensor through which I would run the + of a speaker output, but I doubt whether it's sensitivity is sufficient and whether the ACS 712 can handle audio frequencies. Anyone has an idea? The sensor should be close to the amplifier, so a small microphone in one of the speakers is not an option. Also, the sensor must be able to distinguish between low volume music and the natural noise of the equipment and finally, in no way the sensor may affect or compromise the quality of the audio signal. Any suggestions?
All you need is a protection circuit to protect the Arduino from negative voltages or over-voltage. (I'd increase the resistor to between 1K and 10K, although 100 Ohms is no problem for a speaker output.)
Connect it to an analog input and run the Analog Read Serial example code to figure-out your threshold.
Don't worry about frequency. You'll just be reading voltage, and the negative half-cycles will read zero, so about half of your readings will be zero. Just keep resetting a timer whenever the reading is above your chosen threshold and when nothing is above the threshold for 10 minutes you can "take action".
Thank you for your answer. I intended to use this kind of shield: https://www.az-delivery.de/en/products/acs712-5a?_pos=1&_psq=acs&_ss=e&_v=1.0
I think it was designed for Arduino-like microcontrollers, so will it still need some kind of over voltage and negative current protection? According to specs it reads positive and negative currents up to 5A - 20A - 30A, output is 66mV/A to 185mV/A (depending on the type 5A - 20A - 30A).
Excuse me asking this, but I only have a very basic knowledge of electronics.
I think it was designed for Arduino-like microcontrollers, so will it still need some kind of over voltage and negative current protection?
No
What is the output power of your amp, how many Watts?
It is a luxman R-1050 and according to the service manual (p. 19) it is 55 watt at 8 ohms; Audiokarma says 70 watt at 4 ohms and 55 watt at 8 ohms; total power rating is 280 watts. I also have a Luxman R-800 which is rated 40 watt at 8 ohms, for which I want to build another upgrade kit. Speaker impedance is 8 ohms.
Hi, @wouterke
Welcome to the forum.
Sorry but had to spread your post to read.
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum
Thanks.. Tom..
![]()
So the RMS current will be around 2.6A. Then the ACS712 will be fine. It has an analog output so you can set a threshold for noise in the Arduino.
in no way the sensor may affect or compromise the quality of the audio signal.
That is just impossible. Anything you put in the speaker line will affect the audio in some way.
Hi and welcome!
How will you power the control circuit, and how will it shutoff the amp?
Which Arduino will you be using?
I suppose you will want some example code.
The controller circuit is powered by a separate, small power supply of 12 V or a 3SLi-Ion battery pack, which is stepped down to 3.3 V or 5 V for the microcontroler.
The 12 V is also used to switch the relays that turn on the amp's power supply. This is a softstart system: on powering up the amp, a relay sends the 230 V through a 16.2 ohm 50 Watt resistor to the amps PSU and after 3 seconds a self locking relay takes over and sends the plain 230 V to the PSU.
The relay, the self locking relay and the soft start timings are all controlled by the Arduino or the ESP.
I use a mosfet driver between the output pins of the microcontroller and the relays.
Shutting off the amp is in fact the main purpose of this upgrade kit: by a momentary pushbutton, by remote control, by auto shut off or through a sleep timer.
The board will probably be an arduino Nano or an ESP32-C3.
It may be too early for a code as I'm still working om some other details of this upgrade kit: remote control and maybe volume control (but that seems impossible).
Also, I want to have a complete flowchart and all components available before I start assembling and coding.
There is a big difference between the two. A Nano has 5V I/Os whereas an ESP32 has 3.3V I/O. The ADC range on the nano is 5V and on the ESP32-C3 it is 2.5V. So each would require slightly differently circuitry.
It may be too early for a code
No it is not. Many people will build hardware just to find out later on that they have no idea how to control it or if it is even possible.
For example, for the ACS712, you will find that most libraries are geared towards measuring 50/60Hz AC mains current.
The board will be an ESP32-S3-Zero or a ESP32-C6-Zero from Waveshare. They both have Bluetooth on board, which will be usefull for the remote control. (The transmitter is a small touchscreen by Waveshare with an intgrated ESP32).
There is a slight possibility I use Seeedstudio Xiao ESP32S3 as I still have a few from an abandonned project.
I allready took into account a logic level of 3.3 V, the mosfet drivers use an IRLZ44N which should be fit to the job.
You may be right about the code, I wasn't aware of the default sampling frequency of the ACS 712.
This project comprises quite a few components and it is probably wise to undertake it step by step.
for the ESP32-C6-Zero, Perplexity produced a code to read out the speaker values using the ASC 712. I haven't tested this yet, but if you want to take a look at it I will post it below. initial sampling frequency is set at 10 kHz, but I may use different frequencies to get a more accurate reading.
I haven't tested this yet and I will probably not be able to do so before the next weekend
#include <driver/adc.h>
#define SENSOR_PIN 1 // ADC1_CH0 (GPIO1)
#define SAMPLES 1000
#define SAMPLING_FREQ 10000 // 10 kHz sampling frequency
const float SENSITIVITY = 0.185; // Voor ACS712 5A model
const float ADC_VREF = 2.5; // ADC referentiespanning
const float ADC_RESOLUTION = 4095.0; // 12-bit ADC
float minCurrent = 1000;
float maxCurrent = -1000;
void setup() {
Serial.begin(115200);
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(ADC1_CHANNEL_0, ADC_ATTEN_DB_11);
}
void loop() {
analyzeCurrent();
delay(1000); // Wacht 1 seconde tussen analyses
}
void analyzeCurrent() {
float sum = 0;
minCurrent = 1000;
maxCurrent = -1000;
for (int i = 0; i < SAMPLES; i++) {
int rawValue = adc1_get_raw(ADC1_CHANNEL_0);
float voltage = (rawValue / ADC_RESOLUTION) * ADC_VREF;
float current = (voltage - (ADC_VREF / 2)) / SENSITIVITY;
sum += current;
if (current < minCurrent) minCurrent = current;
if (current > maxCurrent) maxCurrent = current;
delayMicroseconds(100); // 10 kHz sampling
}
float avgCurrent = sum / SAMPLES;
float peakToPeak = maxCurrent - minCurrent;
Serial.print("Gemiddelde stroom: ");
Serial.print(avgCurrent, 3);
Serial.println(" A");
Serial.print("Piek-tot-piek: ");
Serial.print(peakToPeak, 3);
Serial.println(" A");
if (peakToPeak < 0.05) { // Deze waarde moet worden aangepast
Serial.println("Waarschijnlijk alleen ruis");
} else {
Serial.println("Mogelijk muziek gedetecteerd");
}
}
(Apologies for the explanations, they are in dutch, 46: "Gemiddelde stroom: " means: average current))
Not sure what you mean there but the ACS712 output is 5V and the ESP32 is I/O is only 3.3V. So you will need at least a voltage divider otherwise goodbuy ESP.
default sampling frequency
There is none, you sample at whatever rate you want.
I don't don't know anything about Perplexity but if it's AI, it's probably wrong.
What about using a logic level shifter 5V - 3,3V ?
The ACS outputs an analog voltage that is proportional to the current going through it. It is not a logic level voltage.
What about first trying to understand a suggestion before proposing an alternative?
What about first trying to understand a suggestion before proposing an alternative
@wouterke pointed out that he only has a very basic knowledge of electronics. If you believe that he does not understand why don't you explain.
Wrong!
A high resistance load (significantly higher than 8-Ohms) won't affect the sound.
You don't need any special sensor. You just need to detect the voltage, which can be read with the Arduino's analog input. You DO need to PROTECT the Arduino from the voltages from a "high power" amplifier... The "regular Arduino" can be damaged by voltages greater than +5V or by negative voltage, and audio is AC, which swings positive and negative.)
What do you mean by "significantly"
Exactly how will a high resistance enable you to detect the speaker output and protect the Arduino??