Posts

Showing posts from November, 2025

IoT Smart Light Control with Ultrasonic Sensor Simulation

Image
🔧 Introduction Smart lighting is one of the most popular IoT applications. In this project, we’ll build a system where an ultrasonic sensor detects motion or proximity, and an LED light turns on automatically. We’ll demonstrate the setup using a simulation environment , making it easy for beginners to reproduce before moving to real hardware. 🛠️ Components Needed Arduino Uno HC-SR04 Ultrasonic Sensor LED 220Ω resistor Jumper wires  ⚡ Wiring Overview Ultrasonic Sensor (HC-SR04): VCC → 5V GND → GND TRIG → Pin 8 ECHO → Pin 9 LED: Anode (+) → Pin 10 (through 220Ω resistor) Cathode (–) → GND 📸 Circuit Diagram (Simulation) 💻 Arduino Code // IoT Smart Light Control with Ultrasonic Sensor const int trigPin = 12; const int echoPin = 11; const int ledPin = 8; long duration; int distance; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { // Trigger ultrasonic pulse digitalWr...