NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Basic Electronics » Generate a steady DC level from PWM signal
November 17, 2010 by popwarsweet |
Hi I'm trying to drive a VCO with the PWM signal from my micro. If I input the PWM signal directly into the VCO I can clearly see the frequency from the VCO jumping back and forth, not what I want. I was wondering if anybody knows of a solution to get a steady DC level proportional to the duty cycle of the PWM signal? I originally thought of using an RC filter, but I cannot get the ripple to be less than 0.05 volts, which is what I'm looking for. Any ideas? |
---|---|
November 17, 2010 by mrobbins (NerdKits Staff) |
Hi popwarsweet, Welcome to the forums! It's good that you know that you'd like < 50mV ripple in the end from a 5V steps (the PWM output). That's a factor of 10^-2, so we know we need very roughly two order of magnitude separation between the PWM frequency and your filter frequency (if one-pole rolloff like from a single RC filter). What's your PWM operating frequency? (For example, if 14745600 Hz clock counting to 255 and then starting again at 0, that's 57.6kHz, which would suggest very roughly a RC time constant of 576 Hz or less.) And finally, do you have any bandwidth constraints as to how slowly you want to adjust your "analog" voltage into the VCO? Also, just for context, could you tell us more about the overall system this is going to be used in? You've certainly made me curious. Mike |
November 17, 2010 by popwarsweet |
Thanks for the extremely fast response! But I've actually managed to find a workable solution. I was using 65535 as my top value of the PWM signal which was giving me a frequency of around 250 Hz (14.74e6/65535). Using this frequency, my capacitor value in the RC filter had to be large and the ripple was too significant. I just set the top value to 1024, since I really don't need more than .01V resolution, this worked out and my frequency is now around 14kHz on the PWM signal. This allowed me to use a much smaller cap with very little ripple. I'm actually using this to create a digital interface for a superheterodyne receiver I've been working on in class the past couple of weeks. The receiver is being used as an FM stereo receiver. I'm using the analog voltage to a VCO to set the LO frequency for a mixer (essentially a channel select/scanner). I'm also adding many other features that my nerdskit is allowing me to add to the project, I couldn't have found this site at a better time! Thanks again! |
November 18, 2010 by mrobbins (NerdKits Staff) |
Cool -- is the VCO directly outputting a ~100MHz signal to mix against the incoming FM radio signal? Post photos / schematics / updates as you go! Mike |
January 11, 2011 by Jalex |
Hi popwarsweet This was something I thought about doing but in order for this to work you would need a prescaler on the LO and then compare the two frequencies. In other words a PLL circuit. I would be interested in your pictures and schematics too. |
January 11, 2011 by popwarsweet |
@Jalex No prescaler was used in my circuit, also instead of using an RC circuit out from my PWM signal to get DC signal, i built a R2R ladder (DAC) to get a very smooth DC signal out. My VCO outputted 98~118MHz with a 0-5V input. Going into a mixer along with an incoming FM radio signal (88~108MHz), a cross-product at 10.7MHz was outputted from the mixer and was used as the intermediate frequency throughout the system. I'll try to scan some schematics and post them. |
January 20, 2011 by Jalex |
Hi popwarsweet It sounds cool but I have a question. If you don't use a prescaler what are you comapring to hold it on frequecy? Your LO should be at 98 - 118Mhz you can't look at that with the micro. |
January 25, 2011 by popwarsweet |
Hey, I was actually not keeping track of exactly which frequency it was on. I was just scanning up the frequency until my signal strength indicator was high enough, then I simply stopped ramping up the frequency/voltage into the VCO to keep it at that frequency. I did do some testing of the VCO alone at different voltages on a spectrum analyzer to come up with a basic plot of voltage vs. frequency, I used this to estimate which frequency the VCO 'should' be at with respect to the voltage, but I was not measuring the frequency in any way when the project was complete. |
January 25, 2011 by Jalex |
Hi popwarsweet http://www.sm0vpo.com/ Here is a link where you might get some ideas. Harry Is very helpful and mights give you some help for your project. He has solved many problems for me along these line. |
Please log in to post a reply.
Did you know that talking to the microcontroller over the USB/Serial link is easy under Windows, Linux, and OS X? Learn more...
|