Mini - Project - 7th Sem
Mini - Project - 7th Sem
ON
4 CHANNEL IR RELAY
MODULE
BACHELOR OF TECHNOLOGY
In
ELECTRONICS ENGINEERING
DEPARTMENT OF ELECTRONICS
ENGINEERING
Session 2023-24
(An Autonomous State Government Institute)
AFFILIATED TO
DR. A.P.J ABDUL KALAM TECHNICAL UNIVERSITY
1
INDEX
1 DECLARATION 3
2 ACKNOWLEDGEMENT 4
3 INTRODUCTION 5
4 COMPONENT REQUIRED 6
5 CIRCUIT DIAGRAM 15
6 WORKING 16
7 IC PROGRAMMING 19
9 CONCLUSION 24
10 SCOPE OF PROJECT 25
2
DECLARATION
Date: 17/12/2024
3
ACKNOWLEDGEMENT
4
INTRODUCTION
5
Required Components:
• 1 X ATTINY85
• 1x TSOP1838 IR Sensor
• 1X BC547 Transistor
• 4X 1N4148 Diodes
• 5X LED
• 5X 100 Ohm Resistors
• 5X 10K Resistors
• 4X 5V Relays
• 2x 2 Pin Terminal Blocks
• Remote Control
• 1X PERF BOARD
6
Components Detail:
ATTINY85:
With its compact size and ability to run on low voltage (2.7V–5.5V),
the ATTINY85 is ideal for applications such as IoT devices,
wearables, automation systems, and DIY electronics projects.
Its simplicity in programming using Arduino IDE and compatibility
with bootloaders further enhance its usability, making it a
preferred choice for both professionals and hobbyists.
7
TSOP1838 IR Sensor:
8
BC547 Transistor:
The BC547 has three terminals: Emitter (E), Base (B), and
Collector (C). When a small current is applied to the base, it allows
a larger current to flow from the collector to the emitter, effectively
amplifying the input signal. This property makes it ideal for signal
amplification in audio circuits, sensors, and low-power devices.
The transistor has a gain value (hFE) ranging between 110 and
800, enabling efficient signal amplification. It operates in three
regions: the cut-off region (acting as an open switch), the
saturation region (acting as a closed switch), and the active
region (amplifying signals). The BC547 is widely used in
applications like LED drivers, relay drivers, oscillators, and
timing circuits.
9
Relay Module:
10
1N4148 Diode:
11
100Ω & 10KΩ Resistors:
100Ω Resistor
The 100Ω resistor is used in the 4-Channel IR Relay Module
project to limit current flow and protect sensitive components like
LEDs. When connected in series with an LED, the resistor ensures
that the LED operates within its safe current range, preventing
damage caused by excessive current. For example, with a 5V power
supply, the 100Ω resistor drops the voltage and limits the current
flowing through the LED to approximately 20mA. This makes it a
critical component for safe and efficient LED operation.
10KΩ Resistor
The 10KΩ resistor plays a crucial role in the circuit by acting as a
pull-up or pull-down resistor for the base pins of the transistors
(e.g., BC547) and input pins of the ATTINY85 microcontroller. It
ensures stable operation by preventing floating inputs, which
could cause erratic switching behavior. In this project, the 10KΩ
resistor is also used to maintain a high or low state on the input
signal lines, ensuring the proper triggering of transistors and
smooth relay operation. Its high resistance ensures minimal
current consumption, contributing to the overall efficiency of the
circuit
12
Remote Controller:
13
LED:
14
Circuit Diagram:
Project Picture:
15
Explanation:
3. Pull-up Resistor
• Place a 10kΩ resistor between Pin-1 of the microcontroller
and +5V. This serves as a pull-up resistor, ensuring proper
signal levels for the microcontroller to detect the IR signal.
16
• Relay: A 5V relay is used to control external devices (like
lights, fans, etc.). The relay has a coil that is energized to
close the switch, activating the connected load.
• Wiring the Transistor and Relay:
o Pin-3 (Collector) of the BC547 transistor connects to
ground.
o Pin-1 (Emitter) of the BC547 connects to coil pin-2 of
the 5V relay.
o Coil pin-1 of the relay connects to +5V.
5. Flyback Diode
• 1N4148 Diode: This diode protects the relay from voltage
spikes generated when the relay coil is de-energized.
o The cathode of the diode connects to coil pin-1 (the
+5V side of the relay).
o The anode of the diode connects to coil pin-2 (the side
of the relay connected to the transistor).
6. LED Indicator
• LED: An LED is used as an indicator to show when the relay
is activated.
o The cathode of the LED connects to pin-1 of the
BC547 transistor.
o The anode of the LED connects to one side of a 100Ω
resistor.
o The other side of the 100Ω resistor connects to +5V.
17
o Set up a transistor, relay, diode, LED, and terminal
block for each of the three remaining channels.
o Each channel operates independently to control a
different load.
18
IC Programming:
Arduino Code for Decoding IR Codes:
#include <IRremote.h>
int IRpin = 2;
IRrecv irrecv(IRpin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, DEC);
irrecv.resume();
}
19
Arduino Code for Programming ATTINY85:
//Serial.begin(115200);
pinMode(irPin, INPUT);
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Relay3, OUTPUT);
pinMode(Relay4, OUTPUT);
}
void loop() {
int key = getIrKey();
if(key == 1 ){
Relay1State = !Relay1State;
20
if(Relay1State == true)
digitalWrite(Relay1, HIGH);
else
digitalWrite(Relay1, LOW);
}
if(key == 2 ){
Relay2State = !Relay2State;
if(Relay2State == true)
digitalWrite(Relay2, HIGH);
else
digitalWrite(Relay2, LOW);
}
if(key == 3 ){
Relay3State = !Relay3State;
if(Relay3State == true)
digitalWrite(Relay3, HIGH);
else
digitalWrite(Relay3, LOW);
}
if(key == 4 ){
Relay4State = !Relay4State;
if(Relay4State == true)
digitalWrite(Relay4, HIGH);
21
else
digitalWrite(Relay4, LOW);
}
}
int getIrKey(){
int len = pulseIn(irPin,LOW);
int key, temp;
key = 0;
//Serial.print("len=");
//Serial.println(len);
if(len > 5000) {
for(int i=1;i<=32;i++){
temp = pulseIn(irPin,HIGH);
if(temp > 1000)
key = key + (1<<(i-17));
}
}
if(key < 0 )
key = -key;
//if(key)
//Serial.println(key);
delay(250);
return key;
}
22
Result & Discussion:
23
Conclusion:
24
Scope of the Project:
25