Showing posts with label Oscillators. Show all posts
Showing posts with label Oscillators. Show all posts

Comparator Based Crystal Oscillator

Although a simple crystal oscillator may be built from one comparator of an LT1720/LT1721, this will suffer from a number of inherent shortcomings and design problems. Although the LT1720/LT1721 will give the correct logic output when one input is outside the common mode range, additional delays may occur when it is so operated, opening the possibility of spurious operating modes. Therefore, the DC bias voltages at the inputs have to be set near the center of the LT1720/LT1721’s common mode range and a resistor is required to attenuate the feedback to the non-inverting input. Unfortunately, although the output duty cycle for this circuit is roughly 50%, it is affected by resistor tolerances and, to a lesser extent, by comparator offsets and timings.

 Comparator Based Crystal Oscillator Circuit Diagram
Comparator Based Crystal Oscillator

If a 50% duty cycle is required, the circuit shown here creates a pair of complementary outputs with a forced 50% duty cycle. Crystals are narrow-band elements, so the feedback to the non-inverting input is a filtered analogue version of the square-wave output. The crystal’s path provides resonant positive feedback and stable oscillation occurs. Changing the non-inverting reference level can vary the duty cycle. The 2k-680Ω resistor pair sets a bias point at the comparator + (Comparator IC1a) and – (Comparator IC1b) input. At the complementary input of each comparator, the 2k-1.8k-0.1µF path sets up an appropriate DC average level based on the output.
IC1b creates a complementary output to IC1a by comparing the same two nodes with the opposite input. IC2 compares band-limited versions of the outputs and biases IC1a’s negative input. IC1a’s only degree of freedom to respond is variation of pulse width; hence the outputs are forced to 50% duty cycle. The circuit operates from 2.7V to 6V. When ‘scoping the oscillator output signal, a slight dependence on comparator loading, will be noted, so equal and resistive loading should be used in critical applications. The circuit works well because of the two matched delays and rail-to-rail outputs of the LT1720.

Simple Triangle Square Wave Oscillator Circuit Diagram

By making Rt variable it is possible to alter the operating frequency over a 100 to 1 range. Versatile triangle/squarenvave oscillator has a possible frequency range of 0 Hz to 100 kHz.


Simple Triangle Square Wave Oscillator Circuit Diagram


Simple Triangle Square Wave Oscillator Circuit Diagram

Simple MHz Oscillator using an ATtiny15

Most engineers will recognise the problem: Your circuit needs a stable 1 or 2 MHz clock generator (in the author’s case it was for a Pong game using an old AY3-8500). A suitable crystal is not to hand so you cobble together an RC oscillator (there are plenty of circuits for such a design). Now it turns out that you don’t have exactly the right capacitor so a preset pot is add e d to allow some adjustment . Before you know it the clock circuit is taking up more space on the board than you had hoped. 

Providing the application does not demand a precise clock source a tiny 8-pin microcontroller may offer a better solution to the problem. It needs no additional external components and an old ATtiny15 can be found quite cheaply. Another advantage of the solution is that clock frequency adjustment does not involve changing external components and is not subject to component tolerances. 

The microcontroller’s internal RC oscillator is already accurately calibrated to 1.6 MHz. With its inbuilt PLL, internal Timer 1 can achieve up to 25.6 MHz [2]. By configuring internal dividers the timer can output a frequency in range of roughly 50 kHz up to 12 MHz from an output pin. The difference between calculated and the actual output frequency increases at higher frequencies. A meaningful upper limit of about 2 MHz is a practical value and even at this frequency the deviation from the calculated value is about 15 %.

MHz Oscillator using an ATtiny15 Schematic

MHz Oscillator using an ATtiny15 Circuit Diagram

The circuit diagram could hardly be simpler, aside from the power supply connections the output signal on pin 6 (PB1) is the only other connection necessary.The example program, written in Assembler is just 15 lines long! With a program this short comments are almost super fluous but are included for clarity. The code can be downloaded from the Elektor website [1]. 

The program only needs to initialise the timer which then runs independently of processor control to output the clock sign al . The processor can then be put into sleep mode to memory used up the remaining 99 % is free for use for other tasks if required. 

The OSCCAL register contains a calibration byte which allows some adjustment of the CPU clock. This gives a certain degree of fine tuning of the output frequency. A recommendation in the Atmel data sheet indicates that the CPU clock frequency should not be greater than 1.75 MHz otherwise timer operation cannot be guaranteed. 

The more recent ATtiny45 can be substituted for the ATtiny15. In this case the CK SEL fuses should be set to put the chip’s Timer 1 into ATtiny15- compatible mode [3]. After adjustment to the program it will now be possible to obtain a higher (or more exact) frequency from the timer, the ATtiny45’s PLL can operate up to 64 MHz.  Link
Older Post ►
eXTReMe Tracker
 

Copyright 2011 Diagram Digital Schematic is proudly powered by blogger.com