Voltmeter peak value per micron. Built-in ampere-voltmeter on PIC12F675 and LED indicators. Voltmeter Specifications


We continue to understand the options for implementing a voltmeter - ammeter based on a microprocessor.
Don't forget the archive with the files, we will need them today.

If you want to install large indicators, you will have to solve the issue of limiting the current consumption through the MK ports. In this case, it is necessary to install buffer transistors on each digit of the indicator.

Large size indicators


So, the previously discussed circuit will take the form shown in Fig. 2. Three transistors VT1-VT3 of the buffer stage were added for each digit of the indicator. The installed buffer stage inverts the output signal of the MK. Therefore, the input voltage based on VT2 is inverse with respect to the collector of the specified transistor, and therefore is suitable for supplying a comma-forming output to the output. This makes it possible to remove transistor VT1, which was previously in the circuit in Fig. 1, replacing the latter with decoupling resistor R12. Do not forget that the resistor values ​​in the base circuits of transistors VT1-VT3 have also changed.
If you want to install indicators with unconventionally large dimensions, you will have to install low-resistance (1 - 10 Ohms) resistors in the collector circuit of the indicated transistors to limit current surges when they are turned on.

The operating logic of the MK for this option only requires a slight change in the program in terms of inverting the output signal for controlling the bits, namely ports RA0, RA1, RA5.
Let's consider only what will change, namely the subroutine already known to us under the code name “Dynamic indication generation function” in Listing No. 2(see folder “tr_OE_30V” in the archive or the first part of the article):

16. void Indicator ()( 17. while (show_digit< 3) { 18. portc = 0b111111; // 1 ->C 19. if (show_digit == 2)( delay_ms(1); ) 20. porta = 0b100111; 21. show_digit = show_digit + 1; 22. switch (show_digit) ( 23. case 1: ( 24. if (digit1 == 0) ( ) else ( 25. Cod_to_PORT(DIGIT1); 26. PORTA &= (~(1<<0)); //0 ->A0 27. ) break;) 28. case 2: ( 29. Cod_to_PORT(DIGIT2); 30. PORTA &= (~(1<<1)); //0 ->A1 31. break;) 32. case 3: ( 33. Cod_to_PORT(DIGIT3); 34. PORTA &= (~(1<<5)); //0 ->A5 35. break;) ) 36. Delay_ms(6); 37. if (RA2_bit==0) (PORTA |= (1<<2);// 1 ->A2 38. Delay_ms(1);) 39. if ((show_digit >= 3)!= 0) break; 40. ) show_digit = 0;)


Compare both options. The inversion of the signal on the RA port (line 20 of Listing No. 2) is easy to read, since it is written in binary form. It is enough to combine the outputs of the MK and the binary number. In lines 19 and 37, slightly strange conditions appeared that were not there at the beginning. In the first case: “delay the logical zero signal at port RA1 during the indication of the second digit.” In the second: “if there is a logical zero on port RA2, inversion.” When you compile the final version of the program, you can remove them, but for simulation in PROTEUS they are needed. Without them, the comma and the “G” segment will not be displayed normally.
Why? - you ask, because the first option worked great.

In conclusion, remember the words of the blacksmith from the film “Formula of Love”: “...if one person built it, another can always take it apart!”
Good luck!

Reader vote

The article was approved by 27 readers.

To participate in the voting, register and log in to the site with your username and password.

The ampere-voltmeter is designed to measure current 0-9.99A and voltage 0-100V with a resolution of 0.01A and 0.1V, respectively.

The operational amplifier can be replaced with LM2904, the LCD display should be on the HD44780 controller. The number of characters is 2x8... You can also use a 2x16 character display, but in this case most of the display will remain unused. In such a situation, in the device where the ampere-voltmeter will be built, it is recommended to cut a window only for the working part of the display on which information will be displayed. Important! Directly on the displays, as a rule, a current-limiting resistor is installed in the backlight power circuit. If there is no resistor, then you need to install it yourself in the open circuit going to LED +. The resistor resistance is 6...100 Ohms, depending on the desired backlight brightness...

Setting up the device is simple: first, use the “contrast” resistor to set the required display contrast, and use the “set U” and “set I” resistors to adjust the accuracy of the voltmeter and ammeter readings. It is advisable to make adjustments at the upper limits of the voltmeter and ammeter readings. If, after adjustment, the ammeter without load displays any current value, select the operational amplifier so that without load the current value is 0.00A!

Photo of the device!

Connecting an ampere-voltmeter to the power supply.

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
MK PIC 8-bit

PIC12F675

1 To notepad
Shift register

CD74HC164

1 To notepad
Operational amplifier

LM358

1 Replacement: LM2904 To notepad
Linear regulator

LM7805CT

1 To notepad
LCD displayHD447801 8x2 To notepad
C1, C2, C4, C5 Capacitor0.1 µF4 To notepad
C3 Electrolytic capacitor100 µF1 To notepad
Resistor

100 Ohm

2 To notepad
Resistor

91 kOhm

1 To notepad
Resistor

5.1 kOhm

1 To notepad
Resistor

680 Ohm

1 To notepad
Resistor

0.01 Ohm

1

Voltammeter on PIC16F676

This project is a DC ampere-voltmeter (or voltammeter if you prefer). Range - up to 99.9V and 9.9A (or 99.9A, depending on the firmware).


Its peculiarity is that it is built on the widespread PIC16F676 microcontroller, however, despite this, it has the ability to simultaneously display the measured voltage and current on four-character (or three-character) seven-segment indicators, both with a common anode and a common cathode (set one resistor). When using a four-character indicator, the last segment displays the symbol "U" for voltage and "A" for current. The ampere-voltmeter can also work with one indicator, and with the “B” button you can select what will be displayed on it - voltage or current. If both indicators are installed, you can use this button to swap their assignments. The "H" button is used to correct the ammeter readings and equalize the linearity of these readings, if necessary.

up feb 2014: The development can now be found at:

The diagram of the voltammeter is shown below. As already mentioned, it is built on the widespread PIC16F676 microcontroller, on which, in particular, simple voltmeters and ammeters are assembled.


Click on the diagram to enlarge
Due to the limited number of pins for this MK, the 74HC595 register was used. This microcircuit has no analogues with the same pinout, but it is not in short supply and is often used in similar circuits to connect indicators to the MK. To protect the MK outputs from overload and increase the brightness of the indicators, transistor switches are used. When using indicators with a common cathode, it is necessary to use transistors of a different structure, connecting their collectors not to +5V, but to ground, while the resistor at pin 11 of the microcontroller must be moved to a different position. You may need to select resistors at the register output and in the transistor bases to match your indicators and transistors.

As mentioned earlier, the “B” button allows you to swap the purpose of the indicators if there are two of them. If there is only one indicator, then with this button you can alternate between displaying voltage and current. When you press the "H" button, the indicators will begin to flash. While they are flashing, you can use the “B” and “H” buttons to adjust the ammeter readings. After correction, the blinking will stop and the correction factor will be recorded in non-volatile memory. The display mode set by the "B" button is also stored in non-volatile memory.

After switching on, the indicators do not start to light immediately, but with a delay of several seconds. The frequency of reading changes is about 9Hz.

One of the printed circuit board options for four indicators with a common anode. The necessary corrections are circled in the figure: you need to remove the jumper going to ground and add one small jumper.


Files for the project.

Today I’ll tell you how to make a universal, simple measuring device with the ability to measure voltage, current, power consumption and ampere-hours on a cheap microcontroller PIC16F676 according to the following scheme.

Schematic diagram of a voltamperwattmeter

The printed circuit board on DIP parts turned out to be 45x50 mm. Also in the archive there is a printed circuit board for SMD parts.

For microcontroller PIC16F676 There are two firmware: in the first - the ability to measure voltage, current and power - vapDC.hex, and in the second - the same as in the first, only the ability to measure amperes/hours has been added (not always needed) - vapcDC.hex.

The resistor, indicated in gray on the printed circuit board, is connected depending on the indicator: if we use an indicator with common cathodes, then the resistor (1K) coming from the 11th leg of the MK is connected to +5, and if the indicator has a common anode, then we connect the resistor to the common wire.

In my case, the indicator and the common cathode, the resistor was located under the board, from the 11th leg of the MK to +5.

Briefly press the " button IN"activates the operating mode indication: voltage “-U-”, current “-I-”, power “-P-”, ampere/hour counter “-C-”. Some examples of op-amp LM358 have a positive offset at the output, it can be compensated by digital correction of the meter. To do this, you need to switch to current measurement mode, “-I-”. Hold the " button for 7-8 seconds N" until the inscription "-S.-" appears on the indicator. Then use the " IN" And " N» adjust the offset “0”. If the buttons are pressed, the indicator directly shows a constant; when pressed, the current readings are corrected. Exit the mode - simultaneously pressing the keys " IN" And " N". The result is the indication “-3-”, that is, recording in non-volatile memory. The ampere/hour counter is reset by holding the " button N" 3-4 sec.

In my case, I only put the button " IN", to switch the operating mode. Button " N"I don’t put it, since current correction is not required if the op-amp LM358 new, then it has practically no displacement, and if it does, it is insignificant. I do not put the segment indicator on a separate board, which can be easily attached to the device case, for example, built into a converted ATX power supply.

We connect power to the assembled device, supply the measured voltage and current, adjusting the voltmeter and ammeter readings using trimming resistors according to the multimeter readings.

As a result, the entire construction of the voltamperwatt meter cost 150 rubles, without foil fiberglass. Ponomarev Artyom was with you ( stalker68), see you again on the pages of the site Radio circuits !

Discuss the article VOLTAMPERWATTMETER

In addition, it is possible to use one or two indicators. Moreover, if four digits are used, then the rightmost digit displays the stylized units of measurement “V” or “A”. But, there is a limitation on the use of indicators with OA. When the emitter followers are turned on in this way, the indicators become illuminated by measuring currents. Thus, with a 2-indicator circuit, it is advisable to use indicators with OK, in which case the measured currents will not affect the opening of the transistor switches.
If buttons are installed, then pressing button "B" on the left indicator will display the current mode of this indicator, "-U-" or "-I-". Further holding will change the mode. For a version with one 3-digit indicator, this function will help you remember what mode the device is in, and for a 2-digit indicator version, it will swap the displayed voltage and current values. In any case, the function of suppressing insignificant zeros is applied to the voltage, i.e., if the voltage does not exceed 9.9V, then we will not see the first zero (“_Х.Х”) on the indicator.
Kn "N" allows you to enter the current offset correction menu. This may be necessary if, to improve the linearity of the current readings, the op-amp was shifted to the linear section. Thus, by correction you can remove “extra” readings. After briefly pressing the button on the left indicator (if there are two of them), the message “ShI” (current offset) will appear and the indicator will begin to flash. While it is flashing, you can use the buttons to adjust the offset. After a few seconds, the indicator will stop flashing and the data will be written to non-volatile memory. At the same time, the indicator display mode will be saved in memory, which will appear the next time you turn it on.
Displayed voltage 0.0...99.9V, current 0...99.9A (or 0.0...9.99A, depends on the firmware file and OS settings of the op-amp).

Refinement of the current meter assembly:

The author of the improvement is impuls. Simsim idea.
The whole point is to organize the op-amp bias into the linear section,
followed by correction of the readings in the service menu.



You do not have access to download files from our server
PP files for 2x3 and 2x4 indicators, kindly provided by evg339

PP files for 2x3 and 2x4 indicators placed vertically, reworking the PP from evg339, kindly provided by VolosKR


You do not have access to download files from our server


You do not have access to download files from our server


You do not have access to download files from our server

Firmware file for indicators with OA
You do not have access to download files from our server
Firmware file for indicators with OK
You do not have access to download files from our server

Modification of the input voltage divider:


Attention! Divisor by 10


Firmware file below


The polarity of the indicators determines the position of the 1K resistor with 11 n. controller.

Option with measuring inputs for voltage - RA0 and current - RA1^

Firmware file for example, 1:10 i.e. up to 50V, 2x3.2x4.1x3.1x4 indicators and measuring inputs 13 and 12 controller legs You do not have access to download files from our server

Firmware file for example, 1:20 i.e. up to 100V, 1x3.1x4 indicators and measuring inputs 13 and 12 controller legs. You do not have access to download files from our server

Firmware file for example, 1:20 i.e. up to 100V, current measurement, 1x3, 1x4 indicators and measuring inputs 13 and 12 of the controller legs have been changed. You do not have access to download files from our server

Yes! There is no need for a voltage trimmer. Now, let's build with buttons.

Coviraylhik summed it up (thanks to him):

vaDCw2L8UAra0ra1.hex small letter v, div. e.g., 1:10 to 50V,
vaDCw2L4ra01.hex is for one indicator (select V,A with one button)
vaDCw2L8UAra01i.hex Standard up to 100V _0.0V , 0.00A div. voltage, 1:20
vaDCw2L8UAra01X.hex Standard up to 100V, but point 00.0A moved



If you find an error, please select a piece of text and press Ctrl+Enter.