กลับไปหน้ารวมไฟล์
basic-floor-lamp-to-smart-floor-lamp-b60eb2-en.md

One of the motivations behind this project is to show that you can use your Arduino board and components from your electronics kit to make a smart lamp. This will also help you with being energy efficient and reducing your carbon footprint. Let's get started.

Following pictures should give you the basic idea about most of the connections:

LED was used here to test the circuit. It is not required in the main project but I decided to leave it as it is.
Separate both the wires on the lamp. Snip 1 wire and connect 1 end to NO and other end to COM on relay module.

Project Perspective

This project is the fundamental and innovative "Hello World" of smart home renovation. By focusing on the essential building blocks—a single-channel relay and an Arduino—you'll learn how to automate traditional household items using specialized software logic and a robust high-voltage setup.

Technical Implementation: Relays and Wireless Commands

The project reveals the hidden layers of simple app-to-power interaction:

  • Identification layer: The relay module acts as an electronic switch, allowing your low-power microcontroller to safely control 110V/220V AC household appliances.
  • Conversion layer: The Arduino uses digital output pins to send a high-low pulse to the relay, opening or closing the AC circuit.
  • Wireless Interface layer: If using an ESP8266 or ESP32, the lamp can connect to the internet and be commanded via a smartphone app (like Blynk).
  • Processing Logic layer: The Arduino code follows a specialized "sequential decoding" strategy: it performs "ON" or "OFF" commands for the floor lamp based on sensor input or app commands.
  • Communication layer: Data is sent rhythmically between the app and the Arduino to coordinate the lamp's status in real-time.

Hardware Infrastructure

  • Arduino Nano/Uno (or ESP): The "brain" of the project, managing the sensor input, serial communication, and coordinating the relay tasks.
  • 5V/12V Relay Module: Effectively handles the high current and power needed for the floor lamp while protecting the microcontroller.
  • PIR Motion Sensor: Detects movement to trigger the lamp automatically.
  • Floor Lamp: The appliance being controlled, providing visual feedback.
  • AC Power Cord: Provides the primary electrical power for the lamp.
  • Micro-USB Cable: Used to program the Arduino/ESP and provide primary 5V power for the controller.
  • Breadboard: A convenient way to prototype the smart circuit and connect all components securely.

Connections (step by step):

  1. Connect Arduino Nano on the breadboard and establish common rails for +5V and ground.
  2. Next connect PIR motion sensor. 1st pin is Ground. Middle pin is signal pin (connect to any digital pin). Last pin is +5V.
  3. I used a 12VDC relay module for this project this means you need 12Volts supply to make the relay work. Although a 5VDC relay could also be used.

Relay module connections: Connect external 12volts to +DC and -DC to ground. (Make sure negative DC is also connected to arduino's ground otherwise you will have problems.) .IN pin on the relay module will connect to digital Pin. Since lamp consists of 2 wires, cut 1 wire in half and connect 1 end to NO (normally open) and connect other end to COM (common).

Automation and Interaction

The smart lamp conversion process is designed to be very efficient. The core logic, as shown in the code below, initializes the hardware and then enters a loop where it waits for motion sensor input, updating the relay and lamp status in real-time.

I came up with the following code.

int motionPin=8; // PIR signal pin
int val=0;
int pirState=LOW;
int ledPin=3;
int relayPin=4; // IN pin on relay Module

void setup() {
// put your setup code here, to run once:
pinMode(motionPin,INPUT);
pinMode(ledPin,OUTPUT);
pinMode(relayPin,OUTPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
val=digitalRead(motionPin);
if (val==HIGH)
{
if (pirState==LOW){
Serial.println(" MOTION DETECTED");
digitalWrite(ledPin,HIGH);
digitalWrite(relayPin,HIGH);
pirState=HIGH;

}
}
else
if (pirState==HIGH)
{
Serial.println(" MOTION ENDED");
digitalWrite(ledPin,LOW);
digitalWrite(relayPin,LOW);
pirState=LOW;

}
}

Future Expansion

  • OLED Identity Dashboard Integration: Add a small OLED display on the lamp enclosure to show "Connection Status" and "Power Usage" (kWh).
  • Multi-sensor Climate Sync: Connect an LDR (light sensor) to have your floor lamp "Turn ON" automatically at sunset.
  • Cloud Interface Registration Support: Add a WiFi module (ESP8266/ESP32) and link to a cloud dashboard to precisely track and log the lamp history from a smartphone wirelessly over WiFi.
  • Advanced Velocity Profile Customization: Add specialized "Voice Control" (Alexa/Google Home) to have the lamp follow your spoken commands.

Basic floor lamp to SMART floor lamp!!!!! is a perfect project for any electronics enthusiast looking for a more interactive and engaging smart home tool!

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
  - "1x Blynk or SinricPro (Cloud Platform)"
author: "shassandanish1"
category: "Home & Automation"
components:
  - "1x Arduino UNO (or ESP8266/ESP32)"
  - "1x 5V Single Channel Relay Module"
  - "1x Standard Floor Lamp"
  - "1x AC Power Cord with Plug"
  - "1x 5V DC Power Adapter (for Arduino)"
  - "1x Jumper wires (generic)"
  - "1x Breadboard (generic)"
  - "1x Micro-USB Cable"
description: "A fun and simple project to upgrade an ordinary floor lamp into a smart voice-controlled or app-controlled lamp using an Arduino and a relay."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://projects.arduinocontent.cc/3ab851e3-cfcd-4079-8f97-72599e8fa6f6.ino"
encryptedPayload: "U2FsdGVkX1/I1PJzKthpodWs11z4V/vbEC+RBMBYHfqZdkSh7AqW1hG/jWmP0Fd4/QUbJfKiiWZJAGcmfJoy9KTwVvCwrSkxIcWVA+zjhxE="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/basic-floor-lamp-to-smart-floor-lamp-b60eb2_cover.jpg"
lang: "en"
likes: 0
passwordHash: "b060f169b7901bbeb3d4e26d0881437133686ed35710f284e1e25d077ccb45a7"
price: 870
seoDescription: "An intuitive and simple floor-to-smart lamp upgrade for beginners interested in Arduino smart home and high-voltage relay projects."
tags:
  - "smart-home"
  - "iot"
  - "floor-lamp"
  - "relay"
  - "automation"
  - "arduino"
  - "beginners"
title: "Basic floor lamp to SMART floor lamp!!!!!"
tools: []
videoLinks: []
views: 3125