arduino frequency counter


You could do right. What could you make that’s kind of cool with just a couple parts like this? Well, what if you made an incredibly tiny frequency counter, it’s a lot easier than you may think so, let’s zoom in and we’ll put it together. Let’S start by taking five volts from our Arduino to the five volt rail and the same thing with ground from the ground rail to the ground, pin on the Arduino now let’s hook up our OLED VCC to our five volt rail and ground to our ground. Real SCL to a 5 and SDA to a four, so there we have almost all of our connections made in less than a minute couple. More connections let’s take another round from the bottom here, because we’re gon na need something to attach our signal to and we’re gon na read the signal on: pin Digital five so I’m just going to poke that in there so that we can put some alligator clips On it, that’s it that’s the whole thing: let’s go check out the code, then we’ll come back and play here’s. The code for Arduino macro frequency counter now here are the notes. Signal needs to be logic, level. High five volts low, zero volts input can only be on d5 and you will not be able to use analog right on three nine, ten or eleven. Now, this library, that we’re, using here frequent creek count dot, h, there’s a link here where you can find it by this guy, whose parents gave him a fantastic first name to install said library.

You need to go to sketch, include library, managed library, the wait for the thing to finish its duty duty and type in here, hello, I’m typing. Thank you, and there you’ll see it here. A freaking account now there’s also a freak major, which is, if you’re, looking at signals below a killers. So your choice. Alright, so we have three includes wire, which we need because we’re using I squared C for our lid, the Adafruit SSD 1306, which is a driver for our OLED and frequent freak count, which we just talked about, that OLED driver requires an OLED reset it’s on pin 4, which is the default blah blah blah, then we’re gon na create an instance of the Adafruit SSD 1306 library called display using the argument. Oled reset then we’re down into our setup, where we’re going to begin. The display with the command display began SSD 13’s, which six switch cap VCC, which is some black magic that lady ADA did here’s the key if you’re not using an Adafruit OLED. This is probably going to be your hex address. Oh x3, see if you’ve got a new OLED that you bought from far off lands and it’s, not working. Try adding that little bit to your setup, then display display will show the Adafruit logo Baskin. What is Lady ADA’s glory enough basking will clear the display, and we will begin our counter now down here in the main loop of the program.

We just simply say if frequency count is available, do all this. Well, what does all this first we’re going to create a float called count and it will be populated with what’s in the frequency read. That will be your count now, we’re going to create a float called period period, which is the inverse of count, and then we always clear the display we’re going to set our text size to 1, because we’re displaying a lot of crap here display sec text color To white, because it’s, the only color available cursor to the upper left will print our header skip a line then will print the the header for the line, which is frequency and some spaces, so everything lines up nice and Purdy and then display print count, which is Our frequency right after that will print the frequency in Hertz. So if we’re at 50, kilohertz you’re gon na see fifty thousand Hertz, if we’re at five make your you see, five million Hertz display print okay on our Hertz is a print line. So we dropped down a line. Then we do display print period, which is our next calculation and we print the period times 1000, which turns it into milliseconds. We display the milliseconds and then we show everything in the buffer and that’s it let’s go play with it. Alright I’ve got my function, generator all nice and set up and it’s running. You can see. We are outputting a 10 kilohertz square wave of 5 volts, so let’s grab some connectors and hook this up to our Arduino.

Sorry about that might have been a bit of a rough trip there, alright first of all, let’s power up the Arduino, since the code is already uploaded there. We have our Adafruit Industries splash and our frequency counter. Now this flickering, you see, is created entirely by the camera. When you look at this in real life, there is no flickering, so I attach our ground lead there and our frequency pin here and there you see we have 10000 Hertz frequency and 0.1 millisecond period. So if I adjust up, there is 80000 whoops hold on wrong channel. Try this again there’s 80000 and we just down all works very nice. Now what I’ve done is. I have synched this to to zoom out there won’t. We, when I got switched over to channel 2 it’s a hand on there. We go so there’s channel 2 on the scope show in our signal and if we bring up the major window we can see we have our period and our frequency and everything jives very nicely with what we’ve got here. So how about that? A very, very simple! Arduino frequency counter super small, I mean if we take a look at the size of this thing. The whole thing from one end to another is two and three quarter inches or what’s 7 centimeters battery power. This thing put it in a small plastic case and you’ve got the world’s smallest portable frequency counter. I like it, I think it’s pretty cool.


arduino frequency counter Video







arduino frequency counter news








arduino frequency counter Social






👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
safe image.php?d=AQDyi1ELcW4VGzhx&w=720&h=720& dChOhNMmeF - arduino frequency counter

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself:

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today:

70537898 550174072395145 8798850142103928832 n.jpg? nc cat=102& nc oc=AQmCfMPwMf1oPpYqFhzbxfnGdbrmsjZXrEEBy1ox5Z8EJtiYMADoFNZ5mnSNRgCCY74& nc ht=scontent - arduino frequency counter
lI1VUK  normal - arduino frequency counter
Sat May 26 09:11:15 +0000 2018

RT @RuntimeProjects: Arduino Frequency Counter with 16×2 LCD Display – #IoT #Arduino #esp8266
a8byw7fG normal - arduino frequency counter
Thu Feb 25 08:43:21 +0000 2016

Arduino Frequency Counter with 16×2 LCD Display – #IoT #Arduino #esp8266





Originally posted 2016-04-10 15:16:41.

(Visited 603 times, 1 visits today)

About The Author

You might be interested in

Comment (23)

  1. Thanks for sharing your efforts. Q: can this work with a sine wave as well? I’m looking at setting up a simple ATMEGA328P (Nano) to monitor supporting DS1307 RTC and an SD (SPI) card module to tell if a 45VAC signal at 1350Hz changes by more than +/- 2Hz.

    1. Send it through a CMOS buffer with hysteresis, that will square it up and make it 0-5V. You’ll want a resistor and diodes at the input of the CMOS gate to clip the voltage so it doesn’t go outside 0 to 5V.

      Come to that, you could probably feed the 45Vac through an appropriate resistor and protection diodes right into the Arduino. Clipped, it will be pretty close to a square wave.

  2. I kept working from your orignal project and it does measure AC sine wave without issue. Question was how to get from 120VAC to 10VAC. I purchased a standard door chime transformer (U.S.) that drops 120VAC to 24VAC/16VAC/8VAC for $14.00 at Home Depot and added (2) 1/4W 20K resistors to both the plus and minus connections to keep the current draw down – presto measures 60Hz. My problem solved. Thanks for posting your early efforts, It helped me solve my issues for my project.

  3. I think I will add this to my 50 ohm RF dummy load I am currently building maybe add an output power meter as well. Now you got my juices flowing. I’ll never get to bed now.

  4. I only had to make minimal changes for this to work on a Teensy 3.0, which is suppose to be able to measure up to 65MHz.

    The PJCR website has a page that tells you which pin to use and which won’t work with analogWrite() while using this library. It doesn’t list the Nano, but a Nano is just a small Uno without a voltage regulator.

    My display seems to have an error, in that it has a jumper for 0x78, but only works when the software is set to 0x3C. I have no idea why. I have seen comments from others having this same problem.

  5. Big problem, you fed it a signal from function generator that was not offset to meet input range of a pin, 0 – 5. Your input swings below ground. Thats a great way of burning out chip. You need to add an R divider to bias up input, Vdd >> R >> pin >> R >> ground. Then capacitor couple input signal to the pin. The Rs around 1K or less. In your example with 50 ohm generator, you swung -2.5 V across pin, thats about 50 mA you drove into pin. Not a good idea.

  6. BUG: if the count is 0 , there is infmS displayed . I bypassed with if else so that i get a 0 if count is 0

  7. Very nice and simple.
    Question, at 9:45, which button did you press to get that *”major window”* on that scope?
    I have a Hantek MS0 5202D (I think it is) and I don’t remember seeing that particular screen.

    Also, what’s the max frequency that this setup can “see?”
    Can it go up to *27Mhz or even 30Mhz* ?
    I want to do a build for my Ranger RCI-2980 radio. Its build-in frequency count has only 3 digits right of the decimal. Apparently, a later version of the radio had 5 or 6 digits to the right for more accurate adjustment.

    So I’d like to build something, with Arduino that will monitor the actual frequency to 5 or 6 position accuracy as well as perhaps some other data on the screen.
    I use Nextion Enhanced Displays as it comes with its own screen Editor, which is seriously amazing and not expensive. I love these displays.

  8. do i still write
    to start the count or do i use something else? im not well versed in this so sorry if i am asking obvious things
    would it be something like

  9. Thanks to you i found a use for one of my arduinos. I made slight changes so i could use it on a 16×2 lcd screen and hocked that baby up to my adjustable computer clock. Now i can finally exactly see on which frequency im running


Your email address will not be published. Required fields are marked *