This is an old revision of the document!


Smart Lamp

Introduction

The Smart Lamp is an embedded system project that implements an adaptive LED lighting solution with two distinct operating modes, built around the ATmega328P Xplained Mini development board. In Manual Mode, the user controls the LED brightness directly via a potentiometer. The analog signal is read through ADC and converted to a PWM duty cycle that drives the LED. In Automatic Mode, a photoresistor senses the ambient light level, and the microcontroller automatically adjusts the LED brightness — brighter in dark environments, dimmer when the surroundings are already well-lit. At any moment, the current brightness level (0–100%) is displayed on a LCD connected via I2C. The user switches between modes by pressing the onboard button.

The motivation behind this project comes from two sources: the growing interest in smart home automation and energy-efficient lighting and the need for a compact and easy to use lamp for my desk. This auto-dimming lamp is a practical system that demonstrates core concepts for embedded projects.

General Description

  • ATmega328P Xplained Mini — reads ADC inputs, generates PWM output for LED brightness control, drives the LCD over I2C, and handles button press interrupts to toggle modes.
  • LED + Current-Limiting Resistor — is driven by a PWM signal on pin PD6. The resistor limits the current to a safe level.
  • Potentiometer — used in Manual Mode as a variable voltage divider. The wiper voltage is read on ADC0 (PC0) and mapped to a PWM duty cycle.
  • Photoresistor + Pull-down Resistor — used in Automatic Mode. The LDR and resistor form a voltage divider; the midpoint is read on ADC1 (PC1). Lower ambient light → lower voltage → higher duty cycle → brighter LED.
  • 16×2 LCD with I2C adaptor — displays the current brightness percentage and the active mode. Communicates with the MCU via I2C.
  • User Button (onboard) — toggles between Manual and Automatic modes. Connected to pin PB7 on the Xplained Mini board.
  • Breadboard — hosts all discrete components (LED, resistors, potentiometer, LDR) and inter-module wiring.

Hardware Design

pm/prj2026/vlad.radulescu2901/sebastian.coitu.1778148424.txt.gz · Last modified: 2026/05/07 13:07 by sebastian.coitu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0