This circuit is designed to control a bulb using an Arduino UNO microcontroller and a KF-301 relay. The relay allows the Arduino to switch the high-power circuit of the bulb on and off. The bulb is connected to a socket that provides the power source. The Arduino controls the relay by sending a signal to it, which in turn, connects or disconnects the bulb from the power source. The control logic is implemented in the embedded code running on the Arduino, which toggles the relay at a 3-second interval, using an inverted logic where a LOW signal activates the relay and a HIGH signal deactivates it.
/*
Relay Control Sketch
This sketch controls a relay connected to pin D6 of an Arduino UNO.
The relay is turned on for 3 seconds and then turned off for 3 seconds in a continuous loop.
The relay activation is inverted; a LOW signal turns it on, and a HIGH signal turns it off.
*/
int RelayPin = 6; // Define the Arduino pin connected to the relay signal pin
void setup() {
pinMode(RelayPin, OUTPUT); // Set RelayPin as an output pin
}
void loop() {
digitalWrite(RelayPin, LOW); // Turn on the relay (inverted logic: LOW means relay on)
delay(3000); // Wait for 3 seconds
digitalWrite(RelayPin, HIGH); // Turn off the relay (inverted logic: HIGH means relay off)
delay(3000); // Wait for 3 seconds
}
This code is written for the Arduino UNO and is responsible for controlling the KF-301 Relay. The relay is connected to digital pin D6 of the Arduino. The code sets the pin as an output and then enters a loop where it turns the relay on (LOW signal) for 3 seconds, then off (HIGH signal) for another 3 seconds, repeating this cycle indefinitely.