Arduino Crystal Oscillator - Question on output with Oscilloscope - Page 1
Forum section: electronics / beginners

author: JJ_023
author_rank: Frequent Contributor
timestamp: December 18, 2023, 02:40:19 am
content: So I am probing the Arduino Crystal Oscillator. It is supposed to be 16 MHz. The output I got on the oscilloscope is attached below as well as the set up.I used the spring clip for ground, which went on the green dot on the attached set up picture. I probed on the red dot in the set up picture.The oscilloscope is reading the correct clock speed. I don't see a square wave instead I see what is attached. Could somebody please explain why I am seeing that particular waveform with this particular setup.The scope is capable of reading up to 200 MHz.This is for no particular reason except for me expanding my knowledge and understanding.

author: golden_labels
author_rank: Super Contributor
timestamp: December 18, 2023, 03:47:09 am
content: I don’t have one to test, but the shape seems ok. If your concern is, that it doesn’t look like the idealized picture in books: that’s because it’s a real one. It’s not possible to produce a square wave in physical world. If you see something, which approximates one, it’s either because periods between transitions are very long or it’s actively driven to make transitions possibly fast. This is not the case for resonator circuit, whose sole purpose is to produce a stable signal, which crosses a certain value N times a second.The amplitude is low, but that may be due to the oscilloscope probe loading the circuit. This is common and often may prevent the oscillator from working.

author: JJ_023
author_rank: Frequent Contributor
timestamp: December 18, 2023, 04:09:01 am
content: Quote from: golden_labels on December 18, 2023, 03:47:09 amI did a little bit of research and reading. I knew not to expect a textbook square wave but I did not expect to get the results I got.Could you please elaborate why you cannot create a square wave in the physical world to help expand my knowledge.Why would you expect the amplitude to be higher?So in this particular case the oscillator is working? I assume so, because it reads the correct clock speed.

author: ataradov
author_rank: Super Contributor
timestamp: December 18, 2023, 04:26:05 am
content: This is not even a question of whether you can create a square wave or not. Crystal oscillators ideally need to have a sine or close to it. What you are observing is perfectly normal, it is designed to do this.The oscillator is an analog circuit, it does not snap to binary states.Your amplitude is also fine, it is a bit high actually. This may also be the reason for a slight distortion - the crystal may be over-driven. But it is hard to tell for sure without looking at the specifics of the oscillator design.Your added probe capacitance may also affect the observed results.

author: JJ_023
author_rank: Frequent Contributor
timestamp: December 18, 2023, 02:07:11 pm
content: Quote from: ataradov on December 18, 2023, 04:26:05 amThank you for the elaboration on the topic further.

author: Andy Chee
author_rank: Super Contributor
timestamp: December 18, 2023, 02:14:57 pm
content: The Arduino crystal oscillator is generally similar to this:If you can breadboard an oscillator on its own, you can probe around it and change component values with greater ease.

author: Zenith
author_rank: Frequent Contributor
timestamp: December 18, 2023, 02:54:43 pm
content: Quote from: JJ_023 on December 18, 2023, 04:09:01 amBecause an ideal square wave consists of two voltage levels, say 0V and 1V, with no other voltages, not even noise. So a 1Hz square wave would start at 0V at 0 seconds. At 0.5 seconds it would have a value of 1V and at 1 second a value of 0V. Note that there's no number closest to 0.5 or 1 or any other number you consider. It switches instantly between the values of 0 and 1 and there's no other value the voltage can have.In the real world things can't move infinitely fast, and we have other things to consider such as parasitic inductance and capacitance, which can be reduced, but not completely eliminated, and cause lag and ringing. So we have to talk about rise time, which is the time required to move from 10% to 90% of the final value and stay there.

author: ledtester
author_rank: Super Contributor
timestamp: December 20, 2023, 05:36:52 am
content: Through the setting of a fuse bit it is possible to emit the system clock on a GPIO pin.For the Atmega328P if you set the CKOUT bit in the low fuse byte the system clock will appear on PB0.Here is an online fuse calculator for the 328P:https://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega328p

author: rteodor
author_rank: Frequent Contributor
timestamp: December 20, 2023, 06:45:13 am
content: All microcontrollers have some analog part in the clock generation. Indeed the clock might be produced entirely digital. For example, a clock might be produced by s string of "NOT" logical inverters but the resulting frequency depends on the propagation delays of each inverter which depends on the switching speed of the transistors which depend on the fabrication process and temperature and parasitics on the circuit and so on. There are just too many unknowns with such an approach and the result would be unstable phase and frequency.Instead, it is better to use an analog phenomena that is dominant over any other problems of the above. That phenomena is used for an analog oscillator and then the clock is derived from that one. The quartz crystal is not the only way to do it. It can be a simple (and cheaper than a quartz) RC circuit. ATmega's have an internal RC clock generator, and that is also analog.In more complex chips that need various frequencies there are further analog parts that multiply the frequency obtained from a crystal to hundreds of MHz, GHz or even more. At such high frequencies the switching speed of digital transistors is sometimes pushed to the limits: they just can not keep steep enough digital edges so, analog is simpler in those cases too.

author: JJ_023
author_rank: Frequent Contributor
timestamp: December 21, 2023, 01:22:10 am
content: Quote from: ledtester on December 20, 2023, 05:36:52 amThanks for that. I knew that you could get the clock out to 1 of the pins from previous reading although I have never really done it.The calculator is super helpful.

author: JJ_023
author_rank: Frequent Contributor
timestamp: December 21, 2023, 01:23:53 am
content: Quote from: rteodor on December 20, 2023, 06:45:13 amThanks for the additional education.