3 Analog inputs are reading 3, 15, 36 (A5, A1, A0), with the same circuit I’m reading 514 (on the rest). Are those inputs burnt?
So I’ve trying to connect speakers to an analog input to start a sketch when playing audio. The speaker cable is coming from my receiver (Marantz NR-1403) and I’ve been successful with the divisor circuit reading around 510~530 standby and when playing it goes above or below so my sketch is a simply if < 510 || > 530 do something, I’m not doing audio processing just trying to detect when music starts. The problem is I started doing that on A0 and noticed my arduino restarted when i cranked it up (my receiver). I was using a different circuit and probably damaged my input. Then i changed my circuit to this:
And it happened again on A5. Any ideas?
Sounds like you damaged the pins, yeah - I'll bet they're now shorted to ground (and the ADC is correctly reading a near-ground voltage), that's what usually happens when you abuse a pin.
The change in voltage is large enough that it's going outside the power rails, and bad things are happening as a result. Adding a pair of shottky diodes to the analog pin to protect it would be a good idea. Can you get on the audio signal before you amplify it, so that the voltage swings wouldn't be as large? Have you measured (ie, with a scope or something) what the peak voltages are?
No I can't get the audio before the receiver, it's coming directly from my HTPC which is connected to the receiver. I'm using Kodi to play the music. Could you tell me where to put the diode(s) to protect the arduino? Or maybe some other way to start the sketch and music. The arduino is not close to the receiver so can't send serialwrite or something like that.
Edit: I guess this can work?
I was referring to the second schematic on that link, with the diodes to Vcc and Gnd. Use schottky diodes, not normal silicon diodes, to minimize the forward voltage across them so that they keep the voltage within the ATmega specs (which is max Vcc +0.5v or Gnd-0.5v) - a silicon diode has a drop of around 0.7v, which is too much, but a schottky has a drop of around 0.3v.
Also how did you size the cap? 1uf seems excessive...
That's a circuit someone linked to me to input audio to the arduino. I'm using 10uF