This shows you the differences between two versions of the page.
|
pm:prj2026:vlad.radulescu2901:sebastian.coitu [2026/05/07 15:33] sebastian.coitu |
pm:prj2026:vlad.radulescu2901:sebastian.coitu [2026/05/13 19:02] (current) sebastian.coitu |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Introduction ===== | ===== 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 **Smart Lamp** is an embedded system project that implements an adaptive RGB LED strip lighting solution with two distinct operating modes, built around the **ATmega328P Xplained Mini** board. In **Manual Mode**, the user controls the LED brightness directly via a potentiometer. The analog signal is read through ADC and converted to three identical PWM duty cycles that drive the R, G, and B channels. 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 well-lit. At any moment, the current brightness level (0–100%) is displayed on a 16×2 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. | 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 ===== | ===== General Description ===== | ||
| - | + | {{:pm:prj2026:vlad.radulescu2901:schema_bloc_v2.png?700|}} | |
| - | {{:pm:prj2026:vlad.radulescu2901:schema_bloc_sebastian_coitu.png?700|}} | + | |
| Block scheme description: | Block scheme 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. | * **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. | + | * **RGB LED Strip** — the output actuator. The strip has a common anode (+5V) and three separate cathode lines (R, G, B). All three channels receive the same PWM duty cycle, producing white light at variable brightness. |
| + | * **External Power Supply (5V)** — powers the RGB LED strip. GND of the external supply is connected to the MC GND. | ||
| * **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. | * **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. | * **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. | * **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. | * **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 ===== | ===== Hardware Design ===== | ||
| Line 26: | Line 25: | ||
| ^ # ^ Component ^ Value / Model ^ Qty ^ Notes ^ | ^ # ^ Component ^ Value / Model ^ Qty ^ Notes ^ | ||
| | 1 | ATmega328P Xplained Mini | Microchip | 1 | MCU development board | | | 1 | ATmega328P Xplained Mini | Microchip | 1 | MCU development board | | ||
| - | | 2 | LED | 5 mm, white | 1 | Output lamp | | + | | 2 | RGB LED Strip | 5V, 15 LEDs, common anode | 1 | Output lamp | |
| - | | 3 | Resistor R1 | 220 Ω | 1 | LED current limiter | | + | | 3 | NPN Transistor | 2N2222 | 3 | Low-side switch for each RGB channel | |
| - | | 4 | Potentiometer | 10 kΩ, linear | 1 | Manual brightness control | | + | | 4 | Resistor | 1 kΩ | 3 | Base current limiter for 2N2222 | |
| - | | 5 | Photoresistor (LDR) | GL5528 or similar | 1 | Auto mode light sensor | | + | | 5 | Resistor | 220 Ω | 1 | LED current limiter | |
| - | | 6 | Resistor R2 | 10 kΩ | 1 | LDR voltage divider pull-down | | + | | 6 | Resistor | 10 kΩ | 1 | LDR voltage divider pull-down | |
| - | | 7 | LCD Display | 16×2, I2C (PCF8574) | 1 | Brightness level display | | + | | 7 | Potentiometer | 10 kΩ, linear | 1 | Manual brightness control | |
| - | | 8 | Breadboard | 400 point | 1 | Component mounting | | + | | 8 | Photoresistor (LDR) | GL5528 or similar | 1 | Auto mode light sensor | |
| - | | 9 | Jumper wires | M-M, F-F | ~15 | Connections | | + | | 9 | LCD Display | 16×2, I2C (PCF8574) | 1 | Brightness level display | |
| - | | 10 | USB cable | Micro-USB | 1 | Power & programming | | + | | 10 | Breadboard | 400 point | 1 | Component mounting | |
| + | | 11 | Jumper wires | M-M, F-F | ~20 | Connections | | ||
| + | | 12 | USB cable | Micro-USB | 1 | Power & programming | | ||
| ==== Electrical Schematic ==== | ==== Electrical Schematic ==== | ||
| - | {{:pm:prj2026:vlad.radulescu2901:schema_electrica_sebastian_coitu.png?700|}} | + | {{:pm:prj2026:vlad.radulescu2901:schema_electrica_v4.png?700|}} |
| - | + | ||
| - | * Note: in the above electrical schematic the LDR is a complete module including the R2 voltage divider | + | |
| ==== Pin Mapping ==== | ==== Pin Mapping ==== | ||
| ^ ATmega328P Pin ^ Arduino Pin ^ Signal ^ Connected To ^ | ^ ATmega328P Pin ^ Arduino Pin ^ Signal ^ Connected To ^ | ||
| - | | PD6 (OC0A) | D6 | PWM LED | LED anode (via R1, 220 Ω) | | + | | PD6 (OC0A) | D6 | PWM RED | R5 (1kΩ) → Base T1 (2N2222, R channel) | |
| + | | PD5 (OC0B) | D5 | PWM Green | R6 (1kΩ) → Base T2 (2N2222, G channel) | | ||
| + | | PD3 (OC0C) | D3 | PWM Blue | R7 (1kΩ) → Base T3 (2N2222, B channel) | | ||
| | PC0 (ADC0) | A0 | ADC input | Potentiometer wiper | | | PC0 (ADC0) | A0 | ADC input | Potentiometer wiper | | ||
| | PC1 (ADC1) | A1 | ADC input | LDR voltage divider midpoint | | | PC1 (ADC1) | A1 | ADC input | LDR voltage divider midpoint | | ||
| Line 52: | Line 53: | ||
| | PB7 | D7 | GPIO input | Onboard button | | | PB7 | D7 | GPIO input | Onboard button | | ||
| | VCC | 5V | 5V | VCC potentiometer, VCC LCD, VCC LDR | | | VCC | 5V | 5V | VCC potentiometer, VCC LCD, VCC LDR | | ||
| - | | GND | GND | GND | LED catod,GND potentiometer, GND LCD, GND LDR | | + | | GND | GND | GND | GND for all components + external power source | |
| + | |||
| + | ===== Software Design ===== | ||
| + | |||
| + | TODO | ||
| ===== Results Obtained ===== | ===== Results Obtained ===== | ||
| Line 59: | Line 64: | ||
| ===== Conclusions ===== | ===== Conclusions ===== | ||
| + | |||
| + | TODO | ||
| + | |||
| + | ===== Journal ===== | ||
| + | |||
| + | TODO | ||
| + | |||
| + | ===== Resources ===== | ||
| TODO | TODO | ||