Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: FreqCount library for Arduino DUE board

  1. #1
    Junior Member
    Join Date
    Oct 2015
    Posts
    1

    FreqCount library for Arduino DUE board

    Hi everyone, I am working on a project about measuring high frequency of quartz crystal microbalance (QCM). I found an opensource for QCM, which is OpenQCM. They use FreqCount library comes from https://www.pjrc.com/teensy/td_libs_FreqCount.html. I have tried it, and it can work well on Arduino UNO and Mega2560 boards. However, I am trying to use it on Arduino DUE which is more accurate than UNO and Mega2560, but it does not work. I do not know why. Who can explain that? One more question, I find UNO and Mega2560 have the specific pin for frequency measurement input, 5 and 47, respectively. Who knows which specific pin for DUE frequency measurement if using the FreqCount library? I hope someone can give me a big favor.

    Thank you so much

    Dan

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,709
    Quote Originally Posted by RTUYR816 View Post
    Who can explain that?
    Well, I can, since I'm the author of FreqCount.

    It simply doesn't support Arduino Due. FreqCount and FreqMeasure do have a thin abstraction layer to allow porting to other hardware. So far, nobody has done the work to create and test the timer definitions needed to make it work on Due. I an not planning to do that myself, but I'd be happy to merge the code if someone else does it.

    Perhaps you should consider trying Teensy 3.2? It's slightly faster & more powerful than Arduino Due and it is very well supported by FreqCount.

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    3

    Frequency

    Quote Originally Posted by PaulStoffregen View Post
    Well, I can, since I'm the author of FreqCount.

    It simply doesn't support Arduino Due. FreqCount and FreqMeasure do have a thin abstraction layer to allow porting to other hardware. So far, nobody has done the work to create and test the timer definitions needed to make it work on Due. I an not planning to do that myself, but I'd be happy to merge the code if someone else does it.

    Perhaps you should consider trying Teensy 3.2? It's slightly faster & more powerful than Arduino Due and it is very well supported by FreqCount.
    Hi,
    I am doing one project with freqcont with arduino UNO. I have problem with measuring frequency when is voltage (amplitude) lower than 4.5V. May you help me with library ? How could I rewrite or change it ? Is it possible to measure frequency with 2.5 V for example?
    Thank you.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,709
    FreqCount requires the input to be a digital signal.

    Whatever board you're using has its own requirements for digital signals, which are a function of the board's hardware, not FreqCount.

    For help specific to Arduino's boards, you really should ask on the Arduino Forum.

    https://forum.arduino.cc/

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,321
    Basically, this is a potential problem with all MCUs, be their logic voltage 5V, 3.3V or 1.8V. If an input signal is too weak, one has to design an appropriate amplifier. The SN74LVC1404 can be used for that. It contains two unbuffered CMOS inverters which can amplify the signal up to 80 times, and a schmitt-trigger to clean the signal ramps. You'll need a 10nF input coupling capacitor from the signal input to pin3, a 1Meg bias resistor from pin2 to pin3, connect pins 7 and 6 together, connect pins 1 and 8 to +5V, connect pin4 to GND, and connect pin5 to the Arduino's freqcount input pin.

  6. #6
    Junior Member
    Join Date
    Jan 2019
    Posts
    3

    Help

    Could you draw a schematic for me ? Because I am not sure how to connect SN74LVC1404 on Arduino. And what about the programming ?
    Thank you.

  7. #7
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,321
    I did draw the schematics with my words in a way that an experienced technician should be able to understand and to reproduce it, I think. Sorry if I haven’t been clear enough. I’m actually in Switzerland, teaching masterclasses for electronic music, which means that you would have to wait until Monday before I could do a drawing.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,709
    Perhaps you should ask this Due-specific question on Arduino's forum for Due?

    https://forum.arduino.cc/index.php?board=87.0

  9. #9
    Junior Member
    Join Date
    Jan 2019
    Posts
    3
    Īt will be great thanks. But I think that I did not specify my project.
    I built this schematic (Colpitts osc.) for coin counter. Nnormal frequency is 210kHz (Ucc=12V, and amplitude is 5V) and when is coin detected (coin near to coil) frequency is changed for example on 234kHz but there is a problem that amplitude of signal decreases on 2.35V for example. So I can measure normal freq. 210kHz with Arduino UNO (its working really good) however when there is a coin I have serious problem with voltage of signal.Click image for larger version. 

Name:	Screenshot_1.png 
Views:	9 
Size:	79.0 KB 
ID:	15816
    I used this program for measuring freq.: https://www.pjrc.com/teensy/td_libs_FreqCount.html
    So should I use another circuit or is there any possibility to solve it ? I am 17 y.o. student and I have no much experiences so I need help with this.
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •