In compliance with high industry standards

Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

How to send WhatsApp messages with an industrial Raspberry PLC

Node-RED tutorial: Develop your alarm application with Raspberry PLC for industrial automation

Introduction of Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

Introduction

Raspberry Pi automation

Can you imagine receiving an alarm from your industrial Raspberry Pi PLC to your phone via WhatsApp in real time?

That is possible because of the Open-Source Raspberry Pi 4. So in this tutorial, we are going to teach you how to develop a very simple low-code program using Node-RED for PLC programming, so that you can be more competitive by streamlining your business processes.


Related links

How to connect Raspberry PLC to

Wi-Fi

 

Basics about Raspberry Pi based PLC Analog Outputs


How to find your perfect industrial Programmable Logic Controller

How to program a Raspberry Pi industrial PLC
Interrupt inputs with Python

Read >>

Open Source PLC Raspberry Pi
Family Products


Read >>

TouchBerry Pi
Family Products


Read >>

 Requirements

 Either Ethernet cable or HDMI cable with an extra monitor

 Explanation

Node-RED

Setting an alarm with a Raspberry PLC can be a very useful functionality to take control of your industrial environment. With our Open-Source Hardware, you will be able to get WhatsApp messages and take control of your company.

The first thing we need to do is to open the Node-RED from our Raspberry PLC. Install it if you do not have it yet from here.

As we can access either through SSH or HDMI, we will open our browser and just type:

localhost:1880 <--- If you are connected through HDMI

or

YOUR-IP-ADDRESS:1880 <--- If you are connected through SSH.

Once you are into Node-RED, let's develop our alarm application using WhatsApp!

Node-red-contrib-whatsapp-cmb for industrial control

As we are going to use the node-red-contrib-cmb nodes from Node-RED to develop our alarm system, we first need to install the nodes.

1. So, once in Node-RED go to the top right hamburger menu > click on Manage Palette > Install > Typenode-red-contrib-whatsapp-cmb

and install it.

2. If you go to the filter nodes search bar, and search 'WhatsApp', you will see a new green node called Send Message. Drag and drop the node to the flow, and double click to explore it.

3. If any field of a Node-RED node is red, means that it must be configured. As the account field is red, click on the pen to edit. T

The properties' configuration node will be displayed. You will need to fill in your phone and API-KEY. Follow the steps from here to create an API-KEY.

4. Once the API-KEY is created and you can interact with the WhatsApp Bot, it is very easy to test the example. First, fill in your phone and API-KEY in the Send Message node and leave it configured.

Node-red-contrib-whatsapp-cmb - Node-RED tutorial: How to send WhatsApp messages

Getting inputs

This application can be applied for multiple purposes and inputs can come from different places. The Raspberry PLC from Industrial Shields, as you can see here, can have up to 36 inputs. That is perfect for our application, as we could get the values like this:

Getting inputs 1 - Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

Even though it is a very simple way of getting a value from an input, we are going to do it easier with inject nodes.

5. Add three inject nodes with sample values, like 21, 22 and 23 to send a WhatsApp message as a temperature alarm if the value is higher than 22.

Getting inputs 2 - Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

6. Now, add a switch node to get the value if is higher than 22 like this:

Getting inputs 3 - Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

7. Then, add a change node and set the msg.payload to the message you want to be sent to your WhatsApp.

Getting inputs 4 - Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

8. Finally, wire the Send Message node to the change node, and add a debug node to get the debug messages.

Getting inputs 5 - Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

9. Inject the 21, 22 and 23 messages, and get your alarm in your phone!


Get your alarm in your phone - Node-RED tutorial: How to send WhatsApp messages with an industrial Raspberry PLC

Now, would you like to learn how to send emails from your Raspberry Pi PLC controller?

Looking for your ideal PLC?

Take a look at this product comparison with other industrial controllers Arduino.

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC controller comparison >>

Do you want more information?

Just fill the form!

Tell me more!