Monday, 25 April 2016

PC-Based Equipment Controller

Windows-based project that can control up to eight electrical devices using a personal computer. Connecting a computer to external devices is becoming essential in our day-to-day life for automation. But to communicate to a device we need a common communication protocol such as a serial COM port, USB or wireless connectivity. Here we have used the serial communication protocol to control the devices.
                              
This project was inspired by the construction project, ‘Multiple Device Switching Through PC’s Parallel ports are not in use any more, nor are they available on PCs and laptops. So we have designed this project for the serial port, which is still being used for communication in some PCs. 

Circuit and working

The circuit diagram is shown in Fig. 2. It consists of micro-controller AT89C2051 (IC1), MAX232 driver (IC2), eight opto-TRIAC drivers MOC3041 (IC3 through IC10), eight BT136 TRIACs and a few other common components.

Power supply.

The 230V, 50Hz AC mains is stepped down by transformer X1 to deliver a secondary output of 12 V, 500mA. The transformer output is rectified by full-wave rectifier module BR1, filtered by capacitor C6 and regulated by IC 7805 (IC11). Capacitor C7 bypasses the ripples present in regulated supply. The regulated 5V is used to power the micro-controller, MAX232 driver, MOC3041 opto-TRIAC drivers and BT136 TRIACs. LED1 indicates presence of power supply.

Micro-controller. 

The AT89C2051 is a low-voltage, high-performance CMOS 8-bit micro-controller with 2k bytes of Flash programmable and erasable read-only memory. The device is manufactured using Atmel’s high-density non-volatile memory and is compatible with the industry-standard MCS-51 instruction set. It has 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five-vector two-level interrupt architecture, a full duplex serial port, a precision analogue comparator, an on-chip oscillator and clock circuitry. an 11.0592MHz crystal is used as the external clock source. You may use two 33pF capacitors along with the crystal to get proper oscillation frequency.

The devices are controlled through its port pins P1.0 through P1.7. The controlling is done by the user from the PC with the user interface shown in Fig. The micro-controller is connected to the PC through MAX232 driver as shown in Fig. 2.

                                                      
                                                        Fig. 2: Circuit of PC-based equipment controller

MAX232.

The serial output of the computer is connected to MAX232 driver IC2 through DB9 connector as shown in Fig. 2. The MAX232 IC is used for the long-distance and error-free transmission of data. It has two internal charge-pumps that convert +5V into ±10V for RS232 driver operation. Pins 11 and 12 of IC2 are connected to pins 3 and 2 of micro-controller IC1, respectively. serial data command from the PC is received by micro-controller IC1 through driver IC2. The micro-controller then triggers independent opto-TRIAC drivers for devices corresponding to the command received.

RS232 serial port was once a standard feature of a personal computer, used for connections to modems, printers, mice, data storage, uninterruptible power supplies and other peripheral devices. Now, since it is becoming obsolete, one has to use an external USB-to-RS232 converter to connect to RS232 peripherals.

MOC3041.

TRIAC MOC3041 is a TRIAC driver, with inbuilt zero-crossing detector. The zero-crossing, optically-isolated TRIAC driver is an effective solution to interface the micro-controller ports with the AC power loads. A set of TRIAC driver and TRIAC is used for each load. When a particular load is switched on with the help of the personal computer, the particular TRIAC-driver of the corresponding device/load latches on. This action introduces gate current in the TRIAC (BT136).

                                       

BT136. 

TRIAC BT136 is a solid-state switch used for switching the electrical devices. It is a 3-pin device normally available in a TO220 plastic package. It has three terminals—MT1, MT2 and G (gate).

PCB and Component Layout


                                                                            component layout for the PCB

                           
                                                                                  
                                                                                     single sided PCB

Download PCB and Component Layout PDFs: Click here

The TRIAC can be triggered by the current going into the gate. To create a triggering current, a positive or negative voltage has to be applied to the gate with respect to the MT1 terminal. Once triggered, the device continues to conduct until the current drops below a certain threshold called the holding current. When the gate current is discontinued, and if the current flowing between the two main terminals is more than what is called the latching current, the device keeps conducting.
After the TRIAC is turned on, removing the voltage at the gate will not turn the TRIAC to the off state. The only way the TRIAC can be turned off is by reducing the gate current below the holding current or reducing the current to zero by removing the voltage across MT1 and MT2.
When sufficient current of the internal LED (MOC3041) is present, the TRIAC will re-trigger every half cycle of AC line voltage until the internal LED switches off and the power TRIAC has gone through a zero current point. The internal LED is turned on by the user from the PC, which in turn triggers the corresponding TRIAC, and the device connected across the TRIAC is switched on. Thus, each electrical device or appliance is controlled through a solidstate switch using a TRIAC and an opto-TRIAC.
Component List

Download Source Code: Click here

The software program

Here serial communication is used to communicate with micro-controller IC1, and the micro-controller controls the device drivers. For the serial data transfer using RS232 protocol, the micro-controller and the PC should have the same baud rate. Here the baud rate is fixed at 9600 bits per seconds. With eight data bits and one stop bit, the parity is set as ‘none’ and the flow control is hardware in both the micro-controller and the computer. This is the basic setting for the serial data transfer used in the project.
                            
Two programs are used in this project. One is the firmware code for the micro-controller and the other is the user interface program.
                            
Keil µVision is used for coding the firmware for the micro-controller and generating the hex code. The hex code can be burnt into the micro-controller using any compatible programmer board from Atmel, such as TopView programmer.
Construction and testing

An actual-size, single-side PCB for PC-based electrical equipment control circuit is shown in Fig and its component layout is shown in Fig Assemble the circuit on the PCB to save time and avoid assembly errors. Carefully assemble the components and double check for any short-circuit errors in the circuit. Burn the hex code into the micro-controller using a suitable programmer.
Run the VB program and you will see the welcome screen shown in Fig. You need to enter the serial COM port in next screen. In this example, we have used COM 4 as shown in the screenshot in Fig. Clicking the ‘OK’ button will lead you to the main control panel, where you can control the appliances using the mouse by clicking on the corresponding device’s button as shown in the screenshot in Fig. You can either control the devices individually, or all eight at a time. If you click the ‘load1’ button, you will see low voltage at port pin 12 of the micro-controller. Then the first device will be turned on. Press reset switch S1 momentarily in case the device does not turn on. For more troubleshooting, refer to the test points listed in the table.

1 comment:

  1. pcs electronic components

    PC’S, ELECTRONIC COMPONENTS LEARN MORE What is PC’S, ELECTRONIC COMPONENTS? Electronic Components As a computer professional, you should be familiar with the more

    common types of electronic components within a power supply. Here is a description of the basic components found on circuit boards inside a computer.Before the advent

    of…

    Visit to- sunoltech.com for more details

    ReplyDelete