## Variable Frequensy Osc.

17 posts / 0 new
Author
Message

Trying to make a VFO, 124 KHz +/-

Tiny15
100K pot
Unknown cap.

VCC (5V) to pot
Pot wiper to cap and analoginput
Cap to gnd.

Using analog comparator, Vref = 2.56V.
Half wave of 24 KHz squar wave = 48 KHZ, t = 1/48000 = 20 us.

Howto calculate C?

HM

HM

What is the frequency range? Is the potentiometre range 0-100k?

So why there is an AVR? do you really have to measure voltage rise time like using some NE555 timer chip? But the answer is easy, it is perfectly normal exponential RC charge curve, but to know the time you should know what the supply voltage is (or how many % the 2.56V is from supply voltage).

But if you are directly going to use that as the VFO frequency, you would need to also discharge the capacitor and that takes time, you can keep it constant though.

If you are going to have the AVR generate frequency based on potentiometre control, the capacitor value does not need to be in any relation to generated frequency but the pot measurement frequency. How often do you need to change frequency (measure the potentiometre value), 10 or 1000 or how many times per second?

Just thinking, why not just generate square wave in software, and read pot voltage with ADC, and adjust square wave frequency accordingly? Much simpler and easier?

You have no access to the comparator output. WIthout feedback, it won't oscillate.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

To Japael:

A 555 need 4 extra components, the Tiny15 need two. Moreover, the signal are to be handeled by the Tiny 15 anyway.

Do you think I ask if I am able to calculate it myself? My education stopped before log amd ln, (sin and cos).

HM

HM

ka7ehk wrote:
You have no access to the comparator output. WIthout feedback, it won't oscillate.

Jim

javascript:emoticon(':D')

HM

HM

mossige wrote:
Trying to make a VFO, 124 KHz +/-

Tiny15
100K pot
Unknown cap.

VCC (5V) to pot
Pot wiper to cap and analoginput
Cap to gnd.

Using analog comparator, Vref = 2.56V.
Half wave of 24 KHz squar wave = 48 KHZ, t = 1/48000 = 20 us.

Howto calculate C?

HM

I would use a 74HC14 schmitt trigger package, your 100K pot plus one cap. Too simple.

Ross McKenzie ValuSoft Melbourne Australia

I may use the comparator int to: Togle a osc.output, use an output to discharge the cap, count up and down conters and other fun. Soft feed back works very vell. Besides, the VFO are only a bit of the Tiny15s job.

But sertinly, Imay try out a suitable cap value, - since calculating seems to be that dificult ;-)

HM

HM

mossige wrote:
I may use the comparator int to: Togle a osc.output, use an output to discharge the cap, count up and down conters and other fun. Soft feed back works very vell. Besides, the VFO are only a bit of the Tiny15s job.

That will be quantized by the uC Osc Speed, and so is not really a VFO at all.
It is easy to calculate how quantized, by moving to the time-domain.
124k is 8.0645us, and INT jitter and quanta is 2-3 cycles, or 200-300ns at 10MHz.

So your 'VFO' will jump around these values
1/(27*0.3u) = 123456.79012345679
1/(28*0.3u) = 119047.619047619048
1/(29*0.3u) = 114942.528735632184

You forgot to mention how 'smooth' your VFO needed to be, this may even be tolerable ?

Notice that because the VFO is uC clock sampled, you do not really need a R-C 'VFO' at all, just a micro with a reload-able timer, will actually do better than a Comp+INT

You can only get discrete frequencies from a crystal controlled AVR. Fine for fixed radio channels. No good for adjusting to sidebands or 'fine-tuning'.

You can get finer control by altering the RC oscillator frequency with OSCCAL. Note that this will be crap compared to a purpose designed VCO. Obviously you calibrate via a crystal on ASSR.

David.

I wonder, "experts", what acurancy and presition have you

HM

HM

HM,

I didn't attempt any accuracy or precision because in your first post you said BOTH 124KHz +/- and 24KHz ... and you didn't state what your actual needs are.

Cheers,

Ross

Ross McKenzie ValuSoft Melbourne Australia

Also, set by a pot, "accuracy" means little.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

I'm lost here. Is the aim to >>generate<< a variable frequency? Then why are any external components needed at all -- use the AVR's timer in CTC mode. (Well, I suppose there needs to be a way to pick/adjust the frequency...)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

I agree, Lee. If it needs to be variable, I would start with a pot and the ADC and use a timer by setting the TOP value.

I think that the OP had not considered the sampled nature of the comparator "output", expecting, instead, a smooth frequency variation. That will not happen. Instead, the period will always by N clock cycles, where N is some integer. So, that will not be any "smoother" than using a counter.

If a smooth, continuous, frequency variation is needed, then some other hardware will be needed (stand-alone comparator, op-amp, 555, or whatever).

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

theusch wrote:
I'm lost here. Is the aim to >>generate<< a variable frequency? Then why are any external components needed at all -- use the AVR's timer in CTC mode. (Well, I suppose there needs to be a way to pick/adjust the frequency...)

Plz. Think it over once more:

I have asked a question tothe forum. The answers are, sumarisized: "Since your questione are wrong, we will not give you any answer."

I think you would do it wiser if yo first answered my question, and then asked me to explain.

HM

HM

The capacitor value cannot be calculated given the information you provided.

In particular, we need to know how your circuit is REALLY connected because it will not oscillate properly as you have described.

In addition to the fact that the comparator switches ONLY on clock times, you have no way to charge and discharge the capacitor. This requires feedback which you have not described. You only say

Quote:

I may use the comparator int to: Togle a osc.output, use an output to discharge the cap, count up and down conters and other fun.

Too many "may" and "might". What IS your actual circuit. Then we can compute the capacitor value.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

HM,

You mentinoed a VFO, but only one frequency.
What is the frequency range the VFO is to sweep?
(123 - 125 KHz? 0 - 250 KHz? Both are centered on 125 kHz...).

What is the resolution needed?
1 Hz steps?
0.1 Hz steps?
0.001 Hz steps?
etc.

Is there a requirement for how rapidly one can sweep the full range?

You can certainly use an RC triggering an Analog Comparator to make an oscillator, and use the uC to do the resetting on the cap.

BUT, this is a very hard way to make an oscillator. In addition to the inherent time delay mentioned above for the software to reset the cap, there will be some "jitter" in the system, making the frequency "warble", or vary. Using the micro in the feedback loop will not give a stable single frequency.

It would be much simplier, as suggested above, to use a Timer/Counter in CTC mode to generate an output clock of your desired frequency. This will be stable, (as stable as the crystal or internal RC oscillator driving the micro).

Even this method, however, does not give a continuously variable frequency, but discrete frequency steps.

If one used this approach one would feed the pot into an ADC, read the ADC voltage (0-5 V), to set the Timer /Counter frequency from Fmin to Fmax.

Other options certainly exist.

JC