HomeElectronicsLow-Price Automation Utilizing PIC16F676 | Full Electronics Venture

Low-Price Automation Utilizing PIC16F676 | Full Electronics Venture


Sani & DwivediThere are various forms of residence and industrial automation methods accessible out there. These embrace IR distant controller, Bluetooth residence automation, DTMF residence automation, Wi-Fi residence automation, RF residence automation, and voice managed residence automation. The one offered here’s a low-cost automation system. It may be used at residence or in an industrial atmosphere to change gadgets on and off.

IR distant controllers and receivers comply with customary protocols for sending and receiving the info. A few of the customary protocols are NEC, PHILIPS RC5, JVC, and SIRC (Sony infrared distant management). We can be utilizing the NEC protocol for this challenge. After understanding the body format of IR distant, we’ll interface IR receiver TSOP1738 with PIC16F676 microcontroller to decode the important thing pressed from an NEC IR distant, as proven in Fig. 1.

VIRE NEC IR remote
Fig. 1: VIRE NEC IR distant

Every bit is transmitted utilizing the heartbeat distance, as proven in Fig. 2. Logical ‘0’ is a 562.5µs pulse burst adopted by a 562.5µs area, with a complete transmit time of 1.125ms. Logical ‘1’ is a 562.5µs pulse burst adopted by a 1.6875ms area, with a complete transmit time of two.25ms.

Pulse distance frame
Fig. 2: Pulse distance body

When a secret is pressed on the distant controller, the message transmitted consists of the next within the order beneath:

  1. A 9ms main pulse burst (16 instances the heartbeat burst size used for a logical information bit)
  2. A 4.5ms area
  3. The 8-bit tackle for the receiving system
  4. The 8-bit logical inverse of the tackle
  5. The 8-bit command
  6. The 8-bit logical inverse of the command
  7. A remaining 562.5µs pulse burst to indicate the tip of message transmission

The 4 bytes of information bits every are despatched with least important bit first. Fig. 3 illustrates the format of an NEC IR transmission body for an tackle of 00h (00000000b) and a command of ADh (10101101b).

Format of an NEC IR transmission frame
Fig. 3: Format of an NEC IR transmission body

A complete of 67.5ms is required to transmit a message body. It wants 27ms to transmit the 16 bits of tackle (tackle+inverse) and the 16 bits of command (command+ inverse).

Desk 1 reveals 32-bit NEC body format and Desk 2 reveals the entire record of IR key codes for the NEC IR distant.

NEC FramePIC16F676 controller

PIC16F676 is Microchip’s 8-bit CMOS PIC microcontroller with flash reminiscence. It is available in a 14-pin bundle with high-performance RISC CPU, which makes it a really perfect selection for many digital functions associated to embedded methods or industrial automation. This tiny chip incorporates the whole lot it’s worthwhile to develop particular person initiatives. A few of its options are:

  • The flash reminiscence of high-performance PIC16F676 helps in growing the processing pace of the microcontroller.
  • It is available in PDIP, SOIC, and TSOP packages, all of which can be found in 14-pin configuration.
  • PIC16F676 incorporates program reminiscence with reminiscence area round 1.7kB, whereas RAM and EEPROM reminiscences are of 64 bytes and 128 bytes, respectively.
  • One 10-bit ADC module within the system comes with eight analogue channels. This module performs an important function for sensor interfacing and changing analogue values to digital.
  • Energy-on reset, comparator, in-circuit serial programming, and grasp clear reset are another options included within the system. These assist it keep forward of the opposite onboard chips and removes the necessity of shopping for exterior parts for finishing up completely different operations. Pin diagram of PIC16F676 is proven in Fig. 4.
Pin diagram of PIC16F676
Fig. 4: Pin diagram of PIC16F676

Circuit and dealing

The challenge makes use of PIC16F676 microcontroller and an NEC IR distant to change on/off any AC load, together with lights and followers, from the consolation of your chair or mattress. The completely different IR alerts from the distant for the completely different lights and followers are obtained by the microcontroller, which then controls the respective relays by way of a relay driver circuit. These relays are used to change the lights and followers on or off.

NEC remot listThere are various forms of IR distant controllers accessible for various gadgets, however most of them work round 38kHz frequency. This challenge requires an bizarre IR TV distant. For detecting the IR alerts, TSOP 1738 IR receiver proven in
Fig. 5 is used. It will possibly sense the 38kHz frequency sign.

TSOP 1738 IR receiver
Fig. 5: TSOP 1738 IR receiver

The block diagram of the challenge is proven in Fig. 6.

Block diagram
Fig. 6: Block diagram

On this challenge the digital IO pins RC0, RC1, and RC2 of Port C of PIC16F676 microcontroller are used to regulate the relays to change the home equipment on/off. These pins are configured as output pins in this system. The IR receiver is related to pin RC4 of PIC16F676, which is configured as enter pin in this system.

The PIC16F676 microcontroller operates at +5V. Therefore, a transformer is used to step down the 230V AC mains provide, which is rectified utilizing a full-wave rectifier. The rectified voltage is regulated to +5V through the use of regulator IC 7805. The whole circuit diagram is proven in Fig. 7.

part list

The working of this challenge is pretty easy. When a button is pressed on the IR distant, it sends a sequence of codes within the type of encoded pulses utilizing 38kHz modulating frequency. These pulses are obtained by the TSOP 1738 sensor after which learn by the microcontroller. The microcontroller decodes the obtained prepare of the pulses right into a hex worth and compares it with the predefined hex values in this system.

At any time when a secret is pressed on the IR distant, the transmitted IR sign is obtained by an IR receiver and the secret is decoded by the software program. On this challenge, your entire 32-bit string (4 bytes of NEC protocol) is used for decoding. On this 32-bit string, the third byte is in contrast in this system for controlling the lights/followers. If any match happens, the controller performs a relative operation by triggering the respective relay by way of transistor BC547 and the corresponding result’s indicated by an on-board LED. The three LEDs within the circuit present the standing of the relays.

On this challenge, key numbers 2, 4, and 6 of the IR distant have been used for controlling the three relays. Key 2 toggles relay RL1, key 4 toggles relay RL2, and key 6 toggles relay RL3.

Software program

The circuit makes use of the software program program loaded into the inner reminiscence of PIC16F676. This system is compiled utilizing Mikro C PRO model 7.2.0 for PIC compiler and uploaded into PIC16F676. The software program fundamental.c is written in embedded C language, which permits writing the code inside a couple of traces. The generated hex code is burnt into the MCU chip utilizing PIC K150 programmer board.

No header, interrupt, or seize and examine mode is used right here to detect IR sign. Digital pin RC4 reads the info, similar to we learn a push button. At any time when sign goes excessive or low, debouncing is adopted and the timer is run. At any time when the pin modifications its state to a different, the time values are saved in an array.

Fuse bit settings
Fig. 8: Fuse bit settings

IR distant sends logic 0 as 562.5µs pulse and logic 1 as 2250µs pulse. At any time when timer detects 562.5µs pulse, this system assumes it to be 0, and when it detects 2250µs pulse, it assumes it to be 1. Then this system converts it into hex. The incoming sign from distant incorporates 32 bits (4 bytes). Program shops all of the bytes within the array after which decodes the third byte to make use of for comparability.

The straightforward programming assertion ‘change’ case is used to detect and management the house home equipment.

Don’t forget to set fuse bits earlier than programming PIC16F676 utilizing PIC K150 programmer. This system won’t work with out setting the fuse bits. The fuse bit settings are proven in Fig. 8.

Development and testing

An actual-size PCB structure for the automation system is proven in Fig. 9 and its element structure in Fig. 10. After assembling the circuit on PCB, enclose it in an appropriate field. Receiver IR1 needs to be mounted on the entrance panel, in order that the distant can concentrate on it to activate any load related to the respective relay. CON1 needs to be mounted on again facet of the cupboard. All of the three 230V AC home equipment are related to the circuit utilizing two wires and positioned at their location. The creator’s prototype wired on a general-purpose PCB is proven in Fig. 11.

Actual-size PCB layout
Fig. 9: PCB structure
Component layout of the PCB
Fig. 10: Part structure of the PCB
Fig. 11: Writer’s prototype

Obtain PCB and Part Structure PDFs: click on right here

Obtain Supply Code


Pamarthi Kanakaraja is an assistant professor (R&D cell) at Okay.L. College, Vaddeswaram, Guntur district, Andhra Pradesh



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments