Voltage amplifier

Hi Folks,
I need a little help here on a problem that drives me crazy. It seems like it is the easiest step of my project but I don't find a solution for it. Here is the deal:

I have a +24Vdc voltage as an input and I want to control an output voltage from 0 to 10 Vdc.
From the 24V input, I regulate 5V off of it and feed a PIC16F628A. From the PIC I have a controllable voltage of 0 to 5Vdc using the PWM. Now the only thing remaining is to amplify this voltage with an operationnal amplifier with a gain of 2.
Here is my problem: I do not want to use any additional power supply to feed the op amp., I would like to use the +24Vdc I have to supply it.

Case 1: using a traditionnal amp op, I have to use a virtual ground. The problem is that the output voltage amplified will be from 0 to 10 volts in reference to the virtual ground and I need it to be in reference of the circuit ground.

Case 2: I was thinking about using a single supply op amp. Is this going to solve my problem, am I going to have a 0 to 10 volts output in reference of the circuit ground ?

Thanks a lot for your help !

Do you want a variable DC voltage output? If you amplify the PWM output, you'll just have higher voltage PWM, not a variable "non pulsating" voltage.
You'll need some other electronics to get a stable voltage output. You can use a dedicated DAC IC, or R2R ladder.
If you are limited to the PWM you might start with a low pass filter to get first a stable voltage.

If you are OK with PWM, the you just need the amplification. Select and OpAmp and build a non inverting amplifier, with gain 2. There is enough info in the datasheets (in the one from National LM358 there is a nice example).
The virtual ground is not a problem. You'll get 0V out if you input 0V in.
There are many Operational amplifiers that can be powered with a 24V single supply, i.e. the LM358
The only problem is how close you want to get to 0V. You might be selecting the OpAmp based on this.
Hope this helps.

Thanks for this answer.
You're right, I am looking for a stable variable DC voltage output. If PWM does not work, I will use the micro + a digipot, I guess that should work as well.

As far as the virtual ground, if I feed the OpAmp (Which needs -5V / +5V for instance) with 0 and 10Vdc, it means my virtual ground will be at +5Vdc in reference of the circuit ground. So if I have 0V input, I will have 0V output in reference of the virtual ground, meaning +5Vdc in reference of the circuit ground ?? Or am I missing something ?

I do not need to get to close to 0 (A variable output of 0.5V to 10V is fine as well)

If PWM does not work

PWM will need to be filtered. And that is not an easy thing if you want a clean result (at least with my little experience :grin: )

I will use the micro + a digipot, I guess that should work as well.

It will work. Also a dedicated DAC will.This is a matter of resolution. For instance, if you use a 256 step digipot as a voltage divider between 10V and 0V, each step will represent 10V / 256 = 39mV

I do not need to get to close to 0 (A variable output of 0.5V to 10V is fine as well)

Then use a single supply OpAmp, like the cheap and popular LM358. You will source it with 24V and ground (No need of + and - Vin) and build a non invertig amplifier with a gain of 2, problem solved.

You can convert a PWM signal to analog by low-pass filtering - the simplest being a single RC stage. You will have a slower response to change though, should that matter. Knowing what the ultimate load for the 0..10V signal was would help decide a good way to drive it.

Guys,
Thanks for your precious help, I think will go with the PIC + Digipot + LM358 and see how it works !

The 358 might not even be necessary, depending on the digipot you use, and how you use it. As MarkT said, we need to know a little bit more about the use of this output to be able to help more.

The digipot I was willing to use is an AD5220. The 0 to 10 volts actually controls a motor. A low response time should not be a problem. The ultimate goal of this is to control a motor from a computer. This is done using a serial communication between the PC and the microcontroller (for instance, I will press '+', and the motor will run a bit faster or '-' to decrease the speed).

That is pretty much all the information I have.

There is a big chance that a motor can work with PWM. And I don't think that resolution is a problem in that kind of application, does it?

Be carefull with the digipots, as far as I now, they cannot drive as much current as regular mechanical potentiometers. You'll need some further electronics there.

The 0 to 10 volts actually controls a motor

Control could mean its a low-level signal to a motor controller unit, or it might mean the voltage direct into the motor terminals - we need to know this kind of details to be able to say anything useful.

You would be better off using a logic level FET with the gate directly connected to your PWM pin.
There's a range of MOSFETS that cost a couple of dollars that would easily handle the voltages and currents that the motor would draw. The circuit will be a lot simpler too.

Hey guys,
I just wanted to thank you all for your help, I used the PWM on the micro with an RC filter and the single supply opAmp LM358 and it does exactly what I needed.

I greatly appreciate your help !