Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

JOHN CARL C.

DIALA DECEMBER 12, 2023

BTVTEd – CP3

LAB 9

IV. GUIDE QUESTION

1. Can the relay module control other appliances with higher voltage aside from

light? How do you say so?

Yes, a relay can control more than just lights. It's like a remote for turning on

and off things, and it works with devices that use a lot of power, not just light bulbs.

The cool part is that it keeps the small, safe signals away from the big, strong ones,

so everything stays safe. It's like having a switch that listens to a small voice to

control something much louder, like appliances. So, relays are handy for all kinds of

gadgets, not just lights, and they help keep things safe.

2. Define the specification of the 5v relay module and discuss its limitations. Give

some examples of its limitations.

The 5V relay module is like a little switch that listens for a 5-volt signal, often

from something like a computer or a small gadget. It's handy because it can control

bigger things, like appliances or machines that need more power. It keeps the small

signals safe from the big ones, which is cool. However, it does have some limits. You

can't make it switch too fast, or it might not work well. Also, it might wear out over

time if you use it a lot. It could make a little bit of noise and cause some interference,

which might be a problem in certain situations. And, you need to be careful not to go
over its limits, like using too much voltage or current. So, while it's useful for many

things, there are some things you need to keep in mind to use it right.

VI. Create your own program.

Write a program that will turn on the light if a person is within the 0-30cm range.

Otherwise, the light is off. Note: You may use HC-SR04 as your sensor. The circuit

can be found in Activity#6.

#include <DistanceSensor.h>

const int trigPin = 9;


const int echoPin = 10;
const int relayPin = 8;
const distanceThreshold = 30;

DistanceSensor sonar(trigPin, echoPin);

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(relayPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
unsigned int distance = sonar.ping_cm();

if (distance >= 0 && distance <= distanceThreshold) {


digitalWrite(relayPin, HIGH);
} else {
digitalWrite(relayPin, LOW);
}
delay(500);
}
VII. CONCLUSION

I've learned from this activity that by the use of a relay module I can control
things that require high voltage such as a light bulb with a microcontroller that is the
Arduino. I also learned that the relay module not only can control light bulbs but other
big appliances as well.
In conclusion, relay modules are like helpful switches in electronics. They let
us safely control powerful devices using small signals.

You might also like