This is an old revision of the document!


Smart ambient climate station

Fodor Mihnea-Stefan 331CA

Introduction

The smart ambient station automatically monitors temperature and adjusts a cooling fan's speed based on predefined thermal thresholds. It also displays the current real-time clock and allows full manual control via an infrared remote.

The purpose of the project is to maintain a comfortable local climate through automated cooling, while providing visual feedback and auditory alerts. It includes a critical safety mechanism that immediately halts all operations if the device is tilted or knocked over.

The starting concept was a standard thermostat, which evolved into a robust embedded system featuring a state machine, hardware-level safety interrupts and custom communication protocol implementations without relying on heavy third-party Arduino libraries.

For the user it serves as a practical desktop cooling and timekeeping gadget. It offers a highly affordable alternative to commercial cooling devices, while providing the flexibility of full manual control to suit personal comfort.

General Description

The ATmega328P runs a continuous state machine. In Auto Mode, it reads the ADC, calculates the temperature using the Steinhart-Hart equation and adjusts the PWM output to the fan. In Manual Mode, the IR receiver triggers an interrupt that decodes the NEC signal, allowing the user to override the fan speed, toggle RGB disco mode or trigger alarm. The Tilt Sensor has the highest priority: if triggered, it overrides all states, cuts power to the fan, and displays an error (—-) on the clock display.

Hardware Design

Bill of materials:

  • ATmega328P
  • 10k NTC thermistor
  • DS3231 mini RTC module
  • TM1637 4-digit display
  • VS1838B infrared receiver & IR remote
  • SW-520D tilt sensor
  • sunon maglev 5V DC fan
  • buzzer
  • RGB LED
  • NPN transistor 2N2222
  • resistors
  • wires

Software Design

Development Environment:

  • Visual Studio Code with the PlatformIO extension
  • AVR-GCC managed automatically through the PlatformIO framework

Libraries: <avr/io.h>, <avr/interrupt.h>, <util/delay.h>, <math.h>, <stdlib.h>, <stdio.h>.

Algorithms:

  • State machine implemented via a switch-case and global volatile flags (sistem_blocat, mod_manual, sistem_pornit) to manage transitions between states.
  • Steinhart-Hart equation used to convert raw 10-bit ADC values from the NTC thermistor into accurate Celsius temperature readings.
  • NEC protocol decoder that measures high/low pulse durations using a delay-based timer to reconstruct the 32-bit hexadecimal IR code.
  • Instantaneous triggering on INT0 for the tilt sensor to immediately halt the system.
  • BCD to decimal conversion.

Results Obtained

The system successfully modulates fan speeds and updates RGB indicators based on real-time temperature fluctuations without blocking the main loop.

The custom NEC decoder accurately captures 32-bit remote codes, allowing seamless toggling between Auto and Manual modes, speed adjustments and effects.

The hardware initially suffered from false tilt-sensor triggers due to buzzer vibrations. This was successfully resolved via software debouncing logic and hardware piece arrangement.

The module correctly renders the current time fetched from the DS3231 via custom functions.

Concluzii

Download

O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-).

Fişierele se încarcă pe wiki folosind facilitatea Add Images or other files. Namespace-ul în care se încarcă fişierele este de tipul :pm:prj20??:c? sau :pm:prj20??:c?:nume_student (dacă este cazul). Exemplu: Dumitru Alin, 331CC → :pm:prj2009:cc:dumitru_alin.

Jurnal

Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului.

Bibliografie/Resurse

Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe Resurse Software şi Resurse Hardware.

Export to PDF

pm/prj2026/bianca.popa1106/mihnea_stefan.fodor.1778106157.txt.gz · Last modified: 2026/05/07 01:22 by mihnea_stefan.fodor
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