Industrial applications for voltage and current measurement are the most basic but also the most important. Industrial pressure, temperature, humidity, etc. Many measurements are made by changing the physical signal into voltage or current through the sensor, and then displayed on the instrument through the analysis of the electronic instrument. Therefore, how to measure the accurate voltage and current is very important. This paper mainly introduces the application of hycon hy16f198b series chip in voltage and current measurement.
Because hy16f198b chip is internally integrated with high precision ΣΔ ADC, and the fastest ADC output frequency can reach 10kHz, and with the internal hardware LCD driver, hy16f198b has a high accuracy when used for voltage and current measurement.
2. Principle description
2.1. Measurement principle:
2.1.1. Voltage measurement:
The circuit diagram is shown in Figure 1. This circuit is a simple voltage divider with a ratio of 20:1. Due to the program setting, the maximum voltage difference between aio0 and aio1 is 1.2V. Therefore, the upper limit of measurement voltage is 20V.
2.1.2. Current measurement:
The circuit diagram is shown in Figure 2, divided into two parts: when the current source flows through 10 Ω Resistance, the voltage difference. By measuring the voltage difference, the current flowing through can be deduced.
The resolution is divided into external resolution and internal resolution. The external resolution is the ratio of the maximum measured output voltage value to the minimum voltage value to be identified. The minimum measured voltage value of this application is 10mV.
Generally, the internal resolution that we determine by visual method usually refers to the internal resolution when the LCD display has only one grid scrolling after software processing. At this time, the number of full scale grids is the internal resolution, and the signal represented by one grid is about 2-3 times of RMS noise.
The smaller the ratio of internal and external resolution, the higher the accuracy of voltmeter and ammeter, but the ratio of internal and external resolution is limited. For example, if the full-scale differential voltage is 1.1V, the voltmeter and ammeter with 2000 count and internal / external ratio of 1:10 are not amplified, the minimum signal to be processed is 1.1V / (2000) × 10）=55uV。 The minimum signal value that hy16f198b ADC can process is about 65nv, so it is quite easy and accurate to complete the measurement of this specification.
Whether ADC performance can meet the specification requirements is usually based on RMS noise to calculate the external stability and internal resolution ratio. For the development of electronic products, the biggest internal resolution of hy16f198b is input RMS noise, not ADC resolution. The input RMS noise of hy16f198b ADC is about 65nv when it outputs 10 ADC values per second through OSR = 32768 after being amplified by PGA and ad ratio regulator (PGA = 32, adgn = 4). However, the input noise is mainly composed of thermal noise, so we can further reduce the input noise if we use the average software processing.
If we use 8 pieces of software to process the input RMS noise averagely, after considering other noise factors, it can reach about 40nv, and 3 times RMS noise represents about 1 grid of rolling, that is 120nv. With 2.4V driving voltage and 1mV / V full scale, the differential voltage can reach 2.4mv, so we can get 20000 counts internal resolution in this case.
2.2. Control chip
Brief introduction of single chip microcomputer: hy16f series 32-bit high performance flash single chip microcomputer (hy16f198b)
Hy16f series 32-bit high performance flash microcontroller (hy16f198b)
(1) It adopts the latest Andes 32-bit CPU core n801 processor.
(2) The voltage operation range is 2.2 ~ 3.6V, and the working temperature range is – 40 ℃ ~ 85 ℃.
(3) Support external 16 MHz quartz oscillator or internal 16 MHz high precision RC oscillator.
(3.1) operation mode 0 [email protected]/2
(3.2) standby mode 5ua @ lsrc = 34khz + idle mode
(3.3) sleep mode 2.5ua
(4) Program memory 64KB flash ROM
(5) Data memory 8KB SRAM
(6) With bor and WDT function, it can prevent CPU crash.
(7) 24 bit high accuracy ΣΔ ADC analog to digital converter
(7.1) built in PGA (programmable gain amplifier) up to 128 times amplification.
(7.2) built in temperature sensor TPS.
(8) Ultra low input noise operational amplifier opamp.
（9）16-bit Timer A
(10) 16 bit timer B module has PWM waveform generation function
(11) All digital capture / compare function of 16 bit timer C module
(12) Hardware serial communication SPI module
(13) Hardware serial communication I2C module
(14) UART module of hardware serial communication
(15) Hardware RTC clock function module
(16) Hardware touch key function module
(17) Hardware LCD driver 4×36, 6×34
3. System design
3.1. Hardware description
Hy16f198b built-in ADC is used to measure voltage and current with external circuit. The whole circuit includes two buttons, namely (mode selection) and (measurement) button, and the measured value is displayed with internal hardware LCD driver.
(B) Display mode: hy16f198b internal hardware drive 4×36 LCD (LCD driver segment 4×36)
(C) Power circuit: 5.0V to 3.3V power supply system
(D) Analog sensing module: internal ADC
(E) Online burning and ice connection circuit, through the connection of EDM, can support online burning simulation.
And has a strong C platform IDE and hycon analogy software analysis tools and GUI support.
3.2. Function description
If the PGA in ADC is doubled and adgn is doubled, and the reference voltage is supplied by vdda – VSS, then Δ VR_ I=1.2V。
3.2.1. Voltage measurement
In the voltage measurement mode, the measurement range is ± 20V, with voltage measurement circuit. Display to 1mV, accuracy to 10mV.
3.2.2. Current measurement
The main range of current measurement is ± 110mA, with current measurement circuit. The accuracy of display and measurement was 0.1mA
4. Operation process
4.1. Operation method
After startup, first light up the LCD, and then initialize and display the word hycon. Then jump to mode selection.
4.1.1. Key control description
Switch the measurement mode through S2 (mode button); S3 (measurement button) represents the start of measurement.
And every time you press the button, the buzzer will make a sound.
4.1.2. Measurement voltage mode
20V stands for ± 20V measurement (with external measurement circuit)
4.1.3. Measurement current mode
110mA represents ± 110mA measurement (with external measurement circuit)
4.2. Program flow
4.2.1. Main loop flow chart:
4.2.2. Key processing flow chart:
4.2.3. LCD display processing flow chart:
5. Technical specifications
(2) Power consumption: working mode about 2.24ma (Hao = 4MHz, ADC enable)
(3) Measurement accuracy: voltage 10 (MV) and current 0.1 (MA)
(4) Scope of application: measuring voltage range（ ± 20V）
Measuring current range（ ± 110mA）
(5) Working temperature: – 40 ℃ ~ + 85 ℃
6. Summary of results
Hy16f198b as the main control, combined with internal high-precision, multi-channel input, fast ADC measurement. No matter the measurement of voltage or current, compared with the market electricity meter, not only the power consumption is lower than the general market electricity meter, but also the accuracy is not inferior to the market electricity meter. Hy16f198b internal ADC not only can be used to measure voltage and current, but also can be combined with external sensors for other measurements, and still has quite good performance.
Editor in charge: GT