Internet of Things in the Insurance Sector

Today I will talk about you how the Internet of Things can be used in the insurance sector, and I will show you how a smart and connected fire alarm can save lives and lower premiums by notify people and the fire department automatically.

Anything that an insurance company can do to lower the risk of an accident, is to the benefit of both the insurer and the insured. For example, many insurance companies sell fire alarms in their web shops, but most of those alarms have a number of issues. The most dangerous one being that it doesn’t work, which usually happens because the battery is dead. Another problem is that they don’t work remotely, so if no one is home to hear the alarm, it’s not much use.

Therefore I’m building a smart and connected fire alarm that can notify any number of people, wherever they are, and of course, even the fire department. To do that, I will use an Arduino Yun with a gas sensor, and to connect everything, you need a breadboard, and three jumper cables.

To setup the hardware, you start by disconnecting everything from its power source, and then connect the GND on the Arduino to the gas sensor’s GND. Then connect Arduino 5V to the sensor’s VCC, and finally the Arduino’s first analog pin (A0) to the sensor’s signal (S/OUT) pin.

The smart fire alarm will simply get the gas reading from the sensor and publish it to an MQTT broker. This is the Arduino code (Sketch)…

…and after the initial includes (on lines 1-2), a constant for the analog input pin is defined (on line 4). The MQTT client object is defined and created (on lines 5-6), followed by the declaration of a number of variables (on line 7-11). In the setup, I initialize the bridge (on line 15), which allows communication between the microcontroller and the microprocessor, and then I connect the MQTT client to the server (on line 16). I’m using the sandbox provided by Eclipse, but you can use any MQTT broker. The eternal loop starts by checking if a five second interval has passed, and if so, reads the value from the gas sensor (on line 24). Since that value is a raw value (in the range 0-1023), it’s converted to a percentage (on line 25). Then the gas percentage is added to the payload (on line 26), and the data is published to the MQTT broker with the topic name “my/alarm/fire” (on lines 27-28).

With that in place, a server application can subscribe to the MQTT topic, and take necessary action. Here is an example in PHP that checks if the gas reading is above 60%, and if so, sends an SMS…

…and after the include of the MQTT library (on line 3, you can download it from https://github.com/bluerhinos/phpMQTT), I connect to the MQTT broker (on lines 5-6). Then I subscribe to the topic (on lines 8-9), and start an eternal loop (on line 11). When a value is published on the topic in the MQTT broker, the callback function (on line 15) will be called, and the JSON message is parsed (on line 17). The gas reading is extracted (on line 18) and if the gas percentage is above 60 (checked on online 19), an SMS is sent (on lines 21-22). I’m using the Clickatell service, and if you sign up as a developer, you will get your credentials to make the call. Note that the code contains an eternal loop, and therefore I recommend you to run it from the command line, so that you can stop it.

That’s how the Internet of Things can be used in the insurance sector.