Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Need Higher Frequency Resolution than PWM module on PIC

Status
Not open for further replies.

savgrace

New Member
Hey everyone!

I was wondering if anyone could help me out with some simple suggestions. The simpler the better. My problem is:

I'm trying to design a PWM with max frequency of about 45kHz. I was wanting to use the PWM module on say a PIC16F1827 with 32Mhz Oscillator but even at this high FOSC my frequency resolution is only around 50Hz. What I mean is, I can only adjust the frequency by around 50Hz and no smaller increment/decrement... So If I wanted 41775Hz for example, I may only be able to get 41800Hz or 41750Hz.

Needed solution:

Is there someway I can build some solid state circuit(perhaps some IC) where I can control the frequency (1Hz resolution) with my PIC? I was thinking maybe even a 555 timer circuit but I have no idea how to go about this.

Thanks much in advance! :D

P.S. 40Mhz External Oscillator will still not give me high enough resolution.... :/
 
Last edited:
Post deleted
 
Last edited:
If you want fine frequency resolution, use a Direct Digital Synthesiser (DDS), such as the AD9851, AD9852 etc from Analog Devices.
1hz resolution? Easy!

JimB
 
Thanks for the suggestion JimB. Is there another option? It appears these chips are pretty expensive and they don't have the variable Duty Cycle like I need for a PWM. :p
 
A TL494 works in that range and you can set the frequency of operation with an external resistor like maybe a digital pot. or something.
I have made PWM's out of a TL082 dual opamp as a triangle wave generator feeding a LM339 comparator or even a 555 timer as the sawtooth wave source.
A 4046 PLL chip comes to mind for locking to an external frequency source as well as digital frequency selection.

I hope that helps give you some idea's!

jer :)
 
Last edited:
Thanks Gerald. :) Would the vco PLL allow me to generate square wave and adjust the duty cycle as well as frequency digitally (using my PIC)? Or would the PWM controller be an easier option for this? I'm not sure I was understanding the datasheet on the TL494 very well but it was saying maximum duty cycle is 64% Hmmm.... Any simplified circuit diagrams anyone :D ??
 
Last edited:
I woud you use the PWM to adjust the duty cycle as all it requires is a variable voltage to do so.
The PLL can only asist the frequency of operation.
I will look up the data sheet as I thought that it could do 1% to 99% duty cycle for single ended operation.

jer :)
 
Would something like this work? Sorry for the sloppy diagram but I was thinking maybe instead of the pots there I could control the frequency and mark/space (duty cycle) by using a FET driven by the PWM module on the PIC. This way I could vary the charging rate of the capacitors? Would this work?
 

Attachments

  • pic_pwm_idea.jpg
    pic_pwm_idea.jpg
    51.5 KB · Views: 213
Because of the dead time built in to the TL494 the minimum is 3% and the data sheet mentions 100% maximum I believe 97% is the realistic value.
Depending on your aplication you can get a bit closer in single ended operation by just using a triangle wave or sawtooth wave fed into a comparator.
Although it is nice that every thing is on one chip.
I am not sure if you can Bypass the dead time circuit as you don't need it when running single ended.

https://www.electro-tech-online.com/custompdfs/2011/09/slva001e.pdf

jer :)
 
If you wanted to do it that way I would just use a digital pot.
Programing them just takes a couple of lines from the PIC and they cost no more than a standard manual one.
Trying to use fets to replace the pots is very tricky and time consuming to get them to bias properly.
What kind of resolution (steps) do need?
 
Here is a good example of how to setup the TL494 and it is possible to use the FET method to control it is parameters because the FET's would be referenced to ground.

**broken link removed**

jer :)
 
What is this project? Are you making a signal generator? The PIC, if it is running with a crystal, will be rock solid. The 555 and TL494 will have temperature stability problems. Early on you said having to jump form 41800Hz to 41750Hz is not good. You want 41800 and the next step is 41801hz. If you build a 555 or 494 and want to control it to within 1 part in 40000 then you will need about 16 bit control. I do not think you can hold this type of oscillator to 1:40000 over hours or minutes.
 
Yep, you got a point there!
That is why I suggested a PLL but using DDS is an even better idea although a bit costly,But I don't know what his exact requirements are.

JER :)
 
Ya. Actually I thought about that :) The trouble is best digital pot I can find is maybe 1024 steps? I need to adjust the frequency by as little as 1Hz with a frequency range between maybe 500Hz to 45Khz?

Thanks for all your help Gerald :D
 
lol. Thanks guys for the help. I'm actually just trying to build a PWM with the frequency range I stated above. Reason being is I'm just experimenting with electrolysis resonance. On an impedance matched set-up this can have a high Q factor so I need the fine frequency adjustment :p It's mostly just me piddling around having some fun and learning some more electronics at the same time...
 
The resonant power supplies I have built have a low Q, depending on load. If the frequency needs to be between 41800Hz and 41750Hz, the error amplifier will cause the frequency to alternate between the two frequencies. So you might get three-41800 and five-41750 to effectively be somewhere between the two. The DDS thing I have does that to.
 
if you need that kind of resolution these days DDS is the way to go unless you want to spend the time and more parts count building a discrete frequency synthesizer with a triangle wave output fed into a comparator.
That way your output PWM signal is still true to the analog input voltage.
There are some better frequency synthesizer chips avalailable rather than all discrete.
But if you use a synthesized triangle or sawtooth waveform then this will introduce a margin of error into your PWM result and this would be defeating your purpose.

Jer :)
 
Something like this with the output divided down with a prescaler will get you finer than a 1hz resolution then you use that signal to feed another PLL such as a 4046 with vco with a triangle wave output feeding a precision comparator might work for you.


http://www.kb2ljj.com/manuals/62-QRP 40m transceiver kit/MC145170-2.pdf


jer :)

P.S. this one has a N counter range of 40 to 65535 so may not get to sub 1hz but there are ones similar to this one that may have a wider range as it has been a while since a have studied these things, But I know it can be done rather easily. :)
 
Last edited:
one other suggestion I have is if you were to use the Tl494 as suggested earlier using fets to control it you could use a stereo D/A chip to control the two voltages.
From what I understand you can load them using the spdif format and don't cost as much now days.

Well thats my brainstormin for tonight.


Good luck, I will be interested in what you decide to try!!!

jer :)
 
Status
Not open for further replies.

Latest threads

Back
Top