Passive monitoring of an empty house

Passive monitoring of an empty house

Let's imagine an isolated house, unoccupied most of the time, with the heater set to the minimum to prevent pipes from freezing. No Internet, no phone... only electricity. How to make sure, without going there, that: a/ the boiler has not broken down , b/ no one settled in inside the said house without your knowledge? We had a few ideas...




The system

The idea is to use a YoctoHub-GSM-3G-EU for connectivity, a Yocto-PT100 for the temperature, and a Yocto-CO2 to detect a potential presence, the whole system being powered by a USB charger delivering up to 2A.

The system schematic
The system schematic


The PT100 is clearly an overkill in terms of precision, but you can easily find PT100 probes in the form of a metal rod, which allows you to easily measure the temperature outside of the enclosure. Indeed, a temperature measure inside the enclosure is likely perturbed by the heat generated by the system electronics.

The heart of the system
The heart of the system


Measuring the CO2 rate is a quite efficient method to detect the presence of a person or a large animal in a room which is supposed to be empty. The Yocto-CO2 is quite able to detect the CO2 emitted while someone is breathing. Obviously, it's not as reactive as a traditional method, a few minutes are required to observe a significant change. A burglar that breezes through will perhaps not be detected, but if someone lingers a little bit in the room where the detector is located, you are going to see it.

The completed system
The completed system


Prepaid SIM card

To make the system work, we decided to use a prepaid SIM card. The advantage of the prepaid system is that a prepaid SIM card dies on its own if you stop recharging it. Thus, if you don't need the system anymore, or worse if the system disappears for whatever reason, you don't need to wait until the anniversary of your subscription to cancel it.

Configuration

Emoncms

The simplest way is to configure the YoctoHub-GSM-3G-EU so that it sends its data directly on a cloud service such as Emoncms. No programming, easy as pie.

The Yoctopuce hubs can automatically post data from their sensors on Emoncms
The Yoctopuce hubs can automatically post data from their sensors on Emoncms


However, this method suffers from a limitation. As we use a prepaid SIM card, it's unlikely that the YoctoHub-GSM-3G-EU has its own public IP address. This means that the hub cannot be contacted from the Internet. The only way to change the hub configuration is to use its USB port, which implies physical access to the system.

Emoncms through the PHP API

The trick to solve the issue of the non public IP address is to configure the hub so that it posts data on a server running a PHP script. This script then has as main task to retransmit the measures to Emoncms, but it can also change the hub and sensor configurations thanks to the callback API. Thus, if you want to modify a system parameter, such as the callback frequency, you only need to modify the script remotely and the hub configuration change is performed when the hub contacts the script again. This technique has another advantage: with it, you can obtain the maximal value reached by a sensor between two callbacks. In this way, even if someone breathes right on top of the box, even if only for a few seconds... it's going to show. The PHP code to manage the configuration, compute the CO2 maxima, and forward the data on Emoncms takes a few lines only:


<?php
include('yocto_api.php');
include('yocto_temperature.php');
include('yocto_carbondioxide.php');

if (YtestHub("callback",100,$errmsg)==YAPI_SUCCESS)
{  if (YRegisterHub("callback",$errmsg)!=YAPI_SUCCESS)
         {die($errsmg);}

   // remotely change the callback period, if necessary
   $callbackPeriod = 7200;  // one call back every 2 hours
   $network = YFisrtNetwork("$serial.network");
   if (!is_null($network))
     { if ($network->get_callbackMinDelay()!=$callbackPeriod)
       {  $network->set_callbackMinDelay($callbackPeriod);
          $network->get_module()->saveToFlash();
       }
     }

   $temp = -999; $co2  = -999;

   // read temperature current value
   $t = YFirstTemperature();
   if (!is_null($t))
   { $temp=$t->get_currentValue();
   }

   // read CO2 value and max since last callback
   $c = YFirstCarbonDioxide();
   if (!is_null($t))
    { $co2=$c->get_currentValue();
      $co2max=$c->get_highestValue();
      if ($co2max==0) $co2max=$co2;
      $c->set_highestValue(0);
    }

  // send the data to emoncms
  $url = "https://emoncms.org/input/post.json?json={temp:$temp,co2:$co2,co2max:$co2max}&apikey=PutYourEmoncmsApiKeyHere";
  $response = http_get("$url");
} else die('<tt>not supported.</tt>');
?>
 


We configured the system so that it posts data every two hours. On the Emoncms graph below, it's easy to see the temperature peaks caused by the sun and the CO2 peaks when someone breathes in the room where the system is located, or even breathes on the system.

It was sunny the first three days... and someone had fun breathing on the CO2 sensor
It was sunny the first three days... and someone had fun breathing on the CO2 sensor



And how much does it cost?

Nothing... or almost nothing if you select your prepaid SIM card appropriately. We discovered that the M-budget prepaid SIM card (3in1), available in Switzerland at Migros, costs CHF 20.-- when you purchase it and offers you 10MB of free data per month in Switzerland. So, if your system is set up in Switzerland, and if you configure the callback frequency so that the quantity of data is below 10MB per month, using the system costs you absolutely nothing. We don't quite know for how long this offer will stand, but we intend to take advantage of it :-)

Above all, select your prepaid card with care
Above all, select your prepaid card with care


Obviously, these cards are really interesting in Switzerland only, M-budget roaming costs a minimum of CHF 4.50 per month for 10MB. However, this shows that in terms of prepaid cards, it can pay to have a look at offers from outsiders.

Conclusion

With our three Yoctopuce modules, we built in a jiffy a system that solves a precise issue: that is, making sure remotely that the heating in an isolated house works correctly. All this without depending on a subscription to a third party company. Icing on the cake, nothing prevents us from improving the system to, for example, send emails when there is a problem, or even drive the heater remotely...

Add a comment No comment yet
Back to blog












Yoctopuce, get your stuff connected.