กลับไปหน้ารวมไฟล์
arduino-tutorial-controlling-leds-with-ldr-sensor-96db5c-en.md

How to control LEDS using LDR Sensor

So, this is quite basic tutorial and I hope you guys will find it usefull. So, using the LDR sensor we can capture light to turn on the leds.

Short summary - How LDR works:

The LDR sensor is an active component that decreases resistance with respect to receiving light on the component's sensitive surface.

An application that can be an idea for a project :

The LDR sensor can be placed in streetlights to control when the light is on. Ambient light falling on the sensor causes the streetlight to turn off. Thus energy is saved by ensuring the light is only on during hours of darkness.

Back to the project :

Tutorial for this project.

I hope you will find this project fun and useful

Roy.

EXPANDED TECHNICAL DETAILS

Logic-Based Environmental Lighting

A foundational project exploring the interaction between analog light intensity and digital output control.

  • Analog-to-Digital Mapping: The Arduino captures the voltage from an LDR (Light Dependent Resistor) voltage divider circuit. The 10-bit ADC value (0-1023) is mapped in the firmware; as ambient light decreases, the Arduino proportionately increases the brightness of the LEDs using PWM.
  • Hysteresis Software Filter: Includes a basic threshold buffer to prevent the LEDs from "Flickering" when the room is at a medium light level, ensuring a stable and professional-looking lighting transition.

Prototyping

  • Current Protection: Explains the calculation of the 220Ω series resistor for the LEDs, ensuring they operate safely at 20mA without burning out or overloading the Arduino pins.

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

title: "Arduino Tutorial - Controlling LEDS with LDR Sensor"
description: "How to control LEDS with LDR sensor."
author: "RoyB"
category: ""
tags:
  - "arduino uno"
  - "leds"
  - "ldr"
  - "arduino"
  - "sensor"
  - "led"
  - "tutorial"
views: 16202
likes: 7
price: 450
difficulty: "Easy"
components:
  - "1x Resistor 220 ohm"
  - "1x Arduino UNO"
  - "1x Jumper wires (generic)"
  - "1x LDR, 5 Mohm"
  - "1x Plier, Needle Nose"
  - "1x Breadboard (generic)"
  - "1x Resistor 10k ohm"
  - "1x LED (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles:
  - "https://projects.arduinocontent.cc/6613c410-733a-4394-91b8-acf62466ddf8.ino"
  - "https://projects.arduinocontent.cc/6613c410-733a-4394-91b8-acf62466ddf8.ino"
documentationLinks: []
passwordHash: "6d573bafc3bc177a51781600964db9e2de60221e632ddbdaf0da7719503c233b"
encryptedPayload: "U2FsdGVkX18geHV1Wzdhm8ellZM42mkXLWilRt7+22YBT267cjxg3XjtOoSYcPdrHNfODQANVVd7qSfkejaEy9CeiyTjgleNyIyvd5ASkzI="
seoDescription: "Learn how to control LEDS with an LDR Sensor using Arduino. Easy step-by-step tutorial with code and circuit guide."
videoLinks:
  - "https://www.youtube.com/embed/L88Kv0-pDQ4"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/arduino-tutorial-controlling-leds-with-ldr-sensor-96db5c_cover.jpg"
lang: "en"