Introduction: CMOS FREQUENCY COUNTER
This a guide includes PDFs and some photos of how designed a 0-999 Hz frequency counter. I won't go into full detail on how to made the circuit boards or how to use a bread board.
The schematics were made in KiCAD and Ni Mulisim. I prefer KiCAD which is free software that allows you to make your projects schematics, layout the PCB, generate the board files, and send them to a fab house for a professional grade PCB.
Feel free to copy or use this information as a reference guide. This is a good learning exercise, I found it to be an exciting journey and absolute head ache at the same time.
This project utilizes many skills learned in a basic digital design course. This could definitely all be done with one micro controller (Arduino) and a few external part. This project was for learning purposes.
Step 1: Project Scope and Background
So as an introduction, I designed, wired, and tested this circuit. I did most of the work in NI multisim and used the simulations to design most of the modules.
After testing in multisim, I then constructed the test circuit on a bread board, this was to be sure each part was working properly.
I didn't use reference schematics to design the counter. I read the data sheets for the ICs, ran simulations in multisim and tested each chip for the proper function.
This project features 4 main concepts that are all tied together in the final assembly that will be outlined in the block diagrams. I used these blocks to describe how it was all going to be organized and designed.
In the next step I will include the BOM (Bill of materials) and a block diagram of the design and then go into detail on how it was put together.
Step 2: Block Diagram
This next part Is just a visual of the Block diagram. Its a good idea to look at this when you are designing something to cut the problem into pieces.
- Timing Base module A Pierce oscillator circuit with a xtal (crystal) oscillating at 37.788 kHz is fed into a CD4060B (14-stage ripple carry binary counter and frequency divider), this results in a 2Hz signal. That signal is then sent into a JK flip flop configured for toggle mode. This will reduce it in half to a 1Hz square wave. the signal is then sent to yet another JK flip flop and divided down to 0.5Hz (1 second on 1 second off). this will be the precise time base to set up our enable clock in order to "slice" a one second sample of the incoming frequency. This is essentially a slice of pulses that needs to get counted for a duration of one second.
- And Gate Input The And Gate with the input frequency is set up to allow on second samples to flow into the Decade counters converting the continuous frequency into pulses per second which translates to Frequency. it is limited to 999 Hz because it only uses 3 decades to have higher frequency add more counters and Segment displays. it gets bigger and more complex however so a micro controller would be the obvious best use case for real applications
- Synchronous decade counter Their are two main concepts to understand about how the incoming frequency gets counted. The incoming signal needs to be a square wave, and also compatible to the logic level of the chips. I used a function generator on my lab bench but one can be constructed with a 555 timer and a JK or D flip flop configured as a frequency divider. the second concept uses the 0.5Hz signal to enable the measured pulse to exit an AND gate for one second intervals. and blocking it when it goes logic LOW. this pulse exits the AND gate and enters the decade counters at the paralleled clock. the counters function as synchronous counters and uses the carry out and in functions described in the data Sheet for the CD4029.
- Reset The circuit needs to reset every 2 seconds to sample the frequency and not get a compounding reading on the display. we want it to reset the counters to zero before the next slice comes in or it will add to the previous value. which isn't all that interesting! we do this By using D flip flop wired to feed back and we clock the 0.5 Hz signal into the clock which is out putted into the Pre set enable pins of the decade counters. this sets all the counters to zero for two seconds and then goes high for 2 seconds. simple but effective not this could also be done with a JK flip flop but I like to show two ways of doing the same thing. This is all for fun and self learning so feel free to deviate!
- LED SEGMENTS The best part is saved for the end! the Classic 7 segment displays and the driver chips I highly recommend to design this around the data sheet of the 7 segment display and the driver chip. You will need to pay close attention to the difference between common cathode or anode. the chip I used will need to be high or low depending on the LEDs you choose to use and as good practice 220 ohm resistors are used to limit current there is some flexability it is always best to refer to the data sheet no one is really that smart the answers all lie in the Data sheet. When in doubt read it as much as you can.
Step 3: Time Base and Schematics
the o-scope shows how the output should look compared to the time base.
This circuit uses the CD4060 wired up as shown in the picture refer to the PDF Mainpage for full picture
the Chips uses in this circuit are
- 3X CD4029
- 1X CD4081
- 1X CD4013
- 1X CD4060
- 1X CD4027
- 3X CD4543
- 21 X 220 ohm RESISTORS
- 3 X 7 SEGEMNT LED DISPLAYS
- 37.788 KHZ CRYSTAL
- 330K OHM RESISTOR
- 15M OHM RESISTOR
- 18x 10K 8 PIN RESITOR NETWORK (RECOMENDED)
- LOTS OF HOOKUP WIRES IF USING A BREAD BOARD
- MANY BREAD BOARDS
- (Optional BNC connectors For the PCB)
- BENCH POWER SUPPLY
- FUNCTION GENERATOR
- SOLDERING Equipment for PCB Fabrication
RECOMENDED DESIGN SOFTWARE
- KICAD PCB Layout