Code Monkey home page Code Monkey logo

motion-activated-light's Introduction

Motion-Activated Light Bulb using Arduino Uno and PIR Motion Sensor

This project implements a motion-activated light bulb using an Arduino Uno, PIR motion sensor, and a light bulb. The sensor detects motion in the environment and turns on the light bulb. The light bulb remains on for a set period of time and then turns off automatically.

Components

  • Arduino Uno
  • PIR Motion Sensor
  • Breadboard
  • Light Bulb
  • 2N3904 NPN Transistor
  • 1k Ohm Resistor
  • Jumper Wires

Scheme & Showcase

image image

Type One

Recording.2023-03-17.112128.mp4

Type Two

Recording.2023-03-17.112000.mp4

Instructions

Hardware Setup

Connect breadboard with 5V and GND pins from Arduino Uno board. You can place sensor anywhere you want and light bulb too. Sensor has to be connected with power and ground also has to have signal pin connected to any digital pin but in this project we are using ping 2 for it. Light bulb is connected to ground and digital pin 3.

Software Setup

  1. Install the Arduino IDE on your computer if you haven't already done so.
  2. Open the Arduino IDE and create a new project.
  3. Copy and paste the code from the firstType.cpp or secondType.cpp file in this repository into the project.
  4. Upload the project to the Arduino Uno board.

Usage

  1. Power on the Arduino Uno board.
  2. The light bulb will remain off until motion is detected by the PIR motion sensor.
  3. When motion is detected, the light bulb will turn on and remain on for a set period of time (20 seconds by default).
  4. After the set period of time has elapsed, the light bulb will turn off automatically.

Troubleshooting

  • If the light bulb does not turn on when motion is detected, check your wiring connections and make sure the PIR motion sensor is properly positioned.
  • If the light bulb remains on indefinitely, check the delay time in the code and make sure it is set to the desired value.

Credits

This project was inspired by the PIR Motion Sensor example project in the Arduino IDE and modified to include a light bulb and transistor for controlling the light. The code was written by charon.

motion-activated-light's People

Contributors

cchhaarroonn avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.