Low-Price Automation Utilizing PIC16F676 | Full Electronics Mission


Sani & DwivediThere are various sorts of house and industrial automation techniques obtainable out there. These embody IR distant controller, Bluetooth house automation, DTMF house automation, Wi-Fi house automation, RF house automation, and voice managed house automation. The one introduced here’s a low-cost automation system. It may be used at house or in an industrial atmosphere to modify gadgets on and off.

IR distant controllers and receivers comply with commonplace protocols for sending and receiving the info. A number of the commonplace protocols are NEC, PHILIPS RC5, JVC, and SIRC (Sony infrared distant management). We shall be utilizing the NEC protocol for this undertaking. 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 house, with a complete transmit time of 1.125ms. Logical ‘1’ is a 562.5µs pulse burst adopted by a 1.6875ms house, with a complete transmit time of two.25ms.

Pulse distance frame
Fig. 2: Pulse distance body

When a key’s pressed on the distant controller, the message transmitted consists of the next within the order beneath:

  1. A 9ms main pulse burst (16 occasions the heartbeat burst size used for a logical information bit)
  2. A 4.5ms house
  3. The 8-bit deal with for the receiving gadget
  4. The 8-bit logical inverse of the deal with
  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 knowledge bits every are despatched with least important bit first. Fig. 3 illustrates the format of an NEC IR transmission body for an deal with 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 deal with (deal with+inverse) and the 16 bits of command (command+ inverse).

Desk 1 exhibits 32-bit NEC body format and Desk 2 exhibits the whole 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 package deal with high-performance RISC CPU, which makes it a super alternative for many digital functions associated to embedded techniques or industrial automation. This tiny chip incorporates all the pieces you might want to develop particular person tasks. A few of its options are:

  • The flash reminiscence of high-performance PIC16F676 helps in growing the processing velocity 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 house round 1.7kB, whereas RAM and EEPROM reminiscences are of 64 bytes and 128 bytes, respectively.
  • One 10-bit ADC module within the gadget comes with eight analogue channels. This module performs a significant 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 gadget. These assist it keep forward of the opposite onboard chips and removes the necessity of shopping for exterior elements for finishing up totally 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 undertaking makes use of PIC16F676 microcontroller and an NEC IR distant to modify on/off any AC load, together with lights and followers, from the consolation of your chair or mattress. The totally different IR alerts from the distant for the totally different lights and followers are acquired by the microcontroller, which then controls the respective relays by way of a relay driver circuit. These relays are used to modify the lights and followers on or off.

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

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

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

Block diagram
Fig. 6: Block diagram

On this undertaking the digital IO pins RC0, RC1, and RC2 of Port C of PIC16F676 microcontroller are used to regulate the relays to modify the home equipment on/off. These pins are configured as output pins in this system. The IR receiver is linked 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 undertaking 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 acquired by the TSOP 1738 sensor after which learn by the microcontroller. The microcontroller decodes the acquired practice of the pulses right into a hex worth and compares it with the predefined hex values in this system.

Every time a key’s pressed on the IR distant, the transmitted IR sign is acquired by an IR receiver and the bottom line is decoded by the software program. On this undertaking, 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 means 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 undertaking, 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 major.c is written in embedded C language, which permits writing the code inside a number of traces. The generated hex code is burnt into the MCU chip utilizing PIC K150 programmer board.

No header, interrupt, or seize and evaluate mode is used right here to detect IR sign. Digital pin RC4 reads the info, identical to we learn a push button. Every time sign goes excessive or low, debouncing is adopted and the timer is run. Every time the pin adjustments 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. Every time 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 ‘swap’ 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.

Building 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 acceptable field. Receiver IR1 ought to be fastened on the entrance panel, in order that the distant can give attention to it to activate any load linked to the respective relay. CON1 ought to be fastened on again aspect of the cupboard. All of the three 230V AC home equipment are linked 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: Element structure of the PCB
Fig. 11: Writer’s prototype

Obtain PCB and Element Format 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



Similar Posts

Leave a Reply

Your email address will not be published.