[go: up one dir, main page]

CN106646241A - Voltage detection circuit and voltage measurement method - Google Patents

Voltage detection circuit and voltage measurement method Download PDF

Info

Publication number
CN106646241A
CN106646241A CN201510750305.9A CN201510750305A CN106646241A CN 106646241 A CN106646241 A CN 106646241A CN 201510750305 A CN201510750305 A CN 201510750305A CN 106646241 A CN106646241 A CN 106646241A
Authority
CN
China
Prior art keywords
voltage
chip microcomputer
reference voltage
power supply
band gap
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510750305.9A
Other languages
Chinese (zh)
Inventor
周明杰
陈鸡平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oceans King Lighting Science and Technology Co Ltd
Oceans King Dongguan Lighting Technology Co Ltd
Shenzhen Oceans King Lighting Engineering Co Ltd
Original Assignee
Oceans King Lighting Science and Technology Co Ltd
Oceans King Dongguan Lighting Technology Co Ltd
Shenzhen Oceans King Lighting Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oceans King Lighting Science and Technology Co Ltd, Oceans King Dongguan Lighting Technology Co Ltd, Shenzhen Oceans King Lighting Engineering Co Ltd filed Critical Oceans King Lighting Science and Technology Co Ltd
Priority to CN201510750305.9A priority Critical patent/CN106646241A/en
Publication of CN106646241A publication Critical patent/CN106646241A/en
Pending legal-status Critical Current

Links

Landscapes

  • Measurement Of Current Or Voltage (AREA)

Abstract

The embodiment of the invention discloses a voltage detection circuit and a voltage measurement method, wherein the voltage detection circuit comprises: a reference voltage generating circuit and a single chip microcomputer; the output end of the reference voltage generating circuit is connected with a reference voltage input pin of the singlechip, and the power supply end of the reference voltage generating circuit is connected with a working voltage, wherein the reference voltage generating circuit is used for providing a reference voltage for the singlechip and outputting the reference voltage to the singlechip through the output end; and a power supply pin of the single chip microcomputer is connected with power supply voltage, and the single chip microcomputer is used for calculating the power supply voltage by detecting the band gap voltage of the single chip microcomputer and utilizing a relational expression between the band gap voltage and the power supply voltage. The invention can reduce the additional power supply voltage detection circuit and the power consumption brought by the additional power supply voltage detection circuit, is convenient to detect and saves resources.

Description

一种电压检测电路及电压测量方法A voltage detection circuit and voltage measurement method

技术领域technical field

本发明涉及电路领域,具体涉及一种电压检测电路及电压测量方法。The invention relates to the field of circuits, in particular to a voltage detection circuit and a voltage measurement method.

背景技术Background technique

单节锂电池可以直接给单片机供电,当用户使用单节锂电池进行供电时,为了及时观察锂电池的剩余电量以便采取相应措施,需要对锂电池的电压进行检测。如在一些便携式发光二极管(Light Emitting Diode,简称LED)灯具中可以通过对锂电池的电压进行检测,从而可以在锂电池剩余电量不足时及时更换锂电池。A single-cell lithium battery can directly supply power to the microcontroller. When the user uses a single-cell lithium battery for power supply, in order to observe the remaining power of the lithium battery in time and take corresponding measures, it is necessary to detect the voltage of the lithium battery. For example, in some portable light emitting diode (Light Emitting Diode, referred to as LED) lamps, the voltage of the lithium battery can be detected, so that the lithium battery can be replaced in time when the remaining power of the lithium battery is insufficient.

目前,对锂电池电压的检测主要是通过两个分压电阻来对对锂电池的电压进行采样,从而计算得到锂电池的电压并估计剩余电量,但是利用该方法检测锂电池的电压时,需要在原有的电路中接入两个分压电阻来计算,并且分压电阻是直接接在电池上,没有关断措施,所以即使是在LED灯具不工作的状态下,依然有电流流过这两个分压电阻,造成待机电流大,资源浪费,从而需要一种更为简便地检测锂电池电压的方法。At present, the detection of the lithium battery voltage is mainly to sample the voltage of the lithium battery through two voltage divider resistors, thereby calculating the voltage of the lithium battery and estimating the remaining power. However, when using this method to detect the voltage of the lithium battery, it is necessary Connect two voltage divider resistors in the original circuit to calculate, and the voltage divider resistors are directly connected to the battery, there is no shutdown measure, so even when the LED lamp is not working, there is still current flowing through the two A voltage dividing resistor causes a large standby current and wastes resources, thus requiring a more convenient method for detecting the voltage of a lithium battery.

发明内容Contents of the invention

本发明实施例提供了一种电压检测电路及电压测量方法,以期可以更简便地检测锂电池的电压。Embodiments of the present invention provide a voltage detection circuit and a voltage measurement method in order to detect the voltage of a lithium battery more easily.

本发明实施例第一方面提供一种电压检测电路,包括:The first aspect of the embodiments of the present invention provides a voltage detection circuit, including:

参考电压发生电路和单片机;Reference voltage generating circuit and single-chip microcomputer;

所述参考电压发生电路的输出端与所述单片机的基准电压输入引脚连接,所述参考电压发生电路的供电端接工作电压,其中,所述参考电压发生电路用于给所述单片机提供参考电压,并将所述参考电压通过所述输出端输出到所述单片机;The output end of the reference voltage generating circuit is connected to the reference voltage input pin of the single-chip microcomputer, and the power supply terminal of the reference voltage generating circuit is connected to an operating voltage, wherein the reference voltage generating circuit is used to provide a reference for the single-chip microcomputer voltage, and output the reference voltage to the single-chip microcomputer through the output terminal;

所述单片机的电源引脚接电源电压,所述单片机用于通过检测所述单片机的带隙电压,并利用所述带隙电压与电源电压之间的关系表达式计算所述电源电压。The power supply pin of the single-chip microcomputer is connected to the power supply voltage, and the single-chip microcomputer is used to calculate the power supply voltage by detecting the bandgap voltage of the single-chip microcomputer and using a relational expression between the bandgap voltage and the power supply voltage.

其中,所述参考电压发生电路包括电阻和稳压源,所述稳压源的控制端和所述稳压源的取样端连接,并与所述电阻的一端连接,所述稳压源的地引脚接地,所述电阻的另一端接输入电压,所述稳压源的取样端为所述参考电压发生电路的输出端。Wherein, the reference voltage generating circuit includes a resistor and a voltage stabilizing source, the control terminal of the stabilizing voltage source is connected to the sampling terminal of the stabilizing voltage source, and is connected to one end of the resistor, and the ground of the stabilizing voltage source is The pin is grounded, the other end of the resistor is connected to the input voltage, and the sampling end of the voltage stabilizing source is the output end of the reference voltage generating circuit.

其中,所述单片机的型号为HT66F006,所述单片机的基准电压输入引脚与所述稳压源的取样端连接,所述单片机的电源引脚接电源电压,所述单片机的地引脚接地。Wherein, the model of the single-chip microcomputer is HT66F006, the reference voltage input pin of the single-chip microcomputer is connected to the sampling terminal of the voltage stabilizing source, the power supply pin of the single-chip microcomputer is connected to the power supply voltage, and the ground pin of the single-chip microcomputer is grounded.

其中,所述单片机的第五输入输出引脚与所述参考电压发生电路的电压输入端连接,用于利用所述单片机的第五输入输出引脚为所述参考电压发生电路提供工作电压。Wherein, the fifth input and output pin of the single-chip microcomputer is connected to the voltage input terminal of the reference voltage generating circuit, and is used to provide the working voltage for the reference voltage generating circuit by using the fifth input and output pin of the single-chip microcomputer.

其中,所述参考电压发生电路的电压输入端接电源电压。Wherein, the voltage input terminal of the reference voltage generating circuit is connected to the power supply voltage.

其中,所述稳压源的型号为TL431。Wherein, the model of the voltage stabilizing source is TL431.

本发明实施例第一方面提供一种电压测量方法,应用于本发明实施例第一方面提供的电压检测电路,包括:The first aspect of the embodiments of the present invention provides a voltage measurement method, which is applied to the voltage detection circuit provided in the first aspect of the embodiments of the present invention, including:

检测所述单片机的所述内部带隙电压;Detecting the internal bandgap voltage of the single-chip microcomputer;

根据所述内部带隙电压与所述电源电压的关系表达式计算所述电源电压。The power supply voltage is calculated according to a relationship expression between the internal bandgap voltage and the power supply voltage.

其中,所述内部带隙电压与所述电源电压的关系表达式为线性表达式y=kx+b。Wherein, the relationship expression between the internal bandgap voltage and the power supply voltage is a linear expression y=kx+b.

其中,所述检测单片机内部带隙电压之前,所述方法还包括:Wherein, before the detection of the internal bandgap voltage of the single-chip microcomputer, the method also includes:

确定所述内部带隙电压与所述电源电压的线性表达式y=kx+b。A linear expression y=kx+b of the internal bandgap voltage and the supply voltage is determined.

其中,所述确定所述内部带隙电压与所述电源电压的线性表达式y=kx+b,包括:Wherein, the linear expression y=kx+b for determining the internal bandgap voltage and the power supply voltage includes:

分别采集两次不同的参考电源电压以及所述两次不同的参考电源电压分别对应的参考内部带隙电压;Respectively collect two different reference power supply voltages and reference internal bandgap voltages respectively corresponding to the two different reference power supply voltages;

利用所述两次不同的参考电源电压与所述参考内部带隙电压确定所述内部带隙电压与所述电源电压的线性表达式y=kx+b。本发明通过单片机检测单片机的内部带隙电压,再基于参考电压,并根据该内部带隙电压和电源电压之间的线性关系计算得到电源电压,由于是通过单片机内部的带隙电压计算电源电压,所以在LED灯具不工作时,单片机处于休眠状态。从而可以减少额外的电源电压检测电路以及其带来的功耗,检测方便,节约资源。A linear expression y=kx+b of the internal bandgap voltage and the power supply voltage is determined by using the two different reference power supply voltages and the reference internal bandgap voltage. The present invention detects the internal bandgap voltage of the singlechip through the singlechip, and then based on the reference voltage, and calculates the power supply voltage according to the linear relationship between the internal bandgap voltage and the power supply voltage, since the power supply voltage is calculated through the internal bandgap voltage of the singlechip, Therefore, when the LED lamp is not working, the microcontroller is in a dormant state. Therefore, the additional power supply voltage detection circuit and the power consumption caused by it can be reduced, the detection is convenient, and the resources are saved.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1是本发明实施例提供的电压检测电路的第一实施例的结构示意图;FIG. 1 is a schematic structural diagram of a first embodiment of a voltage detection circuit provided by an embodiment of the present invention;

图2是本发明实施例提供的电压检测电路的第二实施例的结构示意图;FIG. 2 is a schematic structural diagram of a second embodiment of a voltage detection circuit provided by an embodiment of the present invention;

图3是本发明实施例提供的电压检测电路的第三实施例的结构示意图;3 is a schematic structural diagram of a third embodiment of a voltage detection circuit provided by an embodiment of the present invention;

图4是本发明实施例提供的电压测量方法的第一实施例的流程示意图;FIG. 4 is a schematic flowchart of a first embodiment of a voltage measurement method provided by an embodiment of the present invention;

图5是本发明实施例提供的电压测量方法的第二实施例的流程示意图。Fig. 5 is a schematic flow chart of the second embodiment of the voltage measurement method provided by the embodiment of the present invention.

具体实施方式detailed description

本发明实施例提供了一种电压检测电路及电压测量方法,以期可以更简便地检测锂电池的电压。Embodiments of the present invention provide a voltage detection circuit and a voltage measurement method in order to detect the voltage of a lithium battery more easily.

为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is an embodiment of a part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”和“第三”等是用于区别不同对象,而非用于描述特定顺序。此外,术语“包括”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second" and "third" in the specification and claims of the present invention and the above drawings are used to distinguish different objects, rather than to describe a specific order. Furthermore, the term "comprise", as well as any variations thereof, is intended to cover a non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes unlisted steps or units, or optionally further includes For other steps or units inherent in these processes, methods, products or apparatuses.

首先参见图1,图1是本发明实施例提供的电压检测电路的第一实施例的结构示意图。其中,如图1所示,本发明第一实施例提供的电压检测电路可以包括:Referring first to FIG. 1 , FIG. 1 is a schematic structural diagram of a first embodiment of a voltage detection circuit provided by an embodiment of the present invention. Wherein, as shown in FIG. 1, the voltage detection circuit provided by the first embodiment of the present invention may include:

参考电压发生电路1和单片机2;Reference voltage generating circuit 1 and single-chip microcomputer 2;

其中,所述参考电压发生电路1的输出端与所述单片机2的基准电压输入引脚连接,所述参考电压发生电路1的供电端接工作电压,其中,所述参考电压发生电路1用于给所述单片机2提供参考电压,并将所述参考电压通过所述输出端输出到所述单片机2;Wherein, the output end of the reference voltage generating circuit 1 is connected to the reference voltage input pin of the single-chip microcomputer 2, and the power supply terminal of the reference voltage generating circuit 1 is connected to an operating voltage, wherein the reference voltage generating circuit 1 is used for Providing a reference voltage to the single-chip microcomputer 2, and outputting the reference voltage to the single-chip microcomputer 2 through the output terminal;

所述单片机2的电源引脚接电源电压,所述单片机2用于通过检测所述单片机2的带隙电压,并利用所述带隙电压与电源电压之间的关系表达式计算所述电源电压。The power supply pin of the single-chip microcomputer 2 is connected to the power supply voltage, and the single-chip microcomputer 2 is used to calculate the power supply voltage by detecting the bandgap voltage of the single-chip microcomputer 2 and utilizing the relational expression between the bandgap voltage and the power supply voltage .

其中,参考电压发生电路1可以产生一标准电压,从而与单片机2的基准电压输入引脚连接,用于给单片机2提供参考电压,从而使整个电压检测电路的电压检测更为准确。Wherein, the reference voltage generating circuit 1 can generate a standard voltage, which is connected to the reference voltage input pin of the single-chip microcomputer 2, and is used to provide the reference voltage to the single-chip microcomputer 2, so that the voltage detection of the entire voltage detection circuit is more accurate.

其中,带隙电压为单片机2工作后,即可检测到的一内部电压,该带隙电压与单片机2的电源电压之间呈线性关系,所以在本发明实施例中,可在单片机2工作时根据该带隙电压在一般环境温度下(-20℃~+40℃)跟单片机的电源电压近似线性特性来检测单节锂电池的电压。Wherein, the bandgap voltage is an internal voltage that can be detected after the single-chip microcomputer 2 works, and there is a linear relationship between the bandgap voltage and the power supply voltage of the single-chip microcomputer 2, so in the embodiment of the present invention, when the single-chip microcomputer 2 is working, The voltage of a single-cell lithium battery is detected according to the approximately linear characteristic of the bandgap voltage and the power supply voltage of the single-chip microcomputer at the general ambient temperature (-20°C ~ +40°C).

在本发明实施例中,单片机2的供电端接工作电压,也即需要测量的电源电压。In the embodiment of the present invention, the power supply terminal of the single-chip microcomputer 2 is connected to the working voltage, that is, the power supply voltage to be measured.

可选地,在本发明的一些可能实施方式中,在单片机2的供电端和电源电压接入引脚的公共节点处接电容的一端,电容的另一端接地,用于给单片机2提供稳定的输入电压。Optionally, in some possible implementations of the present invention, one end of the capacitor is connected to the common node between the power supply terminal of the single-chip microcomputer 2 and the power supply voltage access pin, and the other end of the capacitor is grounded, so as to provide stable voltage for the single-chip microcomputer 2. Input voltage.

优选地,在本发明的一些可能的实施方式中,上述电容的值可以为147微法。Preferably, in some possible implementation manners of the present invention, the value of the above capacitance may be 147 microfarads.

在本发明实施例中,当电路接通后,电路开始工作,单片机2检测内部带隙电压,并基于参考电压发生电路1提供的参考电压对该带隙电压进行标准化,再根据带隙电压和电源电压之间的线性关系,检测得到两组带隙电压和电源电压,即可计算得到带隙电压和电源电压的准备的线性表达式,从而可在后续利用该表达式在任何时刻通过检测带隙电压计算得到该时刻的电源电压。利用该方法,可直接在单片机内部检测带隙电压从而计算电源电压,从而可以不用接额外的电源电压检测电路即可得到单片机的电源电压。由于是通过单片机内部的带隙电压计算电源电压,所以在LED灯具不工作时,单片机处于休眠状态,减少额外的电压检测电路带来的功耗,检测方便,节约资源。In the embodiment of the present invention, when the circuit is connected, the circuit starts to work, the single chip microcomputer 2 detects the internal bandgap voltage, and standardizes the bandgap voltage based on the reference voltage provided by the reference voltage generating circuit 1, and then according to the bandgap voltage and The linear relationship between the power supply voltages, two sets of bandgap voltages and power supply voltages can be detected, and the prepared linear expressions of the bandgap voltage and power supply voltage can be calculated, so that the expression can be used to pass the detection band at any time. The gap voltage is calculated to obtain the power supply voltage at this moment. Using this method, the bandgap voltage can be directly detected inside the single-chip microcomputer to calculate the power supply voltage, so that the power supply voltage of the single-chip microcomputer can be obtained without connecting an additional power supply voltage detection circuit. Since the power supply voltage is calculated through the bandgap voltage inside the single-chip microcomputer, the single-chip microcomputer is in a dormant state when the LED lamp is not working, which reduces the power consumption caused by the additional voltage detection circuit, facilitates detection, and saves resources.

本发明通过单片机检测单片机的内部带隙电压,再基于参考电压,并根据该内部带隙电压和电源电压之间的线性关系计算得到电源电压,由于是通过单片机内部的带隙电压计算电源电压,所以在LED灯具不工作时,单片机处于休眠状态。从而可以减少额外的电源电压检测电路以及其带来的功耗,检测方便,节约资源。The present invention detects the internal bandgap voltage of the singlechip through the singlechip, and then based on the reference voltage, and calculates the power supply voltage according to the linear relationship between the internal bandgap voltage and the power supply voltage, since the power supply voltage is calculated through the internal bandgap voltage of the singlechip, Therefore, when the LED lamp is not working, the microcontroller is in a dormant state. Therefore, the additional power supply voltage detection circuit and the power consumption caused by it can be reduced, the detection is convenient, and the resources are saved.

参见图2,图2是本发明实施例提供的电压检测电路的第二实施例的结构示意图。其中,如图2所示,图2是图1所示的电压检测电路的更为具体的描述,如图2所示:Referring to FIG. 2 , FIG. 2 is a schematic structural diagram of a second embodiment of a voltage detection circuit provided by an embodiment of the present invention. Among them, as shown in Figure 2, Figure 2 is a more specific description of the voltage detection circuit shown in Figure 1, as shown in Figure 2:

所述参考电压发生电路1包括电阻11和稳压源12,所述稳压源12的控制端和所述稳压源12的取样端连接,并与所述电阻11的一端连接,所述稳压源12的地引脚接地,所述电阻11的另一端接输入电压,所述稳压源12的取样端为所述参考电压发生电路1的输出端。The reference voltage generating circuit 1 includes a resistor 11 and a voltage stabilizing source 12, the control end of the voltage stabilizing source 12 is connected to the sampling end of the voltage stabilizing source 12, and is connected to one end of the resistor 11, the stabilizing voltage source 12 The ground pin of the voltage source 12 is grounded, the other end of the resistor 11 is connected to the input voltage, and the sampling end of the voltage stabilizing source 12 is the output end of the reference voltage generating circuit 1 .

可选地,在本发明的一些可能的实施方式中,用于给参考电压发生电路1提供电压输入的电阻11的一端可接一电池。Optionally, in some possible implementations of the present invention, one end of the resistor 11 for providing voltage input to the reference voltage generating circuit 1 may be connected to a battery.

优选地,在本发明的另一些可能的实施方式中,用于给参考电压发生电路1提供电压输入的电阻11的一端也可由单片机的一引脚提供,从而可以节约额外的电源输入。Preferably, in some other possible implementations of the present invention, one end of the resistor 11 for providing voltage input to the reference voltage generating circuit 1 can also be provided by a pin of the single-chip microcomputer, thereby saving additional power input.

优选地,在本发明的一些可能的实施方式中,电阻11的阻值为1千欧姆。Preferably, in some possible implementations of the present invention, the resistance value of the resistor 11 is 1 kohm.

本发明实施例中通过利用稳压源12实现参考电压发生电路1的功能,从而给单片机2提供标准电压。In the embodiment of the present invention, the function of the reference voltage generating circuit 1 is realized by using the voltage stabilizing source 12 , so as to provide the single chip microcomputer 2 with a standard voltage.

参见图3,图3是本发明实施例提供的电压检测电路的第三实施例的结构示意图。其中,如图3所示,图3是图2所示的电压检测电路的更为具体的描述,如图3所示:Referring to FIG. 3 , FIG. 3 is a schematic structural diagram of a third embodiment of a voltage detection circuit provided by an embodiment of the present invention. Wherein, as shown in Figure 3, Figure 3 is a more specific description of the voltage detection circuit shown in Figure 2, as shown in Figure 3:

所述单片机2的型号为HT66F006,所述单片机2的基准电压输入引脚与所述稳压源的取样端连接,所述单片机2的电源引脚接电源电压,所述单片机2的地引脚接地。The model of the single-chip microcomputer 2 is HT66F006, and the reference voltage input pin of the single-chip microcomputer 2 is connected with the sampling terminal of the voltage stabilizing source, the power supply pin of the single-chip microcomputer 2 is connected to the power supply voltage, and the ground pin of the single-chip microcomputer 2 grounded.

所述单片机2的第五输入输出引脚与所述参考电压发生电路1的电压输入端连接,用于利用所述单片机2的第五输入输出引脚为所述参考电压发生电路1提供工作电压。The fifth input and output pin of the single-chip microcomputer 2 is connected to the voltage input terminal of the reference voltage generating circuit 1, and is used to provide an operating voltage for the reference voltage generating circuit 1 by using the fifth input and output pin of the single-chip microcomputer 2 .

所述稳压源12的型号为TL431。The model of the voltage stabilizing source 12 is TL431.

在本发明实施例中,利用单片机2的第五输入输出引脚给参考电压发生电路1提供稳定电压,从而可以省去了给参考电压发生电路1接额外的供电电源。In the embodiment of the present invention, the fifth input and output pin of the single chip microcomputer 2 is used to provide a stable voltage to the reference voltage generating circuit 1, thereby eliminating the need to connect an additional power supply to the reference voltage generating circuit 1.

本发明实施例利用TL431稳压源给HT66F006单片机的基准电压输入引脚提供基准电压,并利用HT66F006单片机的第五输入输出引脚给参考电压发生电路1提供工作电压,从而可以使HT66F006单片机基于该基准电压进行电压检测,以及可以简便地利用单片机给参考电压发生电路1提供工作电压,从而电压检测电路可在该连接下进行电压检测。The embodiment of the present invention utilizes the TL431 stabilized voltage source to provide the reference voltage to the reference voltage input pin of the HT66F006 single-chip microcomputer, and uses the fifth input and output pin of the HT66F006 single-chip microcomputer to provide the working voltage to the reference voltage generation circuit 1, so that the HT66F006 single-chip microcomputer can be based on the The reference voltage is used for voltage detection, and the single-chip microcomputer can be used to provide working voltage to the reference voltage generating circuit 1, so that the voltage detection circuit can perform voltage detection under this connection.

参见图4,图4是本发明实施例提供的电压测量方法的第一实施例的流程示意图。其中,图4所示的电压测量方法应用于图1至图3所示的电压检测电路,具体地,在图1至图3所示的电压检测电路的单片机中实现,如图4所示,本发明实施例提供的电压测量方法可以包括:Referring to FIG. 4 , FIG. 4 is a schematic flowchart of a first embodiment of a voltage measurement method provided by an embodiment of the present invention. Wherein, the voltage measurement method shown in Figure 4 is applied to the voltage detection circuit shown in Figures 1 to 3, specifically, implemented in the single-chip microcomputer of the voltage detection circuit shown in Figures 1 to 3, as shown in Figure 4, The voltage measurement method provided by the embodiment of the present invention may include:

S401、检测单片机内部带隙电压。S401. Detect the internal bandgap voltage of the single-chip microcomputer.

在本发明实施例中,可以基于上述电压检测电路由单片机检测其内部带隙电压。In the embodiment of the present invention, based on the above-mentioned voltage detection circuit, the single-chip microcomputer can detect its internal bandgap voltage.

具体地,检测单片机的内部带隙电压后,基于基准电压得到标准的内部带隙电压值并将该值经过ADC(模数转换)转换成一数字值。Specifically, after detecting the internal bandgap voltage of the single-chip microcomputer, a standard internal bandgap voltage value is obtained based on the reference voltage, and the value is converted into a digital value through an ADC (analog-to-digital conversion).

S402、根据内部带隙电压与电源电压的关系表达式计算电源电压。S402. Calculate the power supply voltage according to the relationship expression between the internal bandgap voltage and the power supply voltage.

在本发明实施例中,内部带隙电压与电源电压的关系表达式为线性表达式y=kx+b,所以可以理解,对于线性表达式来说,可以通过两组带隙电压与电源电压的数值即可计算该表达式中的参数,即确定出准确的表达式,从而后续可再利用该确定表达在计算得到内部带隙电压后计算电源电压的值。In the embodiment of the present invention, the relationship expression between the internal bandgap voltage and the power supply voltage is a linear expression y=kx+b, so it can be understood that, for the linear expression, two sets of bandgap voltage and power supply voltage can be used The value can be used to calculate the parameters in the expression, that is, to determine the exact expression, so that the determined expression can be used to calculate the value of the power supply voltage after calculating the internal bandgap voltage.

可以看出,本实施例的方案中,通过检测单片机内部带隙电压,再根据该内部带隙电压与电压电压的关系表达式计算电源电压,从而不需要额外的电压检测电路即可实现对电路的电源电压的检测,可以减少额外的电源电压检测电路以及其带来的功耗,检测方便,节约资源。It can be seen that in the solution of this embodiment, by detecting the internal bandgap voltage of the single-chip microcomputer, and then calculating the power supply voltage according to the relationship expression between the internal bandgap voltage and voltage voltage, the circuit can be realized without additional voltage detection circuit The detection of the power supply voltage can reduce the extra power supply voltage detection circuit and the power consumption caused by it, the detection is convenient, and the resources are saved.

可选地,在本发明的一些可能的实施方式中,所述检测单片机内部带隙电压之前,所述方法还包括:Optionally, in some possible implementations of the present invention, before the detection of the internal bandgap voltage of the single-chip microcomputer, the method further includes:

确定所述内部带隙电压与所述电源电压的线性表达式y=kx+b。A linear expression y=kx+b of the internal bandgap voltage and the supply voltage is determined.

可以理解,需要在确定出来内部带隙电压与电源电压的线性表达式才能通过检测到的单片机内部带隙电压计算得到电源电压。It can be understood that it is necessary to determine the linear expression of the internal bandgap voltage and the power supply voltage to calculate the power supply voltage through the detected internal bandgap voltage of the microcontroller.

可选地,在本发明的一些可能的实施方式中,所述确定所述内部带隙电压与所述电源电压的关系表达式y=kx+b,包括:Optionally, in some possible implementation manners of the present invention, the determining the relationship expression y=kx+b between the internal bandgap voltage and the power supply voltage includes:

分别采集两次不同的所述内部带隙电压值与所述电源电压值;Collecting two different values of the internal bandgap voltage and the power supply voltage respectively;

利用所述两次不同的所述内部带隙电压值与所述电源电压值以及所述线性表达式y=kx+b,确定所述内部带隙电压与所述电源电压的线性表达式。A linear expression of the internal bandgap voltage and the power supply voltage is determined by using the twice different values of the internal bandgap voltage and the power supply voltage and the linear expression y=kx+b.

可以理解,对于线性表达式,可以通过两组内部带隙电压的值与电压电压的值来确定该表达式,从而在确定出来该表达式后即可利用该表达式计算电源电压。It can be understood that, for a linear expression, the expression can be determined by two sets of values of the internal bandgap voltage and the voltage voltage, so that the power supply voltage can be calculated using the expression after the expression is determined.

可选地,在本发明的一些可能的实施方式中,对于采集到的内部带隙电压以及电源电压需要根据标准电压进行转换,并通过ADC转换得到一数值进行计算。Optionally, in some possible implementations of the present invention, the collected internal bandgap voltage and power supply voltage need to be converted according to a standard voltage, and a value obtained through ADC conversion is used for calculation.

参见图5,图5是本发明实施例提供的电压测量方法的第二实施例的流程示意图。其中,图5所示的电压测量方法应用于图1至图3所示的电压检测电路,具体地,在图1至图3所示的电压检测电路的单片机中实现,如图5所示,本发明实施例提供的电压测量方法可以包括:Referring to FIG. 5 , FIG. 5 is a schematic flowchart of a second embodiment of a voltage measurement method provided by an embodiment of the present invention. Wherein, the voltage measurement method shown in FIG. 5 is applied to the voltage detection circuit shown in FIG. 1 to FIG. 3, specifically, implemented in the single-chip microcomputer of the voltage detection circuit shown in FIG. 1 to FIG. 3, as shown in FIG. 5, The voltage measurement method provided by the embodiment of the present invention may include:

S501、分别采集两次不同的参考电源电压以及参考电源电压分别对应的参考内部带隙电压。S501. Collect respectively two different reference power supply voltages and reference internal bandgap voltages respectively corresponding to the reference power supply voltages.

具体地,在本发明实施例中,使用TL431作为AD采样的参考电压。因为如果采用常用的电池电压采样电路,会增加待机电流,增加最小待机电流:I=(3.0V/200K)=15uA,增加最大待机电流:I=(4.2V/200K)=21uA,导致单节锂电池供电的电路板待机电流会增大15uA-20uA。Specifically, in the embodiment of the present invention, TL431 is used as a reference voltage for AD sampling. Because if the commonly used battery voltage sampling circuit is used, the standby current will be increased, the minimum standby current will be increased: I=(3.0V/200K)=15uA, and the maximum standby current will be increased: I=(4.2V/200K)=21uA, resulting in a single cell The standby current of the circuit board powered by lithium battery will increase by 15uA-20uA.

S502、利用两次不同的参考电源电压与参考内部带隙电压确定该内部带隙电压与电源电压的线性表达式y=kx+b。S502. Determine the linear expression y=kx+b of the internal bandgap voltage and the power supply voltage by using two different reference power supply voltages and the reference internal bandgap voltage.

具体地,在本发明实施例中,采用图3的TL431作为AD采样的参考电压,再采用高精度的直流稳压源作为单片机的电源电压,测量出2次不同VCC值情况下带隙电压的ADC转换值,通过2次测量可计算出单片机的电源电压与单片机带隙电压之间的线性表达式。Specifically, in the embodiment of the present invention, the TL431 in Figure 3 is used as the reference voltage for AD sampling, and a high-precision DC voltage stabilizer is used as the power supply voltage of the single-chip microcomputer, and the bandgap voltage is measured twice under different VCC values. ADC conversion value, the linear expression between the power supply voltage of the microcontroller and the bandgap voltage of the microcontroller can be calculated through two measurements.

例如,使用精准直流电压源给单片机供电2.7V,单片机AD采样得到的带隙电压为1.241V,使用精准直流电压源给单片机供电5.5V,单片机AD采样得到的带隙电压为1.255V。根据y=kx+b可以得到2个等式:For example, if a precise DC voltage source is used to supply 2.7V to the microcontroller, the bandgap voltage obtained by AD sampling of the microcontroller is 1.241V, and a precise DC voltage source is used to supply power to the microcontroller with 5.5V, and the bandgap voltage obtained by AD sampling of the microcontroller is 1.255V. According to y=kx+b, two equations can be obtained:

1.241k+b=2.7;1.241k+b=2.7;

1.255k+b=5.5。1.255k+b=5.5.

根据这2个等式,得到k=200,b=-245.5,从而可确定出来单片机内部带隙电压与所述电源电压的线性表达式为y=200x-245.5。According to these two equations, k=200, b=-245.5 can be obtained, thus the linear expression of the internal bandgap voltage of the single chip microcomputer and the power supply voltage can be determined as y=200x-245.5.

S503、检测单片机内部带隙电压。S503. Detect the internal bandgap voltage of the single-chip microcomputer.

具体地,在确定出单片机内部带隙电压与所述电源电压的线性表达式y=200x-245.5后,再接单节锂电池直接单片机供电,并检测此时单片机的内部带隙电压经过转换后的值。Specifically, after determining the linear expression y=200x-245.5 between the internal bandgap voltage of the single-chip microcomputer and the power supply voltage, a single lithium battery is connected to directly supply power to the single-chip microcomputer, and the internal bandgap voltage of the single-chip microcomputer is detected at this time after conversion value.

S504、根据该内部带隙电压与电源电压的关系表达式y=kx+b计算电源电压。S504. Calculate the power supply voltage according to the relationship expression y=kx+b between the internal bandgap voltage and the power supply voltage.

具体地,举例说明,在确定出单片机内部带隙电压与所述电源电压的线性表达式y=200x-245.5后,单片机再采样得到带隙电压为1.248V,则可以算出单节锂电池电压为4.1V。Specifically, as an example, after determining the linear expression y=200x-245.5 between the internal bandgap voltage of the single-chip microcomputer and the power supply voltage, the single-chip microcomputer re-sampled to obtain a bandgap voltage of 1.248V, then the voltage of the single-cell lithium battery can be calculated as 4.1V.

可以看出,本实施例的方案中,通过检测单片机内部带隙电压,再根据该内部带隙电压与电压电压的关系表达式计算电源电压,从而不需要额外的电压检测电路即可实现对电路的电源电压的检测,可以减少额外的电源电压检测电路以及其带来的功耗,检测方便,节约资源。It can be seen that in the solution of this embodiment, by detecting the internal bandgap voltage of the single-chip microcomputer, and then calculating the power supply voltage according to the relationship expression between the internal bandgap voltage and voltage voltage, the circuit can be realized without additional voltage detection circuit The detection of the power supply voltage can reduce the extra power supply voltage detection circuit and the power consumption caused by it, the detection is convenient, and the resources are saved.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM) and the like.

以上所揭露的仅为本发明一种较佳实施例而已,当然不能以此来限定本发明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。What is disclosed above is only a preferred embodiment of the present invention, and of course it cannot limit the scope of rights of the present invention. Those of ordinary skill in the art can understand all or part of the process for realizing the above embodiments, and according to the rights of the present invention The equivalent changes required still belong to the scope covered by the invention.

Claims (10)

1. a kind of voltage detecting circuit, it is characterised in that the voltage detecting circuit includes:
Reference voltage generating circuit and single-chip microcomputer;
The output end of the reference voltage generating circuit is connected with the reference voltage input pin of the single-chip microcomputer, The power supply termination operating voltage of the reference voltage generating circuit, wherein, the reference voltage generating circuit is used In to the single-chip microcomputer provide reference voltage, and by the reference voltage by the output end output arrive it is described Single-chip microcomputer;
The power pins of the single-chip microcomputer connect supply voltage, and the single-chip microcomputer is used for by the detection single-chip microcomputer Band gap voltage, and calculate the power supply using the relational expression between the band gap voltage and supply voltage Voltage.
2. voltage detecting circuit according to claim 1, it is characterised in that the reference voltage occurs Circuit includes the sampling end connection of resistance and source of stable pressure, the control end of the source of stable pressure and the source of stable pressure, and It is connected with one end of the resistance, the ground pin ground connection of the source of stable pressure, another termination input of the resistance Voltage, the sampling end of the source of stable pressure is the output end of the reference voltage generating circuit.
3. voltage detecting circuit according to claim 1, it is characterised in that the model of the single-chip microcomputer For HT66F006, the reference voltage input pin of the single-chip microcomputer is connected with the sampling end of the source of stable pressure, institute The power pins for stating single-chip microcomputer connect supply voltage, the ground pin ground connection of the single-chip microcomputer.
4. voltage detecting circuit according to claim 3, it is characterised in that the 5th of the single-chip microcomputer Input and output pin is connected with the voltage input end of the reference voltage generating circuit, for using the monolithic 5th input and output pin of machine provides operating voltage for the reference voltage generating circuit.
5. voltage detecting circuit according to claim 2, it is characterised in that the reference voltage occurs The control source termination supply voltage of circuit.
6. the voltage detecting circuit according to claim 4 or 5, it is characterised in that the source of stable pressure Model TL431.
7. a kind of voltage measurement method, the voltage detecting circuit being applied to described in claim 1 to 6, it is special Levy and be, methods described includes:
Detect the described internal band gap voltage of the single-chip microcomputer;
The supply voltage is calculated with the relational expression of the supply voltage according to the internal band gap voltage.
8. method according to claim 7, it is characterised in that the internal band gap voltage and the electricity The relational expression of source voltage is linear representation y=kx+b.
9. method according to claim 8, it is characterised in that the detection single-chip microcomputer inside band gap electricity Before pressure, methods described also includes:
Determine the linear representation y=kx+b of the internal band gap voltage and the supply voltage.
10. method according to claim 9, it is characterised in that the determination internal band gap electricity The linear representation y=kx+b with the supply voltage is pressed, including:
Different twice reference voltage and the reference voltage difference different twice are gathered respectively Corresponding reference inside band gap voltage;
Determine the inside with reference to internal band gap voltage with described using the reference voltage different twice The linear representation y=kx+b of band gap voltage and the supply voltage.
CN201510750305.9A 2015-11-04 2015-11-04 Voltage detection circuit and voltage measurement method Pending CN106646241A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510750305.9A CN106646241A (en) 2015-11-04 2015-11-04 Voltage detection circuit and voltage measurement method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510750305.9A CN106646241A (en) 2015-11-04 2015-11-04 Voltage detection circuit and voltage measurement method

Publications (1)

Publication Number Publication Date
CN106646241A true CN106646241A (en) 2017-05-10

Family

ID=58851246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510750305.9A Pending CN106646241A (en) 2015-11-04 2015-11-04 Voltage detection circuit and voltage measurement method

Country Status (1)

Country Link
CN (1) CN106646241A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109470913A (en) * 2018-09-19 2019-03-15 东莞市正旭新能源设备科技有限公司 A method of supply voltage is pushed away by reference to voltage is counter

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5440254A (en) * 1992-10-20 1995-08-08 Exar Corporation Accurate low voltage detect circuit
CN101281216A (en) * 2008-05-28 2008-10-08 北京中星微电子有限公司 Voltage measuring circuit using scan mode
CN201163288Y (en) * 2007-11-16 2008-12-10 深圳和而泰智能控制股份有限公司 Power supply voltage detecting circuit
CN101754539A (en) * 2010-02-03 2010-06-23 海洋王照明科技股份有限公司 Sampling circuit, LED drive circuit and method for detecting electric quantity of battery
CN202383264U (en) * 2011-12-14 2012-08-15 深圳和而泰智能控制股份有限公司 Battery voltage detection circuit and device
CN203455403U (en) * 2013-08-09 2014-02-26 广州华玺医疗科技有限公司 Battery voltage detection circuit based on Zener diode
CN104348194A (en) * 2013-07-26 2015-02-11 无锡华润矽科微电子有限公司 Electric vehicle charging control circuit and calibration method thereof

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5440254A (en) * 1992-10-20 1995-08-08 Exar Corporation Accurate low voltage detect circuit
CN201163288Y (en) * 2007-11-16 2008-12-10 深圳和而泰智能控制股份有限公司 Power supply voltage detecting circuit
CN101281216A (en) * 2008-05-28 2008-10-08 北京中星微电子有限公司 Voltage measuring circuit using scan mode
CN101754539A (en) * 2010-02-03 2010-06-23 海洋王照明科技股份有限公司 Sampling circuit, LED drive circuit and method for detecting electric quantity of battery
CN202383264U (en) * 2011-12-14 2012-08-15 深圳和而泰智能控制股份有限公司 Battery voltage detection circuit and device
CN104348194A (en) * 2013-07-26 2015-02-11 无锡华润矽科微电子有限公司 Electric vehicle charging control circuit and calibration method thereof
CN203455403U (en) * 2013-08-09 2014-02-26 广州华玺医疗科技有限公司 Battery voltage detection circuit based on Zener diode

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
谭晖: "《Nordic中短距离无线应用入门与实践》", 31 December 2009 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109470913A (en) * 2018-09-19 2019-03-15 东莞市正旭新能源设备科技有限公司 A method of supply voltage is pushed away by reference to voltage is counter
CN109470913B (en) * 2018-09-19 2021-07-30 东莞市正旭新能源设备科技有限公司 A method of inverting power supply voltage by reference voltage

Similar Documents

Publication Publication Date Title
CN105699904A (en) Battery voltage detecting circuit and method
CN106840442A (en) A kind of battery temperature measuring system and method
CN204347169U (en) A kind of break detection circuit and temperature collection circuit
CN204964077U (en) Pressure drag formula pressure sensor pressure detection circuit
CN203773034U (en) Testing device of direct-current ripple system
CN201392361Y (en) AC/DC Voltage Ammeter and Sampling Circuit Based on SCM and Optocoupler
CN105652743B (en) The method and device of Interface Controller
CN201163288Y (en) Power supply voltage detecting circuit
CN106646241A (en) Voltage detection circuit and voltage measurement method
WO2015161822A1 (en) Busbar voltage measurement method and circuit
CN204314387U (en) A kind of precision resister measurement mechanism based on electric bridge
CN115166459A (en) Junction temperature detection device, junction temperature detection method, electronic equipment and storage medium
CN211602245U (en) Torque measuring equipment
CN111077356B (en) Current detection circuit, method, apparatus and storage medium
CN104655916A (en) Alternating-current voltage effective value measuring device and method
CN110873618A (en) A torque measuring device
CN206557143U (en) Soil temperature-moisture sensor new-type circuit
CN203455403U (en) Battery voltage detection circuit based on Zener diode
CN104181370A (en) Load current detection circuit and detection device
CN213986857U (en) Circuit with isolation and capable of continuously detecting water immersion and water immersion detector
WO2014075361A1 (en) Voltage detection apparatus and method
CN206258759U (en) Voltage stable output device
CN204181593U (en) A kind of low-power consumption temp measuring system based on accurate reverse current source
CN206431080U (en) A kind of pen type pH value detector
CN206378226U (en) Pressure detector

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170510