A Frequency meter with AVR
In this project, we want to build a frequency meter device (next figure) with Atmel AVR that has three following abilities:
1- It can receive a signal up to 8MHz and displays its frequency on a LCD.
2- It can generate a squared signal with adjustable frequency.
3- It can control two stepper motor with adjustable velocity with a Potentiometer.
You can see the circuit wiring of this project in Figure 2. The used microcontroller is ATMEL’s ATmega8.
Its external interrupt 0 receive a signal and then microcontroller calculate its frequency and display it on first line of LCD. In second line, it displays the time period of the received signal. For remember the frequency and time period of a same signal have an inverse relationship:
Frequency (Hertz) =1/Time period (second)
Also we can make a signal with a favorite frequency by a potentiometer to control two stepper motors’ velocity. The microcontroller displays its time period and frequency on third and fourth line of LCD respectively.
This project use two jumpers (P2 and P4 ). If we want to check our circuit at any time, we can use P2 jumper to select an internal signal of micro with a specific frequency instead of an external signal with unknown frequency. P4 jumper is used to select a suitable voltage (5v or 12v) for stepper motors.
Two potentiometers are used (R6 and R7 ). R6 is for adjusting LCD contrast, and R7 is for adjusting signal frequency that is generated by microcontroller.
We wrote the program with Codevision, and then simulated our circuit with Proteus and finally to build it, we designed its PCB with Altium Designer. You may need to source files to build a similar circuit. So you can download all of them from below link.