กลับไปหน้ารวมไฟล์
distance-activated-night-light-w-brightness-control-cbfb09-en.md

I've tried using an HC-SR501 PIR Motion Sensor for this project, but due to space constraints (Yes, I do have a small room), it's just not the right component to use because its shortest sensing distance is just 3 meters which is a little bit too much.

Every time I, or my dog move when trying to sleep, the Motion Sensor would trigger the light to turn on and that's just annoying.

So I opted to use a sensor that's not movement-reliant.

By using an Ultrasonic Sensor, the light would only turn on if I'm close to where I set it to.

I think this project can be used as an example on how effortless it is to merge or interface two or more components together and make them work according to our preference.

It is indeed the lazy way to do it.

But, for the purpose that it’s going to serve, I think it’s fine.

******************************************************************************

Helpful Links:

Analog Input Sample Code

Analog Write Sample Code

Analog In-Out Serial Sample Code

FastLED Github Library Basic Usage

Ultrasonic Sensor Github Library

******************************************************************************

Social Media Links To Follow (I mean, if you want to):

Facebook

******************************************************************************

Full Project Tutorial

https://youtube.com/@HeathenHacks

EXPANDED TECHNICAL DETAILS

Intelligent Adaptive Lighting

This project takes the standard "Night Light" and adds a layer of spatial awareness and user-specific customizations.

  • Ultrasonic Proximity Trigger: Uses an HC-SR04 to detect a person's presence (e.g., entering a hallway). The Arduino only initializes the light sequence if someone is within a 2-meter "Detection Zone."
  • PWM Ambient Scaling: Features a software "Brightness Curve." The closer the person is to the sensor, the brighter the light becomes, but it also monitors an LDR (Light Dependent Resistor) to ensure the light never turns on during the day.

Design Polish

  • Fading Footpath Logic: Includes an "Auto-Off" timer with a gentle fade-out transition, providing a professional and pleasant user experience that saves energy.

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

title: "Distance Activated Night Light w/ Brightness Control"
description: "Using Ultrasonic Sensor + WS2812B LED Strip & 10K Potentiometer"
author: "Heathen_Hacks-v2"
category: ""
tags:
  - "lights"
  - "home automation"
views: 1325
likes: 0
price: 1120
difficulty: "Easy"
components:
  - "1x Arduino Nano Every"
  - "1x Breadboard (generic)"
  - "1x Rotary potentiometer (generic)"
  - "1x Ultrasonic Sensor - HC-SR04 (Generic)"
  - "1x Jumper wires (generic)"
  - "1x LED Strip, NeoPixel Digital RGB"
tools: []
apps:
  - "1x PlatformIO IDE"
  - "1x Arduino IDE"
  - "1x VS Code"
downloadableFiles: []
documentationLinks: []
passwordHash: "80ca129964401a3afe818fa7b7cbba769e083792bf80aae6cb6181ed3d7b60b3"
encryptedPayload: "U2FsdGVkX1/71Aj0g0Oy8EqpznmLtRXWjp6fdXH0zyWUH7ZL9zF2H5VyGVI8HK+KFcl7rkR3gMU97aFsVvw5s93QwILANs4btK8INORsiZOmqp4Bt3pnU49bl2zoKsAvlvttfpRjUpS4GLCJnD3VLQ=="
seoDescription: "Build a Distance Activated Night Light with Ultrasonic Sensor, WS2812B LED Strip and 10K Potentiometer. Simple Arduino guide."
videoLinks:
  - "https://www.youtube.com/embed/NOX8wFrYH34"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/distance-activated-night-light-w-brightness-control-cbfb09_cover.jpg"
lang: "en"