Thibault
Published © GPL3+

ThiDom Home Automation

This project uses Arduino, Raspberry and Attiny, it allows you to control and monitor your home.

IntermediateShowcase (no instructions)9,983
ThiDom Home Automation

Things used in this project

Story

Read more

Schematics

Opening detector

Code

Opening detector

Arduino
#include <RF24Network.h>
#include <RF24.h>
#include <PinChangeInterrupt.h> 
#include <init_variable_attiny.h>
#include "check_btn.h"

const byte this_node = 1;
const byte other_node = 0;

void setup() { 
	pinMode(csn_pin, OUTPUT); 
	attachPinChangeInterrupt(digitalPinToPCINT(2),check_btn,FALLING); 
	radio.begin();
	network.begin(95, this_node);
	radio.setDataRate(RF24_250KBPS);   
}

void check_btn(void)
{
  detectchange = true; 
}

void loop() {   
	if (detectchange) {    
		digitalWrite(csn_pin,HIGH);
		radio.powerUp(); 
		SendDataRF24('open',other_node); 
		detectchange = false; 
	} 
}

Credits

Thibault

Thibault

1 project • 10 followers

Comments