DIY digital ammeter on pic. A simple modular AC voltmeter on PIC16F676. Description of the control board circuit

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, ( selection V,A 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

Simple voltmeter AC voltage with a frequency of 50 Hz, made in the form of a built-in module that can be used either separately or built into a finished device.
The voltmeter is assembled on a PIC16F676 microcontroller and a 3-digit indicator and does not contain very many parts.

Main characteristics of the voltmeter:
The shape of the measured voltage is sinusoidal
The maximum value of the measured voltage is 250 V;
Frequency of measured voltage - 40…60 Hz;
The resolution of displaying the measurement result is 1 V;
Voltmeter supply voltage is 7…15 V.
Average current consumption - 20 mA
Two design options: with and without power supply on board
Single Sided PCB
Compact design
Display of measured values ​​on a 3-digit LED indicator

Schematic diagram of a voltmeter for measuring alternating voltage


Implemented direct measurement of alternating voltage with subsequent calculation of its value and output to the indicator. The measured voltage is supplied to the input divider made on R3, R4, R5 and through the separating capacitor C4 is supplied to the ADC input of the microcontroller.

Resistors R6 and R7 create a voltage of 2.5 volts (half the power) at the ADC input. Capacitor C5, of relatively small capacity, bypasses the ADC input and helps reduce measurement errors. The microcontroller organizes the operation of the indicator in dynamic mode based on interruptions from the timer.

--
Thank you for your attention!
Igor Kotov, editor-in-chief of Datagor magazine


🕗 01/07/14 ⚖️ 19.18 Kb ⇣ 238 Hello, reader! My name is Igor, I'm 45, I'm a Siberian and an avid amateur electronics engineer. I came up with, created and have been maintaining this wonderful site since 2006.
For more than 10 years, our magazine has existed only at my expense.

Good! The freebie is over. If you want files and useful articles, help me!

Voltammeter on PIC16F676

This project is an ampere-voltmeter (or voltammeter if you prefer) DC. 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 by 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, they assemble simple voltmeters and ammeters.


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 scarce 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. Display mode button installed"B" 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.

Last summer, at the request of a friend, I developed a scheme digital voltmeter and ammeter. As requested, this meter must be economical. Therefore, a single-line liquid crystal display was chosen as indicators for displaying information. In general, this ampere-voltmeter was intended to monitor discharge car battery. And the battery running on the motor of a small water pump was running low. The pump pumped water through the filter and again returned it over the pebbles into a small pond in the country house.

In general, I did not delve into the details of this quirk. Not long ago, this voltmeter came into my hands again to finalize the program. Everything works as expected, but there is one more request to install an LED to indicate the operation of the microcontroller. The fact is that one day, due to a defect in the printed circuit board, the power supply to the microcontroller was lost, naturally it stopped functioning, and since the LCD display has its own controller, the data loaded into it earlier, the voltage on battery and the current consumed by the pump remained on the indicator screen. Previously, I had not thought about such an unpleasant incident; now I will have to take this matter into account in the program of devices and their circuits. Otherwise, you will admire the beautiful numbers on the display screen, but in reality everything has already burned out long ago. In general, the battery was completely discharged, which, as he said, was very bad for a friend then.
The diagram of the device with an indicator LED is shown in the figure.

The circuit is based on a PIC16F676 microcontroller and an LCD indicator. Since all this works exclusively in the warm season, the indicator and controller can be purchased at the cheapest. The operational amplifier chosen was also appropriate - LM358N, cheap and having an operating temperature range from 0 to +70.
To convert analog values ​​(digitize) voltage and current, a stabilized microcontroller supply voltage of +5V is selected. This means that with ten-bit digitization of an analog signal, each bit will correspond to - 5V = 5000 mV = 5000/1024 = 4.8828125 mV. This value is multiplied by 2 in the program, and we get 9.765625 mV per one bit of binary code. And for the correct display of information on the LCD screen, we need one digit to be equal to 10 mV or 0.01 V. Therefore, scaling circuits are provided in the circuit. For voltage, this is an adjustable divider consisting of resistors R5 and R7. To correct the current readings, a scaling amplifier is used, assembled on one of operational amplifiers microcircuits DA1 – DA1.2. The transmission coefficient of this amplifier is adjusted using a 33k resistor R3. It is better if both tuning resistors are multi-turn. Thus, when using a voltage of exactly +5 V for digitization, direct connection of signals to the microcontroller inputs is prohibited. The remaining op-amp, connected between R5 and R7 and the RA1 input of the DD1 chip, is a repeater. Serves to reduce the impact of noise and impulse noise on digitization due to 100%, negative, frequency independent feedback. To reduce noise and interference when converting the current value, a U-shaped filter consisting of C1, C2 and R4 is used. In most cases, C2 does not need to be installed.

As a current sensor, resistor R2, a domestic factory shunt of 20A is used - 75ShSU3-20-0.5. With a current flowing through the shunt of 20A, a voltage of 0.075 V will drop across it (according to the datasheet for the shunt). This means that in order for there to be two volts at the controller input, the amplifier gain should be approximately 2V/0.075 = 26. Approximately, this is because our digitization resolution is not 0.01 V, but 0.09765625 V. Of course, it is possible apply homemade shunts by adjusting the gain of the DA1.2 amplifier. Gain of this amplifier equal to the ratio of the values ​​of resistors R1 and R3, Kus = R3/R1.
And so, based on the above, the voltmeter has an upper limit of 50 volts, and the ammeter has an upper limit of 20 amperes, although with a shunt designed for 50 amperes, it will measure 50A. So, it can be successfully installed in other devices.
Now about the modification, which includes the addition of an indicator LED. Small changes have been made to the program and now, while the controller is working, the LED blinks at a frequency of approximately 2 Hz. The LED glow time was chosen to be 25ms to save money. It would have been possible to display a blinking cursor on the display, but they said that with an LED it would be more visual and effective. That seems to be it. Good luck. K.V.Yu.


.

One of the options for a finished device implemented by Alexey. Unfortunately I don't know the last name. Thanks to him for his work and photos.

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 shown in gray on 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.

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

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

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