To come in
Sewerage and drainpipes portal
  • Pythagoras and the Pythagoreans. The doctrine and school of Pythagoras. Philosophy of Pythagoras In the philosophy of Pythagoras, the core was
  • Complementarity principle
  • The problem of consciousness in the history of philosophy
  • Dualism - what is it in psychology, philosophy and religion?
  • Topic of lecture subject and history of development of pathopsychology lecturer
  • Goddess Demeter: all about her
  • Ammeter on peak controller circuit. Simple built-in ammeter on PIC16F676

    Ammeter on peak controller circuit. Simple built-in ammeter on PIC16F676

    The diagram in Fig. 1 is a development of the previous design idea for using an analog input in a microcontroller that does not have a built-in ADC, as well as techniques from another design idea for driving a seven-segment LED indicator without external key transistors are used. This circuit has a serial link and only a twisted pair is needed to transmit the measured values \u200b\u200bto a personal computer.

    The serial link was tested using Microsoft's Hyper Terminal program configured with 115,200 baud; 8 bits, parity, 1 stop bit; without hardware control.

    In short, the program drives one 7-segment LED indicator at a time along the RA0 and RB7 lines. Setting the RA0 output to one and using RB7 as an input activates the indicator with a common anode DS3. Setting RA0 output to zero and using RB7 as input activates the common cathode indicator DS2. Using RA0 as an input and setting the RB7 output to one will activate the common cathode indicator DS1, and using RA0 as an input and setting the RB7 output to zero activates the common cathode indicator DS0. After successful activation of one LED, only one of the RB0… RB6 lines is configured as an output to control one LED segment. This circuit no longer has a VDD limitation of 3V or less, as the LEDs are connected in anti-parallel, thus the forward voltage drop across one LED limits the reverse voltage on the other. Using red LEDs requires 1.6 V.

    Figure 2 illustrates new aspects of the design idea. Q1, R5, and R6 act as an equivalent variable resistor, RX, that charges C3. Instead of connecting RX to ground, just connect it to one I / O line - for example RB0 - of the microcontroller. If RB0 is enabled as an output in zero state, then the first analog channel is activated and the measuring subroutine counts charge pulses to 66% of VDD; then, according to the table, the resulting delay value is converted into a three-digit millivolt value. To increase the number of analog inputs, you can connect up to seven variable resistor circuits in parallel - such that each is connected between C3 and one I / O line, RB1… RB7. It is important that the I / O lines are connected to the indicators and also activate or deactivate the analog channels. When one analog channel is activated by an I / O line output in a low state, the other lines are high impedance and act as inputs, which disables all other channels. Accordingly, the indicators are disabled.

    The simplest serial link is also added to the circuit in Fig. 1 without adding external components. If you connect two I / O lines, RA1 and RA2, configured as outputs to RXD (Pin 2) and GND (Pin 5) of the RS 232 connector, you can use the software to create positive and negative voltages with respect to the ground of the RS 232 port. PC. When RA1 is high and RA2 is low, RXD is 5V positive with respect to the PC's RS 232 port ground. When RA1 is zero and RA2 is one, RXD has a negative potential of -5 V with respect to the ground of the RS 232 port on the PC.

    Implementation of a voltmeter from Vladimir

    Added keys to the anodes of the indicator, which increased the brightness of the display, and allows the use of more powerful displays.

    Two seals for DIP14 and SO14

    The circuit uses transistors BC847 (KT3102).

    During the update of the main article of the voltmeter in the circuit and seals from Vladimir, the voltage divider was replaced. The firmware for the voltmeter is in the main article.

    Implementation of a network voltmeter from Wali Marat

    The signet differs from the circuit by replacing the resistors R2 and R3 with one trimmer 4.7k and the absence of a Zener diode VD1.

    A modified circuit of the network voltmeter was also sent, it is distinguished by a better circuit for stabilizing the supply voltage of the voltmeter.

    Photo of a network voltmeter

    Wali Marat Voltmeter / Ammeter Implementation

    A 5.1V VD1 Zener diode (marked in green) was added to all the circuits from Wali Marat to protect the microcontroller's ADC input from overvoltage.

    The device presented here is useful if you have a power supply with an output voltage of 0-10 V. It is these measurement limits that are "laid down" in the circuit shown in the figure. It is based on an Atmega8 (U1) microcontroller in a standard DIP package. It may seem cumbersome, but it was chosen because of its wide popularity, and also because programmers for this microcontroller are very common. Atmega8 is used by most radio amateurs and on the Internet you can find many circuits with this microcontroller. Therefore, if you do not like this voltmeter, Atmega8 will not be left idle.

    Digital voltmeter based on Atmega8. Schematic diagram.

    The voltmeter reading will be displayed on a digital seven-segment three-digit indicator (DISP1). I will give some information about him.

    7-segment digital LED indicator is an indicator consisting of seven LEDs, set in the form of a digit 8. By lighting or turning off the corresponding LEDs (segments), you can display numbers from zero to nine, as well as some letters. Usually, several digital indicators are used to create multi-digit numbers - for this, the indicators are provided with a comma (dot) segment - dp. As a result, one indicator has 8 segments, although they are called 7-segment by the number of digital segments.

    Each segment of the indicator is a separate LED that can be turned on (lit) or off (not lit) depending on the polarity of the voltage applied to them. Indicators are available both with a common cathode and with a common anode. It is about the common connection of all LEDs (segments). In addition, indicators can contain several digits, in which case each digit is called a digit or sign. For example, a three-digit (three-digit) seven-segment display contains three digits. It is such an indicator that is needed for this device.


    The design uses a red indicator GNT-2831BD-11 with a common anode. Resistors R1-R8 determine the current in the indicator and, therefore, its brightness. Their resistance should not exceed the maximum output current (40mA), even when all 8 LEDs are on at once. The circuit uses a single-ended 10-bit ADC (analog to digital converter) found in the AVR. The output range is 0-999. When the limit of these values \u200b\u200bis reached, the symbol "---" appears.

    At the input of the voltmeter (in), a voltage divider is installed from resistors R9, R10 and R11, providing a measurement range of up to 10 V with an error of 0.01 V. At pin 23 of the microcontroller U1, the divider generates a voltage that should not exceed 2.5 V. Input resistance voltmeter close to 1mOhm. To calibrate the voltmeter, apply a precisely known voltage to its input and, by moving the trimmer R11, achieve the same readings on the indicator.

    The refresh rate of the voltmeter is about 4 Hz. The circuit is powered from a stabilized 5 V voltage source. The device's current consumption is about 25 mA (most of the consumption falls on the indicator). Place the C1 and C2 components as close to the microcontroller as possible.

    Correctly set bits are shown in the figure below.


    If you need measurement ranges up to 100V, change R10 to 9.1mΩ and R11 to 2.2mΩ. Then you will get the desired measuring range with an accuracy of 0.1 V and an input resistance of about 10 mΩ. In this case, you will have to change the place of the indicator point so that it is displayed behind two symbols, and not behind the first, as in the diagram. To do this, leave pin 28 of the microcircuit U1 free, and connect pin 27 to the common wire. Now, instead of symbols in the form of 0.00, 00.0 will be displayed.

    Last summer, at the request of a friend, I developed a scheme digital voltmeter and an ammeter. This measuring device should be economical as requested. Therefore, a single-line liquid crystal display was selected as indicators for displaying information. In general, this ammeter was intended to control discharge car battery... And the battery was discharged to the engine of a small water pump. The pump pumped water through a filter and again returned it by pebbles to a small pond in the country.

    In general, I did not delve into the details of this quirk. Not so long ago, this voltmeter again came to my hand to refine the program. Everything works as expected, but there is one more request to install the microcontroller operation indication LED. The fact is that once, due to a defect in the printed circuit board, the power of the microcontroller disappeared, it naturally ceased to function, 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 did not think about such an unpleasant incident, now I will have to take this matter into account in the program of devices and their circuits. And then you will admire the beautiful numbers on the display screen, but in fact everything has already burned out a long time 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 indicator LED is shown in the figure.

    The basis of the circuit is 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 op-amp was also selected corresponding - LM358N, cheap and having an operating temperature range from 0 to +70.
    To convert analog values \u200b\u200b(digitization) of voltage and current, a stabilized microcontroller supply voltage of + 5V was selected. This means that with a ten-bit digitization of an analog signal, each digit will correspond to - 5V \u003d 5000 mV \u003d 5000/1024 \u003d 4.8828125 mV. This value in the program is multiplied by 2, and we get - 9.765625 mV per one bit of the 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, the circuit provides scaling circuits. For voltage, it is an adjustable divider consisting of resistors R5 and R7. A scaling amplifier, assembled on one of the operational amplifiers of the DA1 - DA1.2 microcircuit, is used to correct the readings of the current value. The gain of this amplifier is adjusted using a 33k resistor R3. It is better if both trimming resistors are multiturn. Thus, when using a voltage of exactly +5 V for digitizing, 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 influence on the digitization of noise and impulse noise, due to one hundred percent, negative, frequency independent feedback... To reduce noise and interference when converting the current value, a U-shaped filter consisting of C1, C2 and R4 serves. In most cases, C2 can be omitted.

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


    .

    One of the options for the finished device, implemented by Alexey. Unfortunately I don’t know the last name. Thanks for his work and photos.

    Today I will 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 voltammetric wattmeter

    The printed circuit board on DIP details 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 firmwares: 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 marked 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 with a common anode, then the resistor is connected to the common wire.

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

    Short press of the button " IN"activates the indication of the operating mode: voltage" -U- ", current" -I- ", power" -P- ", ampere / hour counter" -C- ". LM358 have a positive offset at the output, it can be compensated by digital correction of the meter. To do this, you must switch to the current measurement mode, "-I-". Hold the button for 7-8 seconds H"until the inscription" -S.- "appears on the display. Then, using the buttons IN"And" H"Adjust the offset" 0 ". If the buttons are pressed, the indicator directly shows a constant, released - the corrected current readings. Exit from the mode - pressing the keys simultaneously " IN"and" H". Result - indication" -3- ", that is, writing to non-volatile memory. The ampere / hour counter is reset to zero by holding down the" H"3-4 sec.

    In my case, I only put the button " IN", to switch the operating mode. The button" H"I do not put it, since current correction is not required if the op-amp LM358 new, then it has practically no displacement, and if it does, then 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 unit.

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

    As a result, the entire construction of the voltampervatmeter cost 150 rubles, without foil-clad fiberglass. Ponomarev Artyom was with you ( stalker68), see you soon on the site Radio circuits !

    Discuss the article VOLTAMPERVATTMETER