Tom van Loon
Published © CC BY-NC-SA

Tiny DOOR Sensor 1

The cheapest DIY version of a WiFi node.

BeginnerProtip2 hours569
Tiny DOOR Sensor 1

Story

Read more

Custom parts and enclosures

Part list

Schematics

Tiny DOOR S1 SCH

Code

Tiny DOOR S1 - INI

C/C++
IDE
// 
// Tiny Door Transmitter by @TOM at aquapoeder.nl
// https://www.hackster.io/Tom_van_Loon/tiny-door-sensor-1-e9d338
//
// https://creativecommons.org/licenses/by-nc-sa/2.0/
//
// Sources ;
// 
// Nathan Chantell
// https://nathan.chantrell.net/20130215/tinytx3-wireless-sensor-board/
//
// Suat Özgür
// https://github.com/sui77/rc-switch/
//

const int DO = 0;  // For sending to the Transmitter
const int LED = 1; // For indication of trigger
const int CS = 2;  // For selecting the Transmitter
const int IN = 3;  // Default LOW

int buttonState = 0;

#include <RCSwitch.h>;
RCSwitch mySwitch = RCSwitch();

Tiny DOOR S1 - SETUP

C/C++
IDE
void setup() {
  
  pinMode(DO, OUTPUT);
  pinMode(LED, OUTPUT);
  pinMode(CS, OUTPUT);
  pinMode(IN, INPUT);
  
  mySwitch.enableTransmit(DO); // Equels PB0
  

Tiny DOOR S1 - LOOP

C/C++
IDE
void loop() {
  buttonState = digitalRead(IN);
  if (buttonState == HIGH) {
    digitalWrite(CS, HIGH); // Broken chain / Alarm
        delay(80);
    mySwitch.send(4477265,24); // Elro 01010 B ON code ( Sending string 20817 )
        delay(300);
    digitalWrite(CS, LOW);
        delay(80);
    digitalWrite(LED, HIGH);
        delay(8000);
    digitalWrite(LED, LOW);
  }
  else {
    digitalWrite(CS, HIGH);
        delay(80);
    mySwitch.send(4477268,24); // ( Sending string 20820 )
        delay(300);
    digitalWrite(CS, LOW);
        delay(80);
        
  } // END of if then
  
    delay(23000);
}

Credits

Tom van Loon

Tom van Loon

3 projects • 2 followers
Sr Test Technician - OPS

Comments