A
voltage meter, level and frequency.
In communication
technology, and in amateur radio practice, it is necessary to measure signal
not only to the voltage, but by the level. Signal levels are measured in
logarithmic units – db, (Db=20Lg(Uout./Uin.) for voltage and current, and =10
Lg(Uout./Uin.) for power.) For measurements of absolute levels are used
initial values of P= 1 mW, U=775mV, I=129 mA to the load R=600 Ohms.
The proposed device allows you to measure
high-frequency signals ac with the conclusion of the indicator values of
voltage V., the level of the dB. and frequency in Hz.
Voltage measuring range: 0-50 V, the
accuracy in the range of 0-5V equal to (5000/1024) is approximately 5 mV. In
the range of 5-50 V the accuracy of approximately 50 mV..
The maximum measured
frequency depends on the type of in-applied diodes head. When using the
measuring head, described in the journal Radio №1, 2008."RF
voltmeter on the diode Schottky", the author conducted measurements at
frequencies up to 30 Mhz.
The measured voltage value is recounted
program in levels, according to the formula Db=20Lg(0,775V/Uin.) and is
displayed on the indicator after the value of the voltage.
Frequency measurement is made with an
accuracy of 1 Hz, the maximum possible frequency measured theoretically
limited by the frequency quartz resonator, and may not exceed a half of its value.
When using the quartz 20 MHz, it is possible measurement of frequency up to 10
MHz.
The device is assembled on the
micro controller ATmega48, has 4 Kb program memory and so-the color of frequency
up to 20 MHz.
The indicator is a two-line indicator of
the company Winstar with 16 characters in each line Win1602.
Device for frequency meter and measuring
head taken from those described in the technical literature sources. Examples
are in the folder "Schema/Advanced".
The
principle of the device.
The input of the
ADC(0), (PortC0, pin 23), is a constant voltage from RF head. To the input of
the ADC is connected protective diodes and a voltage divider. When input
voltage is less than 5V, divider passport-chan, in excess of 5V he turned on
(1:10) contact relay, as a result of the input voltage on the ADC does not
exceed 5 V, and the measured value is multiplied by 10.
The reference voltage of the ADC is equal to
the voltage supply the controller (5V), the inputs of the AVcc, AREF on through
the smoothing filter from the filter choke 100 mkH and 0.1 mkF capacitors.
The input timer T0, (PortD4, pin 6), the
signal comes from a generator frequency counter, imagine-a-a, rectangular
pulses of scale, close to 5V. (The same signal is the input of the capture
timer T1, in this scheme is not used, but reserved for the prospects of
frequency measurement with just the right speed to hundredths of Hertz. While Proteus’
version is not giving the desired results;and the iron did not intend to. For
the practice of accuracy in 1 Hz enough, but for the possibility to bring to
the desired result circuit keep-lena.)
Analog and digital ground are separated, to
ensure greater accuracy of the ADC, and are connected together in one point of
the resistor R9, which has a resistance 0 Ohm (shorted).
Description
of the program.
The program is
written in the demo-version of Bascom 2.0.5.0.
First set the type used by the
microcontroller, the frequency quartz resonator, used indie lamp and define the
connection. Then configure the ADC. Next, configure the timers. 16-bit T1 works
as a timer and gives interrupt 1 second, the interval measurement of frequency.
8-bit T0 is included as a counter and is used for counting the number of pulses
on pin6 (T0) for 1 sec. As an 8-bit counter can only count up to 256, with
overflow he generating-the interrupt and increases by 1 the contents of the
4-byte variable TimHoh. As a result of the frequency can be measured to 4Byte’s
value of 2^32=4294967296 Hz,that at 20mhz quartz more than enough.
Configure the PortD1 as an output, and his
name Delitel, it will be used to power divider 1:10, with over-voltage at the
ADC input 5V.
Next we define the variables: Timecounter
As Byte to record the contents of the counter T0, Timhoh As Long to increase
the range of accounts, F As Long to store the value of the frequency in Hertz,
Flagt1 As Bit -flag, changes its value to the opposite by interruption of the
T1, is used for determination of the moments of the beginning and the end of
the accounts of the pulse frequency.
W As Word- of-character variable to store
the value 10 bit ADC, K As Byte =1 or 10, depending off voltage divider or
included. V&A – 4 Byte’s variables with floating-point values of a and
voltage level of the signal being measured.
We allow to interrupt the overflow timers
T0 and T1, the total resolution of the interrupt while not allow, they will
interfere with the calculations.
Display splash on the indicator, stop
Timers, start the ADC is set to "0" output on of the divisor and the
timer T1, the value of THE k coefficient equal to do 1.
Next is the main loop of the program. In
it:
-read the value of the ADC, if the ADC
=1023 (overflowing), the set K=10, turn on the divider to-voltage, and again
read the value of the ADC. If the ADC is less than 101 ( approximately 5V, when
enabled by the attenuator, or 0,5V for disabled), then the set of K=1 and
turning off the voltage divider.
-Set the cursor to the first position, a
top of the line.
-We expect the voltage and level. When a
voltage of less than 5V output in the indicator value with three digits after
the decimal point, at a voltage of more than 5V with two digits after the
decimal point. Followed by a space, display level set to two decimal points. In
this case, even though the variables Single -unsigned, negative values are
displayed on the indicator with the sign "minus", no additional
intervention in its conclusion no need.
-We make a pause of 100ms.
Start the measurement frequency:
-Allow the total resolution of the
interrupt.
-Record in Таймер1 value for 1 sec., zero T0, also resets variables Timhoh and F.
-Run Тimer1.
-Wait for the installer flag Flagt1, which
is set to "1" by interruption of T1.
"As soon as Flagt1=1, run the timer
T0, which will count the pulses at the entrance 6, and look forward to reset
the flag state of the Flagt1, which will be cleared when the following
interruption of T1, after 1 second.
"As soon as Flagt1=0, we stop the
timer, the value of Тimer0
record in the variable Timecounter. The Variable F is assigned a value that is
stored in the Timhoh (number of overflows T0). Then shifted left by 8
positions, and add to it the value of the variable Timecounter, in which is
stored the value of the Timer T0. Thus we get the value of the frequency of
dimension up to 4 bytes.
- Prohibit shared interrupts.
-Clean indicator, translate the cursor to
the first position of the bottom-line and print the value of the frequency.
-Wait for the 100 ms, and we go back to the
beginning of the main loop.
In the timer interrupt T1
"T1over:" is reset timer, change the flag Flagt1 and exit from the
interruption.
In the timer interrupt T0
"T0over:" increases by 1 the contents of the variable Timhoh and
pro-usual output from the interruption. Reboot T0 is not done, because after
the overflow he begins to account from scratch.
Summary.
The device was developed for measuring the
level of equipment located at remote sites. In stationary conditions,
dimensions of measuring devices, do not have such an important value. Has small
dimensions and weight, reflects the main parameters of the controlled signal.
Convenient for finding damage, though accuracy is not very high, for the
overwhelming majority of works it is quite enough. The main advantage of the
instrument, the universality and simplicity. Debugged in Proteus v7.7sp2. Proteus’
files are attached. Schemes implemented in the program DipTrace.