Home > Microcontroller >Microcontroller Production > Analysis of circuit design of MCU controlled relay

Analysis of circuit design of MCU controlled relay

Source: InternetPublisher:失踪的猫 Keywords: relay mcu circuit design Updated: 2025/01/24

Two ways to control relays

Controlling the relay to open and close is nothing more than controlling the on and off of the power supply or ground terminal of the relay. It is usually achieved by using a triode switch or a field effect transistor switch. Regardless of the solution, the idea is the same. The following will analyze the idea of ​​relay circuit design in terms of controlling the on and off of the power supply and the on and off of the ground using actual product circuits.

1. Control power on and off

The circuit in the figure below is a 12V relay control circuit of a device, which is used to control the on and off of the vehicle's oil circuit.

Wiring diagram:

Circuit Design Analysis of MCU Controlled Relay

Schematic diagram:

Circuit Design Analysis of MCU Controlled Relay

Let's analyze the circuit briefly:

VKK is the main power supply, CON_OIL+ is connected to one end of the relay coil, the other end of the relay coil is grounded, and CTRL_OIL is the MCU control pin.

CTRL_OIL ==》 Low level

When CTRL_OIL is set to low level, transistor Q23 is not turned on and the G of PMOS tube Q20 is

The pole is pulled high by resistor R77 and is not turned on, so no current flows through the relay and the relay is in the disconnected state.

CTRL_OIL ==》 High level

When CTRL_OIL is set to a high level, transistor Q23 is turned on, the G pole of PMOS tube Q20 is pulled down to 1/2 VKK, VGS < 0, PMOS tube Q20 is turned on, current flows through the relay coil, and the relay is in a closed state.

2. Control grounding on and off

The circuit in the figure below is a 12V relay control circuit of another device. The difference from the figure above is that this one controls the on and off of the relay ground terminal.

Wiring diagram:

Circuit Design Analysis of MCU Controlled Relay

Schematic diagram:

Circuit Design Analysis of MCU Controlled Relay

Let's analyze the circuit briefly:

VKK is the main power supply, one end of the relay coil is connected to the power supply, YOULU- is connected to one end of the relay coil, and YOULU_CTRL- is the MCU control pin.

YOULU_CTRL-==》 Low level

When CTRL_OIL is set to a low level, transistor Q7 is turned on, transistor Q5 is turned on, current flows through the relay, and the relay is in a closed state.

YOULU_CTRL- ==》 High level

When CTRL_OIL is set to a high level, transistors Q7 and Q5 are not turned on, no current flows through the relay coil, and the relay is in an open state.

The diode connected in parallel to the relay is called a freewheeling diode, which is used to eliminate the influence of the reverse electromotive force generated when the relay is disconnected on the circuit. When using a freewheeling diode, when the current of the inductive load changes or decreases suddenly, its current can change more smoothly, avoiding the generation of sudden voltage.

This schematic uses 1N4007, a general-purpose diode, which is generally used for rectification. The unidirectional conductivity of this ordinary diode depends on the PN junction formed by the contact between the P-type semiconductor and the N-type semiconductor. Due to the existence of junction capacitance, the reaction time is not too short, so at the moment the switch circuit is disconnected, the ordinary diode may not have time to turn on, which is equivalent to not using a freewheeling diode. It will still generate a large reverse electromotive force, so it would be better to use a Schottky diode.

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号