Voltmeter on a line of LEDs. Digital ammeter and voltmeter on PIC16F873A DIY LED voltmeter

Digital VOLTMETER and AMMETER for laboratory power supply (unipolar and bipolar) on a specialized ICL7107 chip

It so happened that there was a need to manufacture an ammeter and a voltmeter for laboratory power supplies. To solve the problem, I decided to scour the Internet and find an easily repeatable scheme with an optimal price-quality ratio. There were thoughts of making an ammeter and a voltmeter from scratch based on an LCD and a microcontroller (MK). But I think to myself, if it’s a microcontroller, then not everyone will be able to repeat the design - after all, you need a programmer, and I don’t even really want to buy or make a programmer for programming once or twice. And people probably won’t want it either. In addition, all microcontrollers (that I have dealt with) measure the positive polarity input signal relative to the common wire. If you need to measure negative values, you will have to deal with additional operational amplifiers. Somehow all of this was stressful! My eye fell on the widespread and affordable ICL7107 chip. Its cost turned out to be half the cost of MK. The cost of a 2x8 character LCD turned out to be three times more than the cost of the required number of seven-segment LED indicators. And I like the glow of LED indicators more than LCD. You can also use a similar, even cheaper, domestically produced m/skh KR572PV2. I found the diagrams on the Internet and went ahead to check the functionality! There was an error in the diagram, but it was corrected. It turned out that when calibrating the readings, the m/sx ADC works quite accurately and the accuracy of the readings will completely satisfy even the most picky user. The main thing is to take a good quality multi-turn tuning resistor. The counting is very fast - without brakes. There is a significant drawback - bipolar power supply ±5V, but this issue can be easily solved using a separate mains power supply on a low-power transformer with positive and negative stabilizers (I will give the diagram later). To obtain -5V, you can use a specialized ICL7660 microcircuit (visible in the photo at the top of the page) - cool stuff! But it has an adequate price only in an SMD package, and in a regular DIP it seemed to me a little expensive, and it’s much more difficult to buy than conventional linear stabilizers - it’s easier to make a negative stabilizer. It turned out that the ICL7107 perfectly measures both positive and negative voltages relative to the common wire, and even the minus sign is displayed in the first digit. In fact, in the first digit only the minus sign and the number “1” are used to indicate the polarity and value of hundreds of volts. If for a laboratory power supply a voltage indication of 100V is not needed and there is no need to indicate the voltage polarity, since everything should be written on the front panel of the power supply, then the first indicator can not be installed at all. For an ammeter the situation is the same, but only a “1” in the first digit will indicate that a current of ten Amperes has been reached. If the power supply has a current of 2...5A, then you can not install the first indicator and save money. In short, these are just my personal thoughts. The schemes are very simple and start working right away. You only need to set the correct readings on the control voltmeter using a trimming resistor. To calibrate the ammeter, you will have to connect a load to the power supply and use the control ammeter to set the correct readings on the indicators and that’s it! To power ammeters in a bipolar power supply circuit, it turned out that it is best to use a separate small network transformer and stabilizers with a common wire isolated from the common wire of the power supply itself. In this case, the inputs of the ammeters can be connected to the measuring shunts “at random” - m/sx will measure both “positive” and “negative” voltage drops on the measuring shunts installed in any part of the power supply circuit. This is especially important when both stabilizers in a bipolar power supply are already connected via a common wire without measuring shunts. Why do I want to make a separate low-power power supply for meters? Well, also because if you power the meters from the transformer of the power supply itself, then when you receive a voltage of 5 V out of 35 V, you will need to install an additional radiator, which will also generate a lot of heat, so it’s better to use small sealed transformers on a small board. And in the case of a power supply with a voltage of more than 35 V, say 50 V, you will have to take additional measures to ensure that for five Voltage stabilizers at the input the voltage is no more than 35 V. You can use high-voltage switching stabilizers with low heat generation, but this increases the cost. In short, if not one thing, then another ;-)

Voltmeter circuit:


Ammeter circuit:


Photo view of the printed circuit board of a voltmeter and ammeter (board size 122x41 mm) with seven-segment LED indicators of type E10561 with digits 14.2 mm high. The power supply for the voltmeter and ammeter is separate! This is necessary to ensure the ability to measure currents in a bipolar power supply. The ammeter shunt is installed separately - a 0.1 Ohm/5 W cement resistor.

Scheme of the simplest mains power supply for joint and separate power supply of voltmeters and each of the ammeters (maybe a nonsense idea, but it works):

And a photo view of printed circuit boards using compact sealed transformers 1.2...2 W (board size 85x68 mm):


Voltage polarity converter circuit (as an option for obtaining -5 V from +5 V):


Video of voltmeter operation

Video of workammeter

I won’t make kits or boards, but if anyone is interested in this design, you can download the printed circuit board drawings.

Thank you all for your attention! Good luck, peace and goodness to your home! 73!

Figure 1 shows a circuit of a digital ammeter and voltmeter, which can be used as an addition to circuits of power supplies, converters, chargers, etc. The digital part of the circuit is implemented on a PIC16F873A microcontroller. The program provides voltage measurement 0... 50 V, measured current - 0... 5 A.

LED indicators with a common cathode are used to display information. One of the operational amplifiers of the LM358 chip is used as a voltage follower and serves to protect the controller in emergency situations. Still, the price of the controller is not so small. The current is measured indirectly, using a current-voltage converter made by the operational amplifier DA1.2 of the LM358 microcircuit and the transistor VT1 - KT515V. You can also read about such a converter. The current sensor in this circuit is resistor R3. The advantage of this current measurement circuit is that there is no need for precise adjustment of the milliohm resistor. You can simply adjust the ammeter readings with trimmer R1 and within a fairly wide range. The load current signal for further digitization is removed from the load resistor of the converter R2. The voltage on the filter capacitor located after the rectifier of your power supply unit (stabilizer input, point 3 on the diagram) should not be more than 32 volts, this is due to the maximum supply voltage of the op-amp. The maximum input voltage of the KR142EN12A microcircuit stabilizer is thirty-seven volts.

Adjusting the voltammeter is as follows. After all the procedures - assembly, programming, checking for compliance, the product you have assembled is supplied with supply voltage. Resistor R8 sets the voltage at the output of the KR142EN12A stabilizer to 5.12 V. After this, the programmed microcontroller is inserted into the socket. Measure the voltage at point 2 with a multimeter that you trust, and use resistor R7 to achieve the same readings. After this, a load with a control ammeter is connected to the output (point 2). In this case, equal readings of both devices are achieved using resistor R1.

You can make a current sensor resistor yourself, using, for example, steel wire. To calculate the parameters of this resistor, you can use the program “Did you download the program?” Have you opened it? So, we need a resistor with a nominal value of 0.05 Ohm. To make it, we will choose steel wire with a diameter of 0.7 mm - this is what I have, and it does not rust. Using the program, we calculate the required length of the segment having such resistance. Let's look at the screenshot of this program's window.

And so we need a piece of stainless steel wire with a diameter of 0.7 mm and a length of only 11 centimeters. There is no need to twist this segment into a spiral and concentrate all the heat at one point. Look like that's it. What is not clear, please go to the forum. Good luck. K.V.Yu. I almost forgot about the files.

We consider simple circuits of digital voltmeter and ammeter, built without the use of microcontrollers on the CA3162, KR514ID2 microcircuits. Typically, a good laboratory power supply has built-in instruments - a voltmeter and an ammeter. A voltmeter allows you to accurately set the output voltage, and an ammeter will show the current through the load.

Old laboratory power supplies had dial indicators, but now they should be digital. Nowadays, radio amateurs most often make such devices based on a microcontroller or ADC chips like KR572PV2, KR572PV5.

Chip CA3162E

But there are other microcircuits of similar action. For example, there is a CA3162E microcircuit, which is designed to create an analog value meter with the result displayed on a three-digit digital indicator.

The CA3162E microcircuit is an ADC with a maximum input voltage of 999 mV (with readings “999”) and a logic circuit that provides information about the measurement result in the form of three alternately changing binary-decimal four-bit codes on a parallel output and three outputs for polling the bits of the dynamic circuit indication.

To get a complete device, you need to add a decoder to work on a seven-segment indicator and an assembly of three seven-segment indicators included in the matrix for dynamic display, as well as three control keys.

The type of indicators can be any - LED, fluorescent, gas-discharge, liquid crystal, it all depends on the circuit of the output node on the decoder and keys. It uses LED indication on a display consisting of three seven-segment indicators with common anodes.

The indicators are connected according to a dynamic matrix circuit, that is, all their segment (cathode) pins are connected in parallel. And for interrogation, that is, sequential switching, common anode terminals are used.

Schematic diagram of a voltmeter

Now closer to the diagram. Figure 1 shows a circuit of a voltmeter that measures voltage from 0 to 100V (0...99.9V). The measured voltage is supplied to pins 11-10 (input) of microcircuit D1 through a divider on resistors R1-R3.

The SZ capacitor eliminates the influence of interference on the measurement result. Resistor R4 is used to set the instrument readings to zero; in the absence of input voltage, and resistor R5 is used to set the measurement limit so that the measurement result corresponds to the real one, that is, we can say that they calibrate the device.

Rice. 1. Schematic diagram of a digital voltmeter up to 100V on SA3162, KR514ID2 microcircuits.

Now about the outputs of the microcircuit. The logical part of the CA3162E is built using TTL logic, and the outputs are also with open collectors. At the outputs “1-2-4-8” a binary decimal code is generated, which changes periodically, providing sequential transmission of data on three digits of the measurement result.

If a TTL decoder is used, such as KR514ID2, then its inputs are directly connected to these inputs of D1. If a CMOS or MOS logic decoder is used, then its inputs will need to be pulled to positive using resistors. This will need to be done, for example, if the K176ID2 or CD4056 decoder is used instead of KR514ID2.

The outputs of the decoder D2 are connected through current-limiting resistors R7-R13 to the segment terminals of the LED indicators H1-NC. The same segment pins of all three indicators are connected together. To poll the indicators, transistor switches VT1-VT3 are used, to the bases of which commands are sent from the outputs H1-NC of the D1 chip.

These conclusions are also made according to an open collector circuit. Active zero, so transistors of the pnp structure are used.

Schematic diagram of an ammeter

The ammeter circuit is shown in Figure 2. The circuit is almost the same except for the input. Here, instead of a divider, there is a shunt on a five-watt resistor R2 with a resistance of 0.1 Ot. With such a shunt, the device measures current up to 10A (0...9.99A). Zeroing and calibration, as in the first circuit, is carried out by resistors R4 and R5.

Rice. 2. Schematic diagram of a digital ammeter up to 10A or more on SA3162, KR514ID2 microcircuits.

By selecting other dividers and shunts, you can set other measurement limits, for example, 0...9.99V, 0...999mA, 0...999V, 0...99.9A, this depends on the output parameters of the laboratory power supply in which these indicators will be installed. Also, based on these circuits, you can make an independent measuring device for measuring voltage and current (desktop multimeter).

It should be taken into account that even using liquid crystal indicators, the device will consume significant current, since the logical part of the CA3162E is built using TTL logic. Therefore, it is unlikely that you will get a good self-powered device. But a car voltmeter (Fig. 4) will turn out to be quite good.

The devices are powered by a constant stabilized voltage of 5V. The power source in which they will be installed must provide for the presence of such a voltage at a current of at least 150mA.

Connecting the device

Figure 3 shows a diagram of connecting meters in a laboratory source.

Rice. 3. Connection diagram of meters in a laboratory source.

Fig.4. Homemade automobile voltmeter on microcircuits.

Details

Perhaps the most difficult to obtain are CA3162E microcircuits. Of the analogues, I know only NTE2054. There may be other analogues that I am not aware of.

The rest is much easier. As already said, the output circuit can be made using any decoder and corresponding indicators. For example, if the indicators have a common cathode, then you need to replace KR514ID2 with KR514ID1 (the pinout is the same), and drag the transistors VT1-VTZ down, connecting their collectors to the power supply negative, and the emitters to the common cathodes of the indicators. You can use CMOS logic decoders by connecting their inputs to the power supply positive using resistors.

Setting up

In general, it is quite simple. Let's start with a voltmeter. First, we connect terminals 10 and 11 of D1 to each other, and by adjusting R4 we set the readings to zero. Then, remove the jumper that closes terminals 11-10 and connect a standard device, for example, a multimeter, to the “load” terminals.

By adjusting the voltage at the source output, resistor R5 adjusts the calibration of the device so that its readings coincide with the readings of the multimeter. Next, we set up the ammeter. First, without connecting the load, by adjusting resistor R5 we set its readings to zero. Now you will need a constant resistor with a resistance of 20 O and a power of at least 5W.

We set the voltage on the power supply to 10V and connect this resistor as a load. We adjust R5 so that the ammeter shows 0.50 A.

You can also perform calibration using a standard ammeter, but I found it more convenient to use a resistor, although of course the quality of calibration is greatly influenced by the error in the resistance of the resistor.

Using the same scheme, you can make a car voltmeter. The circuit of such a device is shown in Figure 4. The circuit differs from that shown in Figure 1 only in the input and power supply circuit. This device is now powered by the measured voltage, that is, it measures the voltage supplied to it as a supply.

The voltage from the vehicle's on-board network through the divider R1-R2-R3 is supplied to the input of the D1 microcircuit. The parameters of this divider are the same as in the circuit in Figure 1, that is, for measurements within the range of 0...99.9V.

But in a car the voltage is rarely more than 18V (more than 14.5V is already a malfunction). And it rarely drops below 6V, unless it drops to zero when completely turned off. Therefore, the device actually operates in the range 7...16V. The 5V power supply is generated from the same source, using stabilizer A1.

This design describes a simple voltmeter with an indicator on twelve LEDs. This measuring device allows you to display the measured voltage in the range of values ​​​​from 0 to 12 volts in steps of 1 volt, and the measurement error is very low.

Voltage comparators are assembled on three LM324 operational amplifiers. Their inverse inputs are connected to a resistor voltage divider, assembled across resistors R1 and R2, through which a controlled voltage is supplied to the circuit.


The non-inverting inputs of the operational amplifiers receive a reference voltage from a divider made across resistances R3 - R15. If there is no voltage at the input of the voltmeter, then the outputs of the op-amp will have a high signal level and the outputs of the logic elements will have a logical zero, so the LEDs will not light up.

When the measured voltage is received at the input of the LED indicator, a low logical level will be established at certain outputs of the op-amp comparators, and accordingly the LEDs will receive a high logical level, as a result of which the corresponding LED will light up. To prevent the supply of voltage level at the input of the device there is a protective zener diode of 12 volts.

This version of the scheme discussed above is perfect for any car owner and will give him visual information about the state of charge of the battery. In this case, four built-in comparators of the LM324 microassembly are used. The inverting inputs generate reference voltages of 5.6V, 5.2V, 4.8V, 4.4V, respectively. The battery voltage is directly supplied to the inverting input through a divider across resistances R1 and R7.

LEDs act as flashing indicators. To configure, a voltmeter is connected to the battery, then the variable resistor R6 is adjusted so that the required voltages are present at the inverting terminals. Fix the indicator LEDs on the front panel of the car and plot next to them the battery voltage at which one or another indicator lights up.

So, today I want to look at another project using microcontrollers, but also very useful in the daily work of a radio amateur. This is a digital device based on a modern microcontroller. Its design was taken from a radio magazine for 2010 and can easily be converted to an ammeter if necessary.

This simple design of a car voltmeter is used to monitor the voltage of the car's on-board network and is designed for a range from 10.5 V to 15 volts. Ten LEDs are used as an indicator.

The heart of the circuit is the LM3914 IC. It is able to estimate the input voltage level and display the approximate result on LEDs in dot or bar mode.

The LEDs display the current value of the battery or on-board network voltage in dot mode (pin 9 is not connected or connected to the minus) or column mode (pin 9 to the power plus).

Resistance R4 regulates the brightness of the LEDs. Resistors R2 and variable R1 form a voltage divider. Using R1, the upper voltage threshold is adjusted, and using resistor R3, the lower threshold is adjusted.

Calibration of the circuit is done according to the following principle. We apply 15 volts to the input of the voltmeter. Then, by changing the resistance R1, we will achieve the ignition of the VD10 LED (in dot mode) or all LEDs (in column mode).

Then we apply 10.5 volts to the input and R3 achieves the glow of VD1. And then we increase the voltage level in steps of half a volt. Toggle switch SA1 is used to switch between dot/column display modes. When SA1 is closed - a column, when open - a dot.

If the voltage on the battery is below 11 volts, the zener diodes VD1 and VD2 do not pass current, which is why only HL1 lights up, indicating a low voltage level on the vehicle’s on-board network.


If the voltage is in the range from 12 to 14 volts, the zener diode VD1 unlocks VT1. HL2 lights up, indicating normal battery level. If the battery voltage is above 15 volts, the zener diode VD2 unlocks VT2, and the HL3 LED lights up, indicating a significant excess of voltage in the vehicle network.

Three LEDs are used as an indicator, as in the previous design.

When the voltage level is low, HL1 lights up. If the norm is HL2. And more than 14 volts, the third LED flashes. Zener diode VD1 forms the reference voltage for operation of the op-amp.

♦ In the previous article: to control the charging current it is used ammeter for 5 - 8 amperes. An ammeter is a rather scarce thing and you can’t always find one for such a current. Let's try to make an ammeter with our own hands.
To do this, you will need a pointer measuring device of the magnetic-electric system for any current of the full deviation of the needle on the scale.

It is necessary to ensure that it does not have an internal shunt or additional resistance for the voltmeter.
♦ The measuring pointer device has an internal resistance of the movable frame and the current of the full deflection of the pointer. The pointer device can be used as a voltmeter (additional resistance is connected in series with the device) and as an ammeter (additional resistance is connected in parallel with the device).

♦ The circuit for the ammeter is on the right in the figure.

Additional resistance - shunt calculated using special formulas... We will make it in a practical way, using only a calibration ammeter on current up to 5 - 8 amperes, or by using a tester, if it has such a measurement limit.

♦ Let's assemble a simple circuit from a charging rectifier, a standard ammeter, a wire for a shunt and a chargeable battery. See the picture...

♦ A thick wire made of steel or copper can be used as a shunt. The best and easiest way is to take the same wire that was used to wind the secondary winding, or a little thicker.

You need to take a piece of copper or steel wire about 80 centimeters, remove the insulation from it. At two ends of the segment, make rings for bolt fastening. Connect this segment in series with a reference ammeter.

Solder one end from our pointer device to the end of the shunt, and run the other along the shunt wire. Turn on the power, set the charge current using the regulator or toggle switches according to the control ammeter - 5 amp.
Starting from the soldering point, run the other end from the pointer device along the wire. Set the readings of both ammeters to the same level. Depending on the frame resistance of your pointer gauge, different pointer gauges will have different shunt wire lengths, sometimes up to one meter.
This, of course, is not always convenient, but if you have free space in the case, you can carefully place it.

♦ The shunt wire can be wound into a spiral as in the figure, or in some other way depending on the circumstances. Stretch the turns a little so that they do not touch each other, or put rings made of vinyl chloride tubes along the entire length of the shunt.

♦ You can first determine the length of the shunt wire, and then use insulated wire instead of bare wire and wind it in bulk onto the workpiece.
You must select carefully, performing all operations several times, the more accurate the readings of your ammeter will be.
The connecting wires from the device must be soldered directly to the shunt, otherwise the device arrow will read incorrectly.

♦ The connecting wires can be of any length, and therefore the shunt can be located anywhere in the rectifier body.
♦ It is necessary to select a scale for the ammeter. The ammeter scale for measuring direct current is uniform.