Automated Fan Using Bluetooth Module and PIC Microcontroller
Automated Fan Using Bluetooth Module and PIC Microcontroller
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
2 Relay Module
Philippine Christian University
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
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
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