Electromagnetic relay control technology based on PIC16F87X single chip microcomputer

Electromagnetic relay is a commonly used component in automatic control. It uses electromagnetic principles to realize an automatic switch that connects or disconnects one or a group of contacts. It is widely used in electronic equipment, instruments and automation equipment. However, in various automatic control equipment, there is a problem of interconnection between a low-voltage automatic control circuit and a high-voltage electrical circuit: on the one hand, the control signal of the low-voltage electronic circuit can control the actuator of the high-voltage electrical circuit; on the other hand, Provide good electrical isolation for electronic circuits and electrical circuits to protect the safety of electronic circuits and personnel. To this end, using PIC16F87X single-chip microcomputer control electromagnetic relay to try to complete this bridge role.

1 Working principle of electromagnetic relay

An electromagnetic relay is a relay that generates a predetermined response from the relative motion of mechanical components under the action of current in the input circuit. Electromagnetic relays are generally composed of control coils, iron cores, armatures, contact reeds, etc. The control coils and contact groups are insulated from each other, which provides good electrical isolation for the control circuit. It mainly uses the principle of electromagnetic induction to work.When the rated voltage of the coil is added to both ends of the coil of the relay, a certain current will flow through the coil, thereby generating an electromagnetic effect, and the armature will be under the action of electromagnetic force attraction. Overcome the pulling force of the return spring and attract the iron core, so that the moving contact of the armature and the static contact (normally open contact) are attracted; when the coil is powered off, the electromagnetic suction force also disappears, and the armature will be in The reaction force returns to the original position, so that the moving contact is attracted to the original static contact (normally closed contact). The pull-in and release of the relay play the role of switching on and off in the circuit. Choose the electromagnetic relay should pay attention to the following points:

(1) Selection of the rated working voltage of the relay. When using a relay, you should first understand the working power supply voltage in the circuit where the relay is located.The working voltage of the relay should be equal to this voltage, or the circuit power supply voltage is 80% of the working voltage of the relay. The voltage exceeds the rated working voltage of the relay, otherwise the relay coil is easily burned.

(2) Selection of relay contact load. The number and form of contact load should be determined according to the characteristics of the circuit controlled by the relay, and then the size of the contact capacity should be selected according to the type of current, voltage and current in the contact control circuit. The size of the contact capacity reflects the voltage applied to the contact and the ability to pass the contact current. The load of the general contact should not exceed the capacity of the contact.

(3) Selection of relay coil power supply. Under normal circumstances, the circuit design uses DC relays, and the types of relays can also be considered according to the characteristics of the control circuit, as well as the power consumed by the relays.

(4) Selection of relay operation time. The action time and release time of the relay should be selected according to the actual circuit's time requirement for the action of the controlled object. It is also possible to add electronic components to the relay circuit to accelerate or delay the action and release time of the relay to meet different requirements.

(5) Working environment conditions. When choosing a relay, the ambient temperature, working life, and shock and vibration should also be considered.

2 PIC16F87X control circuit design

2.1 Features of PIC16F87X

The PIC16F87X series of 8-bit microcontrollers introduced by Microchip is a high-performance embedded single-chip microcomputer that uses a reduced instruction set (RISC) structure and Flash storage technology.It runs fast, has rich expansion functions, powerful functions, and a clear logical structure. Power-on, power-off reset protection and watchdog functions.

2.2 Principle of relay control circuit

Based on many characteristics of PIC16F87X, the hardware circuit of PIC16F87X control relay is designed (see Figure 1).

PIC16F87X control relay hardware circuit

Figure 1 Schematic diagram of the PIC16F87X control relay circuitWhen the RD0 pin of the single-chip microcomputer outputs a low level, the optocoupler U1 is cut off, there is no potential difference between the two ends of the relay coil, the relay armature is released, and the normally open contact of the relay is released, which is equivalent to a switch off; when the single-chip microcomputer When the RD0 pin outputs a high level, the optocoupler U1 is saturated and turned on, and 24V power is applied to both ends of the relay coil. The relay pulls in and its normally open contact closes, which is equivalent to a switch close.

At the moment when the optocoupler is cut off, the current in the coil cannot mutate to zero, and a higher voltage induced electromotive force will be generated across the relay coil.A diode D1 should be placed on both ends of the coil to release the induced electromotive force generated by the coil through D1. Protect the triode from breakdown, and eliminate the interference of induced electromotive force to other circuits.

2.3 PIC16F87X control software design

The PIC16F87X control software is developed in C language under the MPLABIDE environment and compiled using the PICC compiler developed by Hitech. The program flow is shown in Figure 2.

The source program of the relay control software is as follows:

Relay control software source program

After the source program is compiled, it is programmed into the PIC16F87X through ICD2 programming. The control circuit is powered on and the relay is turned on and off repeatedly within the specified time. You can hear the relay ringing continuously, and observe the RD0 output with an oscilloscope. The signal is shown in Figure 3.

The oscilloscope observes the signal output by RD0

3 Conclusion

The electromagnetic relay based on I6X single-chip microcomputer control uses a photocoupler to drive and isolate the relay; the diode freewheel is used to prevent the high back pressure that occurs when the current in the relay coil is cut off, and the device that drives the relay is protected. The circuit is simple in design, reliable in operation, and has certain application value.

Welcome to reprint, this article comes from the electronic enthusiast network (http: //)

Christmas light

Are you still looking for that little something extra to liven up your living room and party decorations? Offering a fun way to feature photos at birthdays, Christmas, weddings, parties and retirement celebrations, these string lights work well with many decor types including dorm rooms, bedrooms, and living areas, adding that special glow for homemade crafts and decorations. Whatever creative vision you have, they will surely be a great fit and brighten the mood wherever they are. They are the perfect cost and energy efficient solution to all of your home dcor desires. Elevate your entertainer status and be the talk of the town at your next event with these one of a kind photo clip Led String Lights.

Product Feartures:

1.)High Quality & Energy Efficient:The tube lights is IP65 Waterproof, dustproof; transparent PC material, corrosion resistant, cost resistant, aging resistant, more durable; free from time and space constraints. Low power consumption and energy saving.

2.) Meteor Shower Effect with Romantic Aesthetic: Led meteor shower lights, the light of every bulb turns on and out one by one in sequence and quickly just like meteor shower or falling snow in the night sky, multi-colored, very beautiful. It can be used as one, or be connected (as much as five string lights).

3.) Package Content: 1 x LED Meteor Shower Light

Led Icicle Light

Led Icicle Lights,Led Icicle Christmas Lights,White Led Icicle Lights,Led Ice Cycle Lights

XINGYONG XMAS OPTICAL (DONGGUAN ) CO., LTD , https://www.xingyongxmas.com