当前位置:网站首页>Measure the voltage with analog input (taking Arduino as an example, the range is about 1KV)

Measure the voltage with analog input (taking Arduino as an example, the range is about 1KV)

2022-07-08 01:14:00 Silicon organism

Statement : I am a freshman majoring in Vehicle Engineering , The technical level of posting is not high , And this method has long been shared , This post only shares one experience , Please do not carry out some dangerous operations according to the content of this post , In case of accident , Nothing to do with me !

Premise of instructions :

   arduino Of A0、A1、、 The waiting port is the analog signal input port ,arduino The board is measured A0 The potential of the mouth A0 Port data , The range of pressure measurement is 0~5V, The resulting value is 0~1023. When measuring potential with analog input , The negative pole of the tested object shall be connected with GND Connect , Otherwise, it cannot be measured , And a series of wrong values are generated due to floating .

The core idea :

       1、arduino Read voltage function of analog input .

       2、 Resistance partial voltage of series resistor .

       3、 The analog input value is calculated to obtain the voltage value .

example :

The left side is the serial port monitor output value , On the right is the measured value of voltmeter .

The design of this example is 0~1030V Measuring circuit of measuring range .     

 

  Circuit diagram :

Just look at the picture on the left , The right side is a little messy .

 

 

      Because the resistance is often not as accurate as the value measured by the mark or multimeter , therefore , The design of the circuit should be flexible . We can connect a variable resistor in series on the circuit to adjust the test accuracy . There is another way to adjust the accuracy , That is, modify some parameters in the calculation program , The value in this example has been debugged like this .

    About the choice of variable resistance , Total value of personal suggestions 10k Ohmic , At the time of calculation , It can be calculated by making the large partial voltage resistance take a value slightly smaller than the actual value , After that, it is compensated by sliding rheostat . such as 47k resistance , Value for 45k Calculate , If it is not enough, it can be compensated by adjusting the value resistance .

Calculation :

        We know that the resistance partial voltage ratio of the series resistance is directly proportional to the resistance specific range , So we can calculate our original 5v How many times has the range been enlarged .

  Be careful : We mentioned earlier that the resistance of electronic components is not completely accurate , So there is a problem in the value of resistance , Subsequently, the variable resistance and adjustment value will be used to calibrate , So this is a rough calculation .

Program :

      If only one voltage is measured , The procedure is very simple , But when designing other projects , If you want to measure the voltage somewhere , This method can be used .

void setup() {
pinMode(A0,INPUT);                       // Make A0 For analog input 
Serial.begin(9600);  
}

void loop() {
int i =analogRead(A0);                   // Make A0 Port readout voltage , But this is 0~1023 The number of .
float V=0.00;           
Serial.print("  i=");  
Serial.print(i);                         // Efferent i Size .
V=i*(5.00/1023.00)*206.00;               //206.00 Is the magnification of the test voltage ( Adjust according to the actual situation , The original number is 205.55)
Serial.print("  V="); Serial.println(V); // Outgoing voltage V Size 
delay(100);                    
}

      This procedure will A0 Oral value i And the final calculation result V Output to computer , among i*(5.00/1023.00) It's to make A0 Mouth measured 0~1023 The number of becomes the actual measured voltage ( This operation can also be used map Function mapping implementation ). after , Multiply 206.00( Magnification ) You can get the voltage at the pressure measuring end V.

calibration :

It is also mentioned repeatedly above , We leave elastic space in circuit design . Here is a brief description of the specific operation :

1, Using variable resistance . After connecting the circuit , Adjust the variable resistance to 0, Then the pressure measuring end is connected to the measured object , At the same time, the measured object is connected to a finished voltmeter ,arduino Connecting to a computer , And turn on the serial monitor . Observe the value of the finished voltmeter and the... Returned from the serial port monitor V value . Adjust the variable resistance repeatedly , Until the two readings are basically consistent . Try more groups .

2,( It's not necessary ) If the adjustment through variable resistance is still not calibrated , You can modify the multiple we calculated above .

Final , We can make arduino Calculate the exact value , however , Definitely not 100% accurate . The following figure shows some of my pressure measurement results .

The first group

 

 

  The second group

 

 

 

 

The third group  

 

 

原网站

版权声明
本文为[Silicon organism]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130546118343.html