IO expansion circuit and control method thereof

Through the design of the IO expansion circuit, the microcontroller and driver module are used to output high and low level state signals, which solves the problem that traditional IO chips cannot meet the multi-state control requirements, and realizes a low-cost, high-robustness IO expansion circuit. Suitable for multi-state control of complex equipment.

CN118759972APending Publication Date: 2024-10-11XIAMEN LEELEN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410951100.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

When traditional IO chips control controlled devices with large IO requirements such as indicators and buttons, they are expensive and cannot meet the multi-state control requirements of complex devices. Especially when IO resources are insufficient, they cannot be effectively allocated.

Method used

Using IO expansion circuit, including microcontroller, driver module, current limiting anti-reverse module and output port, by outputting high and low level switch control signals and status control signals, multi-state control of the controlled equipment is realized, reducing costs and Improve circuit robustness.

Benefits of technology

It realizes multi-state control of controlled equipment, reduces the cost of using IO chips, simplifies circuit design, meets the multi-state requirements of complex equipment, and improves scalability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118759972A_ABST
    Figure CN118759972A_ABST
Patent Text Reader

Abstract

The invention relates to the field of IO equipment, and discloses an IO expansion circuit and a control method thereof.The IO expansion circuit comprises a microcontroller, a driving module, a current-limiting reverse-preventing module and an output port, the output port is used for being connected with controlled equipment, and the control method of the IO expansion circuit is applied to the microcontroller. The control method of the IO expansion circuit comprises the following steps: outputting a switch control signal in a first level state to an output port so as to allow controlled equipment to enter a working state; and when the controlled equipment is allowed to enter the working state, outputting state control signals of different level states to the driving module so as to control the controlled equipment to perform switching of different working states. According to the IO expansion circuit and the control method thereof, the state switching of a plurality of controlled devices can be realized, the requirements of different states of the controlled devices are met, and the IO expansion circuit solves the problems that the product cost is reduced, and the change of various states of a product can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of IO devices, and in particular to an IO expansion circuit and a control method thereof. Background Art

[0002] In circuit design, it is often encountered that there are not enough IO (input and output port) chips, especially for controlled devices with many IO requirements such as indicator lights and buttons. With the diversification of device types, in addition to the large number of IO requirements, the traditional IO chip that controls the opening and closing of controlled devices no longer meets the market demand. It is also required that the IO chip can control multiple states of the controlled devices, for example, the state of the indicator light: high brightness, low brightness, off. At present, in the case of insufficient IO number, IO expansion chips, single-chip microcomputers, etc. are usually added. For special needs, IO with pulse width modulation signals is usually added. However, the current solution has the following disadvantages: the expansion IO chip and the IO chip control the state of multiple controlled devices through pulse width modulation signals, which is too costly and increases the difficulty of printed circuit board layout. In addition, for complex controlled devices, there are more signals and insufficient IO resources to allocate, which cannot meet the required requirements. Summary of the invention

[0003] In view of this, an embodiment of the present application provides an IO expansion circuit and a control method thereof, which not only realizes the control of the switch and state of the controlled device, but also saves application costs.

[0004] In a first aspect, an embodiment of the present application provides a control method for an IO expansion circuit, wherein the IO expansion circuit includes a microcontroller, a driving module, a current limiting and anti-reverse module, and an output port, wherein the output port is used to connect a controlled device, and the control method is applied to the microcontroller, including:

[0005] Outputting a switch control signal in a first level state to the output port to allow the controlled device to enter a working state;

[0006] When the controlled device is allowed to enter the working state, state control signals of different level states are output to the driving module to control the controlled device to switch between different working states.

[0007] In a first possible implementation manner of the first aspect, the microcontroller outputs the state control signal in the first level state when outputting the switch control signal in the first level state, so as to control the controlled device to be in the first working state;

[0008] Alternatively, the state control signal in the second level state is output to control the controlled device to be in the second working state.

[0009] In a second possible implementation of the first aspect, the control method of the IO expansion circuit further includes:

[0010] The switch control signal in the second level state is output to the output port, so that the controlled device is switched to a non-operating state.

[0011] In a third possible implementation manner of the first aspect, the number of the current limiting and anti-reverse modules is one, the number of the output ports is multiple, the first end of each of the output ports is connected to the current limiting and anti-reverse module, and the second end of each of the output ports is respectively connected to the controlled device, and the method further includes:

[0012] Outputting corresponding switch control signals to each of the output ports to allow the corresponding connected controlled device to enter a working state;

[0013] When at least one of the controlled devices enters the working state, the state control signal of the first level state or the second level state is output to the driving module to control all the controlled devices entering the working state to synchronously switch to the first working state or the second working state.

[0014] In a fourth possible implementation of the first aspect, the number of the current limiting and anti-reverse modules is multiple and equal to the number of the output ports, the first end of each of the output ports is respectively connected to each of the current limiting and anti-reverse modules, and the second end of each of the output ports is respectively connected to each of the controlled devices, and the method further includes:

[0015] Outputting corresponding switch control signals to each of the output ports to allow the corresponding connected controlled device to enter a working state;

[0016] When at least one of the controlled devices enters the working state, the state control signal of the first level state or the second level state is output to the driving module to control all the controlled devices entering the working state to synchronously switch to the corresponding first working state or second working state.

[0017] In a fifth possible implementation of the first aspect, when the controlled device is an LED lamp, the output port is used to connect the LED lamp, and the method further includes:

[0018] The microcontroller outputs the switch control signal in a first level state and the state control signal in a first level state, and the LED lamp is in a low brightness state;

[0019] The microcontroller outputs the switch control signal in a first level state and the state control signal in a second level state, and the LED lamp is in a high-brightness state;

[0020] The microcontroller outputs the switch control signal in a second level state, and the LED lamp is in a light-off state.

[0021] In a sixth possible implementation of the first aspect, the LED lamp is connected to a photosensor, and the method further includes:

[0022] The photosensitive sensor senses the brightness of the environment in which the LED lamp is located, so that the microcontroller switches the working state of the LED lamp accordingly according to the brightness of the environment.

[0023] In a first aspect, an embodiment of the present application provides an IO expansion circuit, comprising: a microcontroller, a driving module, a current limiting and anti-reverse module and an output port, wherein the output port is used to connect a controlled device, and the microcontroller uses the control method to control the connected controlled device.

[0024] In a first possible implementation manner of the second aspect, the current limiting and anti-reverse module includes a first current limiting resistor, a second current limiting resistor and a diode;

[0025] The first end of the first current limiting resistor is used to connect to a power supply, the second end of the first current limiting resistor is connected to the anode of the diode, the cathode of the diode is connected to the first end of the second current limiting resistor, the second end of the second current limiting resistor is used to connect to the power supply, and the series node of the diode and the second current limiting resistor is connected to the output port.

[0026] In a second possible implementation of the second aspect, the driving module includes a triode, a first bias resistor, and a second bias resistor;

[0027] The collector of the transistor is connected to the series node of the first current limiting resistor and the diode, the base of the transistor is respectively connected to the first end of the first bias resistor and the first end of the second bias resistor, the second end of the first bias resistor is connected to the microcontroller, the second end of the second bias resistor is connected to the emitter of the transistor, and the emitter of the transistor is grounded.

[0028] The embodiments of the present application have the following beneficial effects:

[0029] An IO expansion circuit and its control method according to an embodiment of the present application, the IO expansion circuit includes a microcontroller, a driving module, a current limiting and anti-reverse module and an output port, the output port is used to connect a controlled device, the IO expansion circuit and its control method are applied to the microcontroller, the IO expansion circuit and its control method include: outputting a switch control signal of a first level state to the output port to allow the controlled device to enter a working state; when the controlled device is allowed to enter a working state, outputting a state control signal of a different level state to the driving module to control the controlled device to switch between different working states. Based on the above scheme, the present application can realize that the IO chip outputs high and low level state control signals and switch control signals to meet the requirements of different states of the controlled device, and the cost is very low, the circuit robustness is high, and the scalability is rich. The control method of the IO expansion circuit solves the product pain points of both reducing costs and having more varieties. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.

[0031] Figure 1 A schematic diagram showing the structure of an IO expansion circuit according to an embodiment of the present application is shown;

[0032] Figure 2 A first circuit structure schematic diagram of the IO expansion circuit according to an embodiment of the present application is shown;

[0033] Figure 3 A second circuit structure schematic diagram of the IO expansion circuit according to an embodiment of the present application is shown;

[0034] Figure 4 A first flow chart of a control method of an IO expansion circuit according to an embodiment of the present application is shown;

[0035] Figure 5 A second flow chart of the control method of the IO expansion circuit according to an embodiment of the present application is shown.

[0036] Description of main component symbols:

[0037] 100-IO expansion circuit; 110-microcontroller; 120-drive module; 130-current limiting and anti-reverse module; 140-output port. DETAILED DESCRIPTION

[0038] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0039] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0040] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.

[0041] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0042] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0043] In an embodiment of the present application, the control method of the IO expansion circuit is applied to the IO expansion circuit 100 to control the working state and non-working state of the controlled device connected to the IO chip, and the IO chip and the controlled device are interconnected through the IO expansion circuit 100. It should be noted that in order to reduce costs, the control method of the IO expansion circuit can output switch control signals and state control signals in high and low level states through the microcontroller 110 to control the controlled device to perform corresponding actions without a pulse width modulation function. In addition, the control method of the IO expansion circuit can reduce the use of IO chips, and the implementation method is simple, reduces costs, and has strong reliability. Among them, the IO device includes the IO expansion circuit 100, and the IO device can be a smart product such as a smart panel, a smart door lock, and a smart screen.

[0044] Before describing the control method of the IO expansion circuit, the structure of the IO expansion circuit 100 is first introduced accordingly.

[0045] like Figure 1 As shown, the IO expansion circuit 100 includes a microcontroller 110, a driving module 120, a current limiting and anti-reverse module 130, and an output port 140, wherein the output port 140 is used to connect a controlled device, and the microcontroller 110 adopts the control method of the IO expansion circuit. Exemplarily, the output port 140 is used to connect a controlled device, wherein the output port 140 is used as the output end of the IO expansion circuit 100 to connect a plurality of different controlled devices; the output end of the microcontroller 110 is used as the input end of the IO expansion circuit 100 to output a state control signal and a switch control signal to control the state of the connected controlled device, specifically including the working state and switch state control of the controlled device. For example, the controlled device includes any one or a combination of an LED lamp, a button, and a relay.

[0046] In one embodiment, the current limiting and anti-reverse module 130 includes a first current limiting resistor R1, a second current limiting resistor R2 and a diode D1; wherein, the first end of the first current limiting resistor R1 is used to connect to the power supply VCC, the second end of the first current limiting resistor R1 is connected to the anode of the diode D1, the cathode of the diode D1 is connected to the first end of the second current limiting resistor R2, the second end of the second current limiting resistor R2 is used to connect to the power supply VCC, and the series node of the diode D1 and the second current limiting resistor R2 is connected to the output port 140.

[0047] In one embodiment, the driving module 120 includes a transistor Q1, a first bias resistor R3 and a second bias resistor R4; wherein the collector of the transistor Q1 is connected to the series node of the first current limiting resistor R1 and the diode D1, the base of the transistor Q1 is respectively connected to the first end of the first bias resistor R3 and the first end of the second bias resistor R4, the second end of the first bias resistor R3 is connected to the microcontroller 110, the second end of the second bias resistor R4 is connected to the emitter of the transistor Q1, and the emitter of the transistor Q1 is grounded.

[0048] In this embodiment, the transistor Q1 is used to be turned on or off when the high or low level state of the state control signal changes. For example, when the state control signal input is at a low level, the transistor Q1 is in an off state. At this time, there is no current flowing between the collector and the emitter of the transistor Q1, and the load in the IO expansion circuit 100 will not be affected by the state control signal; when the state control signal input is at a high level, the transistor Q1 is in a saturated or amplified state. In the saturated state, there is a large current flowing between the collector and the emitter of the transistor Q1, and the load in the IO expansion circuit 100 can be controlled to be in an on state. The first current limiting resistor R1 is used to limit the current of the transistor Q1 in the IO expansion circuit 100 to avoid damage to external devices caused by excessive current, and at the same time make the transistor Q1 work more stably.

[0049] In this embodiment, the diode D1 is used to conduct or cut off according to the conduction or cut off of the transistor Q1, so as to switch the working state of the external device. The diode D1 is used to be in the conduction state when the transistor Q1 is cut off. The diode D1 is also used to be in the cut off state when the transistor Q1 is turned on, and at the same time prevent the power supply VCC from flowing to the ground after the transistor Q1 is turned on. The diode D1 can be a Schottky diode with a low voltage drop, which is used to further reduce the voltage loss and power consumption when the transistor Q1 is turned on. For example, the second current limiting resistor R2 has a value of 1K, the power supply VCC has a value of 5V, the voltage drop between the controlled device and the diode D1 has a value of 2.5V, the first current limiting resistor R1 has a value of 500Ω, and the path 1 includes the power supply VCC→the second current limiting resistor R2→the controlled device; the path 2 includes the power supply VCC→the first current limiting resistor R1→the diode D1→the controlled device. When the state control signal is at a low level, then in the path 1, the current and voltage of the second current limiting resistor R2 are calculated as I1=(V VCC -Vf1) / R2=2.5mA;U1=R2*I1=2.5V, where I1 represents the current of the second current limiting resistor R2, V VCC represents the power supply VCC voltage, R2 represents the resistance value of the second current limiting resistor R2, and Vf1 is the voltage drop of the controlled device; when the switch control signal is at a low level, the transistor Q1 is turned off, and in path 2, the current and voltage of the first current limiting resistor R1 are calculated as follows: I2=(V VCC -Vf1-Vf2) / R1=4mA; U2=R1*I2=2.5V, wherein I2 represents the current of the first current limiting resistor R1, U2 represents the voltage of the first current limiting resistor R1, Vf2 represents the voltage drop of the diode D1, and R2 represents the resistance value of the first current limiting resistor R1; thus, it can be seen that the voltage of the first current limiting resistor R1 is greater than the voltage of the second current limiting resistor R2, and the diode D1 can be effectively turned on when the transistor Q1 is cut off.

[0050] In this embodiment, the first bias resistor R3 and the second bias resistor R4 are used to make the transistor Q1 work in the saturation region to minimize the switching time and switching loss of the transistor Q1. The resistance value of the first bias resistor R3 is used to affect the magnitude of the input bias current of the transistor Q1 so that the transistor Q1 works in the saturation region. The output current of the transistor Q1 satisfies: I c <β*I b , where I c It is the output current of transistor Q1, β is a constant, which represents the amplification factor of the output current of transistor Q1, I b Represents the input current of the transistor Q1. The second bias resistor R4 is used to ensure that the transistor Q1 can be reliably cut off when the input is floating.

[0051] In one embodiment, Figure 2 As shown, the number of the current limiting and anti-reverse module 130 can be one, the number of the output ports 140 can be multiple, the first end of each output port 140 is connected to the current limiting and anti-reverse module 130, and the second end of each output port 140 is connected to the controlled device. In this way, the n+1 IO ports of the microcontroller 110 can be used to control n controlled devices.

[0052] In another embodiment, if Figure 3 As shown, the number of current limiting and anti-reverse modules 130 is multiple and equal to the number of output ports 140, the first end of each output port 140 is respectively connected to each current limiting and anti-reverse module 130, and the second end of each output port 140 is respectively connected to each controlled device.

[0053] In combination with the above circuit structure, the control method of the IO expansion circuit of the present application is specifically introduced below.

[0054] Please refer to Figure 4 , is a flow chart of a control method for an IO expansion circuit proposed in an embodiment of the present application. Exemplarily, the control method for the IO expansion circuit is applied to a microcontroller 110, and the control method for the IO expansion circuit includes the following steps:

[0055] S210, outputting a switch control signal in a first level state to the output port 140, so as to allow the controlled device to enter a working state.

[0056] Exemplarily, the switch control signal output by the microcontroller 110 can directly act on the controlled device through the output port 140 to control the corresponding controlled device to enter the working state and the non-working state. The microcontroller 110 can be used to output multiple switch control signals to control different controlled devices to enter the working state and the non-working state respectively. The microcontroller 110 is also used to output switch control signals of different level states to switch the working state and the non-working state of the corresponding controlled device.

[0057] For example, in one embodiment, the control method of the IO expansion circuit further includes: outputting a switch control signal in a second level state to the output port 140 to switch the controlled device to a non-operating state.

[0058] Specifically, the level state of the switch control signal includes a high level and a low level. When the switch control signal is at a high level, it can be indicated that the controlled device has entered a working state, and current will flow through the corresponding controlled device; when the switch control signal is at a low level, it can be indicated that the controlled device has entered a non-working state, and no current will flow through the corresponding controlled device.

[0059] S120, when the controlled device is allowed to enter the working state, outputting state control signals of different level states to the driving module 120 to control the controlled device to switch between different working states.

[0060] Exemplarily, the state control signal output by the microcontroller 110 can turn on and off the driving module 120, thereby switching different working states of the external device. The microcontroller 110 can be used to output a state control signal and multiple switch control signals, which can respectively control different controlled devices to enter different working states. The microcontroller 110 is also used to output state control signals of different level states to switch different working states of the corresponding controlled devices. Specifically, the level state of the state control signal includes a high level and a low level.

[0061] For example, in one embodiment, when the microcontroller 110 outputs a switch control signal in a first level state, it outputs a state control signal in a first level state to control the controlled device to be in a first working state; or, it outputs a state control signal in a second level state to control the controlled device to be in a second working state.

[0062] It can be understood that the control method of the IO expansion circuit controls the working state and non-working state of multiple different controlled devices through the state control signal and switch control signal output by the microcontroller 110, and controls the different working states of the external devices respectively. On the one hand, the switch control signal can be used to wake up the controlled device so that the controlled device can enter the working state from the non-working state; the switch control signal can be used to shut down the controlled device so that the controlled device can enter the non-working state from the working state; on the other hand, the state control signal can be used to change the controlled device to different working states when the controlled device enters the working state.

[0063] In one embodiment, see above Figure 2For the IO expansion circuit 100 structure with multiple controlled devices, the control method of the IO expansion circuit also includes: the microcontroller 110 outputs a corresponding switch control signal to each output port 140 to allow the corresponding connected controlled device to enter a working state; when at least one controlled device enters the working state, a state control signal of a first level state or a second level state is output to the driving module 120 to control all controlled devices that have entered the working state to synchronously switch to the first working state or the second working state.

[0064] In another embodiment, see above Figure 3 For the IO expansion circuit 100 structure with multiple controlled devices, the control method of the IO expansion circuit also includes: the microcontroller 110 outputs a corresponding switch control signal to each output port 140 to allow the corresponding connected controlled device to enter a working state; when at least one controlled device enters the working state, a state control signal of a first level state or a second level state is output to the driving module 120 to control all controlled devices that have entered the working state to synchronously switch to the corresponding first working state or second working state.

[0065] It can be understood that each output port 140 is connected to each current limiting anti-reverse module 130 to connect each controlled device respectively, so as to control the switch state of each controlled device respectively, and when the switch state of each controlled device is switched, it will not affect the working state of other controlled devices. Specifically, each output port 140 is connected to the series node of the diode and the second current limiting resistor.

[0066] Exemplarily, taking the control of multiple LED lamps as an example, the control method of the IO expansion circuit drives by outputting a switch control signal and a state control signal in a high-level state, so that the LED lamps in the IO expansion circuit 100 are in a working state and a non-working state.

[0067] In one embodiment, when the controlled device is an LED lamp, the output port 140 is used to connect the LED lamp, and the number of the LED lamp may include one or more, such as Figure 5 As shown, the control method of the IO expansion circuit also includes the following steps:

[0068] S310, the microcontroller 110 outputs a switch control signal in a first level state and a state control signal in a first level state, and the LED lamp is in a low brightness state;

[0069] S320, the microcontroller 110 outputs a switch control signal in a first level state and a state control signal in a second level state, and the LED light is in a high-brightness state;

[0070] S330, the microcontroller 110 outputs a switch control signal in a second level state, and the LED lamp is in a light-off state.

[0071] Specifically, the control method of the IO expansion circuit can meet the three state requirements of the LED lamp according to the state control signal and the switch control signal of different level states. For example, when the state control signal is at a high level, the transistor Q1 is turned on, the emitter level of the transistor Q1 is pulled to the ground, the diode D1 is turned off, and the path 2 is blocked. At this time, when the switch control signal is at a high level, the LED lamp is in the light-off state; when the switch control signal is at a low level, the path 1 is turned on, and the state of the LED lamp is a low-brightness state. When the state control signal is at a low level, the transistor Q1 is turned off, the emitter level of the transistor Q1 is pulled to a high level, the diode D1 is turned on, and the path 2 is accessible. At this time, when the switch control signal is at a high level, the LED lamp is in the light-off state; when the switch control signal is at a low level, the path 1 is turned on, and the state of the LED lamp is a high-brightness state. It can be seen from this that the switch control signal controls the on and off of the LED lamp, and the state control signal controls the state of the LED lamp.

[0072] In one embodiment, the IO expansion circuit 100 further includes at least one photosensitive sensor; exemplary, a photosensitive sensor is connected near each LED lamp, so that the state of the LED lamp and the ambient brightness can be matched. The control method of the IO expansion circuit also includes: sensing the ambient brightness of the LED lamp through the photosensitive sensor, so that the microcontroller 110 switches the working state of the LED lamp accordingly according to the ambient brightness.

[0073] Specifically, the control method of the IO expansion circuit sets different brightness thresholds according to the use requirements of the LED lamp, and the photosensitive sensor is used to transmit the corresponding photosensitive signal to the microcontroller 110, and the microcontroller 110 determines the current ambient brightness according to the photosensitive signal, and then generates a state control signal of the corresponding level state. For example, when the photosensitive sensor senses a weak ambient light brightness, the microcontroller 110 is used to generate a state control signal of a high level state according to the photosensitive signal, so that the LED lamp can be switched to a state of lower brightness; and when the photosensitive sensor senses a strong ambient light brightness, the microcontroller 110 is used to generate a state control signal of a low level state according to the photosensitive signal, so that the LED lamp can be switched to a state of higher brightness.

[0074] It can be understood that the control method of the IO expansion circuit realizes the automatic adjustment and switching function between the photosensitive sensor and the LED light. When the photosensitive sensor senses the change in ambient light brightness, the control circuit adjusts the different brightness states of the LED light to meet specific usage requirements. In the above manner, the control method of the IO expansion circuit can realize the function of automatic adjustment and switching of the LED light based on the photosensitive sensor, realize the automatic control and energy efficiency optimization of the LED light, and this design idea is particularly suitable for occasions where lighting control is required according to the ambient light brightness, such as indoor lighting, lighting landscape, etc.

[0075] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims

1. A control method for an IO expansion circuit, characterized in that: The IO expansion circuit includes a microcontroller, a driving module, a current limiting and anti-reverse module and an output port, wherein the output port is used to connect a controlled device. The control method is applied to the microcontroller, including: Outputting a switch control signal in a first level state to the output port to allow the controlled device to enter a working state; When the controlled device is allowed to enter the working state, state control signals of different level states are output to the driving module to control the controlled device to switch between different working states.

2. The control method of the IO expansion circuit according to claim 1, characterized in that: The microcontroller outputs the state control signal in the first level state when outputting the switch control signal in the first level state, so as to control the controlled device to be in the first working state; Alternatively, the state control signal in the second level state is output to control the controlled device to be in the second working state.

3. The control method of the IO expansion circuit according to claim 1, characterized in that: Also includes; The switch control signal in the second level state is output to the output port, so that the controlled device is switched to a non-operating state.

4. The control method of the IO expansion circuit according to claim 1, characterized in that: The number of the current limiting and anti-reverse modules is one, the number of the output ports is multiple, the first end of each of the output ports is connected to the current limiting and anti-reverse module, and the second end of each of the output ports is respectively connected to the controlled device, and the method further includes: Outputting corresponding switch control signals to each of the output ports to allow the corresponding connected controlled device to enter a working state; When at least one of the controlled devices enters the working state, the state control signal of the first level state or the second level state is output to the driving module to control all the controlled devices entering the working state to synchronously switch to the first working state or the second working state.

5. The control method of the IO expansion circuit according to claim 1, characterized in that: The number of the current limiting and anti-reverse modules is multiple and equal to the number of the output ports, the first end of each of the output ports is respectively connected to each of the current limiting and anti-reverse modules, and the second end of each of the output ports is respectively connected to each of the controlled devices, and the method further includes: Outputting corresponding switch control signals to each of the output ports to allow the corresponding connected controlled device to enter a working state; When at least one of the controlled devices enters the working state, the state control signal of the first level state or the second level state is output to the driving module to control all the controlled devices entering the working state to synchronously switch to the corresponding first working state or second working state.

6. The control method of the IO expansion circuit according to claim 1, characterized in that: When the controlled device is an LED lamp, the output port is used to connect the LED lamp, and the method further includes: The microcontroller outputs the switch control signal in a first level state and the state control signal in a first level state, and the LED lamp is in a low brightness state; The microcontroller outputs the switch control signal in a first level state and the state control signal in a second level state, and the LED lamp is in a high-brightness state; The microcontroller outputs the switch control signal in a second level state, and the LED lamp is in a light-off state.

7. The control method of the IO expansion circuit according to claim 6, characterized in that: The LED lamp is connected to a photosensitive sensor, and the method further comprises: The photosensitive sensor senses the brightness of the environment in which the LED lamp is located, so that the microcontroller switches the working state of the LED lamp accordingly according to the brightness of the environment.

8. An IO expansion circuit, characterized in that: include: A microcontroller, a driving module, a current limiting and anti-reverse module and an output port, wherein the output port is used to connect a controlled device, and the microcontroller uses the control method according to any one of claims 1 to 7 to control the connected controlled device.

9. The IO expansion circuit according to claim 8, characterized in that: The current limiting and anti-reverse module includes a first current limiting resistor, a second current limiting resistor and a diode; The first end of the first current limiting resistor is used to connect to a power supply, the second end of the first current limiting resistor is connected to the anode of the diode, the cathode of the diode is connected to the first end of the second current limiting resistor, the second end of the second current limiting resistor is used to connect to the power supply, and the series node of the diode and the second current limiting resistor is connected to the output port.

10. The IO expansion circuit according to claim 9, characterized in that: The driving module includes a transistor, a first bias resistor and a second bias resistor; The collector of the transistor is connected to the series node of the first current limiting resistor and the diode, the base of the transistor is respectively connected to the first end of the first bias resistor and the first end of the second bias resistor, the second end of the first bias resistor is connected to the microcontroller, the second end of the second bias resistor is connected to the emitter of the transistor, and the emitter of the transistor is grounded.