1
\$\begingroup\$

I'm building a simple pierce oscillator for fun and trying to read the frequency using an arduino uno and the freqcount.h library (I don't have an oscilloscope). However, I'm consistently getting a reading of 0 Hz when the resonator I'm using is labeled as 4.096MHz. Below is the circuit I put together, the top part is a simple inverter and the rest is from a diagram of the pierce oscillator I found on wikipedia. I calculated the values for the capacitors based on the 20pF capacitance of the resonator (and assuming 5pF capacitance of the inverter and stray capacitances). Even if my values were off, however, why would I get a reading of 0Hz? Please be gentle, I'm a beginner. Thanks.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Your oscillator may very well be oscillating, but at too-low amplitude for the Arduino to recognize. You'd like to have the average collector voltage to be somewhere close to half the DC supply voltage of +5V. \$\endgroup\$ – glen_geek Jul 1 at 20:24
  • \$\begingroup\$ It's not oscillating. You have 1 Megohm in series with the base; that means too little base current to turn the transistor on to drive 1k. 100k might work if Hfe >= 200. \$\endgroup\$ – Brian Drummond Jul 1 at 20:55
  • \$\begingroup\$ Too many phase shift sections and ditto what they said. \$\endgroup\$ – Andy aka Jul 1 at 20:59
  • \$\begingroup\$ Thank you all this helped a lot \$\endgroup\$ – omzrs Jul 1 at 22:35
  • \$\begingroup\$ What is the highest frequency the Arduino can measure? I'm afraid that it's quite smaller than 4 MHz. \$\endgroup\$ – the busybee Jul 2 at 11:55
1
\$\begingroup\$

You would get a value of 0Hz, if the circuit is not oscillating at all, or if it oscillates, it may oscillate with too low amplitude for the Arduino to detect it.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Ok thanks I'll try addin an amplifier \$\endgroup\$ – omzrs Jul 1 at 22:35
  • \$\begingroup\$ Or just make a Pierce oscillator from an unbuffered CMOS inverter which is easier to make than fiddling with transistors. \$\endgroup\$ – Justme Jul 1 at 22:53
2
\$\begingroup\$

It would be worth your while to use a proved transistor Pierce oscillator circuit.

Here's one from National Semiconductor Application Note 400.

enter image description here

http://educypedia.karadimov.info/library/AN-400.pdf

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.