You are on page 1of 11

Exploring Node-Red for

IoT Application
Development

ibrahim zouaid
ibrahim.zouaid1@gmail.com
Contents

1. Introduction to Node-Red
2. Location Tracking with Node-Red
3. Setting Up Webhook Relay
4. Creating the Flow for Location Tracking
5. Enhancing Location Tracking
6. Generating O2 Saturation Levels
7. Automating O2 Saturation Tracking
8. Conclusion and Next Steps
9. Thank You
Introduction to Node-Red

Node-Red is a powerful graphical development tool that


allows easy connection of hardware devices, APIs, and
online services. Initially developed by IBM for internal
use, it was open-sourced in 2016 and has since been
widely adopted for IoT application development in
various industries. It comes with a plethora of pre-built
nodes for performing complex tasks, such as sending
data using MQTT protocol.
Location Tracking with Node-Red

One of the key applications of Node-Red is location


tracking. In this scenario, we need to track the location
of a patient while ensuring the security and privacy of
their data. We leverage an open-source mobile
application called OwnTracks, which securely sends
phone location data to a chosen server without the need
for external data aggregation services.
Setting Up Webhook Relay
Creating a Public Endpoint for Webhooks

1 Create Webhook Bucket

To begin, we create a bucket on


https://my.webhookrelay.com and name it 'patientTrack'.
Buckets are used to aggregate webhooks and send them to
multiple destinations via WebSockets. Once the bucket is
created, we obtain the public endpoint URL and provide it to
the OwnTracks application installed on our IoT device.

2 Install and Configure Application

After installing the OwnTracks application, we configure it to


use the public endpoint URL obtained from the Webhook
Relay. Additionally, we set the secret encryption key to ensure
data encryption before sharing the location. Once configured,
we can manually publish the location from the application.
Creating the Flow for Location Tracking
Step-by-Step Flow Creation

Sending Location Data to Map


Obtaining Webhook Data Decrypting OwnTracks Data and API

We use the After obtaining the payload, we The formatted location data is
node-red-contrib-webhookrelay decrypt the location data using then sent to the worldmap and
node to receive webhooks from the node-red-contrib-owntracks tracks nodes to update the
the Webhook Relay bucket. This node, ensuring the same pointer on the map and draw
involves generating a pair of key encryption key set in the IoT lines as the patient moves.
& secret tokens and adding them object application is used. The Additionally, the http response
to the node, along with setting the decrypted payload is then node is used to send the latitude
bucket name as defined in the formatted as per our specific and longitude to our web
Webhook Relay. requirements. application API.
Enhancing Location Tracking
Advanced Features for Automated Alerting

1 Geo-Fencing for Risk Zones

By connecting the decrypted OwnTracks data with the


node-red-node-geofence, we can create triggers based on
geo-fences. This enables us to automate actions such as
sending alerts when the patient enters or exits specified
zones.

2 Humidity Monitoring for Patient Safety

We utilize the openweathermap API to extract weather and


atmospheric parameters at the patient's location. This helps
us evaluate if the environment poses any risks to the
patient's health based on humidity levels and wind degrees in
comparison to the patient's oxygen saturation levels.
Generating O2 Saturation Levels

In cases where the IoT device is not yet available, we


create a Node-Red flow to generate random oxygen
saturation levels. This flow involves using the http in
node to define the URL for capturing the saturation
percentages, reading the values from a JSON file, and
applying necessary adjustments to mimic real-world
scenarios.
Automating O2 Saturation Tracking
Building a Flow for O2 Saturation Levels

Data Reading and Adjustment Integration with Web Application

The Node-Red flow includes a node to The final step involves passing the
read and adjust the random saturation generated O2 saturation data to the web
values obtained from an external API. By application API for visualization and
setting the minimum and maximum analysis. This integration enables
values and adapting the data to realistic seamless tracking and monitoring of
ranges, we ensure the simulated data is patient health metrics.
meaningful and useful.
Conclusion and Next Steps
Wrapping Up the IoT Application Flow

1 Exploration of Advanced Features

Through this exploration of Node-Red for IoT application


development, we have uncovered the power of leveraging
advanced features such as geo-fencing, humidity monitoring,
and automated alerting. These capabilities lay the
groundwork for creating comprehensive and secure IoT
solutions.

2 Future Development Opportunities

As we conclude, it's important to recognize that the potential


for further development and enhancement of IoT
applications using Node-Red is vast. There are opportunities
to integrate additional sensors, implement predictive
analytics, and foster innovation in remote patient monitoring.
Thank You
Questions and Discussion

You might also like