Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for controlling a relay, so as to solve the problem in the prior art that when a power supply of an electric vehicle is in a power loss state or has another fault, the electric vehicle fails and cannot be started.
In order to achieve the above purpose, the embodiments of the present invention provide the following technical solutions:
the first aspect of the embodiment of the invention discloses a relay control method, which is suitable for a relay control device, wherein the relay control device comprises a system foundation chip SBC, a singlechip MCU and an AND gate circuit, and the method comprises the following steps:
after the electric automobile is powered on, the system base chip SBC judges whether the system base chip SBC normally operates, and if the system base chip SBC normally operates, a reset signal is released to control the MCU to be powered on;
the MCU is powered on and initialized, and the communication connection between the MCU and the SBC is established;
the MCU sends a control instruction to the SBC to control the output levels of two pins FS0B and FS1B of the SBC and control a relay to control the IO output level;
and the AND gate circuit receives and outputs a relay control level based on the relay control IO of the MCU and the level output by the FS0B, FS B of the SBC, so that the driving module controls the relay based on the relay control level.
Optionally, the MCU sends a control command to the SBC to control the output levels of the two pins FS0B and FS1B of the SBC, including:
the MCU reads the detection data of the SBC, wherein the detection data is used for indicating the voltage data detected by the SBC in real time after the SBC normally operates;
judging whether the detection data of the SBC has abnormal data or not;
and if no abnormity exists, sending a control instruction to the SBC, and controlling two pins FS0B and FS1B of the SBC to output high level.
Optionally, the system base chip SBC determines whether the SBC itself normally operates, and if the SBC normally operates, releases the reset signal to control the MCU to power on, including:
the SBC monitors the output voltage of the whole vehicle;
judging whether the output voltage of the whole vehicle is higher than a first rated voltage or not;
if the output voltage of the whole vehicle is lower than a first rated voltage, judging whether the output voltage of the whole vehicle is lower than a second rated voltage;
and if the output voltage of the whole vehicle is higher than the second rated voltage, determining that the SBC normally operates, and releasing a reset signal to control the MCU to be electrified.
Optionally, the and circuit receives and outputs a relay control level based on the relay control IO of the MCU and the level output by the FS0B, FS B of the SBC, so that the driving module controls the relay based on the relay control level, including:
when the level output by the relay control IO of the MCU is high level and the levels output by two pins FS0B, FS B of the SBC are high levels, the AND gate circuit receives and performs AND logic on the high level output by the relay control IO of the MCU and the high level output by two pins FS0B, FS B of the SBC, determines that the output relay control level is high level, and enables the driving module to control the relay to be powered on based on the relay control level;
when the level output by the relay control IO of the MCU is low level and the levels output by the two pins FS0B, FS B of the SBC are high levels, the AND gate circuit receives and performs AND logic on the low level output by the relay control IO of the MCU and the high levels output by the two pins FS0B, FS B of the SBC, determines that the output relay control level is low level, and enables the driving module to control the relay to be powered off based on the relay control level.
Optionally, the method further includes:
and when the MCU is not abnormal, sending a watchdog feeding instruction to the SBC according to a preset time period, wherein the watchdog feeding instruction is used for detecting the communication state of the MCU and the SBC.
The second aspect of the embodiment of the present invention discloses a relay control device, which is applied to the relay control method shown in the first aspect of the present invention, and the device includes: the system comprises a system foundation chip SBC, a singlechip MCU and an AND gate circuit;
the single chip microcomputer MCU is connected with the system foundation chip SBC through a serial peripheral interface SPI, and a relay control IO of the MCU is connected with the input end of the AND gate circuit;
the SBC is connected with the input end of the AND gate circuit through two pins;
the output end of the AND gate module is connected with the input end of the driving module, and the output end of the driving module is connected with the input end of the relay;
the SBC is used for judging whether the SBC normally operates or not after the electric automobile is powered on, and releasing a reset signal to control the MCU to be powered on if the SBC normally operates;
the MCU is used for powering up and initializing, and establishing communication connection between the MCU and the SBC; the MCU sends a control instruction to the SBC to control the output levels of two pins FS0B and FS1B of the SBC and control a relay to control the IO output level;
and the and gate circuit is used for receiving and outputting a relay control level based on the relay control IO of the MCU and the level output by the FS0B, FS B of the SBC, so that the driving module controls the relay based on the relay control level.
Optionally, when the MCU is configured to send a control instruction to the SBC and control the output levels of the FS0B and FS1B pins of the SBC, the MCU is specifically configured to:
the MCU is communicated with the SBC through an SPI (serial peripheral interface) interface and reads detection data of the SBC, and the detection data are used for indicating voltage data detected by the SBC in real time after the SBC normally operates; judging whether the detection data of the SBC has abnormal data or not; and if no abnormity exists, sending a control instruction to the SBC, and controlling two pins FS0B and FS1B of the SBC to output high levels.
Optionally, the system base chip SBC is specifically configured to:
the SBC monitors the output voltage of the whole vehicle; judging whether the output voltage of the whole vehicle is higher than a first rated voltage or not; if the output voltage of the whole vehicle is lower than a first rated voltage, judging whether the output voltage of the whole vehicle is lower than a second rated voltage; and if the output voltage of the whole vehicle is higher than the second rated voltage, determining that the SBC normally operates, and releasing a reset signal to control the MCU to be electrified.
Optionally, the and gate circuit is specifically configured to:
when the level output by the relay control IO of the MCU is high level and the levels output by two pins FS0B, FS B of the SBC are high levels, the AND gate circuit receives and performs AND logic on the high level output by the relay control IO of the MCU and the high level output by two pins FS0B, FS B of the SBC, determines that the output relay control level is high level, and enables the driving module to control the relay to be powered on based on the relay control level; when the level output by the relay control IO of the MCU is low level and the levels output by the two pins FS0B, FS B of the SBC are high levels, the AND gate circuit receives and performs AND logic on the low level output by the relay control IO of the MCU and the high levels output by the two pins FS0B, FS B of the SBC, determines that the output relay control level is low level, and enables the driving module to control the relay to be powered off based on the relay control level.
Optionally, the MCU is further configured to:
and when no abnormity exists, sending a watchdog feeding instruction to the SBC according to a preset time period, wherein the watchdog feeding instruction is used for detecting the communication state of the MCU and the SBC.
Based on the relay control method and the relay control device provided by the embodiment of the invention, the relay control device comprises a system foundation chip SBC, a singlechip MCU and an AND gate circuit. After the electric automobile is powered on, the system foundation chip SBC judges whether the system foundation chip SBC normally operates or not, and if the system foundation chip SBC normally operates, a reset signal is released to control the MCU to be powered on; powering on and initializing the MCU of the singlechip, and establishing communication connection between the MCU and the SBC; the MCU sends a control instruction to the SBC to control the output levels of two pins FS0B and FS1B of the SBC and control the IO output level of the relay; and the AND gate circuit receives and outputs the level output by the relay control IO of the MCU and the FS0B, FS B of the SBC based on the level output by the relay control IO and the SBC, and outputs the relay control level, so that the drive module controls the relay based on the relay control level. In the embodiment of the invention, the MCU is used for controlling the output levels of the two pins FS0B and FS1B of the SBC and controlling the relay to control the IO output level, so that the control level of the relay is determined, the drive module is used for controlling the relay based on the control level of the relay, and the problems that when the power supply of the electric automobile is in power shortage or other faults, the electric automobile is damaged and cannot be started can be solved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
Known from the background art, often be connected with the relay driver through singlechip (MCU) among the electric automobile, when the car was electrified, in case this power takes place insufficient voltage or other trouble, MCU passes through input/output (IO) interface direct control relay driver closure for be the outage state between power and the consumer, lead to electric automobile to break down, and can't start the vehicle.
Therefore, the embodiment of the invention provides a relay control method and a relay control device, wherein the MCU is used for controlling the output levels of two pins FS0B and FS1B of the SBC and controlling the relay to control the IO output level, so that the control level of the relay is determined, the relay is controlled by the driving module based on the control level of the relay, and the problems that when the power supply of an electric automobile is in power shortage or other faults, the electric automobile is damaged and cannot be started are solved.
Referring to fig. 1, a schematic flow chart of a relay control method is provided for an embodiment of the present invention, where the relay control method includes:
step S101, after the electric automobile is powered on, a System Base Chip (SBC) judges whether the electric automobile normally operates, step S102 is executed, and if the electric automobile cannot normally operate, the SBC is determined to have a fault, so that peripheral equipment cannot be powered on.
In the specific implementation process of step S101, after it is detected that the electric vehicle is powered on, if it is detected that a key of the entire vehicle is turned to "Stat" or a touch operation of a keyless start button is detected, a current voltage of the entire vehicle is monitored, whether the voltage of the entire vehicle is normal is determined, if the voltage of the entire vehicle is normal, the SBC normally operates, step S102 is executed, if the voltage of the entire vehicle is abnormal, the SBC cannot normally operate, and it is determined that the SBC fails, so that the peripheral device cannot be powered on.
It should be noted that, in addition to the above-described manner of determining whether the voltage of the entire vehicle is normal, whether the SBC itself is normally operated may also be determined by determining whether the input power supply and the output power supply of the system are normal, which is not limited in this application and may be determined according to actual conditions.
It should be noted that the abnormal voltage of the entire vehicle means an unstable state of the circuit caused by an excessively high voltage or an excessively low voltage.
Step S102: and releasing the reset signal to control the MCU to be powered on.
And S103, powering on and initializing the MCU, and establishing communication connection between the MCU and the SBC.
In the process of implementing step S103 specifically, the MCU is powered on, and determines whether it is operating normally within a first preset time, and if it is operating normally, the MCU is reset through a Serial Peripheral Interface (SPI) to establish a communication connection between the MCU and the SBC, and if it cannot operate normally.
It should be noted that the first preset time may be set to 256 milliseconds, which may be determined according to practical situations, and the application is not limited thereto.
And step S104, the MCU sends a control instruction to the SBC, controls the output levels of two pins FS0B and FS1B of the SBC, and controls the relay to control the IO output level.
In the process of implementing step S104 specifically, the SBC detects the electrical performance of the electrical devices of the whole vehicle in real time, so as to determine the state of the whole vehicle, so that the MCU controls the relay to control the IO output level, and sends a control instruction to the SBC through the SPI, so that the SBC executes the control instruction of the output levels of the two pins FS0B and FS 1B.
Step S105: and the AND gate circuit receives the level output by the relay control IO of the MCU and the FS0B, FS B of the SBC and outputs the relay control level to enable the driving module to control the relay based on the relay control level.
In the process of implementing step S105 specifically, when the level output by the relay control IO of the MCU is a high level and the levels output by the two pins FS0B, FS B of the SBC are high levels, the and circuit receives and performs and logic on the high level output by the relay control IO of the MCU and the high level output by the two pins FS0B, FS B of the SBC, and determines that the output relay control level is a high level, so that the driver module controls the relay to be powered on based on the relay control level.
When the level output by the relay control IO of the MCU is low level and the levels output by two pins FS0B, FS B of the SBC are high levels, the AND gate circuit receives and performs AND logic on the low level output by the relay control IO of the MCU and the high levels output by two pins FS0B, FS B of the SBC, the control level of the output relay is determined to be low level, and the drive module controls the relay to be powered off based on the control level of the relay.
In the embodiment of the invention, after an electric automobile is powered on, the SBC performs self-checking so as to determine the running state of the SBC, when the SBC normally runs, a reset signal is released to control the MCU to be powered on, the MCU is powered on and initialized, the communication connection between the MCU and the SBC is established, a control instruction is sent to the SBC to control the output levels of two pins FS0B and FS1B of the SBC and control the IO output level of a relay, an AND gate circuit receives and controls the output levels of the two pins FS0B, FS B of the SBC and the relay based on the MCU to output the relay control level, and a driving module controls the relay based on the relay control level. In the invention, the MCU controls the output levels of two pins FS0B and FS1B of the SBC and controls the relay to control the IO output level, so that the control level of the relay is determined, the drive module controls the relay based on the control level of the relay, and the problems that the power supply of the electric automobile is damaged and the vehicle cannot be started when the power supply of the electric automobile is in power shortage or other faults can be solved.
In order to better understand the implementation process of the relay control method shown above, explanation is made.
The SBC detects the electrical performance of the electrical devices of the whole vehicle in real time, automatically outputs a low level when electrical abnormity is detected, and at the moment, the relay control IO of the MCU also outputs the low level. And the AND gate circuit receives the low level output by the relay control IO of the MCU and the low level output by the FS0B, FS B of the SBC, performs AND logic, determines that the output relay control level is the low level, and enables the driving module to control the relay to be powered off based on the relay control level.
In the embodiment of the invention, the MCU is used for controlling the output levels of the FS0B pin and the FS1B pin of the SBC and controlling the relay to control the IO output level, so that the control level of the relay is determined, the drive module is used for controlling the relay to be powered off based on the control level of the relay, and the problem of electric leakage of the whole vehicle is solved.
Based on the relay control method shown in fig. 1, in the process that the MCU executing step S104 sends a control command to the SBC to control the output levels of the two pins FS0B and FS1B of the SBC, as shown in fig. 2, the method includes the following steps:
step S201: the MCU reads the detection data of the SBC.
In step S201, the detection data is used to indicate voltage data detected by the SBC in real time after the SBC operates normally.
In the process of implementing step S201, after the SBC operates normally, the voltage data of each circuit of the entire vehicle is detected in real time, the detected state of each output voltage is marked, and the voltage data is stored in the internal register, so that the MCU can read the voltage data.
Step S202: and judging whether the detection data of the SBC has abnormal data, if not, executing the step S203, and if so, resetting the MCU.
Step S203: and sending a control instruction to the SBC, and controlling two pins FS0B and FS1B of the SBC to output high level.
In the embodiment of the invention, the MCU sends a control instruction to the SBC by judging whether the detection data of the SBC fails or not, and the two pins FS0B and FS1B of the SBC are controlled to output high levels, so that a follow-up AND gate circuit determines the control level of the relay, and the drive module controls the relay based on the control level of the relay, thereby solving the problems that the power supply of the electric automobile is damaged and the automobile cannot be started when the power supply of the electric automobile is in power shortage or other faults.
Based on the relay control method shown in fig. 2, referring to fig. 3 in conjunction with fig. 2, the relay control method further includes:
step S204: and sending a watchdog feeding instruction to the SBC according to a preset time period.
In step S204, the watchdog feeding instruction is used to detect the communication state between the MCU and the SBC in real time.
In the process of implementing step S204 specifically, the MCU sends a watchdog feeding instruction to the SBC according to a preset time period, so that the system base chip SBC receives and executes a watchdog feeding action based on the watchdog feeding instruction.
It should be noted that the watchdog is a protection mechanism for mutual monitoring of the MCU and the SBC.
In the embodiment of the invention, the watchdog is arranged to detect the communication states of the MCU and the SBC in real time, so that the MCU and the SBC can monitor each other, the subsequent MCU can control the output control level, and the relay can be controlled to control the IO output level, and the problems that the power supply of the electric automobile is damaged and the automobile cannot be started when the power supply of the electric automobile is in power shortage or other faults can be solved.
Based on the relay control method shown in fig. 1, in the process of executing step S101 to determine whether the system base chip SBC normally operates, and if the system base chip SBC normally operates, releasing the reset signal to control the MCU to power on, as shown in fig. 4, the method includes the following steps:
step S401: the system base chip SBC monitors the output voltage of the entire vehicle.
Step S402: and judging whether the output voltage of the whole vehicle is higher than a first rated voltage, if so, executing a step S303, and if so, indicating that the SBC cannot normally operate, and determining that the SBC fails, so that peripheral equipment cannot be powered on.
Step S403: and judging whether the output voltage of the whole vehicle is lower than a second rated voltage, if so, executing S404, and if so, indicating that the SBC cannot normally operate, and determining that the SBC fails, so that peripheral equipment cannot be powered on.
Step S404: and determining that the system base chip SBC normally operates, and releasing a reset signal to control the MCU to be powered on.
In the embodiment of the invention, the normal operation state of the SBC is determined, the reset signal is released to control the MCU to be electrified, so that the subsequent MCU establishes the communication connection between the SBC and the MCU, and the drive module controls the relay based on the relay control level, thereby solving the problems that the power supply of the electric automobile is damaged and the automobile cannot be started when the power supply of the electric automobile is in power shortage or other faults.
Based on the above relay control method disclosed in the embodiment of the present invention, the embodiment of the present invention also correspondingly discloses a relay control device, as shown in fig. 5, which is a structural block diagram of a relay control device provided in the embodiment of the present invention, the relay control device includes: a system base chip SBC100, a singlechip MCU200 and an AND gate circuit 300.
The system base chip SBC100 is connected to the MCU200 through the serial peripheral interface SPI, a relay control Input/Output (IO) interface of the MCU200 is connected to an Input of the and circuit 300, and the SBC100 is connected to an Input of the and circuit 300 through two pins.
The output end of the and gate module 300 is connected to the input end of the driving module, and the output end of the driving module is connected to the input end of the relay.
SBC100 is configured to determine whether the electric vehicle is normally operated after being powered on, and release the reset signal to control the MCU200 to be powered on if the electric vehicle is normally operated.
The MCU200 is configured to power up and initialize, establish a communication connection between the MCU200 and the SBC100, send a control instruction to the SBC100, control output levels of two pins FS0B and FS1B of the SBC100, and control an IO output level of the relay.
And the and gate circuit 300 is configured to receive and output the level output by two pins of FS0B, FS B of the relay control IO and SBC of the MCU200, and output the relay control level, so that the driver module controls the relay based on the relay control level.
It should be noted that, the specific principle and the implementation process of each unit in the relay control device disclosed in the above embodiment of the present invention are the same as the method for implementing the relay control in the above embodiment of the present invention, and reference may be made to corresponding parts in the relay control method disclosed in the above embodiment of the present invention, and details are not repeated here.
In the embodiment of the invention, after an electric automobile is powered on, the SBC performs self-checking so as to determine the running state of the SBC, when the SBC normally runs, a reset signal is released to control the MCU to be powered on, the MCU is powered on and initialized, the communication connection between the MCU and the SBC is established, a control instruction is sent to the SBC to control the output levels of two pins FS0B and FS1B of the SBC and control the IO output level of a relay, an AND gate circuit receives and controls the output levels of the two pins FS0B, FS B of the SBC and the relay based on the MCU to output the relay control level, and a driving module controls the relay based on the relay control level. In the invention, the MCU controls the output levels of two pins FS0B and FS1B of the SBC and controls the relay to control the IO output level, so that the control level of the relay is determined, the drive module controls the relay based on the control level of the relay, and the problems that when the power supply of the electric automobile is in power shortage or other faults, the electric automobile is damaged and cannot start the automobile can be solved.
Based on the relay control device shown in fig. 5, when the MCU200 is configured to send a control command to the SBC100 and control two pin output levels of FS0B and FS1B of the SBC100, the MCU is specifically configured to:
MCU200 communicates with SBC100 through the SPI interface, and reads the detection data of SBC100, where the detection data is used to indicate voltage data detected by SBC100 in real time after SBC100 normally operates, and determine whether there is abnormal data in the detection data of SBC100, and if there is no abnormal data, send a control command to SBC100, and control two pins FS0B and FS1B of SBC100 to output a high level.
In the embodiment of the invention, the MCU sends a control instruction to the SBC by judging whether the detection data of the SBC fails or not, and the two pins FS0B and FS1B of the SBC are controlled to output high levels, so that a follow-up AND gate circuit determines the control level of the relay, and the drive module controls the relay based on the control level of the relay, thereby solving the problems that the power supply of the electric automobile is damaged and the automobile cannot be started when the power supply of the electric automobile is in power shortage or other faults.
Based on the relay control device shown in fig. 5, the MCU is further configured to:
when there is no abnormality, a watchdog feeding instruction is sent to SBC100 according to a preset time period.
It should be noted that the watchdog feeding instruction is used to detect the communication state between the single chip microcomputer MCU200 and the system base chip SBC 100.
In the embodiment of the invention, the watchdog is arranged to detect the communication states of the MCU and the SBC in real time, so that the MCU and the SBC can monitor each other, the subsequent MCU can control the output control level, and the relay can be controlled to control the IO output level, and the problems that the power supply of the electric automobile is damaged and the automobile cannot be started when the power supply of the electric automobile is in power shortage or other faults can be solved.
Based on the relay control device shown in fig. 5, SBC100 is specifically configured to:
the system base chip SBC100 monitors the output voltage of the whole vehicle, judges whether the output voltage of the whole vehicle is higher than a first rated voltage, judges whether the output voltage of the whole vehicle is lower than a second rated voltage if the output voltage of the whole vehicle is lower than the first rated voltage, determines that the system base chip SBC100 normally operates if the output voltage of the whole vehicle is higher than the second rated voltage, and releases a reset signal to control the single chip microcomputer MCU200 to be powered on.
In the embodiment of the invention, the normal operation state of the SBC is determined, the reset signal is released to control the MCU to be electrified, so that the subsequent MCU establishes the communication connection between the SBC and the MCU, and the drive module controls the relay based on the relay control level, thereby solving the problems that the power supply of the electric automobile is damaged and the automobile cannot be started when the power supply of the electric automobile is in power shortage or other faults.
Based on the relay control device shown in fig. 5, the and circuit 300 is specifically configured to:
when the level of the relay control IO output of the MCU200 is a high level and the levels output by the two pins FS0B, FS B of the SBC100 are high levels, the and circuit 300 receives and performs and logic on the high level of the relay control IO output of the MCU200 and the high level output by the two pins FS0B, FS B of the SBC100, determines that the output relay control level is a high level, and enables the driving module to control the relay to be powered up based on the relay control level; when the level of the relay control IO output of the MCU200 is a low level and the levels output by the two pins FS0B, FS B of the SBC100 are high levels, the and circuit 300 receives and performs and logic between the low level of the relay control IO output of the MCU200 and the high levels output by the two pins FS0B, FS B of the SBC100, determines that the output relay control level is a low level, and enables the driver module to control the relay to be powered down based on the relay control level.
In the embodiment of the invention, the MCU is used for controlling the output levels of the two pins FS0B and FS1B of the SBC and controlling the relay to control the IO output level, so that the control level of the relay is determined, the driving module is used for controlling the relay to be powered on and powered off based on the control level of the relay, and the problems that when the power supply of the electric automobile is in power shortage or other faults, the electric automobile is damaged and cannot be started can be solved.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.