"Control LED Light with Raspberry Pi and Relay Module"

Here's a sample code for a basic home automation hub using a Raspberry Pi:

This code sets the GPIO mode and warns that we're using GPIO.BCM, then sets up a GPIO pin (in this case, pin 18) as an output. It then defines functions to turn the pin on, turn it off, and blink it 5 times. Finally, it enters a loop that blinks the pin indefinitely.

The electrical items you would need for this project include:

  1. Raspberry Pi
  2. Relay Module
  3. LED Light
  4. Jumper Wires
  5. Power Supply for Raspberry Pi

For the hardware setup:

  1. Connect the relay module to the Raspberry Pi's GPIO pins.
  2. Connect the LED light to the relay module's normally open (NO) terminal.
  3. Connect the power supply to the Raspberry Pi and the LED light.

The circuit diagram for the Raspberry Pi home automation hub involves connecting three main components: the Raspberry Pi, the relay module, and the LED light.

  1. Raspberry Pi: The Raspberry Pi is the main control unit for this project and runs the code to control the relay module.

  2. Relay Module: The relay module acts as an interface between the Raspberry Pi and the LED light. The relay module has two main terminals: normally open (NO) and normally closed (NC). When the relay module is not activated, the NO and NC terminals are not connected, and when the relay module is activated, the NO and NC terminals are connected.

  3. LED Light: The LED light is connected to the NO terminal of the relay module. When the relay module is activated, the NO terminal is connected to the NC terminal, completing the circuit and allowing current to flow through the LED light, illuminating it.

Here's how the circuit diagram could look like:

In this diagram, the Raspberry Pi's GPIO pin is connected to the IN pin of the relay module. The relay module's NO pin is connected to the positive terminal of the LED light, and the LED light's negative terminal is connected to the ground. The relay module's VCC pin is connected to a 5V power supply to provide power to the relay module. When the Raspberry Pi sends a signal to the IN pin of the relay module, it activates the relay and connects the NO and NC terminals, completing the circuit and illuminating the LED light.

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.