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   

112 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
    Replies
    1. Hi Richard,
      Can you share the ASM code for 20Mhz. Many thanks in advance.
      E-mail:javed4004[at]yahoo.com

      javed

      Delete
  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. 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
  38. can you send me the asm source code and if possible css pic c source code to tcruise7771@hotmail.com

    ReplyDelete
  39. 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
  40. 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
  41. 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
  42. Hi, I need de ASM code cause change it to work with 16F628A.
    Please, send me to jorgeceles@gmail.com.
    Thanks in advance
    Best regards!

    ReplyDelete
  43. Kindly send me the source code to my mail ID

    mohan_raj198112@rediffmail.com

    ReplyDelete
  44. can you send me the ASM code to my mail id
    rasu.kumbhar240893@gmail.com

    ReplyDelete
  45. Hi Great little little counter
    having same problems as others using pic 16f84a 20mhz and the count is out
    if possible can you send me asm code

    many many thanks In advance

    rwdpictures@gmail.com

    ReplyDelete
  46. Hello Mr Gaurav Chaudhary, congratulations to interesting project.
    Can you send me the Assemble code for PIC16F84A I will post a little modification to input for read 1GHz with inclusion ECL chip.
    Thank you so much in advance
    ricardokf@gmail.com

    ReplyDelete
  47. africa.dintwe@gmail.com please send me a source code

    ReplyDelete
  48. Hi Gaurav Chaudhary,
    Would you please send me the source code or hex code for the frequency counter?
    Here is my mail: jameshko2011@gmail.com

    Thanks,

    James

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

    ReplyDelete
  50. Hi!
    How can I get the firmware for 8MHz quartz?
    skif42ru@gmail.com
    or the source code for independent alterations to other resonators

    ReplyDelete
  51. hello. sir..
    if i measuring the frequency from AC supply (230V)... to modified any think in this circuit. other wise same circuit

    ReplyDelete
  52. Hi
    Thanks for sharing this great project, could you please email me source code, behzadmahboubi@gmail.com
    I need to do some modifications,
    Regards
    Behzad

    ReplyDelete
  53. olà, por favor você poderia-me mandar o [firmware] deste frequencimetro de 60 mhz? não consigo salva o que estar aqui, não da opção, já estar montado o frequencimetro só falta o firmware, seria possivel? obrigado denil17silva@hotmail.com

    ReplyDelete
  54. Can you please tell me the input voltage for this circuit ? Is it AC or DC voltage ?

    ReplyDelete
    Replies
    1. i am not sure, but surly mains voltage will blow this up.

      Delete
  55. Hi Gaurav Chaudhary,
    Can you please, design a circuit for me ? The circuit will display LOW BATTERY, OVER LOAD, AC ON, DC ON, SCROLLING INPUT VOLTAGE UP TO 60V and SCROLLING MY NAME ON GLCD. This circuit will be Inverter out display. Get back asap to tell me the price. Thanks.

    ReplyDelete
    Replies
    1. sure i can, drop me a email with more detailed specification.

      Delete
  56. Hi Gaurav Chaudhary,

    I am interested in your project can you please assist me in my project i want to build. Actually i can't disclose my project on web. Please i need your help. If you can add me on Skype than it would be great.my id is "umairaqib"... also my email is umairaqib@hotmail.com

    Waiting for your quick response.

    Umair

    ReplyDelete
    Replies
    1. drop me a email with details of project.

      Delete
    2. hello gaurav
      please help in my project.
      Please send me code for this frequency meter.
      I am using MPLAB IDE v8.88 with Hi-Tech compiler.
      I am using PIC16F1933 micro controller.

      Delete
  57. This comment has been removed by the author.

    ReplyDelete
  58. Hi,
    Please send me code for this frequency meter.
    I am using MPLAB IDE v8.88 with Hi-Tech compiler.
    I am using PIC16F1933 micro controller.

    ReplyDelete
  59. please send source code to wikastana@yahoo.com

    thanks

    ReplyDelete
  60. it would be a great help for me if you please mail me the source code at juwel_rana82@yahoo.com.

    ReplyDelete
  61. Hi !
    Please, can you send me a source code?
    marele.mos@gmail.com
    Thank you very much !

    ReplyDelete
  62. Hi
    Thank you
    Please, can you send me a source code?
    mourad3d@hotmail.com

    ReplyDelete
  63. Good job,i will also need the code in c please, if possible.....keibbow@yahoo.com..

    ReplyDelete
  64. hi Gaurav Chaudhary no Answer me

    ReplyDelete
    Replies
    1. https://sites.google.com/site/microembededfiles/home/july-2011/Freqmeter.rar?attredirects=0&d=1

      Delete
  65. hi Gaurav ,
    Is there is any posibility by adding any prescaler like LMX2322 or MC12080 to your project to extend the frequency measuring up to 1 or 2 GHZ .
    Best Regards,

    Engr Obaid Kakar

    ReplyDelete
  66. our country not have LCD Module, so please send me modify Circuit support LED SSD (Seven Segment Display) Thank you ..... Welcome

    ReplyDelete
    Replies
    1. http://www.constructor.bg/mk/Hz_meter.htm

      Delete
  67. What is the mean of IF and how could i change it ,to be 12,500 Mhz? How the controler add/substract the IF? lz1dmd@gmail.com

    ReplyDelete
  68. can u send me the code
    syrial13@hotmail.com

    ReplyDelete
    Replies
    1. https://sites.google.com/site/microembededfiles/home/july-2011/Freqmeter.rar?attredirects=0&d=1

      Delete
  69. can we use it to measure human voice frequency?

    ReplyDelete
    Replies
    1. The human voice is not a frequency,but a spectrum of many freqs

      Delete
  70. Hello, Could you send me the source code please.
    mikegmcgee@gmail.com

    ReplyDelete
  71. I would like to use 1X16 LCD.Can you tell me what i must do for this?
    Thank you
    nikin22000@yahoo.com
    Nick
    Greece

    ReplyDelete
  72. Hi Gaurav,

    I am completing a tachometer and was looking for some projects on the internet as an inspiration.
    I have also found this Frequency Meter/counter which is great for its simplicity, usefulness and a nice design.
    It is really good and it would be a pity not to build/ make it.
    I´ve got more pieces of PIC16F818 and I would like to use one for this project.
    Could you please send the source code v ASM or mikoC to my address edbarted@gmail.com .?


    Thank you very much!
    Best regards,


    Ed Bartosek

    ReplyDelete
  73. The frequency counter is working well but i don't have the word "MHz" after the numbers.Any ideas....
    Thank you.

    ReplyDelete
  74. I suppose i need the code for customization.Is it possible to send me?My email is nikin22000@yahoo.com

    ReplyDelete
  75. Hello Gaurav, congratulations for your article.
    It worked perfectly for me. Could you send me the ASM code ? Thank you in advance
    glauciofotografo@hotmail.com

    ReplyDelete
  76. this project is amazing and it worked perfectly ....
    could you please send me the source code of this circuit ...
    shakeel.shiki@gmail.com

    ReplyDelete
  77. Hello sir I am very interested in building this circuit can you send me please the ASM code my id is cedrikilunga@yahoo.fr

    ReplyDelete
  78. Hi Friends,
    Can anyone share the ASM code for 20Mhz. Many thanks in advance.
    E-mail:javed4004[at]yahoo.com

    javed

    ReplyDelete
  79. Hi,

    great project. Could you please send me the source code? ksplat525@gmail.com
    Thanks.

    ReplyDelete
  80. As i understand nobody has this .asm file unfortunately.....If someone did please email it to nikin22000@yahoo.com.Thank you

    ReplyDelete
  81. Good afternoon friends. I wonder if this is possible frequency meter I see receiver analog radio stations. I have an analog receiver Transglobe the Philco Ford 9 band, I would put it a digital display so I can see the frequencies of radio stations to tune it someone can answer me?
    Since I already thank you thank you
    J.Carlos
    Blog: http://qsldobrasil.blogspot.com

    ReplyDelete
  82. Alguem tem alguma dica/
    Estou no aguardo amigos!

    ReplyDelete
  83. Fellows,

    After some experiments i found that:
    1. If you have LCD 1X16 ground pin 18
    2.the jumpers at pin 11,12,13 is for USB,LSB,IF when pin 10 is not grounded.If it is grounded the pin 10 then you can do the coarse calibration IF you need it (not me after all).
    3.The variable c has little influence on the frequency value.
    4.Be careful of the sin purity of the hf input...

    regards
    Nick - Greece (nikin22000@yahoo.com)

    ReplyDelete
    Replies
    1. How do I display the frequency of the radio station in OM no meaning unless the frequency of FI 455 KLZ eg the 1600kHz frequency meter shows 2.05556kHz where should 1600kHz this is the real frequency of the radio station.
      I await advice tips of how to make friends .

      J.Carlos

      Delete
    2. How to calibrate this frequencymeter in 20.00000Mhz? Anyone know how to do this?

      Delete
  84. Friend frequency meter can I use this receiver in Philco analogicoTransglobe to see the frequencies of the stations on the display?

    PY2255SWL
    Blog: http://qsldobrasil.blogspot.com

    ReplyDelete
  85. Friend I rode in this breadboard frequency meter and used the BF254 Transistor Display FECC1602E-FLYGBW-51LE, worked satisfactorily, he scores or the frequency is shown that the tuned station eg Radio Record 1000 Hz it shows 2.05568.
    I wonder if he has to show how the frequency of the station taking FI455 kHz then he showed the right frequency Anyone know?

    J.Carlos
    Blog: http://qsldobrasil.blogspot.com

    ReplyDelete
  86. Friends posted pictures of it mounted on my blog: check it out!
    Blog: http://qsldobrasil.blogspot.com

    ReplyDelete
  87. Friend I rode this Frequencimetro in the stands and ran conteto, the ESM ele frequencies of the analog radio Transglobe Philco Ford bom, mas sem remove the ESM FI 455klz eg radio Record 1000kHz 1455kHz ele ESM Nine of the Julho 1600 kHz elel ESM 2055 Veja kHz photos on the blog below. How I would change, that I must fazer for elementary reading of less frquencia FI455klz? Alguem tem idea how fazer?
    Looking forward from any major tip ja get VERY grateful.

    J.Carlos
    Blog: http://qsldobrasil.blogspot.com

    ReplyDelete
  88. Get answers from comments I'm doing regarding this frequencymeter I rode this Blog: http://qsldobrasil.blogspot.com
    Obtenga respuestas de los comentarios que estoy haciendo con respecto a este Frecuencímetro Monté este Blog: http://qsldobrasil.blogspot.com

    ReplyDelete
  89. Hi,
    Project done and works great, congrats!
    However I would like to change the display style to "xx.xxx.xx0 Hz" as seems more appropriate for where I'm using it.
    If still possible, I'll really appreciate to have the source (adresa33@gmail.com).
    Thank you!
    Costi

    ReplyDelete
  90. Adresa you saw the pictures I posted on my Blog? http://qsldobrasil.blogspot.com
    This working but I want to subtract the FI 455HZ and will show 1000khz 1455khz. You know how to get it, a friend here in Brazil is trying to do this.
    J.Carlos

    ReplyDelete
    Replies
    1. Carlos,
      I tested/used the device as a regular frequency meter not for some superhet radio... unfortunately I don't know how to set the "offset".
      However, when first time programmed the "old" 16F84 without erasing the EEPROM, the zero value was some aberrant value... after erasing it, the zero was zero... :).

      Delete
  91. Great,
    Can you share the ASM code for counter? Many thanks in advance.
    E-mail: PC5ACO[at]mail.ru

    ReplyDelete
  92. Hello Sir,

    This is great project. Could you please send me the ASM source code? akatic{AT}gmail.com
    Thanks in advance.

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

    ReplyDelete
  94. Dear Sir.
    I do thanks for this project. Could you send me ASM source code please? kyaw.tunlinn@gmail.com. Thanks advance.

    ReplyDelete