# Analog level shifter

I have a user-adjustable supply Vcc_user (at minimum 3.3 V, 5 V, 12 V or 24 V). Adding 48 V would be a nice to have but not required. I might also use a continuously adjustable voltage.

I would like to have two things:

1. an analog output, which scale is 0 to Vcc_user

Most ADCs and DACs have some fixed voltage range V_converter (like 0-3.3 V or 0-5 V).

Is there an easy way to scale my voltage to map [0, Vcc_user] to [0,V_converter] (and the other way)?

If Vcc_user was fixed, it would be as easy as using a non-inverting op-amp (or an op-amp follower followed by a voltage divider). But how to do it with a variable Vcc_user?

EDIT: a few extra specifications:

• bandwidth : 100 Hz is enough
• accuracy : 10% is acceptable, < 2% would be nice
• resolution: 7 bits should be enough
• With DACs, it may be as easy as using a multiplying DAC (immediately leading to a solution for a successive approximation ADC). Commented May 3 at 8:46
• Is there an advantage of "7 bit relative conversion" over "11 bit full range" (48 V)? Commented May 3 at 8:58
• @greybeard : multiplying DAC, with a reference voltage proportionnal (voltage divider) to Vcc_user, and an amplifier always supplied from 48V might do the job for the analog out part. And a 11 bit analog input with 48V range can do for the input. Thanks a lot! Commented May 3 at 9:14

I'm assuming you actually need the voltage digitized to do something with the digital value using a microcontroller...

Solution 1:

48/3.3=14 so 4 bits ; use 12 bit ADC and DAC with 48V full scale, you get 12 bits on 48V and 8 bits on 3.3V.

For ADC, a voltage divider and a 3V3 reference will be fine, you'll need to digitize both the input and the variable supply and do the division in software to get the ratio.

You will need a 48V rail to rail opamp for the DAC output, which could be a problem.

Solution 2:

Using PWM instead of a DAC gives you ratiometric output (supply voltage x duty cycle) and rail to rail output (you just need 2 MOSFETs driven as switches to do the PWM). With a RC or LC filter, if you can tolerate a bit of ripple and the output impedance from the filter, it'll be fine. If you can't tolerate the filter's output impedance, then you'll need a rail to rail buffer.

For the ADC, these compute the ratio between input voltage and reference voltage, so you could derive the reference voltage from the variable supply. However the dynamic range is quite large and will probably exceed the allowed VREF range on most ADCs. So either back to the above solution, or use something like a voltage ratio to duty cycle converter (sawtooth oscillator + comparator), or a DIY delta sigma ADC, and measure the output with the micro.