Smart Home in 8 KBytes...

Smart Home in 8 KBytes...

Home presence and the alarm system connection

2017. május 29. - Eaglewing

pics.pngThe idea of the whole smart home was popped in my head thankfully to my wife. Well, not directly, but on an interesting way :).

I realized several times that the recuperator was switched off (which control was designed and produced by myself too) by my wife. I asked her the simplest question: why? Because it is noisy :) she replied. I just remembered that our alarm system has some programmable outputs. Then the idea was born: let us run the recuperator when we are not home.

 

The service manual of Bosch Solution has a nice chapter about programmable outputs.

(Page 202 when interested in the Bosch Service Manual)

There are 4 outputs to us (three at mine, as the 4th was used for the extra buzzer).

alarmsys_output.PNG

Some possible events from the service manual:

  • System Armed
  • Armed in Stay Mode
  • Armed in Away Mode
  • Exit Warning
  • AC Fail
  • Low Battery
  • Mimic System Fault
  • Sirens running
  • …and so on, approx. 80 events are listed, etc.

I used the ones marked with bold. I don’t need to detect that the alarm system armed when we are home (armed in stay mode) – would not make much sense.

However, when I get a signal when we are not home (armed in away mode), or the alarm is running, or there is a problem with the system, then we need to act.

The alarm system outputs support different kind of polarity approaches: normally open and going low, or normally low, one shot open, etc. (page 213 when interested). These outputs are open collectors. That made me some headache to figure out how do they work, but the simplest use and explanation is the following.

“Normally open, going low” is a behavior like a switch which is normally switched off (disconnected). At the trigger of the event, the connection between ground and the mentioned pin will be closed, so the switch is turned on (closed)....but there are some caveats I had experienced while playing with that:

- I was able to measure between an output and gnd 12V. That is nice, but means nothing. You cannot a drive a relay or other things. It won't work, no current will flow.

- If an output is not "going low", but you try to drive a relay or connect anything else (like arduino), it will float. So you can measure and "detect" everything. Even grounded values. This must be considered at programming

- The only stable thing you can rely on is the activated state: then the output is really stable grounded. 

So here comes the logic: we check for grounded state, but this state must be there for at least some seconds to accept it as a valid result, and so the misreadings from the other (floating) status will be ignored/filtered

How to connect that thing to the Arduino? Basically it is the same thing as this example on the Arduino page:

https://www.arduino.cc/en/Tutorial/InputPullupSerial

Yes, you have to configure your digital input as INPUT_PULLUP, and simply connect Arduino GND with the alarm system GND, and alarm system output with an arduino input pin. No need to use optocouplers, as the alarm system already has a built-in protection for that (so the service manual says..).

And a different thing I solved: There is an option to start the alarm system remotely, by simply violating an always live zone - disconnecting a zone - for a second. An alarm system zone is cabled through a relay, which is normally closed. It will be opened for a sec it an alarm have to be started (about the relays I will write later)

Arduino code to process the alarm system signal:

  

void initiateAlarmSystem()
{
//set input pins, pullup
#define ALARMSENS1 7 //input, pullup AWAY ARMED
#define ALARMSENS2 5 //input, pullup ALARM HIGH
#define ALARMSENS3 6 //input, pullup SYS FAIL
#define ALARMTRIGGER_RELAY3 24 //output, relay

pinMode(ALARMSENS1, INPUT_PULLUP);
pinMode(ALARMSENS2, INPUT_PULLUP);
pinMode(ALARMSENS3, INPUT_PULLUP);
pinMode(ALARMTRIGGER_RELAY3, OUTPUT);
digitalWrite(ALARMTRIGGER_RELAY3, HIGH);

}
void readAlarmSystemstatus()
{

//a 3 digital pin állapotát leolvassa. time késleletés kell bele, mert néha fluktuál pár állapot...

const long CHECKPERIOD = 6000; // 6 sec
static unsigned long AlarmSens1Expire = 10000; //skip immediate check at arduino startup
static unsigned long AlarmSens2Expire = 10000;//skip immediate check at arduino startup
static unsigned long AlarmSens3Expire = 10000;//skip immediate check at arduino startup

//reading alarm system status
//out1: alarm system away armed
//goes stable low when armed, otherwise it is very unstable....
//so we only report armed delayed when =LOW more than 5 sec

if (digitalRead(ALARMSENS1)==HIGH)
{
//definetly not armed or we are disarmed
if (alarmSystemArmedAway==true)
{
//addLogEntry(F("Alarmsys away OFF!"));
//ALARM system deactived
//notify smart control: set back heating, turn off recuperator, etc/
alarmSystemArmedAway = false;
#ifdef ServerDEBUG
Serial.println(F("Alarmsys: Away OFF"));
#endif
addLogEvent(3,6);
sd_stat2.alarmSystemArmedAwayLastOffTime = now();needsSoftSave = true;
nofityAlarmSystemAwayArmedStatusChanged();
}
AlarmSens1Expire = millis()+CHECKPERIOD;
alarmSystemArmedAway = false;

}
else if (digitalRead(ALARMSENS1)==LOW)
{
if (millis()>AlarmSens1Expire)
{
if (alarmSystemArmedAway==false)
{
alarmSystemArmedAway = true;
#ifdef ServerDEBUG
Serial.println(F("Alarmsys: Away ON"));
#endif
addLogEvent(3,5);
sd_stat2.alarmSystemArmedAwayLastOnTime = now();needsSoftSave = true;
nofityAlarmSystemAwayArmedStatusChanged();
//addLogEntry(F("Alarm sys away armed!"));
//ALARM system is activated
//notify smart control: set heating to eco, turn on recuperator for on hour, etc/

}

}
}

 

Questions? Feel free to ask in the comments section.

Meantime you may request my CV in email as I am looking for new challenges (job) - my main experience lies in the ICT project/program manager area for German multi companies. Contact is stingraycayman@gmail.com. 

 

 

 

 

 

A bejegyzés trackback címe:

https://arduinosmarthome.blog.hu/api/trackback/id/tr1512546145

Kommentek:

A hozzászólások a vonatkozó jogszabályok  értelmében felhasználói tartalomnak minősülnek, értük a szolgáltatás technikai  üzemeltetője semmilyen felelősséget nem vállal, azokat nem ellenőrzi. Kifogás esetén forduljon a blog szerkesztőjéhez. Részletek a  Felhasználási feltételekben és az adatvédelmi tájékoztatóban.

Nincsenek hozzászólások.
süti beállítások módosítása