First, the serial port is secret

The serial port is one of the main external interfaces of the computer. There are many devices connected through the nine-pin serial port, such as serial mouse, MODEM, and tablet. The schematic diagram of the 9-pin serial port is shown in the figure. The definition of each pin is as follows:

How to use the computer serial port to achieve automatic control

The initial state 4 pin is low level. When the serial port is open, the 4 pin is high level, the serial port is closed, and the 4 pin is restored to the low level. Therefore, the high and low levels of the 4 pin can be skillfully used to control the power of other appliances.

Since the output current of each pin of the serial port is very small, it is not enough to drive the relay to work. Therefore, it is necessary to take 5V power from the USB port of the computer (the 5V power supply current of the USB port can reach 500mA, and the 5v relay can be fully driven). The specific circuit is as shown in the figure below. .

The serial port 4 of the computer is connected to the base of the T1 via R1, and controls the conduction and the cutoff of the T1, thereby controlling whether the relay J1 is sucked.

Tl adopts NPN type 9013, the resistance value of Rl is generally between l~lOkΩ, other components can be according to the parameters in the figure. After this circuit is soldered, it can work normally without debugging.

How to use the computer serial port to achieve automatic control

Second, the use of VB to achieve serial port control

In the Visual BasIC 6.0 integrated development environment, select the "Project" menu, then click the "Parts" menu item, select the "MicroSOFt Comm Control 6.0" option in the pop-up "Parts" dialog box, after confirmation, the toolbox will appear " The MSComm tool, add the control "MSComml" on the form as shown below.

How to use the computer serial port to achieve automatic control
How to use the computer serial port to achieve automatic control

In this way, the VB language programming and interface design are adopted in the upper computer, and the automatic control is conveniently realized by using the serial port with the circuit cleverly.

Interactive Smart Board

Interactive Smart Board,Smart Boards,Smart Board Projector,Smart Electric Board

ALLIN , https://www.nbdisplayapio.com

Posted on