Bluetooth Based Monitoring & Control System
Bluetooth Based Monitoring & Control System
System
Automatic Dawn to Dusk Light with manual override
Step 1 : Usage of LDR
LDR means Light Dependent Resistor. LDR is a sensor which detects light intensity in the
environment. Attaching a 10K Ohm resistor with one of the legs of LDR is a must. So in the
breadboard, an LDR was connected to a 10K Ohm resistor attaching to the ground and the other
leg was connected to A3 pin, as the LDR gives out an analog voltage as output.
void setup() {
Serial.begin(9600);
}
void loop() {
tempIn = analogRead(tempPin);
temp = (double)tempIn / 1024; //find percentage of input reading
temp = temp * 5; //multiply by 5V to get voltage
temp = temp - 0.5; //Subtract the offset
temp = temp * 100; //Convert to degrees celsius
}
void setup() {
Serial.begin(9600);
pinMode(redledPin, OUTPUT);
pinMode(blueledPin, OUTPUT);
}
void loop() {
tempIn = analogRead(tempPin);
temp = (double)tempIn / 1024; //find percentage of input reading
temp = temp * 5; //multiply by 5V to get voltage
temp = temp - 0.5;
temp = temp * 100; //Convert to degrees celsius
if (temp < 23.0) { //room temp is low
digitalWrite(redledPin, HIGH);
digitalWrite(blueledPin, LOW);
}
else if (temp > 28.0) { //room temp is high
digitalWrite(redledPin, LOW);
digitalWrite(blueledPin, HIGH);
}
}
void setup() {
Serial.begin(9600);
pinMode(redledPin, OUTPUT);
pinMode(blueledPin, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
tempIn = analogRead(tempPin);
temp = (double)tempIn / 1024; //find percentage of input reading
temp = temp * 5; //multiply by 5V to get voltage
temp = temp - 0.5;
temp = temp * 100; //Convert to degrees celsius
if (temp < 23.0) { //room temp is low
digitalWrite(redledPin, HIGH);
digitalWrite(blueledPin, LOW);
noTone(buzzer);
}
else if (temp > 28.0 and temp < 58.0) { //room temp is high
digitalWrite(redledPin, LOW);
digitalWrite(blueledPin, HIGH);
noTone(buzzer);
}
else if (temp >= 58.0) { //fire alarm
tone(buzzer, 1000);
digitalWrite(redledPin, LOW);
digitalWrite(blueledPin, LOW);
}
}
void setup() {
Serial.begin(9600);
pinMode(redledPin, OUTPUT);
pinMode(blueledPin, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
tempIn = analogRead(tempPin);
temp = (double)tempIn / 1024; //find percentage of input reading
temp = temp * 5; //multiply by 5V to get voltage
temp = temp - 0.5;
temp = temp * 100; //Convert to degrees celsius
if(Serial.available() > 0) { //automatic
data = Serial.read();
if(data == '1') {
digitalWrite(redledPin, HIGH);
digitalWrite(blueledPin, LOW);
noTone(buzzer);
}
else if(data == '0'){
digitalWrite(redledPin, LOW);
digitalWrite(blueledPin, HIGH);
noTone(buzzer);
}
}
else { //manual
if (temp < 23.0) { //room temp is low
digitalWrite(redledPin, HIGH);
digitalWrite(blueledPin, LOW);
noTone(buzzer);
}
else if (temp > 28.0 and temp < 58.0) {
digitalWrite(redledPin, LOW);
digitalWrite(blueledPin, HIGH);
noTone(buzzer);
}
}
if (temp >= 58.0) {
tone(buzzer, 1000);
digitalWrite(redledPin, LOW);
digitalWrite(blueledPin, LOW);
}
Serial.print("*T"+String(temp)+"*");
}