# Input Voltage scaling (reducing & amplyfying!)

Hello,

i have a beginners question regarding the conditioning of an input voltage to sample on the ADC. Since i am going to use a ESP32 the target Voltage is 0-3.3v.

The input voltage is coming in form of an audio signal, unfortunately in a very large and unforseeable variety of forms. Basically the device should take everything from professional +4dB to consumer -10db to headphone levels.

So, as far as i understand, the range i have to deal with is roughly
-5 / +5v just to make sure it can accept some weird professional level
-2 /+2v for +10dB signal
-0.5 / +0.5v for -4db line signal
something lower for headphone signal
(Line level - Wikipedia)

So to scale this, as far as i understand i either need voltage dividers or op amps to reduce OR amplify the signal to scale it to 3.3v

What i dont understand is if this can be done in one circuit or if the signal needs to be switched between two circuits, where one amplifies and one reduces the voltage?
Is there an electronics specific term for this problem (maybe "signal conditioning?)

Please excuse if this is a trivial question like i said, i am an electronics beginner.

cheers,
t.

p.s. optimally the circuit would automatically adjust to the incoming voltages but thats maybe not possible
p.p.s. high quality audio processing is not important, i want to read out an SMPTE 12M timecode signal which seems to be in the range of 960hz to 2400hz (SMPTE EBU timecode by Phil Rees)

sample on the ADC

target Voltage is 0-3.3v.

The ADC on an ESP8266 is 0 to 1V.

I am going to use an ESP32 but in any case, i found this:

According to the ESP8266 datasheet, the ADC pin has 10 bit resolution. This means that your analog reading will return a value between 0 to 1024.

The ADC only converts voltage between 0 and 3.3Volts. So before you apply any voltage to your A0 pin, you need to make sure that you’re using a device that only outputs 3.3V. Otherwise you might need to use a voltage divider.

Note: with earlier versions of the ESP, the A0 pin operated at maximum voltage of 1.0V, so check your board A0 voltage before following the next circuit.

I guess you need a circuit like this, that take an input from -56 to +18 dbV and output a constant level adjustable between -10 to 20 dbV, at least as first stage.

Ciao, Ale.

Is this more or less the same with less parts?
So the idea could be to amplify all signals to 0-10v with autogain and then use voltage dividers to get the level to 3.3v?

Would a pot (potentiometer - volume control) work for you? A pot is a variable voltage divider. (An audio taper pot is probably better than a linear pot in this application.)
I think you can get-by without amplification. For example if 0 - 3.3V is 0- 1024 then 0 - 0.5V is 0 - 151 and that might be enough range to be useful.

I'd certainly try it without amplification first. The decoding is the tricky part and there's no point in making an amplifier if you can't get it to work with a good-strong signal first.

You might be able to get a usable range using one fixed voltage divider.*

In any case you're going to need an [u]over-voltage protection circuit[/u] in case the pot is adjusted wrong or in case you've got the wrong voltage divider switched-in.

You'll also need to [u]bias the input[/u] so the Arduino can read the negative-half of the AC audio waveform.

something lower for headphone signal
(Line level - Wikipedia)

The tricky thing about "line level" is that the real signal level depends on a the volume control setting and the loudness of the program material. Pros have one or more level meters somewhere in the chain but that doesn't mean every signal is hitting +4dBu. Consumer's don't have meters and consumer "line level" can vary a lot on different equipment.

Headphone level is usually interchangeable with line-level (with the headphone volume turned-up). The main difference is that headphone outputs are capable of driving lower impedance loads, and the headphone output always has a volume control, and sometimes line-level outputs don't. (The headphone jack on a laptop doubles as a line-output... I've got a laptop plugged into my living room stereo.)

• I've made sound activated lighting that digitally self-adjusts to a 20-second moving average to set a (digital) threshold or reference level. (My setup also automatically switches the ADC reference voltage, but I can only get-away with that because I'm using a peak detector circuit that only puts-out positive voltage so my input is not biased. That won't work for you because you need to read the actual audio.)

Yes, if you google for “audio compressor circuit” or “Audio AGC circuit” you’ll find a lot of them, since your requirements are not so heavy, i would start with sometime simple. I’m not an expert in that kind of circuit, so I can’t offer more than this…

Ciao, Ale.