PC817 and MCU connection circuit (pc and MCU communication)
Today, I will share with you the knowledge of the connection circuit between PC817 and MCU. It will also explain the communication between PC and MCU. If you can happen to solve the problems you are facing now, don't forget to pay attention to this site, let's start now!
List of contents for this article:
- 1、... To connect it to the MCU of STC15L204EA, can I use the optocoupler of PC817 directly?_ Baidu knows...
- 2、How to design the IO protection circuit of a microcontroller in plc
- 3、MCU PWM output controls current changes. How should hardware achieve it?
- 4、Usage of photoelectric isolation switch pc817, four-pin row, input and output connection method
- 5、Questions about the current limiting resistance of pc817 optocoupler circuit.?
- 6、... Development: The reason why the IO pin of STC microcontroller cannot drive the optocoupler PC817 and the solution (with PC817 parameters and...
... To connect it to the MCU of STC15L204EA, can I use the optocoupler of PC817 directly?_ Baidu knows...
Friends, you can substitute. It is completely possible to use the PC817, which has the same functions and features as the 817. In addition, the 521 and 621 models can also be used as replacements for the 817, and they are basically the same in performance. As an optical coupler, PC817 is widely used in signal isolation, data transmission and other fields. Its working principle is to use light emitting diodes and phototransistors to achieve isolated transmission of electrical signals.
Yes, drive at low level (sink current), pay attention to the maximum current limit of the IO port. Generally, optocoupler 5- 10mA will work, depending on the speed requirements.
Answer: ESP32 can generally follow the following steps when using PC817: Hardware connection: Connect the positive electrode of the LED of the PC817 to a GPIO pin of the ESP32, such as GPIO12, etc., and the negative electrode of the LED is connected to a current-limiting resistor and then grounded. The collector of the phototransistor of the PC817 is connected to the positive electrode of the power supply, and the emitter is connected to another GPIO pin of the ESP32, such as GPIO13, etc.

How to design the IO protection circuit of a microcontroller in plc
Optocoupler isolation: If the external circuit voltage and the MCU power supply voltage are completely different, optocoupler must be used to achieve electrical isolation to avoid high-voltage serial connection and burning the MCU. Typical models such as PC817 can achieve insulation withstand voltage of more than 2500V.
Assume that the microcontroller is powered by a 5V power supply. The input is very simple. Two voltage-dividing resistors are used to divide 24V into 5V and then directly connect it to any IO port of the microcontroller. If you need to respond to changes in the IO port in time, you can connect external interrupt pins. When the microcontroller detects a high level, it means that the 24V power supply is turned on, and a low level means that it is turned off. If an external interrupt is used, a rising edge trigger can be used. The interrupt means the moment when the power supply is turned on.
The single-chip microcomputer controls the turning on and off of the relay coil through a digital output port to achieve switching control for large current loads, but problems such as insufficient driving capacity, ground interference and reverse electromotive force protection need to be solved. The specific implementation steps and precautions are as follows: The output current of the IO port of the driving circuit design MCU is usually small (for example, the output current of a single IO port of the AVR MCU is about 20mA), and it is impossible to directly drive the relay coil (50-200mA current is required).
General IO pins are generally integrated with ESD protection diodes, bidirectional MOS transistor driver circuits, and pull-up/pull-down resistors. Only when the pins are configured by software to output at a specific level, will they be temporarily connected to VCC or GND through the internal driver circuit. Under normal conditions, they are in a high-impedance floating state.
The power supply circuit establishes driving power matching: Connect the VCC pin to a DC power supply consistent with the rated voltage of the load. For example, when driving a 12V relay, it is connected to a 12V DC power supply. It is strictly prohibited to connect to AC power supply. Common ground requirement: The GND pin must be completely common ground with the GND of the control terminal (MCU, PLC, etc.) to avoid false logic triggering caused by potential differences.
MCU PWM output controls current changes. How should hardware achieve it?
1. Connection method: Connect the LED in parallel with the capacitor, so that the brightness of the LED will change with the change of the voltage across the capacitor, so that the intensity of the LED's light can be controlled through the PWM signal, that is, the current through the LED is controlled. Summary: Through the design of the above hardware circuit, the microcontroller can control the conduction and cutoff of the optocoupler through the PWM signal, and then change the voltage across the capacitor through the RC charging circuit, and finally realize the control of the LED current.
2. This PWM generation circuit is mainly used for single-chip microcomputer control, and its basic principle is realized through the counter (CCR) of the single-chip microcomputer timer. As long as the MCU is equipped with a timer, PWM output can be easily realized. If the MCU has a dedicated PWM output module, the PWM output function can also be realized. After realizing PWM output, the signal usually needs to be amplified or converted by the driving circuit.
3. The PWM principle, the SG90 rudder control principle and the key points of the STM32CubeMx configuration output adjustable PWM wave are as follows: PWM principle: Definition: Pulse width modulation is a method of controlling the average power of a signal by changing the pulse width of an electrical signal. Working principle: By adjusting the pulse width, waveforms of different amplitudes and frequencies can be generated, thereby achieving precise control of current or power.
Usage of photoelectric isolation switch pc817, four-pin row, input and output connection method
The two input pins can be connected to the input signal, and the other to the resistor and ground. The input is positive; yes. 2. Can one of the two output pins be connected to the power supply resistor and the other to the MCU input? --- No, it must be connected here. Connect the MCU input to a drain resistor.
0v photoelectric switch wiring method Single-control single-open switch switch (single-pole, single-throw switch, controls one branch) wiring method: This switch has the simplest wiring. Usually, the wires are pre-threaded during construction. You only need to use a red line to connect the L terminal on the back of the switch, and a blue line to connect the L1 terminal.
0v photoelectric switch wiring method 220v photoelectric switch wiring method can be divided into single control single open switch, single open five-hole wiring, single open three-hole wiring, etc. Single-control single-open switch (that is, a rocker switch that controls a branch) wiring method: Single-open connection is the simplest. Generally, the center line is already threaded during construction. Generally, a red line is used to connect the L terminal on the back of the socket, and a blue line is used to connect the L1 terminal. It will be ok.
Questions about the current limiting resistance of pc817 optocoupler circuit.?
1. PC817 optocoupler circuit current-limiting resistorPC817 and MCU connection circuitThe core role of the LED is to protect the internal LEDsPC817 and MCU connection circuitPrevent damage caused by excessive current. The calculation of the current-limiting resistance is based on Ohm's law: R = Vr / IFPC817 and MCU connection circuit, where: Vr is the voltage across the resistor, equal to the supply voltage (Vs) minus the forward voltage drop (VF) of the LED, that is, Vr = Vs - VF.
2. A current-limiting resistor must be added between the anode and cathode of optocoupler 817, otherwise the circuit on the LED side will be directly burned.### The principle is based on the fact that the input side of the optocoupler 817 is an infrared light emitting diode, and its forward conduction voltage drop is about 2 V. The normal working current is generally recommended in the range of 5 to 20mA.
3. Recommended current-limiting resistor resistance value: $$R = \frac{5 - 2}{0.01} = 380Ω$$Actual selection can use 400Ω/1/8W carbon film resistor, which is a common matching solution in the industry.### Special circumstances add that if the front-end circuit already has its own series current-limiting circuit, and after actual measurement, the current of the optocoupler light-emitting tube can be controlled within the rated range, the external current-limiting resistor can be omitted. However, this situation is very rare and it is not recommended to omit it directly.
4. There are no fixed parameters for the current-limiting resistance of the optocoupler circuit. It is necessary to calculate and determine the basic parameters based on actual scenarios.##Determine the optocoupler model and forward current range: Get the recommended forward working current IF range from the corresponding optocoupler data sheet. For example, the common PC817, the recommended forward current is generally 5~20mA. Power supply voltage V: The power supply voltage on the input side, such as 5V, 12V, etc.
... Development: The reason why the IO pin of STC microcontroller cannot drive the optocoupler PC817 and the solution (with PC817 parameters and...
firstPC817 and MCU connection circuit, consider the current limiting resistor issue. The maximum allowable current on the input side of the PC817 is 50mAPC817 and MCU connection circuit, the voltage drop on the input side photodiode is 2 V. Using a single chip microcomputer 5V power supplyPC817 and MCU connection circuit, generally a current-limiting resistor needs to be added. The maximum value R1 is 18KΩ, and the minimum value R2 is 76Ω. Choosing a 660Ω resistor is appropriate. The problem may not be resistance. Then analyze the P2 pin parameters of STC15 MCU. P2 defaults to quasi-bidirectional port mode, and the sink current can reach 20mA, but the sink current is only 270uA.
An optocoupler can be connected between the IO port and the peripheral, so that the IO port of the microcontroller does not need to be directly connected to the load, which can effectively solve the problem of being affected by the peripheral.
Failure to connect while burning an STC microcontroller may be caused by a variety of reasons. The following is a detailed analysis and solution. Hardware connection problems Check the power supply to ensure that the power pins of the MCU are correctly connected and the power supply is stable. For example, the VCC pin should be connected to the appropriate supply voltage, typically 3V or 5V. If the power supply voltage is insufficient or unstable, it may cause the MCU to fail to work normally and it will not be possible to burn online.
About pc817 and MCU connection circuit scatter slots online slots online philippines,BAY888.com The world's leading slot game platform, providing exciting gaming experience and great rewards. Join now and start your journey to victory!,Thank you for taking the time to read the content of this site. Don't forget to look for more information on the communication between PC and MCU, and the connection circuit between PC817 and MCU on this site.
相关文章
Recommended for pc and ps4 to share a display (which is recommended for pc and ps4 to share a display)
How does nba2k24mt synchronize with pc (how does nba2k24 make the computer play by itself)
Comparison between Luxi PC1609 and 1615 (Luxi DMC quoted today)
Is it necessary to wait for a PC for the rise of monster hunters (minimum configuration requirements for the rise of monster hunters)
The price of pc material and pet material PVC material is higher (which is the better difference between pc and pet material)
How to set the proportion of vocal accompaniment and vocal accompaniment in pc national K songs (how to adjust the proportion of vocal accompaniment in national K songs)
