Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Energy-saving Devices Using Arduino

Energy-saving devices are crucial in today's world to reduce energy consumption and promote sustainability. These devices help in minimizing the wastage of electricity by automating the control of electrical appliances. With the help of Arduino, we can create efficient energy-saving systems that are both cost-effective and easy to implement. This article will guide you through creating an energy-saving device using Arduino, focusing on its importance and the necessary adjustments to align it with the Arduino environment.

Project: The project involves creating an automatic light control system using Arduino. The objective is to turn off the lights when no one is present in the room, thereby saving energy. The system will use a PIR (Passive Infrared) sensor to detect motion and a relay module to control the light. When the PIR sensor detects motion, it will send a signal to the Arduino, which will then activate the relay to turn on the light. If no motion is detected for a specified period, the Arduino will deactivate the relay, turning off the light.

Components List:

  1. Arduino Uno - 1
  2. PIR Sensor - 1
  3. Relay Module - 1
  4. LED (as a substitute for the light) - 1
  5. Jumper Wires - Several
  6. Breadboard - 1
  7. Resistor (220 ohms) - 1

Examples:

// Define the pins for the PIR sensor and the relay module
const int pirPin = 2; // PIR sensor output pin
const int relayPin = 3; // Relay module control pin

// Variable to store the PIR sensor status
int pirStatus = 0;

void setup() {
  // Initialize the serial communication
  Serial.begin(9600);

  // Set the PIR sensor pin as input
  pinMode(pirPin, INPUT);

  // Set the relay module pin as output
  pinMode(relayPin, OUTPUT);

  // Initially turn off the relay
  digitalWrite(relayPin, LOW);
}

void loop() {
  // Read the status of the PIR sensor
  pirStatus = digitalRead(pirPin);

  // Check if motion is detected
  if (pirStatus == HIGH) {
    // Motion detected, turn on the relay
    digitalWrite(relayPin, HIGH);
    Serial.println("Motion detected! Light ON.");
  } else {
    // No motion detected, turn off the relay
    digitalWrite(relayPin, LOW);
    Serial.println("No motion. Light OFF.");
  }

  // Add a small delay to avoid bouncing
  delay(1000);
}

Explanation:

  • pirPin and relayPin are defined to specify the pins connected to the PIR sensor and relay module, respectively.
  • In the setup() function, serial communication is initialized, and the pin modes for the PIR sensor and relay module are set.
  • The loop() function continuously reads the status of the PIR sensor. If motion is detected (pirStatus == HIGH), the relay is activated to turn on the light. If no motion is detected, the relay is deactivated to turn off the light.
  • A delay of 1000 milliseconds (1 second) is added to avoid bouncing and ensure stable operation.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.