Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Multifunctional frequency meter. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Measuring technology

Comments on the article Comments on the article

The proposed device, in addition to the usual measurement of the frequency of signals, can measure their period, as well as the duration of positive and negative pulses. In addition, the frequency of signals less than 1 kHz is calculated as the reciprocal of their period, and the repetition period of signals less than 1000 μs is calculated as the reciprocal of their frequency. This improves the accuracy of the measurement.

Once I assembled a very popular Denisov frequency meter [1], or rather, its version [2] on the PIC16F628A microcontroller and the ALS318 LED indicator. After many years, he again caught my eye. This device measures the frequency regularly, but it is painfully primitive, and the readings are constantly flickering. It was decided on the same basis (by changing the connection of two microcontroller outputs, input circuits and power circuits) to create a device devoid of the shortcomings of its prototype, as well as supplemented with new functions and modes.

The instrument described below has the following capabilities: "normal" frequency measurement by counting the number of pulses in one second; measuring the frequency of low-frequency signals as the reciprocal of its period; measuring the period of the signal, wherein the period of the high-frequency signals is calculated as the reciprocal of its frequency; measuring the duration of pulses of both positive and negative polarity.

It is also possible to store in the non-volatile memory of the microcontroller one value of the measured value in each mode with their subsequent viewing if necessary. It is possible to quickly change the settings of the device and automatically turn it off in the absence of external influences for a certain time.

Main Specifications

  • Maximum measured frequency, MHz ......40
  • Frequency measurement resolution by conventional method, Hz ....... 1
  • Frequency measurement resolution through a period, Hz .......0,001
  • Minimum measured period, µs .......0,05
  • Maximum measured period, s ....... 2
  • Frequency at which the method of measuring the period and frequency changes, Hz ..... 900 ... 1000
  • Minimum measured pulse duration, µs ....... 1
  • Maximum measured pulse duration, s ....... 1
  • Amplitude of the measured signal, V.......0,1...100
  • Relative measurement error ......1 10-5
  • Additional measurement error, units ml. discharge ...... 1
  • The duration of the measurement result display, s.......0,25 - 2
  • Device automatic shutdown delay, min ....... 8, 16, 32, 64
  • Supply voltage, V......5,5...10
  • Average current consumption in operating mode, mA ....... 15 ... 25
  • Current consumption in sleep mode, µA, no more ....... 10

The scheme of the frequency meter is shown in fig. 1. The microcontroller PIC16F628A (DD1) controls the signals generated at the outputs RA3, RB0-RB2, RB4-RB7 through the limiting resistors R10-R17 the anodes of the indicator elements HG1 and HG2, which are used as two four-digit seven-element LED indicators with common cathodes of the elements of each discharge FYQ-3641AHR-11. The signals that control the cathodes of the indicator discharges come from the outputs of the 74HC138N (DD2) decoder, to the inputs of which the signals come from the RAO-RA2 lines of the microcontroller operating in the output mode. Using the same lines, working in the input mode, the program checks the status of the control buttons SB1 and SB2. Resistors R1-R4 set the desired potentials at the inputs when the buttons are pressed and released.

Multifunctional frequency meter
Rice. 1. Frequency meter circuit (click to enlarge)

The microcontroller is clocked from its internal oscillator, the frequency of which is 16 MHz, set by an external quartz resonator ZQ1. The MCLR pin is not used and is connected to the positive voltage of the microcontroller to avoid failures.

The program performs operations related to dynamic indication in the procedure for processing interrupt requests from the TMR2 timer, following with a period of 2 ms. Therefore, the information on the eight-digit indicator is updated with a frequency of 1/(8x0,002) = 62,5 Hz. This ensures the invisibility of the indicator flicker in all operating modes of the device.

The signal from the input amplifier-shaper is fed to the combined lines RA4 and RB3 (pins 3 and 9 of the microcontroller, respectively, having alternative functions T0CKI and CCP1). In the mode of a conventional frequency counter, T0CKI is the input of the pulse counter, and the RB3 line, operating in the input and output modes, is used to programmatically open and close the counter input and then "count up".

When measuring the period and duration, both lines work as inputs T0CKI and CCP1. In this case, an algorithm is used to capture the state of the TMR1 register at the moments of signal drops and calculate the time intervals between these moments, as well as to control the correctness of the result by analyzing the contents of the TMR0 register.

The idea is that the measured signal is fed to the combined count and capture inputs of the microcontroller timers. This allows you to judge by the number of transitions counted by the TMR0 timer whether the necessary transitions are missed by the TMR1 timer capturing unit due to insufficient microcontroller performance.

The input amplifier-shaper on transistors VT1 and VT2 is assembled according to a well-known and well-established scheme. The relatively large capacitance of the capacitors C1 and C9 is explained by the need to ensure the lower limit of the bandwidth is not more than 1 Hz (for this, the resistor R20 is used, which increases the input resistance of the step on the transistor VT2). Elements C8, C10, C11, L1 increase the gain of the driver amplifier for signals near the maximum measurable frequency. Resistor R5 and diodes VD1, VD2 protect transistor VT1 from breakdown by the input signal.

The shaping amplifier consumes a significant current (about 5 mA), so to save power in the sleep mode of the device, it was necessary to disconnect it from the amplifier using a switch on a VT3 field effect transistor with a p-type channel. Due to the lack of free outputs, the microcontroller controls this key with a signal from the RA2 output, which is also used to control the DD2 decoder. In operating mode, the signal at this pin is a rectangular pulse with a repetition rate of 125 Hz. When the logic level of this signal is low, the capacitor C13 is charged through the VD3R23 circuit and the transistor VT3 opens with a negative gate voltage relative to the source. At a high signal level, the VD3 diode prevents the capacitor from discharging through the relatively small resistance of the resistor R23. The time constant of the C13R24 circuit is chosen large enough to prevent interference with a frequency of 125 Hz from entering the input amplifier-shaper.

In sleep mode, the microcontroller sets the output RA2 to a constant high logic level. Capacitor C13 is discharged through resistor R24, and after about 3 ... 5 s, transistor VT3 closes and completely disconnects the driver amplifier from the power source. As a result, the current consumed by the device in sleep mode does not exceed 10 μA, which, if desired, allows you to abandon the mechanical power switch.

The lines RA0 and RA1 of the microcontroller in sleep mode are configured as inputs, and on them (as well as on inputs 1 and 2 of the decoder), when the buttons SB1 and SB2 are released, thanks to the resistors R1 and R3, a high logic voltage level is set. A high level also operates at the input of 4 decoders. Such a combination of levels at its inputs corresponds to a low level at output 7, which, through the resistor R21, enters the RB7 line of the microcontroller, which works in this case as an input.

When you press any button, the code at the inputs of the decoder changes, therefore, at its output 7, the low level is replaced by a high one, which is transmitted through the resistor R21 to the input RB7 of the microcontroller. In sleep mode, an interrupt is enabled for a level change at this input, so pressing any button returns the microcontroller to the active mode.

The device is powered by a voltage of 5 V from an integrated voltage regulator NCP551SN50 (DA1). This microcircuit is characterized by a small allowable difference between the input and output voltage and an extremely low own current consumption (typical value - 4 μA). The use of a conventional 78L05 stabilizer instead of it is possible, but it will nullify the meaning of the sleep mode due to the large intrinsic current consumption of the stabilizer - about 3 mA. All parts of the device are placed on a printed circuit board with dimensions of 63x65 mm made of fiberglass laminated on one side. The drawing of the printed conductors of the board is shown in fig. 2. The location of parts on its two sides - in fig. 3. The dimensions of the board are chosen so that they can be conveniently placed in a case from a DT-830 multimeter, having previously cut off the plastic stands in it. At the same time, there is enough space for various battery options - from the Krona battery to five or six AAA galvanic or rechargeable batteries. The fact that all parts, including the buttons, the input connector and the screw block for supplying voltage, are compactly placed on the board, allows you to use the device even without a case. Please note that the indicators are located at the bottom of the board. This arrangement is somewhat unusual, but provides a greater viewing angle of the indicator.

Multifunctional frequency meter
Rice. 2. Drawing of printed circuit board conductors

Multifunctional frequency meter
Rice. 3. Location of parts on two sides of the board

The FYQ-3641AHR-11 indicators can be replaced by others with common cathodes, such as CPD-03641. If you install 74AC138N instead of the 74HC138N decoder, then, if necessary, you can increase the current up to two times, and hence the brightness of the indicators, by reducing the resistance of the resistors R10-R17 to 390 ohms. But then the current consumed by the device in operating mode will increase proportionally. In my opinion, the brightness of the indicators is sufficient even with the values ​​\uXNUMXb\uXNUMXbof these resistors indicated in the diagram.

A quartz resonator can be used not only at a frequency of 16 MHz, but also at 4 MHz, but in this case the minimum measured pulse duration will increase four times. Variants of the microcontroller program for both indicated values ​​of the resonator frequency are attached to the article.

Buttons SB1 and SB2 - clock angular. Instead of the BF998 transistor, you can use the BF998R, their difference is only in the mutually mirrored pin arrangement. Therefore, the BF988R transistor will have to be mounted on the board in an upside down position. The KT368A transistor is replaced by any similar low-power npn transistor with a cutoff frequency of at least 300 MHz. Diodes 1N4148 can be replaced by domestic series KD521, KD522.

The block part of the connector for power supply, designed for a plug with a diameter of 1 mm, is used as the XW5,5 input jack. A piece of shielded wire 50 cm long is soldered to the plug, at the opposite end of which a probe is soldered to the central wire, and a crocodile clip is soldered to its braid.

To reduce the size, capacitors and resistors are used mainly for surface mounting, size 0805. Capacitor C13 is tantalum. To prevent unwanted short circuits on the printed conductors in the places of their passage under the elements for surface mounting, strips of paper adhesive tape are preliminarily glued. Output resistors are used where it is beneficial in terms of convenient wiring of printed conductors. Place the surface mount elements on the board first, then the jumper wires, and lastly the wire lead elements.

As a last resort, the NCP551SN50T1 stabilizer can be replaced by the less scarce LP2950CZ-5.0. The board has a slot marked DA1 for it. But in this case, the current consumed in sleep mode will increase to 70 ... 100 μA.

The appearance of the assembled board is shown in fig. four.

Multifunctional frequency meter
Rice. 4. Appearance of the assembled board

When using the elements indicated in the diagram and a high-quality quartz resonator, the characteristics of the device indicated at the beginning of the article are provided without any adjustment. If there is an accurate exemplary frequency meter, it makes sense, by applying a signal with a frequency of 5 ... 30 MHz to the input of the device and controlling its value by the exemplary frequency meter, to achieve as close as possible the readings of the manufactured device by adjusting them with a tuning capacitor C7. If necessary, by selecting a resistor R19, a constant voltage within 2 ... 2 V should be set on the collector of the transistor VT3.

The microcontroller program is written in MPASM assembly language. The HEX files attached to the article for loading into the microcontroller memory (fmeter_X16_FULL.HEX for a 16 MHz quartz resonator and fmeter_X4_FULL. HEX for a 4 MHz quartz resonator) were obtained by translating the program in the MPLAB environment. To fully utilize all the capabilities of the device, it is preferable to use a 16 MHz resonator. The configuration word is entered into the program's HEX file automatically when it is translated, so manual configuration is not required.

When the device is turned on, the indicator after a greeting displays readings according to the previously selected mode. When you press the SB1 button, the name of the current mode appears on the indicator (in most cases - immediately, but sometimes you may need to hold the button down for up to 2 s). With subsequent clicks on this button, the modes and their names on the indicator change in a circle: the usual frequency meter , low frequency counter , period measurement , measuring the duration of positive pulses , measuring the duration of negative pulses and again the usual frequency counter.

Pressing the SB2 button while any mode is indicated on the display leads to the transition of the device to its initial state with the corresponding mode change. In the absence of pressing any button during the waiting time (3 ... 10 s), the device switches to its original state in the previous (before pressing the SB1 button) mode.

If, after the appearance of the mode name on the indicator, hold without releasing the SB1 button for more than 3 s, the indicator will display the inscription . At the same time, pressing the SB2 button, as well as the absence of button presses during the waiting time, puts the device into sleep mode, which is exited by pressing any button. Pressing the SB1 button in this mode (of course, having previously released it) leads to the alternate appearance of the inscriptions on the display и .

By pressing the SB2 button while the inscription is displayed , go to the setting submenu. Here - indication period, s; - duration of waiting for pressing the buttons, s; - time to automatic shutdown, min. Zeros in these labels will be replaced by the current values ​​of the corresponding parameters, flashing for greater visibility.

The items of this menu are sequentially switched by pressing the SB1 button, and pressing the SB2 button changes the value of the current parameter, which is immediately displayed on the indicator. Exit with saving the set parameter values ​​- after the waiting time has elapsed without pressing the buttons.

Pressing the SB2 button in the initial state (in some modes, the duration of pressing up to 2 s is required) will lead to the appearance of the inscription on the indicator . Releasing the button immediately after its appearance - to display on the indicator for 8 s the measured value previously stored in the non-volatile memory of the microcontroller, flashing to differ from the current measured value. If, when the inscription appears while holding down the SB2 button, press the SB1 button, the current measured value will be written to the non-volatile memory. This will be confirmed by a flashing on the indicator.

The transition to sleep mode also occurs when there is no action on the buttons for 8-64 minutes.

Conventional frequency counter

The operation of the device in this mode is based on counting the pulses of the measured signal by the timer TMR0 of the microcontroller for a certain time interval. The countdown of this interval (1 s) occurs in the TMR3 timer interrupt routine, called with a period of 2 ms. In the same procedure, dynamic indication is performed.

When the frequency of the measured signal is less than 10 MHz, the sign is displayed in the high order of the indicator.

Low frequency counter

In the low-frequency frequency counter mode, when measuring the frequency up to 1000 Hz, the signal period is actually measured, and the frequency is calculated as its reciprocal and displayed in thousandths of a hertz (the comma is included in the fourth digit from the right of the indicator). If the frequency is above 1000 Hz, it is measured in the usual way. The reverse switching occurs at a frequency of 900 Hz. This mode allows, with a short measurement time, to obtain at least three decimal digits of the frequency value after the decimal point on the indicator.

Sign of the regime - signs in the two most significant digits of the indicator. At high frequency values, they are alternately overwritten by non-zero high-order digits of the measurement result.

Period measurement

In this mode, when the period of the measured signal is more than 1000 µs, the measurement is performed directly by the timer TMR1 of the microcontroller, clocked by counting pulses with a frequency of 1 MHz from the internal generator. With a smaller signal period, its frequency is measured, and the period is calculated as its reciprocal value. The result is always displayed in microseconds, in the latter case - with three decimal places after the decimal point.

Mode sign - sign in the most significant digit (with direct measurement of the period) or signs in the two most significant digits (when measuring the period through the frequency). As in other modes, these characters are overwritten by non-zero leading digits of the result.

Pulse Width Measurement

For positive and negative pulses, this mode differs only in that in the first case, the time is measured from the rising to the falling edge of the signal, and in the second, from the falling to the rising edge. The measurement is made by directly counting the time interval between the drops by the timer TMR1 of the microcontroller, clocked from the internal generator with pulses with a period of 0,25 μs. This provides a reliable measurement of the duration of 3 µs or more.

If the measured pulses are shorter than the specified value, then the timer capture module sometimes does not have time to capture both edges limiting it during one pulse and captures the final edge of the next pulse (or skipping several pulses). Comparing the results of measuring the duration and the repetition period of the pulses, the program detects such a situation and subtracts the value of the repetition period from the measured duration. The result in this case, of course, is less reliable. If a duration exceeding several pulse periods is received, an over-frequency message is displayed.

The duration of pulses less than 32768 µs is displayed with a resolution of 0,25 µs, longer ones - 1 µs.

Sign of the regime - signs (measuring the duration of positive pulses) or (measuring the duration of negative pulses) in the two most significant digits of the indicator. If the result is corrected for the duration of the pulse repetition period, then the sign flashes.

It should be noted that the asymmetry of the input part of the device, as well as the presence of a Schmitt trigger at the RB3/CCP1 input (pin 9) of the microcontroller, leads to a large error in measuring the duration of pulses with gentle drops. This error decreases with increasing signal amplitude. Attempts to measure signals with an amplitude of less than 0,1 V in any mode may result in false readings. However, this also applies to other similar devices. With a known stable input signal, an indirect sign of its insufficient amplitude can be significant fluctuations in readings.

If the parameters of the input signal do not allow the measurement, the following messages are displayed on the indicator of the device: - too high frequency, - period too long - no signal.

Literature

  1. Denisov A. Digital scale - frequency counter on PIC16F84. - URL: cqham.ru/digi.htm.
  2. Korabelnikov E. Frequency meter - digital scale with dynamic indication. - URL: radiomaster.com.ua/1651-chastotomer-cifrovaya-shkala-s-dinamic-heskoj.html.

The microcontroller program can be downloaded from ftp://ftp.radio.ru/pub/2015/05/fmeter.zip.

Author: B. Balaev

See other articles Section Measuring technology.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

The world's tallest astronomical observatory opened 04.05.2024

Exploring space and its mysteries is a task that attracts the attention of astronomers from all over the world. In the fresh air of the high mountains, far from city light pollution, the stars and planets reveal their secrets with greater clarity. A new page is opening in the history of astronomy with the opening of the world's highest astronomical observatory - the Atacama Observatory of the University of Tokyo. The Atacama Observatory, located at an altitude of 5640 meters above sea level, opens up new opportunities for astronomers in the study of space. This site has become the highest location for a ground-based telescope, providing researchers with a unique tool for studying infrared waves in the Universe. Although the high altitude location provides clearer skies and less interference from the atmosphere, building an observatory on a high mountain poses enormous difficulties and challenges. However, despite the difficulties, the new observatory opens up broad research prospects for astronomers. ... >>

Controlling objects using air currents 04.05.2024

The development of robotics continues to open up new prospects for us in the field of automation and control of various objects. Recently, Finnish scientists presented an innovative approach to controlling humanoid robots using air currents. This method promises to revolutionize the way objects are manipulated and open new horizons in the field of robotics. The idea of ​​controlling objects using air currents is not new, but until recently, implementing such concepts remained a challenge. Finnish researchers have developed an innovative method that allows robots to manipulate objects using special air jets as "air fingers". The air flow control algorithm, developed by a team of specialists, is based on a thorough study of the movement of objects in the air flow. The air jet control system, carried out using special motors, allows you to direct objects without resorting to physical ... >>

Purebred dogs get sick no more often than purebred dogs 03.05.2024

Caring for the health of our pets is an important aspect of the life of every dog ​​owner. However, there is a common assumption that purebred dogs are more susceptible to diseases compared to mixed dogs. New research led by researchers at the Texas School of Veterinary Medicine and Biomedical Sciences brings new perspective to this question. A study conducted by the Dog Aging Project (DAP) of more than 27 companion dogs found that purebred and mixed dogs were generally equally likely to experience various diseases. Although some breeds may be more susceptible to certain diseases, the overall diagnosis rate is virtually the same between both groups. The Dog Aging Project's chief veterinarian, Dr. Keith Creevy, notes that there are several well-known diseases that are more common in certain breeds of dogs, which supports the notion that purebred dogs are more susceptible to disease. ... >>

Random news from the Archive

Websites learn how visitors feel 01.01.2016

Anger is easy to see in a person's behavior. Professor Jeffrey Jenkins can now tell how angry you are just by moving your computer mouse.

According to a study conducted by his group, people experiencing anger (or other negative emotions - frustration, excitement, sadness) begin to move the mouse with less accuracy, change the speed of the cursor. Thanks to modern technologies, the professor collected enough information and developed an algorithm that can guess the emotional state of a person by the speed of the cursor moving around the site.

"With this technology, sites will become smarter," says Jenkins. "They will not only give information, but literally feel you. Understand not only the information you provide, but also the feelings that you experience."

According to his research, when a user is upset or excited, the cursor path from straight lines and smooth arcs becomes broken and abrupt. Moreover, an angry or upset person moves the mouse much more slowly than a calm person. Jenkins believes that the new technology will help web designers quickly fix bugs and problems on sites that cause negative emotions for users.

"It's usually pretty hard to pinpoint exactly when a user gets angry and leaves the site without coming back," says the professor. "Now we can feel the backlash and not only restructure the site to reduce stress, but also offer help when needed." .

So far, the system is designed to work with a mouse only, but Jenkins is already planning to modify it for use in smartphones.

Other interesting news:

▪ Protein that damages brain connections discovered

▪ Growing plants in total darkness

▪ Electric vehicle chargers from McDonald's

▪ Miniature 868MHz radio module with built-in antenna

▪ Smartphone Oppo N1

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Metal detectors. Article selection

▪ article In the middle of nowhere. Popular expression

▪ article What is Stonehenge? Detailed answer

▪ article Daylily. Legends, cultivation, methods of application

▪ article Display block BSK-10. Encyclopedia of radio electronics and electrical engineering

▪ article A handkerchief stands and a hand. Focus secret

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024