
The essential sensors for home automation are the following:
- the movement sensor like the PIR sensor we’ve made used of here
- the flood sensor
- the temperature sensor
- the humidity sensor
Today, we are going to add one more sensor to the list: the Reed switch.
The Reed switch is a simple contact that closes when a magnet is brought close to it. Thanks to this effect we can sense when doors or windows are opened or closed.
A lot of alarm systems uses not only movement sensors but also reed-switches that are installed inside the windows. Reed switches can also be useful for other applications: A magnet and reed switch mounted on a bicycle can help calculate the speed of the bicycle based on the RPM of the wheels.
Today we will make a simple device that will light up a LED when a window is opened and if it is opened for 15 minutes, it turns on a buzzer to remind you to close it.
I personally need a device like that now, we are having our winter now and it is very cold outside. Sometimes I need to open the window to have some fresh air in the room. Here is where the device will help me remember to close the window in case I forget, especially when I am in the other room.
Parts needed

Here is the list of parts we need to this project:
- 1 x Arduino Uno board
- 1 x Reed switch
- 1 x Buzzer
- 1 x LED
- 1 x 220 resistor
- 1 x 1.2k resistor
- 1 x Breadboard
- Jumper wires
- 1 x Magnet
The schematic
When you have all the components, you can start with the connection. Below you can find the schematic of the project. To clarify and simplify this, keep in mind that all red cables are 5V and all blue cables are GND.



The code
And the code. I made a simple rising edge detection with a bool variable to make the code detect when the high state occurs, save the millis value in the variable and power the LED. At the same time, our code detects if the window is open for more than 15 minutes. If it is, the buzzer turns on.
Here is the video of how it works, to make it shorter I change the time from 15 minutes to 30 seconds. After this time if the window is open, the buzzer turns on.
And that is it for this session.
You might also like:
- Arduino hx711 tutorial
- Arduino magnetic switch
- Best Arduino Kits
- gifts for engineering students
- gifts for engineers
- mpu6050 Arduino projects
- Current sensor Arduino
- Soil Moisture Sensor With Arduino
- Arduino Count up Timer Using the Nokia 5110 LCD
- Arduino Yun: Integrating or Juxtaposing Arduino with Linux
- Arduino Projects: Line Follower Robot
- Arduino RFID Project for Beginners
- Arduino MOSFET Project
- Which Arduino Should You Buy
- What Can You Do With Arduino Boards?
- Great Alternatives to the Arduino Microcontroller
- Arduino Projects: Color Sensor
- Arduino IDE Alternatives
- Arduino Mega vs. Uno
- Arduino Projects: Arduino LCD Display
- Read Arduino Rotary Encoders
- A Selection of the Best Arduino Simulators
- Arduino Projects: IR Receiver
- Arduino Light Sensor Project
- Arduino Projects: Arduino Decibel Meter
- Arduino Stopwatch Project
- Arduino Bluetooth RC Car Project
- Arduino Temperature Logger Project
- Arduino Projects: Arduino 7 Segment Display
- Arduino Projects: Clap ON Clap OFF Light
- Arduino Relay Project
- Install a Library Onto the Arduino IDE
- Arduino Projects: Rainfall Detector
- Arduino Projects: RGB LED Arduino
- Arduino Stepper Motor Project
- Arduino Projects: Arduino DC Motor Control
- The Top Affordable Arduino Robot Kit
- Arduino 3D Printed Case
- Arduino Projects: Asynchronous LEDs Blink
- Arduino Projects: Ultrasonic Distance Sensor
- Arduino Projects: LED – 4X4X4 LED Cube
- Arduino Car Projects: Build an Obstacle Avoiding Robot With Less Than $30
- Arduino Projects: Servo Potentiometer Control
- Arduino LED Project: Knight Rider
- Arduino Projects: PIR Motion Sensor
- The Difference between Arduino and Raspberry Pi
- Top 9 Books Every Engineer Should Read
- Top Used Sensors for Arduino
- First Hand on the Arduino Uno Board