Convert PWM to Analog out

Kyle,

Did you read the CUBLOC manual? Page 207 discusses the PWM instruction and 292 discusses how to use PWM as a D/A convertor. Note the R and C values on page 292 give a single time constant of nearly 1/2 second.
http://cubloc.com/download/cubloctouchmanual.pdf

A Microchip app note on the subject of PWM and filtering:
http://ww1.microchip.com/downloads/en/AppNotes/00538c.pdf

I agree with the others in stating that a PLC with a voltage output would be an easier way to accomplish your task.

I'm curious on how you plan to integrate your CUBLOC. Are you designing a cicuit board, too? Or is this going to be a nest of solder connections on a perfboard?
 
Peter Nachtwey said:
I SAID GET AN ANALOG OUTPUT!!!!

I'm going to tell you the same thing. Get the components to match or you and your successors will be in for a world of pain.

A simple RC filter is not going to provide you with a smooth analog voltage - you'll be turning your square wave into the typical RC sawtooth wave, I don't care how big a capacitor you put in there. If you don't believe me, grab your scope and try it.

...

Now that you've seen with your own eyes what waveform you'll be dealing with, choose a different component. If you want an analog output, buy the component with the analog output. If that manufacturer doesn't make one, get another manufacturer. Get a different part. If you just can't find the part, then you must redesign the system, or at least that part of it.

Whatever you do, don't use a PWM output and a filter to try to fake an analog signal. It won't work. You might have some success with a PWM capture microprocessor with an analog output, but that's even worse. If you do that, you'll have another point of programming failure ready to mess you up.

And yes, I know this from personal experience. (Luckily for me, while still at school.)

Pick the right parts and make your job easy.
 
OK. Enough said. From what I have learned in this thread is that converting PWM to analog WILL work but it is NOT a good idea.

I would like to hear back from Bits & Bytes with his experiences that he mentioned early in this thread.
 
This is the method I use to vary the reference voltage to an AC Drive with a 0-10VDC input using a PWM [NPN] output from a PLC.
Works for me!

For a sourcing PNP output the circuit will be different and the PWM output pulse width would not be inverted. ie Pulse width 0-100% = 0-10VDC.
 
This is the method I use to vary the reference voltage to an AC Drive with a 0-10VDC input using a PWM [NPN] output from a PLC.
Works for me!
Hi Bits & Bytes. Can you tell me how many of these devices you have and how long they have been in service? What kind of duty cycle does this drive see in any given day? What is the application? Thanks for your time.

I have attached the documentation of the device that will be controlled with the PWM to analog output. (Disregard, currently too big to upload) How about a link:

http://www.hydraforce.com/Electro/Elec-pdf/3-435-1.pdf

Thanks to everyone for their input and suggestions.
 
Last edited:
The PWM output is always active. Pulse width is varied to change desired speed of the drive.
Used this application for YEARS to vary speed of VFD with 0-10VDC input reference from a PLC NPN output with PWM functionality.

In my application the current is very low [a few mAmps] versus your 1500mAmp requirement.
You could switch an opto with your PLC output. This would need sufficient load capacity for your application, then upsize the ratings of the resistors and capacitor attached to the opto output to match your desired load voltage and current requirements.
 
In my application the current is very low [a few mAmps] versus your 1500mAmp requirement.
The output of the valve driver is 1500mA. The PWM to analog signal is just for reference, very low mA.
The PWM output is always active. Pulse width is varied to change desired speed of the drive.
Used this application for YEARS to vary speed of VFD with 0-10VDC input reference
How often do you have to change the speed of the drive? How precise does the speed have to be?
 
Kyle Grathwol said:
OK. Enough said. From what I have learned in this thread is that converting PWM to analog WILL work but it is NOT a good idea.

No, it only works when the output you're driving takes a long time to turn off compared to the pulse width of the PWM.

Good examples are:
1. Motors. With the built-in inertia, they work fantastic with a PWM.
2. Lights, especially high-brightness LEDs. You can get a significantly brighter light with a PWM.
3. PWM capture and compare sensor inputs. These sensors are specifically designed for PWM inputs.

Bad examples are:
1. Analog sensor inputs. The sampling could be at the high or low point, or at some point in the sawtooth if you're using an RC filter to try and maintain a constant voltage.
2. Digital sensor inputs. This is kind of ridiculous, but I wanted a second example. ;)
 
The resolution of the PWM output is primarily hardware dependent.
Have used the IDEC MicroSmart PWM instruction which has a range of 0-100 in increments of 1.
Changed platform to Omron CJ1M. Earlier versions had similar resolution as IDEC. Newer versions have 0-1000 in increments of 1.

Depending on your application this may or may not be accurate enough. Consider also the device you are driving! In my case the speed reference of an AC Drive. Kyle Grathwol is controlling a device I am not familiar with.

Most modern devices use an analogue to digital converter on their front end. These generally include some form of built-in filtering that will accept the PWM input with no problem.

All I can suggest is to test the application and see if it works.
 
Depending on your application this may or may not be accurate enough.
Thanks Bits & Bytes.

I will only need 4 or 5 different analog values to send to the valve driver. The valve driver drives a proportional hydraulic directional control valve that controls the speed of a hydraulic cylinder. I will only need 4 or 5 different speeds so a very smooth linear acceleration/deceleration isn't necessary.
 
if you need only 4 or 5 set values whay not use 4 digital outputs with
a set of binary encoded voltage dividers ? this will give you 16 difrent
values and you can use trimers to tune to the precice setpoint.
btw i use that same driver {hidraforce} to drive a vibrator press.
 

Similar Topics

Hello there, We're trying to build a prototype for a 3D food printer. The main control board for the printer sends out PWM signals. For...
Replies
19
Views
4,674
Hello all, I'm currently working on a servo motor linear positioning system (ball screw). I'm all set up regarding communication between my HMI...
Replies
1
Views
92
I have an application using an incremental encoder and then I convert it to degree (0-360) using calculation program. For a while, the calculation...
Replies
8
Views
306
Hi all. Me again still learning Rockwell. So I'll be polling an INT data array from a Modbus SE power meter with a L82 (with a Modbus ProSoft in...
Replies
56
Views
1,395
Hello, could someone kindly convert the attached RSP files that are currently used for SLC 5 PLC into PDF please
Replies
6
Views
534
Back
Top Bottom