Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Measuring the frequency of a short pulse train

Status
Not open for further replies.

riccardo

Member
Hello,

I am looking at ways of measuring resonance of a coil/cap in parallel so that it can then be pulsed at that frequency (around 100kHz). Preferably I would like to do this with a relatively small 8-bit AVR like the ATMega 328P used in the UNO. Basically I would put a single pulse into a coil, then the ringing waveform is buffered to give a set of sqare pulses for the micro to use.

I've seen a few different methods for making freqency counters but have difficulty with them. This is due to a few reasons:
  • The frequency is too high for direct pulse timing like the Arduino PulseIn command. (the accuracy is very poor)
  • I dont have a continuous pulse train to sample continuously
  • The pulse train can have a varying number of pulses from the ringing coil (e.g. 5 to 20)
Could anyone offer any suggestion on how to do this?
 
You simply need to rewrite the frequency counter program slightly - I'm presuming there are Arduino frequency counter programs just as there are PIC ones (50MHz counter when using a 4MHz clock).

A frequency counter normally continuously reads the frequency - you simply need to modify the code so it only reads it once, or twice, or three times, whatever you want. I would suggest that you modify it by adding a button to 'reset' the counter, which waits to be pressed after a reading has been taken - I would also add a routine before the reading is taken, that waits until a pulse has been detected before it starts the reading.

So it sits there waiting for a pulse, once it detects one it starts counting the incoming pulses (using a hardware counter - again presuming the Arduino has a suitable one), and stops counting after 1 second - then displays the reading, and waits for the button to be pressed to start again.
 
If the coil and cap are in series then could you vary the frequency and see at what frequency the current is maximum? I may be wrong on this but I'm sure someone will correct me. Over 40 years since I studied resonant circuits!


Mike.
Whoops, just seen they're in parallel but think the power should still be maximum at resonance.
 
You can use a timer input capture module. Basically this allows you to read a 16-bit counter value each time the input changes state (or e.g. has a positive edge). The different between two positive edges is the period of the waveform, although you can wait for as many edges as you want to get a more accurate measurement. Just subtract one [unsigned short] count from another to get the period. For 100kHz, the period will be 160 counts for 16MHz crystal of the Uno.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top