Anda di halaman 1dari 7

PCB Parts and Costing

Component Quantity Rating Price (Php)

Terminal Blocks 2 -------------------------- 34

-----

PCB Board 1 2x2 12

Diode 1 1N4001 2

Bluetooth Module 1 -------------------------- 485

-----

Servo Motor 1 0-180 degrees 250

DC Motor 1 6V 50

Resistor 1 10 kohms 1

Power MOSFET 1 IRF 3205 60

Switch 1 Dip Switch 25

Total Php 919.00


Schematic Diagram

PCB Layout

Code:

/* Bluetooth Controlled Electric Fan unsigned long previousServoMillis = 0;


MicroCon Lab Midterm Exam/Project int servoPosition1 = 90;
Jumadiao, Punzalan, Rivera || ECE43 int servoStep = 50; //intervals between
degrees
Updated as of 10:52PM 11-15-17 */
int servoInterval = servoStep;
#include <SoftwareSerial.h>
int servoDegStep = 1; //1 deg per interval
#include <Servo.h>
int bTx = 10; //Rx BT Module HC-05
unsigned long currentMillis = 0;
int bRx = 11; //Tx BT Module HC-05 }
const int servoMinDegrees = 20; else if (a == 'A'){
const int servoMaxDegrees = 160; analogWrite(fanpin,90);
const int fanpin = 6; //Main Fan Motor Serial.println("LVL1");
const int servoPin1 = 9; //Sway Servo fanstate = 1;
int state = 0; }
int fanstate = 0; else if (a == 'B'){
int angle = 90; //starting angle analogWrite(fanpin,180);
SoftwareSerial BT(bRx, bTx); Serial.println("LVL2");
Servo swayServo; fanstate = 1;
}
void setup() { else if (a == 'C'){
Serial.begin(9600); analogWrite(fanpin,255);
Serial.println("Ready"); Serial.println("LVL3");
BT.begin(9600); fanstate = 1;
swayServo.write(servoPosition1); }
swayServo.attach(servoPin1); else if ((a == 'X') and (fanstate == 1)){
pinMode(fanpin,OUTPUT); state = 1;
} Serial.println("Sway ON");
char a = 0; }
else if (a == 'Y'){
void loop() { state = 0;
currentMillis = millis(); Serial.println("Sway OFF");
if (BT.available()>0){ }
a = BT.read(); }
if (a == 'O'){ if(state==1){
digitalWrite(fanpin,LOW); sway_mech();
state = 0; }
fanstate = 0; else{
Serial.println("OFF"); sway_pause();
swayServo.detach(); servoPosition1 = servoPosition1 +
servoDegStep;
}
}
}
swayServo.write(servoPosition1);
}
void sway_mech() {
}
swayServo.attach(servoPin1);
if (currentMillis - previousServoMillis >=
servoInterval) { void sway_pause(){ //Pauses the Sweep of the
Servo.
previousServoMillis += servoInterval;
currentMillis = millis();
servoPosition1 = servoPosition1 +
servoDegStep; if (currentMillis - previousServoMillis != 0) {
previousServoMillis = currentMillis;
if ((servoPosition1 >= servoMaxDegrees) || servoPosition1 = servoPosition1;
(servoPosition1 <= servoMinDegrees)){
}
servoDegStep = - servoDegStep;
}

APPLICATION
APP LAYOUT

BLOCK PROGRAM
Pictures:

Anda mungkin juga menyukai