PWM to DC

Hello, i have mega 2560. how do i convert the pwm signal to stright DC voltage?

Thank you

Hello, i have mega 2560. how do i convert the pwm signal to stright DC voltage?

Thank you

With a low-pass RC filter. 4.7k and caps from 0.1 to 1.0 seem to be common recommended values, but you can do the math out to figure out what's right for your application, based on your tolerance for ripple vs the timescale of changes.

Note that you cannot draw current from this - it's just a reference voltage. If you need non-negligible current, you'll need to buffer it with an opamp.

Please explain more of what you want to do with the voltage. It may determine how we advise on this question.

Weedpharma

maor444: Hello, i have mega 2560. how do i convert the pwm signal to stright DC voltage?

Thank you

You want it pretty ripple free, or 100% ripple free? I don't expect you can get to 100%. Maybe, 99 44/100 percent.

The output of a PWM signal at about 500 hz is pretty ripple free. If you need more, you can add RC or LC circuits.

As weedpharma asks, give us more detail of your requirement, and we can give more precise advice.

And don't double post!!

Weedpharma

Do not cross-post. Threads merged.

I want to make srtight DC voltage and connect it to MKS 247D device. the DC voltage that i need is determined the amount of the gas flow in the MKS 247D. the MKS 247D controlls gases and i need to connect it to the Arduino with Shield circuit, so i need stright DC to supply the MKS 247D to determined the gas flow of the device.

I tried to connect RC circuit to the PWM but i had high jumps in the voltage. I need maximum jumps of 0.06V.

So you see a big jump from analogWrite(pinX, 0) to (pinX, 1) and (pinX, 2) for example?

If the levels were strictly linear from 0 to 255, the smallest, 1/255 of 5V, would yield 19.6mV/step, so a level of (pinX, 3) would be ~58.8mV. What are you seeing?

im not use this, im using LINX in LabVIEW. i see sine wave

and i want it will be stright not sine wave.

Can you use your Oscope to view the voltage from the PWM, with a LC circuit on it? What is the ripple?

You may need some other ckt to get a smooth ( 0.06v) or less, ripple. That is a really critical spec.

Even if the arduino PWM could give that much accuracy, you could lose it if you are using a breadboard with non-soldered wires. For that kind of accuracy, solder all wires that you can.

Is your power supply even that accurate? How about your house voltage?

You may need a high precision (high cost) power supply for that much accuracy.

im not use this, im using LINX in LabVIEW.

Who knows then. I have no knowledge of LINX and LabVIEW.

Hi , Try this one , the schematic is verified and for your reference.
If you want buy exist module , please visit:
http://www.ebay.com/itm/3CH-PWM-DAC-For-UNO-ATMEGA2560-STM32-8051-PIC-Low-Cost-Module-16bit-DAC-DAC-3000-/321910893394?hash=item4af3626b52:g:WDcAAOSwhcJWOQ1M

maor444: im not use this, im using LINX in LabVIEW. i see sine wave

You are using LV in oscilloscope mode, right - x=time, y=volts ? Are you seeing a sine wave, or a lopsided sawtooth?

First, do this in your sketch: analogWrite(pin, 128);

Then attach a resistor (3300 to 4700 ohms) to the pin. Then attach one lead of a capacitor (4.7 to 10 microfarads) to the resistor (to the end that is NOT attached to the Arduino pin.). Attach the other end of the cap to ground. If you are using a polarized capacitor, put the negative side to ground.

Now observe the signal between the junction of the resistor and the capacitor, and ground. It should be flat, and 2.5 volts.

I succed. i used simple RC circuit. R=3.9K C=30uF. i got 0.025 ripple.