Embedded basic circuit design and common chip usage


1. Basic circuit

1. Button circuit

Insert image description here
Observing the above circuit we can see:

  • Pin when buttonSW1 is not pressedBTN1 is followed by3V3, so the default is high level
  • The button will generate mechanical vibration at the moment of pressing and releasing, which may cause instantaneous contact and separation between the button contacts, thereby causing the jitter of the button signal. Jitter refers to the multiple opening and closing cycles caused by unstable contact when a button is pressed or released, which may cause false triggering of the circuit or unstable signals.
  • Resistor function: A resistor voltage dividing network is formed on the signal line of the button to limit the current. The purpose of this is to reduce the instantaneous current of the key contact to prevent excessive current from flowing through the key contacts, thereby reducing the jitter caused by the contact.
  • Capacitor function: Used to filter out high-frequency noise. Because the key signal may be affected by external factors such as power supply noise, interference, or electromagnetic radiation, these interference signals may introduce high-frequency noise on the key signal line. Through parallel capacitors, these high-frequency noises can be directed to the ground to maintain the stability of the key signal.

2. Crystal oscillator circuit

Insert image description here

  • A 22pF capacitor is connected to the 8M high-speed crystal oscillator, while a 10pF capacitor is connected to the 32.768k low-speed crystal oscillator. This is because the high-frequency crystal oscillator has a higher oscillation frequency and requires a larger capacitance value to resonate with the crystal oscillator to ensure oscillation stability. Larger capacitance values ​​provide proper compensation and load capacitance. For low-speed 32.768 kHz crystal oscillators, a 10 pF capacitor is often used. The oscillation frequency of low-frequency crystal oscillators is lower, so a smaller capacitor value is required to resonate with the crystal oscillator. Smaller capacitance values ​​provide more appropriate compensation and load capacitance to meet the operating conditions of low-frequency crystal oscillators.

3. Buck circuit

Insert image description here

  • Diode: used to protect the circuit from reverse voltage damage. When the polarity of the input voltage is wrong or the power supply is turned off, the diode blocks the flow of reverse current, thereby protecting other circuit components from damage; in a half-wave or full-wave rectification circuit, the diode functions to convert the AC signal into a DC signal Function; adjust voltage.
  • Size capacitor: Filter component: to reduce ripple or high-frequency noise in the output voltage. When the input voltage undergoes step-down conversion, there may be some AC components or high-frequency noise components. By connecting a capacitor to the output, these high-frequency components can be conducted to ground, thus smoothing the output voltage. Stable output voltage: The charging and discharging characteristics of the capacitor can help stabilize the output voltage. Reduce switching interference: In some switching power supply buck circuits, capacitors are also used to reduce switching interference

2. Common chips

1. SN74HC244PWR

SN74HC244PWR is a three-state buffer/driver chip. Its main function is to provide signal buffering and driving functions in the circuit. Mainly used for signal buffering, driving and isolation to improve circuit performance, stability and reliability. It is widely used in digital circuits, communication systems, computer interfaces and other electronic equipment.

can generally be used for the output ofserial port signals in actual circuit design

It has 20 pins and here is a detailed analysis of each pin:
Insert image description here

  • 1A1: Input port 1A1, used to receive input signals.
    1Y1: Output port 1Y1, corresponding to the output signal of input port 1A1.
  • 2A1: Input port 2A1, used to receive input signals.
    2Y1: Output port 2Y1, corresponding to the output signal of input port 2A1.
  • 3A1: Input port 3A1, used to receive input signals.
    3Y1: Output port 3Y1, corresponding to the output signal of input port 3A1.
  • 4A1: Input port 4A1, used to receive input signals.
    4Y1: Output port 4Y1, corresponding to the output signal of input port 4A1.
  • 1A2: Input port 1A2, used to receive input signals.
    1Y2: Output port 1Y2, corresponding to the output signal of input port 1A2.
  • 2A2: Input port 2A2, used to receive input signals.
    2Y2: Output port 2Y2, corresponding to the output signal of input port 2A2.
  • 3A2: Input port 3A2, used to receive input signals.
    3Y2: Output port 3Y2, corresponding to the output signal of input port 3A2.
  • 4A2: Input port 4A2, used to receive input signals.
    4Y2: Output port 4Y2, corresponding to the output signal of input port 4A2.
  • 4OE: Output enable pin, used to control whether the output port is valid.
  • VCC: Positive power pin, connected to the positive power supply (usually 5V).
    GND: Ground pin, connected to the ground/negative terminal of the circuit.

main effect:

  • 1. Buffer function: SN74HC244PWR can amplify, stabilize and isolate the input signal to provide a stronger output signal. It can prevent interference or deformation of the input signal from affecting subsequent circuits, thereby ensuring the reliability and stability of signal transmission.

  • 2. Driver function: SN74HC244PWR can drive heavier loads, such as logic gates, memories, etc., to ensure that signals can be effectively transmitted to the target device or circuit. It provides high drive capabilities, allowing signals to be transmitted over long distances in circuits without loss of quality.

  • 3. Three-state function: SN74HC244PWR has a three-state output function, that is, the output port can be in high level, low level or high impedance state. This allows multiple chips to be shared on the same bus and the outputs selectively enabled or disabled by controlling the enable pins.

  • 4. Circuit isolation: SN74HC244PWR can achieve circuit isolation between input and output to prevent signal feedback and interference. This is important to protect sensitive components in circuits or prevent interference.

2. TLP2362

TLP2362 is an optocoupler chip used to isolate and transmit electrical signals. Electrical isolation is achieved through optical coupling between input and output. This means that the signal transmission between the input and output circuits is by light rather than direct current transmission. The isolating nature of optocouplers helps provide electrical isolation and noise suppression, thereby enhancing system stability and security.

The TLP2362 is a digital input and digital output optocoupler suitable for interfacing directly with the digital pins of an MCU. It can be controlled and communicated via logic levels (high or low).

can generally be used for the transmission ofPWM signals in actual circuit design.

Has two main pins:
Insert image description here

Input pin: It is the pin connected to the input signal (as shown in the figure above LF_PWM). When the input signal is applied to this pin, the LED will emit a light signal.

Output pin: It is the pin connected to the phototransistor (as shown in the figure above LF_PWM_OUT). When the LED emits a light signal, the phototransistor will sense the light and generate a corresponding electrical signal output.

By using the TLP2362 for electrical isolation, the PWM signal can be efficiently transmitted into the target circuit while maintaining isolation and stability of the input and output circuits.

3. ACS724

ACS724 is a Hall effect-based current sensor chip for measuring DC or low-frequency AC current. It uses an integrated Hall sensor to sense the magnetic field and convert the current signal into a voltage output proportional to the input current.

Insert image description here
The following is the basic principle of current measurement by ACS724:

  • 1. Connect the circuit: Connect the input pin of ACS724 to the loop of the current to be measured. Typically, the current passes through the sensing path of the ACS724, and the line between the positive and negative poles of the current to be measured can be introduced into the sensing port of the ACS724.

  • 2. Hall effect measurement: ACS724 uses an integrated Hall sensor to sense the current through the sensing path and convert it into a voltage output. Hall sensors sense the magnetic field generated by passing an electric current and generate a voltage signal.

  • 3. Output voltage: The output of ACS724 is an analog voltage whose magnitude is proportional to the input current. The output voltage is usually specified in the chip specification and can be amplified and processed by external circuitry to fit the MCU's input range.

  • 4. Read output: The output voltage of ACS724 can be read by connecting the output pin of ACS724 to the analog input pin of MCU. Using the analog input function of the MCU, you can obtain a voltage value proportional to the input current.

  • 5. Calibration and Calculation: In order to obtain accurate current values, you may need to perform calibration. Calibration typically involves measuring the ACS724's output voltage at a known current and using that information to establish a relationship between current and output voltage. The measured output voltage is then converted to the corresponding current value using a calibration curve or equation.

Note that the output of the ACS724 is an analog voltage, so you need to match it to the analog input pins of the MCU and ensure that the resolution and sampling rate of the MCU's ADC (analog-to-digital converter) are sufficient for the required accuracy and response time

4.LM358

The LM358 is a dual operational amplifier chip commonly used in signal amplification, filtering, comparison and arithmetic applications. It consists of two independent operational amplifiers and has the characteristics of low power consumption, wide voltage supply range and high common mode rejection ratio. It can be used to measure voltage, but it requires appropriate external circuitry to implement the voltage measurement function.

Insert image description here
Here is a basic voltage measurement circuit using an LM358 to measure the voltage of a motor:

  • 1. Connect the circuit: Connect the positive pole of the motor to the positive power supply of the circuit, and the negative pole to the negative ground of the circuit. Make sure that the power supply range of the circuit is suitable for the operating voltage range of the LM358.

  • 2. Voltage divider circuit: Use a resistor divider circuit to reduce the high voltage of the motor to a range suitable for the LM358 input. This can be accomplished by connecting two suitable resistors between the positive and negative terminals of the motor. Select the resistor values ​​to obtain the desired voltage divider ratio so that the divided voltage fits within the input range of the LM358.

  • 3. Connection to LM358: Connect the output of the voltage divider circuit to the non-inverting input pin (+) of one of the op amps of the LM358. Connect the inverting input pin (-) of this op amp to ground. Connect the output pin of the op amp to an MCU or other device that reads the voltage.

  • 4. Power supply and pin connections: Make sure the LM358's power pins are properly connected to the appropriate supply voltage and ground. Also connect the op amp's pins to achieve the desired operating mode and functionality.

  • 5. Read the output: Use MCU or other devices to read the voltage output by the LM358. Depending on the specifications and circuit design of the LM358, you can get a voltage output proportional to the motor voltage.

It should be noted that the LM358 is an operational amplifier with a relatively high input resistance and can accept higher voltages, but the resistor voltage dividing ratio and circuit design still need to be selected according to specific application requirements to ensure the measured voltage Within the input range of LM358.

5.EL357-NB

EL357-NB is an optocoupler chip that integrates light-emitting diodes and photodiodes. It is a high-speed, high-precision, analog input and digital output optocoupler that needs to be connected to the analog input pin of the MCU or used. ADC (Analog-to-Digital Converter) performs signal sampling and processing.

can generally be used for the output of control signals in actual circuit design, such as relays.

Insert image description here
function:

  • 1. Electrical isolation: EL357-NB can achieve electrical isolation between input and output circuits. Through the optical isolation design, there is no direct electrical connection between the current and voltage at the input and output ends, thus avoiding potential electrical interference and noise propagation. This electrical isolation improves system safety and reliability and reduces possible failures and damage.

  • 2. Signal transmission: EL357-NB transmits the input signal by modulating the light output of the LED. When the input signal changes, the light output of the LED changes accordingly. After receiving these changing optical signals, the photodiode converts them into corresponding electrical signals, thereby realizing the transmission of the input signal to the output signal. This photoelectric conversion process can isolate and transmit various types of signals, such as digital signals, analog signals, pulse signals, etc.

  • 3. Noise suppression: Since EL357-NB achieves optical isolation, it can effectively suppress noise and interference signals from the input circuit. Noise and interference at the input end will not propagate to the output end, thus improving the purity and reliability of the output signal. This has important implications in noise-sensitive applications such as measurement, control and communication systems.

  • 4. Voltage level shift: EL357-NB can also realize voltage level shift between input and output circuits. Due to the existence of electrical isolation, the input and output terminals can be at different potentials, thereby enabling signal transmission and interconnection between high-voltage systems and low-voltage systems.

6. SMBJ30CA

The SMBJ30CA is an electronic component that is a bidirectional protective diode commonly used to protect circuits from overvoltage or overcurrent. The main function is to provide overvoltage protection in the circuit. When the voltage in the circuit exceeds the set threshold (30V), the SMBJ30CA will automatically turn on and guide the overvoltage voltage to ground to protect other circuit components from damage.

Insert image description here
SMBJ30CA specific meaning:

  • SMBJ: Indicates the SMBJ package type, which is a surface mount device package with a rectangular shape and small size suitable for mounting on a printed circuit board.

  • 30: Indicates that the rated reverse working voltage (V_RWM) of this diode is 30V. This means that under normal operating conditions, the diode can withstand a reverse voltage of no more than 30V.

  • CA: Indicates that the diode is a bidirectional protective diode with bidirectional voltage protection function. It protects the circuit from forward and reverse overvoltage damage.

Guess you like

Origin blog.csdn.net/Dustinthewine/article/details/134741668