Let's build a Door Sensor
Note: Too big resistance in series with Reed Switch can create issues. Earlier I put 1M ohm, this started dropping 2.2v in open condition. Seems the air inside Reed Switch produced resistance around 1M ohm, this can create issues of false detection. Replacing it with 100k ohm resolved issue.
Download Arduino Sketch from https://github.com/shariramani/ATtiny-RF-433MHz-Door-Sensor
Learn how to program ATtiny at https://openplatform.xyz/attiny13_my_adventures.html
I had normally open reed switch. When door is open, reed switch remains open so the detector pin pb0 reads high. When door closes, magnet comes near to reed switch and reed switch gets closed and detector pin pb0 reads low.
ATtiny is sleeping all the time except following conditions.
Code also has a very simple software debouncer. It reads pin state multiple times at brief intervals. 10 consecutive same readings declare the door state close or open. For our application this simple software debouncer is more than enough.
RF Transmitter is powered by ATtiny pin. This pin goes high only when we have something to transmit.
Remove the LED jumper after initial testing to save power.
ATtiny is sleeping most of the time, 3xAAA cells will provide enough juice to run the ckt for year.
To increase the reach, attach an Antenna to receiver and transmitter. Look at following links to build one for youerself
https://davidaugustat.com/arduino/wireless-rgb-controller-433mhz-rf-modules
https://arduinodiy.wordpress.com/2015/07/25/coil-loaded-433-mhz-antenna/
I am running openhabian on raspberry pi 3b.
Connect RF receiver to raspberry-pi gpio pins
How to receive RF signals
Convert RF to MQTT
Configure Door Sensor in Openhab2
Create rules in Alexa or Openhab2.
To use standalone door sensor, connect a buzzer instead of RF transmitter.
I am an IOT enthusiast with more than 20 years of experience in the IT sector. Specializing in telecom service's; follow me for some very innovative and best in class IOT products as I unfold my knowledge and passion for the subject.
Just me, myself and I, exploring the universe of uknownment. I have a heart of love and interests in technology, IOT and travel . And I want to share my world with you .