Introduction: Frequency Counter With Waveform Display

A frequency counter with a waveform display function. You can also specify which part of the input waveform you want to count.

This can be made using a PIC with a built-in high speed ADC. Since the pin spacing of the selected PIC is 0.5mm pitch, it was necessary to make a printed circuit board.

Thinking of printing a simple chassis with a 3D printer, too. See the '.stl' files in the appendix. (But I also like bare PCBs..)

---
Thanks for printing the case for me, ncc-shoji! He printed the stl file that I had posted and gave it to me as a gift.
:D

Step 1: Draw the Schematic With “kicad - Eeschema”

Design overview

  • High-speed counter and ADC ...PIC24FJ64GC006-I/PT
  • Frequency display is character LCD ...I2C AE-AQM1602A
  • Waveform display is graphic LCD ...SPI AE-AQM1248
  • Analog front end ...JFET & BGA420 / Infineon
  • Battery operation ...LTC3245EMSE

Step 2: Draw the Pattern With “kicad - Pcbnew”

By mounting the battery on the upper side of the back, the board is tilted, making the LCD panels easier to see. Since I am right-handed, I placed the rotary encoder on the right side of the board. 2-layer board is used, with 3.3V on the back side and GND zone on the front side. The high-frequency circuitry is in the GND zone on both the front and back sides.

Create a Gerber file and order it to "fusion_pcb"
https://www.seeedstudio.com/fusion_pcb.html

Step 3: Assemble 1/3

Here is a my recommendation for assembling PCB.

LTC3245, C20, C21, C22

Since it is an IC with a heat dissipation pad, solder it with a hot plate. Place the cream solder on the pads of the print pattern, place the component on it and heat it with a hot plate. The solder will start to melt when the temperature exceeds about 180℃. When the entire solder is melted, switch off the hot plate.

Step 4: Assemble 2/3

parts side:U1 BGA420, U3 PIC, SMD capacitors, R8, R1, R3, R4, R5, R6, C1, C6, C5, C3, C4, C12, C8, C14, C15, C16, C17, Y2, C18, C19, C10

Back side:R2, R7, R9, C11, C23, D1, BT1, (J2)

Step 5: Assemble 3/3

Tall parts: SW4, Q1, U2, Y1, SW2, U7(TP4056)

Since it is inserted from the back of the PIC write connector, Please make sure place insulation before installing GFX panel LCD U4 J1, J4, SW3

Other parts : U5, battery holder18650, JP1, BT2, U5(enabled I2C Pull-UP), rotary-encoder SW1

Step 6: Program Using "MPLAB X IDE".

---

Frequency measurement

  • Timer1 is used as an asynchronous counter. If it is a synchronous counter, it cannot count above the clock frequency of PIC. Timer1 can operate in three modes:
    16-BitTimer
    16-BitSynchronousCounter
    16-BitAsynchronousCounter
  • When Timer1 overflows, an interrupt occurs and the software counts the upper 16 bits.

---

Waveform display

  • 12-BIT HIGH-SPEED, PIPELINE A/D CONVERTER
    Perform high-speed A / D conversion using PADC
  • Data transfer using DMA transfer at the same time as conversion
  • Display on graphic LCD AQM1248A-RN 48x128pixels SPI

See github for details
https://github.com/agysft/08_FreqCounterWaveform.X

---

J2 is the PIC's write connector; connect Pickit3 to it and write your program.
When writing, do not short-circuit JP1 (remove the short pin). For normal use, short JP1 before use.

Step 7: Appendix

How to use

  1. Turn on the power switch Pow (SW3).
  2. Frequency count mode The frequency count result and waveform are displayed approximately every second.
  3. When the rotary encoder (SW1) is pressed, the frequency counter disappears and the "sampling time change mode" is set. You can select the sampling time for the waveform display by turning it left or right.
  4. Press the rotary encoder from 3 to enter the "bias voltage change mode" of the input signal. You can move the waveform up and down by turning it left and right.The trigger level is always the center. Adjust the area you want to trigger by moving the waveform up or down.
  5. Press the rotary encoder from 4 to return to 2.
  6. From any state, press and hold the rotary encoder to enter the time setting mode. You can set the clock time. By turning it left or right, you can set the year, and each time you press the rotary encoder, you can set the month, day, hour, and minute. Set to minutes or press and hold in the middle to return to 2.


Block Diagram and Signal flow

The signal input from the measurement terminal is amplified by the preamplifier, and the amplification factor is selected by the multiplexer. By applying an arbitrary bias voltage to this signal with a DAC, the frequency can be counted (pseudo trigger level change) at any part of the waveform. The frequency counter consists of 16-bit hardware + 16-bit software. The waveform display is A / D converted according to the Time Base, the data is transferred to the memory by DMA, and the data is displayed as a waveform. The light blue part is PIC.

Feature
By applying an arbitrary bias voltage to the waveform, you can arbitrarily set the threshold value you want to count. It is possible to measure by aiming at the fundamental wave part of the waveform with complicated frequency components or the the ringing part of waveform including ringing such as overshoot and undershoot.

Specification

  • Measurable frequency: DC to 48MHz (48MHz is actually measured. Performance limit has not been implemented)
  • Waveform observable sampling rate: MAX 250ns / sample
    • Measurement range: 250ns, 500ns, 1us, 2.5us, 5us, 10us, 25us, 50us, 100us, 250us
    • Waveform display: Horizontal axis 128 pixels (250ns x 128 = 32us)
    • Logically up to 2MHz, frequencies above this are observed as beat components (aliasing signals)
  • Power supply: 18650Li-ion battery x 1
  • Charging circuit: If a ready-made Li-ion battery charging board (TP4056, etc.) is installed, it can be charged via micro B type USB.
  • Board size: 99mm x 80mm
  • Weight: 113g (actual measurement including battery)

---

PS

Why are there two LCD panels?

At first, it was only the I2C character display panel and it's just a normal frequency counter.

I wanted to see the waveform, so I added the SPI GFX panel. Since it is troublesome, I made it as a printed circuit board as it is.

If you thought that you only needed the GFX panel from the beginning; you are right!

---

Thank you !

Step 8: Appendix2 - Assembling the Case

1. Print the front and back cases *

2. Embed 6 insert nuts

3. Attach the board with center two screws

4. Attach the back cover with four screws

5. Attach the knobs and the conversion connector

* Printing with transparent material on the back allows you to see the charging status

PCB Challenge

Participated in the
PCB Challenge