Sensors and microcontrollers. Part 3. We measure current and voltage.
We turn to the final part of the sensor review cycle, in which we consider the DC and AC current and voltage sensors. For all other sensors that did not fall into the main series, we will do additional reviews when they are suddenly needed in future articles. This article opens up a new cycle of materials about measuring the parameters of power quality, which will include issues of connecting current and voltage sensors to a microcontroller, reviewing the algorithms of power quality analyzers, the meaning of certain power quality indicators and what they mean. In addition, we will touch on the topic of digitization and data processing, which concerns many people, mentioned in the comments to the first article.
Content
Part 1. Mat.part. It considers a sensor that is not tied to any particular measured parameter. The static and dynamic characteristics of the sensor are considered. Part 2. Climate control sensors. It discusses the features of working with sensors of temperature, humidity, pressure and gas composition Part 3. Sensors of electrical quantities. In this part I will look at current and voltage sensors.
ATTENTION: Do not insert the spokes into the socket Do not climb into the 220V network without the necessary skills!
There is a direct current, it is variable. It happens all at once, which sometimes brings a lot of problems. But more about that later. For a start, let's deal with the terminology. Figure 1: AC Voltage In the measurement of alternating current, we have 4 different quantities, which will guide the measurements. All the formulas and terms below apply to the current meter. 1. The instantaneous voltage value is the potential difference between two points. Measured at a specific point in time. This value is basic in all other calculations. In fact, our task will be to read a sequential set of instantaneous voltage values at regular intervals in order to later get some other data with their help. u = u (t) (1) The result is approximately the following graph: Figure 2: Measurement of a series of instantaneous voltage values When selecting the sampling frequency of the sensors, we are guided by the Kotelnikov-Shannon theorem, when in order to restore a signal with a frequency f it is necessary to perform reading with a frequency greater than 2f. I note the need for strict inequality, that is, if we need to digitize a signal with a frequency of 50 Hz, then the reading must be done with a frequency of at least 101 Hz. But, of course, the more the better. If we recall the GOST on electricity quality indicators, then in the Harmonics section we find that harmonics up to 40, i.e. up to 2 kHz, are interesting for our measurement. And microchips of electricity meters read at a frequency of 4096 times per second. The power of two is chosen so that you can apply fast Fourier transform algorithms. Having this large data set collected per unit of time, for example, 1c, we proceed to the following: 2. Amplitude voltage value - which is defined as the maximum modulo value from our sample: (2) where [u (t)] is an array with data. For harmonic oscillations, this value is used in the following formula: (3) 3. The average value of the voltage, i.e. The arithmetic average, i.e. the constant component of the alternating voltage. (four) Where - the sampling period of the analog signal. I intentionally write the sum instead of the integral. In an industrial AC network, the average value should be zero. If this condition is not met, there may be certain problems, since the direct current magnetises the transformers, introducing them into saturation, or heats the supply line. The latter way may be useful for solving the problem of frozen ice on the wires - the wire is heated and the ice falls off. In low-current analog circuits, the constant component is present all the time and can be very useful. And if it interferes with us, then we will quickly get rid of it, but more on that later. 4. RMS voltage value . - also known as the effective voltage value - on a linear resistive load, it performs the same work as a constant voltage of a similar level. Is determined by the following formula: (five) When measuring the voltage in the outlet, we, as a rule, are interested in precisely this very actual voltage, which is 230 / 380V. Amplitude and effective values of sinusoidal voltage are interconnected through . During the design of the measuring system, we will be primarily interested in the amplitude value of voltage and current. During the measurements we will be guided by one of the following schemes: Figure 3: Connecting measuring devices A puzzle for the mind - both connection schemes are correct, but under what circumstances is it important to choose one of them correctly? Answers in the comments.
Voltage sensors
First of all, we will measure the voltage. All of the following applies to voltages of at least the supply voltage of the ADC of our controller. Thus, we need to measure the voltage with an amplitude greater than the ADC is able to chew. Therefore, the voltage level must be lowered - i.e. to weaken the signal. For small voltages (for example, as thermocouple thermocouple from the previous article), the inverse problem is necessary - signal amplification. This is a more difficult task and we will definitely return to it in the following articles. We set the condition for the calculation of our sensors: Measured voltage: AC, 0-1000V, frequency 50 / 60Hz. For a three-phase voltage of 380V, the amplitude is almost 600V, and there are also 660V mains. So let it be. In fact, I took this calculation from my piece of iron and was too lazy to redo it. Output voltage ± 1,65V - half from the power supply + 3.3V
Voltage divider
The easiest way would be a voltage divider. Figure 4: Voltage Divider The voltage on our measuring device will be defined as the input voltage multiplied by the divider coefficient: (6) When choosing the resistance of resistors, it is necessary to determine the following requirements: 1. The current through the resistor circuit must be 1-2 orders of magnitude greater than the current of our measuring device so that this current does not affect the readings. The meter has a finite resistance value and it turns out that another resistor is connected to the resistor R2. The greater the internal resistance, the closer the total resistance to the resistance R2. The resistance of the internal circuits of the ATmega ADC, for example, is 100 MΩ. 2. The power allocated to our divider should not be too large 3. The applied input voltage must be less than the resistor breakdown voltage. Let the current through our maker be 1mA. Then, the total resistance of the resistors will be equal to: (7) Define the required transfer ratio of our divider: (eight) For a series of ratings of resistors E24, we choose the nearest value, which gives about 1MΩ: R1 = 990 kΩ (three 330 kΩ resistors) then R2 = K · R1 = 1.63 kΩ From the E24 series, select the second resistor R2 = 1.6 kΩ Check the ratio: (9) The error from the previously estimated 2.3%, which is fine with us. In general, it is possible to accurately select resistors from the E192 series, but in my case it is not necessary - a voltage of 1000V at the input is an abnormal mode, and the system will still be calibrated later. Look measuring circuit will be as follows: Figure 5: Voltage Meter Circuit When designing a voltage divider for large operating voltages, it is necessary to take into account the maximum allowable voltages for the resistors used. For example, the nominal operating voltage for SMD resistors is 15 V (0201); 50 V (0402, 0603); 150 V (0805); 200 V (1206, 2010, 2512), And the maximum allowable is 50 V (0201); 100 V (0402, 0603); 200 V (0805); 400 V (1206, 2010, 2512). That is why I use three series-connected resistors of the size 1206 - they fit into 555 volts of the worker and 1000 V maximum allowable. Of course, all these resistors must be highly accurate, since the measurement accuracy depends on their resistance and thermal stability of this resistance. On the basis of the R4-C1 chain, a low-pass filter is assembled so that no hindrances to us are terrible. By the way, we can quickly see what this filter does: Figure 6: Filter Frequency Response As can be seen from the LAFC graph, for the working frequency range from 0 to 2000 Hz the filter practically does not spoil the amplitude and phase of the signal. But the interference at frequencies of the order of 100 kHz and above, coming from the high-frequency converters, reliably choke. So everything is super. Advantages:
a wide range of voltages and frequencies determined by the values of resistors;
high accuracy, again determined by the accuracy and thermal stability of resistors;
measures constant and alternating voltage.
Disadvantages:
no galvanic isolation - when interacting with an industrial network, it is necessary to provide for the protection of the user from electrical circuits, or to use a galvanic isolation;
low efficiency - the entire current of the divider goes into heat;
Voltage transformer
Figure 7: Voltage Transformer For cases when it is necessary to measure very high voltages, 6 / 10kV and above, a voltage transformer is used. In fact, it is a conventional transformer, the main mode of operation of which is the idle mode. The accuracy class of such a transformer depends on the working area of the magnetization characteristic. After all, we need to pass through it not just a signal with a certain amplitude, but also not to spoil its shape. Here is the problem - most voltage transformers practically do not miss harmonics. It's all about the metal core and the reversal loss. At the same time, the thinner the core plate. the better its frequency response. The usual accuracy class of the transformer is 0.5, 1, 3 Advantages:
a huge range of operating voltages - up to hundreds of kilovolts and above;
so necessary galvanic isolation.
Disadvantages:
works on a certain frequency band;
only works with alternating voltage;
The last drawback is a bit far-fetched, because if necessary, you can use a measuring DC transformer. Yes, DC transformers "exist", but the correct name of the device is a magnetic amplifier. The accuracy and linearity of such devices leaves much to be desired - work takes place at the site of saturation of the core by magnetization. It looks like this: Figure 8: DC Measurement with a Magnetic Amplifier You can read about this miracle of technology here: analogiu.ru/6/6-2-2.html If the topic is interesting, then I will sift a review of these old regulators.
Electronic Insulated Sensor
The drawbacks of both schemes are devoid of electronic isolated sensor. In fact, it is a complete device. Inside of which there are both a voltage divider, and operational amplifiers, and a galvanic isolation unit and an isolated power supply circuit for this whole ugliness: Figure 9: Block diagram of an electronic isolated sensor I only came across industrial sensors with an output voltage of 0-10V or a current of 0-10mA. Unlike previous sensors, it produces a unipolar signal. In principle, such a scheme can be developed independently, applying, for example. Isolated analog amplifier like HCPL-7850 . The main drawback of the scheme is very difficult and very expensive. And as right notes in the comments of Comrade. progchip666
It is extremely difficult to transmit an analog signal with an accuracy of even one percent over the galvanically-isolated interface, therefore, in this case, it is often necessary to distill it into a figure and in such a form already distill it. Unfortunately, the amplifier shown in the diagram must also be powered. Of course from galvanized source.
The easiest and most accurate way to measure current. As you know, when current flows through an active resistance, a voltage drop occurs on it, which is proportional to the measured current. Great, take a resistor and place it in the gap of the circuit to be measured: Figure 10: Current Shunt Current Sensor The voltage drop across the shunt is proportional to the current flowing: (ten) Accordingly, depending on the required voltage at the sensor output, we select the desired resistance of the shunt. But! The voltage drop on the shunt will lead to the power losses emitted into the heat, respectively, at high currents we have to be content with small values of the voltage from the sensor in order to limit the losses. These industrial-grade ShSM shunts provide a standard output voltage of 75mV at rated current: Figure 11: The current shunt type SHSM For voltage of 75mV, most of the measuring heads for shunts were calibrated. Pay attention to the second pair of screws - they are designed specifically for connection to the measuring device to improve measurement accuracy by separating the currents of the power and measuring circuit ... To measure current using such shunts, it is necessary to use operational amplifiers. In this case, the average gain is 20-40, which is due to the widespread operational amplifiers. In principle, in noncritical DC circuits, you can use the amplifier cascade based on a single transistor. The linearity of such a scheme will limp, but for threshold protection circuits, this is a simple and reliable option. We get the following scheme: Figure 12: Using an Op Amp as an Amplifier It should be borne in mind that when measuring AC, the output signal will be bipolar and the operational amplifier must be powered from a bipolar power source. Let's look just in case, how our scheme works: Figure 13: Simulation of current sensor amplifier At the input, we apply 75mV, multiply by 20, at the output we have a signal with an amplitude of 1.5V for a current of 10A. In the following material we will understand what a bipolar signal can be uncomfortable. Advantages :
high accuracy;
wide range of voltages and frequencies;
measures direct and alternating current.
Disadvantages:
no galvanic isolation;
low efficiency.
Current transformer
The measuring current transformer is a transformer, the primary winding of which is connected to the current source, and the secondary is closed to measuring instruments or protective automatics devices. Current transformers are used to measure currents in high-current circuits, often with high potential. For example, we wanted to measure the current in a 10kV network. Or, we want to get a simple and relatively cheap way to galvanically isolate the measured current circuit of our device to 220V. The main problem of current transformers is that they can only measure alternating voltage. The current transformer is always loaded. If the secondary winding of the current transformer is open, a potential of a couple of thousand kilovolts will arise on it, which will cripple the personnel and damage the device by breaking its insulation. Transformers come with built-in primary winding. For example: Figure 14: Coilcraft CS2106L Series Current Transformer Either such elephants, having the similarity of the primary winding in the form of a huge bus, or a window for passing wires through it Figure 15: Industrial multi-amp current transformer The main disadvantage of the current transformer is that it works only at a certain frequency of 50, 60 or 400 Hz due to the metallic core. Of course, the current transformer is capable of transmitting a signal at a higher frequency, but with much lower accuracy. In this case, one should pay attention to the sheet thickness of the core used - the thinner the iron in the current transformer, the higher the maximum permissible operating frequency. By the way, there are current transformers from ferrite, which are used to measure systems with a frequency of 50-60 kHz or more. For example, the Coilcraft CS1 series is designed for operation in the range of 20-50 kHz and can be used in switching power supplies. But if we remove it, we get an air transformer, or, so-called. Rogowski coil: Figure 16: Rogowski coil wiring diagram Unlike other sensors that require interaction with the circuit to be measured, the Rogowski coil can be installed over the wires of the circuit to be measured as a belt. Some measuring instruments are equipped with such sensors: Figure 17: Rogowski coil sensor The range of measured currents is from tens to thousands of amperes, but they suffer from low accuracy. Advantages:
galvanic isolation;
work with large currents in thousands of Amperes;
Disadvantages:
measures only alternating current in a certain frequency range (except for the Rogowski coil);
changes the phase of the signal and requires compensation
Hall Effect Current Sensors
Sensors of this type use the effect of the appearance of potential difference when a conductor with a current in a magnetic field is placed. Figure 18: The Hall Effect When creating a sensor, we take the magnetic core, pass the wire of the circuit to be measured through it, and place the Hall sensor in the open magnetic section, receiving the open type current sensor: Figure 19: Open-Type Hall Effect Current Sensor The advantage of this sensor is simplicity. The disadvantage is the presence of magnetic bias of the core, therefore, increasing the nonlinearity of indications. Add a winding to the core and start up a current proportional to the measured current: Figure 20: Compensated-type Hall Effect Current Sensor With zero core bias, we increase the linearity of the sensor and its accuracy class. However, by its design, such a sensor approaches current transformers, respectively, its cost increases significantly. Like transformers, there are types of sensors that allow the power wire to pass through: Figure 22: Hall Effect Current Sensor There are sensors with a shared core - but their value is simply rolls over. Sensors with an integrated power circuit based on a 2.1kV and 3kV galvanically isolated electrical isolation are manufactured by Allegro. Due to their small size, they do not provide high accuracy, but they are compact and easy to use. Figure 23: Allegro ACS754 Current Sensor
ACS712 sensor - measurement of direct and alternating current up to 30A with an accuracy of ± 1.5%
ACS713 sensor - optimized for measuring DC current up to 30A. It is twice as sensitive as its universal counterpart.
ACS754 sensor - measurement of direct and alternating current up to 200A with an accuracy of ± 1.5%
ACS755 sensor - optimized for measuring DC current.
Sensor ACS756 - sensor for measuring DC and AC up to 100A with a supply voltage of 3-5V.
Figure 24: Dependence of the output voltage of the sensor on the current. Merits :
wide range of measured currents with frequency up to 50-100 kHz and above;
')
I set myself the task of making review material on sensors, the most frequently used by the community when developing various devices. Most of the sensors were not included in the cycle only for the reason that in the near future they will not be needed for my materials, but some of them are in the plans. Be sure to make a separate material with acceleration sensors, angular velocities, a compass and examples, so stay tuned for new articles!