0% found this document useful (0 votes)
60 views

Automated Fan Using Bluetooth Module and PIC Microcontroller

The document describes an automated electric fan system created by students at Philippine Christian University. The system uses a PIC16F877A microcontroller, Bluetooth module, relay module, and other components to control an electric fan. Code was written for the microcontroller and a mobile app was developed to send Bluetooth commands to control the fan's power on/off via relays. Recommendations are provided to improve fan speed control and add a reverse function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Automated Fan Using Bluetooth Module and PIC Microcontroller

The document describes an automated electric fan system created by students at Philippine Christian University. The system uses a PIC16F877A microcontroller, Bluetooth module, relay module, and other components to control an electric fan. Code was written for the microcontroller and a mobile app was developed to send Bluetooth commands to control the fan's power on/off via relays. Recommendations are provided to improve fan speed control and add a reverse function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Philippine Christian University

Automated E-Fan

Submitted by:
Jannelle B. Bote
Christian R. Endaya
Michael C. Ganadores
George Miguel V. Obusan
Arnie B. Serrano
Philippine Christian University
Materials used:
 PIC16F877A Microcontroller
Philippine Christian University

The PIC microcontroller PIC16f877a is one of the most renowned


microcontrollers in the industry. This microcontroller is very convenient to use,
the coding or programming of this controller is also easier. PIC16F877a is a 40-
pin PIC Microcontroller, designed using RISC architecture, manufactured by
Microchip, and is used in Embedded Projects. It has five Ports on it, starting from
Port A to Port E. It has three Timers in it, two of which are 8-bit Timers while 1 is
of 16 Bit.

 2 Relay Module
Philippine Christian University

The 2 Channels Relay Module is a convenient board which can be used to


control high voltage, high current load such as motor, solenoid valves, lamps and
AC load. It is designed to interface with microcontroller such as Arduino, PIC and
etc. The dual-channel relay module can switch mains-powered loads from
microcontroller pins. Because the board has two channels, two separate loads
can be powered. This is beneficial in terms of home automation.
Philippine Christian University
 Jumper Wires

Jumper wire is an electric wire that connects remote electric circuits used for
printed circuit boards. By attaching a jumper wire on the circuit, it can be short-
circuited and short-cut (jump) to the electric circuit. There are three types of
jumper wires: Male-to-Male jumper, Male-to-Female jumper, Female-to-Female
jumper.
Philippine Christian University

 HC05 Bluetooth Module

Designed to replace cable connections, the HC-05 communicates with the


electronics via serial communication. It is typically used to exchange files
between small devices such as mobile phones via a short-range wireless
connection. It operates on the 2.45GHz frequency band.
Philippine Christian University

 Bluetooth Terminal Controller

A simple app that allows Bluetooth-enabled devices, such as Micro Controller Boards,
to communicate with one another, as well as a Bluetooth serial terminal console. To
transmit data between internet of things devices, it employs the RFCOMM Protocol,
also known as Serial Port Protocol (SPP).
Philippine Christian University

 Electric Fan

Fans are used for circulating air in rooms and buildings; for cooling motors and
transmissions; for cooling and drying people, materials, or products; for exhausting dust
and noxious fumes; for conveying light materials; for forced draft in steam boilers; and in
heating, ventilating, and air-conditioning systems.
Philippine Christian University

Pin Diagram

It shows how each component is connected to the others. The Vcc pin of the HC1, pin
no. 1 of the U1, the positive terminal of D1 and the RL1 are connected to a 5V power
source (positive), while the GND pin of the HC1, Q1, X1, C1, C2 and R1 are connected
to ground. The positive terminal of the FAN-DC is connected to a 220V as well the COM
and the negative terminal of is connected to normally closed. The OSC1/CLKIN and
OSC2/CLKOUT that are also known as pin 13 and 14 respectively are connected to
CRYTSAL. The RC6/TX/CK is connected to the RxD pin, while the RC7/RX/DT is
connected to TxD pin of the Bluetooth module. The RD0/PSP0 is connected to a
positive terminal of R1, while the negative terminal is connected to a ground.
Philippine Christian University

Legends

C1, C2……………………………………………CAPACITOR TxD………………………………………TRANSMIT DATA

X1…………………………………………………CRYSTAL RxD………………………………………RECEIVED DATA

D1………………………………………………..DIODE RD0……………………………………..0TH PIN OF POCTD

Q1………………………………………………..TRANSISTOR RC6………………………… SYNCHRONOUS CLOCK OR


USART ASYNCHRONOUS TRANSMIT PIN
R1…………………………………………………RESISTOR
RC7……………………………..SYNCHRONOUS DATA PIN
U1…………………………………………………PIC16F877A OR THE USART RECEIVED PIN

HC1………………………………………BLUETOOTH HC-05 OSC1/CLKIN…………………. OSCILLATOR INPUT PIN

RL1………………………………………….RELAY OSC2/CLKOUT…………… OSCILLATOR OUTPUT PIN

Vcc…………………………………VOLTAGE COMMON GND………………………………………..GROUND


COLLECTOR

10k……………………………10K OHM RESISTOR ……………………………………………POWER

5V………………………………..5 VOLTS
…………………………………………..WIRE
220V…………………………….220V VOLTS

…………………………………….FAN-DC
Philippine Christian University

Microcontroller Code
#define DATA PORTC.RC7
void main()
{
TRISC = 0x00;
PORTC = 0X00;
TRISD.F0 = 0;
UART1_Init(9600); // Initialize UART module at 9600bps
Delay_ms(100); // Wait for UART module to stabilize
while (1)
{ while(!UART1_Data_Ready());
if (UART1_Data_Ready())
{
DATA = UART1_Read();
if(DATA =='1')
PORTD.F0=1;
if (DATA =='2')
PORTD.F0=0;
}
}
}
Philippine Christian University
APK Source Code:
package org.appinventor;
import com.google.appinventor.components.runtime.HandlesEventDispatching;
import com.google.appinventor.components.runtime.EventDispatcher;
import com.google.appinventor.components.runtime.Form;
import com.google.appinventor.components.runtime.Component;
import com.google.appinventor.components.runtime.HorizontalArrangement;
import com.google.appinventor.components.runtime.ListPicker;
import com.google.appinventor.components.runtime.Button;
import com.google.appinventor.components.runtime.BluetoothClient;
import com.google.appinventor.components.runtime.util.YailList;
class Screen1 extends Form implements HandlesEventDispatching {
private HorizontalArrangement HorizontalArrangement1;
private ListPicker ListPicker1;
private Button Button2;
private Button Button3;
private BluetoothClient BluetoothClient1;
protected void $define() {
this.AlignHorizontal(3);
this.AppName("Bluetooth Terminal HC-05");
this.Icon("microchip.png");
this.Title("Bluetooth Terminal");
HorizontalArrangement1 = new HorizontalArrangement(this);
HorizontalArrangement1.AlignHorizontal(3);
HorizontalArrangement1.AlignVertical(2);
HorizontalArrangement1.BackgroundColor(0xFF000000);
Philippine Christian University
HorizontalArrangement1.Height(75);
HorizontalArrangement1.Width(LENGTH_FILL_PARENT);
ListPicker1 = new ListPicker(HorizontalArrangement1);
ListPicker1.FontBold(true);
ListPicker1.FontSize(20);
ListPicker1.Height(75);
ListPicker1.Width(75);
ListPicker1.Text("PAIR");
ListPicker1.TextColor(0xFF000000);
Button2 = new Button(HorizontalArrangement1);
Button2.FontBold(true);
Button2.FontSize(20);
Button2.FontTypeface(1);
Button2.Height(75);
Button2.Width(75);
Button2.Text("ON");
Button2.TextColor(0xFF000000);
Button3 = new Button(HorizontalArrangement1);
Button3.FontBold(true);
Button3.FontSize(20);
Button3.FontTypeface(1);
Button3.Height(75);
Button3.Width(75);
Button3.Text("OFF");
Button3.TextColor(0xFF000000);
BluetoothClient1 = new BluetoothClient(this);
Philippine Christian University
EventDispatcher.registerEventForDelegation(this, "BeforePickingEvent",
"BeforePicking" );
EventDispatcher.registerEventForDelegation(this, "AfterPickingEvent",
"AfterPicking" );
EventDispatcher.registerEventForDelegation(this, "ClickEvent", "Click" );
}
public boolean dispatchEvent(Component component, String componentName, String
eventName, Object[] params){
if( component.equals(ListPicker1) && eventName.equals("BeforePicking") ){
ListPicker1BeforePicking();
return true;
}
if( component.equals(ListPicker1) && eventName.equals("AfterPicking") ){
ListPicker1AfterPicking();
return true;
}
if( component.equals(Button2) && eventName.equals("Click") ){
Button2Click();
return true;
}
if( component.equals(Button3) && eventName.equals("Click") ){
Button3Click();
return true;
}
return false;
}
public void ListPicker1BeforePicking(){
Philippine Christian University
ListPicker1.Elements(YailList.makeList(BluetoothClient1.AddressesAndNames()));
}
public void ListPicker1AfterPicking(){
ListPicker1.Selection(BluetoothClient1.Connect(ListPicker1.Selection()));
}
public void Button2Click(){
BluetoothClient1.SendText("1");
}
public void Button3Click(){
BluetoothClient1.SendText("2");
}
}
Philippine Christian University
Recommendations:
While the system has been proven effective, it is still limited by a number of factors. For
one, the researchers did accomplish in using a Bluetooth module to enable the fan’s
basic functions; however, we believe further improvements can be made to the system
in order to make it more efficient and to unlock more actions for the fan other than its
default factory build. These recommendations may also serve as a point of reference for
future related studies/projects:

 The use of a Thyristor that would help control the fan speed

 The use of an L293D Motor to unlock reverse fan motion so that the fan can also
act as an exhaust fan
Philippine Christian University
Philippine Christian University
Philippine Christian University

You might also like