Monday, July 18, 2011

60 Mhz Frequency Meter / counter

Introduction


 This is 60 MHz frequency meter / counter for measuring frequency from 10 Hz to 60 MHz with 10 Hz resolution. The meter provides very stable readings and has excellent input sensitivity thanks to on board amplifier and TTL converter, so it can even measure weak signals from crystal oscillators. With the addition of prescaller it is possible to measure the frequency of 1GHz and above. 

           The basic idea comes from the AN592 Microchip application note: "Frequency counter using PIC16C5x" where you may find a simple software wich implements a frequency counter using a PIC microcontroller.I wrote a specifically designed software to improve the counter resolution, to handle the IF mode and value by means of an operating menu, to decode and edit the read frequency on an LCD display. The result was a simple and effective device. 



  
Circuit / Schematic 
       The electrical schematic is very simple, given that most of the functions are implemented by the microprocessor. It was needed only an amplifier stage to raise the input signal level from 200-300 mV p.p. to about 3 volts p.p.  A self biased common emitter amplifier produces a pseudo-TTL driving signal. The 10uH inductor in the collector lead helps extend the high frequency response. Any "fast" NPN transistor should be suitable. I used a BFR91, but you may substitute a transistor scrounged from an old TV tuner or a VHF receiver.
   

BFR 91 Transistor Front
         The amplifier's quiescent Vce is set to 1.8 to 2.2 volt by the resistor marked * on the diagram. It is nominally 10K, but you may need to change it. The collector voltage is applied to the PIC's counter/timer via a series 470 ohm resistor.The PIC is able to short this signal to ground via an internal pull-down transistor to disable counting. 

           The PIC implements a 32 bit counter, partly in internal hardware and partly in software. Counting is enabled by turning off the internal pull-down transistor for "exactly" 0.4 second. At the end of this time, the PIC divides the count by 4, then adds or subtracts the appropriate IF frequency to get the actual frequency. The resulting count is converted to printable characters and delivered
to the display.

PCB Design 









Download Firmware and schematic 


Click here to download

Calibrating : before use 


       Before the frequency meter will work properly, it must be calibrated. This may be as simple as connecting a known frequency source and adjusting the trimmer capacitor so the correct value is displayed. If you are unable to adjust the displayed frequency, then a "coarse calibration" is required. This involves starting with the power off. Pin 10 is connected to ground and the power is then turned on (and held on). The PIC will measure and display the input frequency, followed by the letters CAL. If you can't adjust the indicated frequency to the correct value (by adjusting the 33 pF trimmer), then coarse adjustments can be made by briefly connecting pin 12 or pin 13 to ground. It may take several tries, because the program only checks these pins once each measurement (0.4 second). Once you are happy with the adjustment, remove the ground from pin 10 (while power is still applied). This will cause the PIC to store the calibration in non volatile internal memory.

if you feel like an question just make a comment   

48 comments:

  1. Hi - Thanks for a great circuit :) - I would like to make the count update rate faster. The program will run at 20Mhz with a 16F84-20 PIC, but the displayed frequency is obviously 5x lower than it should be (eg a 50Hz input shows 10Hz). Do you have the ASM source code please so I can adjust the timing values ? - many thanks.

    ReplyDelete
  2. hi richard

    i will send you the source code please send me you email id

    Thank you

    ReplyDelete
  3. hi richard

    i have sended you the source code please
    check you mail

    Thank you

    ReplyDelete
  4. Can this project be modified to work with PIC16F877A?
    And software have changed?
    We have available this circuit and a display 16 * 1.
    Can I projecting single PCB.

    ReplyDelete
  5. You can send me to the ASM code?
    vankov@inbox.ru

    ReplyDelete
  6. Hi - Thanks for a great circuit :) - I would like to make the count update rate faster. The program will run at 20Mhz with a 16F84-20 PIC, but the displayed frequency is obviously 5x lower than it should be (eg a 50Hz input shows 10Hz). Do you have the ASM source code please so I can adjust the timing values ? - many thanks.

    sory my english ....

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. I noticed the pcb layout does not match the schematic. Which is correct for the .HEX file?

    Schematic
    PIC6 - LCD11 - PCB11
    PIC7 - LCD12 - PCB12
    PIC8 - LCD13 - PCB9
    PIC9 - LCD14 - PCB8

    Also, could you send me the .asm source file as I can use it to verify which is the correct pinouts plus I would like to add voltage measurement to the code. rhodes[at]fnrf.science.cmu.ac.th Replace [at] with @

    Thanks

    ReplyDelete
    Replies
    1. hi
      thankx for your comment

      but as u can see with the schematic the lcd pin 7,8,9,10 not connected to any where so what do is on the pcb side there is no drill holes for female burg strip

      and so on lcd module only from pin 1 to 6 and 11 to 16 have male burg strip pin7 to 10 left empty .

      you said PIC8 - LCD13 - PCB9 but when there is no drill on pcb side so no metal pin on female burg strip(i pulled out 4 metal pin with a pliers)and even on the lcd pin 7 to 10 male burg strip is not soldered.and you can see the PCB trace is going to lcd 13 ultimately .
      i have personally tested it working fine.

      if you still have any confusion ,feel free to ask.

      Delete
    2. Hi,

      I use PIC16F84A-04P & LCD LMB162AFC, With the JDM programer is Successfull but I do not Anything in The LCD?

      Regards,
      SugengKisw

      Delete
    3. have you properly set the lcd contrast by that 10K pot

      i have never been used the LCD LMB162AFC i don't where it has same commands for interfacing
      you should you HD44780 or LM016L display or any compatibly with them

      Delete
  9. Hello,

    Does the hex file work with PIC16f84A ?
    Thanks,

    regards,
    Sugeng Kisw

    ReplyDelete
  10. I like it and could be nice quick troubleshooting tool...

    I would like to take your effort and make a USB powered version - do you have any idea of current draw on 9V Battery ?

    Also a copy of source code would make the USB conversion easier. Plan on using Windows/C++Builder for display instead of LCD.

    Bob

    ReplyDelete
  11. Hi richard

    Can you please sent me the ASM source code?
    osmosis86@gmail.com

    Thank you

    ReplyDelete
  12. Hi,

    I made a mistake in wiring
    Now it work,LCD LMB162AFC can be used for this Schematic. No Add anything.
    Thanks you very much.

    Regards,
    Sugeng Kisw

    ReplyDelete
  13. Hi richard

    Can you please sent me the ASM source code?
    kahya.anil@gmail.com

    Thank you

    ReplyDelete
  14. Can I get the asm code for few modifications
    thilinaprabath@gmail.com

    ReplyDelete
  15. Can you please sent me the ASM source code? tazn85@gmail.com thanks&verry good post

    ReplyDelete
  16. plz send me asm code tazn85@gmail.com

    ReplyDelete
  17. Can I get the asm code for few modifications
    govindaylur@yahoo.com

    ReplyDelete
  18. Sir i need coding for PIC16F877A to this same circuit.

    ReplyDelete
  19. Dear Mr. Gaurav Chaudhary.
    I found very interesting your frequency meter
    Do you have a tutorial that explains how do you get the precision and the accuracy of your project? I appreciate to study it.
    Thank you.
    Moris Alkabes

    ReplyDelete
  20. Congratulations for your design and thank you by publishing it, Gaurav Chaudhary. It works perfectly. It's very stable with frequency.
    I would like to measure higher frequencies and I could read above that it's possible to get more than 1 GHz with prescaler but ..... is the software prepared to it or needs a diferent software?

    Thanks in advance.
    Gerardo U.
    trifonc@yahoo.es

    ReplyDelete
  21. Sorry, I don't know the function of the jump in the pin 11 of the pic. What is it for? I read that jumps in Pin 10, 12 and 13 are for calibrating, but the pin 13?

    Thank again.

    Gerardo

    ReplyDelete
  22. Hello Gaurav Chaudhary,

    I really like your project and I just want to ask can I use your 16F84 hex file to program 16F84A?

    Best regards!

    ReplyDelete
  23. Good day, can You send me the .asm file? kind.of.wolf@gmail.com

    Best wishes.

    ReplyDelete
  24. Hi, this is a very well-done project ! Can you send me the source file? mattia.bond@hotmail.it
    Best regards!

    ReplyDelete
  25. Hey

    Good job.
    Could you please send me the asm code of your project
    akanksha8767@gmail.com

    Thanks

    ReplyDelete
  26. Hi sir.....Thanks for the circuit.I would like to make the count update rate faster. The program will run at 20Mhz with a PIC16F840, but the displayed frequency is obviously 5x lower than it should be (eg a 50Hz input shows 10Hz). Do you have the source code for that? so I can able to calibrate the values? thanks.

    ReplyDelete
  27. source code please
    zubusha@yahoo.com

    ReplyDelete
  28. Hi richard

    Can you please sent me the ASM source code?
    My id is
    ms23.sidhu@gmail.com

    Thank you

    ReplyDelete
  29. hi, Sourcecode will let me learn this better. my email. sambomg@gmail.com

    thanks for good project

    ReplyDelete
  30. Hi....Thanks for the circuit. But i want to learn about this better. So, Could you sent me the ASM source Code.
    my email: ervan.erry@gmail.com
    thanks you

    ReplyDelete
  31. Hi, i'm a student registered for electrical engineering. Am doing my final year design project. Could you please send me via email the ASM code of your project. Please help, the deadline is against me for design proposal. my email: thobekani.khumalo@gmail.com. Your help would be highly appreciated.

    thanks

    Nicholas khumalo

    ReplyDelete
  32. hi, thanks for your perfect project, but let me learn more about this.
    so i hope you sent me the ASM sour code,
    email : magfurramdhani@gmail.com
    email : magfur.ramdhani@yahoo.com
    thanks before ^_^

    ReplyDelete
  33. please sent me the source code, it will make me easy to learn,,
    my email : magfur.ramdhani@gmail.com

    thanks before.. ^_^

    ReplyDelete
  34. hi,
    Great to see frequency counter using 16f84.for my project i want to make a Frequency Counter using the 16f84.
    please can u send me the source code, It will be useful for me
    thanks in advance
    mail id:go4mothi@gmail.com

    kind regards
    mothilal

    ReplyDelete
  35. hi i just built the circuit..It works fine but does not show the frequency for 32MHZ..CAN ANYONE HELP..THANKS...

    ReplyDelete
  36. Thank you for your hard work. Please send me the ASM code.

    kshgunawardena@gmail.com

    ReplyDelete
  37. Sir
    My eamil ID: abhinavjain001@gmail.com

    ReplyDelete
  38. can u send me your code, i'm having trouble with a project and i need a frecuencymeter, this will be useful thanks
    nicoft@me.com

    ReplyDelete
  39. can you send me the asm source code and if possible css pic c source code to tcruise7771@hotmail.com

    ReplyDelete
  40. Hello, I am a student of electrical engineering registration. Project is to design my final year. Can you please send me an email through the ASM code of your project. Please help
    email: dinhduy.kk@gmail.com thanks!

    ReplyDelete
  41. Hi, i'm a student registered for electrical engineering.Am doing my final year design project. Could you please send me via email the ASM code of your project.Please help. email: dinhduy.kk@gmail.com thanks!

    ReplyDelete
  42. I notice that you say your circuit can be set for specific IF frequencies.
    Would I be right in thinking this involves the use of pins 11, 12 and 13 to allow the PIC to measure an offset frequency, store it and then add/subtract it from the actual input to pin A4?
    Could you clarify this point please?
    Thank you

    ReplyDelete