The usual method to detect smoke consists in measuring the reflection of a light beam on the smoke particles suspended in the air. Although we don't explicitly have a smoke detector in our product catalogue, we recently started offering a product which can be used for this: the Yocto-RangeFinder. Indeed, this sensor uses exactly the same principle for its main feature (distance measurement) and can therefore easily be used as USB smoke detector, or even as a networked smoke detector.
The principle is simple: normally, the Yocto-RangeFinder infra-red beam is reflected at a pre-determined distance.
Journey of the infra-red beam in the absence of smoke
In the presence of smoke, part of the infra-red beam is reflected against the particles in suspension and the sensor measures a shorter distance.
Infra-red beam reflection against the smoke
The Yocto-RangeFinder enables a detection on a range of 25cm. The measuring area must be located where the smoke is most likely expected to stay: usually on just under the ceiling, because it's there that smoke coming from combustion goes first.
Now let's see how to embed smoke detection into an application, for example to signal the event in a data base or via Internet.
The simplest way would be to read the sensor value periodically to know if a reflection is detected. But it's not the best solution because in case a light smoke, reflection is intermittent. Thus, this method might miss a significant event if the readings don't happen at the right time. The best method is to use the callback mechanism, which is automatically triggered when there is a change of value. To do so, here is the code to be added at the beginning of your software:
string errmsg = "";
if (YAPI.RegisterHub("usb", ref errmsg) != YAPI.SUCCESS)
Console.WriteLine("Failed to init USB: " + errmsg);
sensor = YRangeFinder.FirstRangeFinder();
if (sensor == null)
Console.WriteLine("Smoke detector not connected, check cable !");
From there, you only need to regularly call the YAPI.HandleEvents() function and your smokeCallback() function is automatically invoked in case of smoke detection, even if the detection happens in between two calls to YAPI.HandleEvents(). Here is an example of a callback function:
static void smokeCallback(YProximity sensor, string value)
// The value is the detection distance, in millimeter
// Here, we use 250mm as a normal reflection distance
if (Int32.Parse(value) >= 250) return;
// Insert your own code here to report the event
Console.WriteLine("Smoke detector detection: " + value);
And just for fun, here is a short demonstration using a multi-sensor smoke detection application:
Note: although this system can be quite useful for specific experiments, this is not a real safety system, and it is for sure not certified as such!