跳到主要內容

MQTT Origin Purpose and Hands On Connect Raspberry Pi and iPhone


    "Top-down doesn't work", quoting from Arlen Nipper,  President and CTO of Cirrus Link, speaks at Advantech 2016 Industrial IoT World Partner Conference. Youtube Link

The following MQTT Broker application structure is from GTWang Blogger. I think this structure delivers a clear spirit of MQTT that is M2M, Device to Device, Tag to Tag communication. It is a flat structure and just like Arlen said, Top-down doesn't work, because there is no master-slave or top-down relation in it.


The Origin of MQTT
    MQTT(Message Queuing Telemetry Transport) was invented by Andy Stanford-Clark (IBM) and Arlen Nipper (Arcom, now Cirrus Link) back in 1999, when they faced AT&T regulation issue and turned to VSAT(satellite communication) solution to get data and control oil pipeline system. However, they could not use the traditional way to poll devices thru satellites due to data cost expensive and propagation delay.



MQTT Benefits - Do More With Less
    MQTT is invented for SCADA application 20 years ago. It becomes popular in these years due to IoT and Cloud computing. The key of being one of the hottest IoT language is the need for real-time, QoS(Quality of Service, makes sure Subscriber receive msg), lower power consumption, light-weight protocol. It must be the reason why FB Messenger adopts MQTT protocol. And it is a great example of "Do More With Less". Company can create various applications and product thru MQTT benefits.

SCADA Application
    Back to the original invention for SCADA system, an application interface to control and get data from PLCs  and other sensor device nodes. This structure has been no change for almost 40 years.
Is it the time to do something different for SCADA?
According to Arlen, "What we know Top-Down doesn't work". It seems like that they already used Top-Down method, from IT(Information Technology) to OT(Operation Technology) for controlling and monitoring pipeline system and the result was negative. It comes the conclusion, "Bottom-Up" is a good way to implement MQTT for SCADA application.
In 1999, I believe that there was no MQTT supported PLC or sensor devices. Even there was, it had to be highly-customized product and cost expensive in the market.
Nowadays, MQTT is an open protocol, and so many device can implement MQTT for various applications. It should be a good timing to do "Bottom-Up", from OT to IT, for SCADA application by implementing MQTT.
  
MQTT Implementation for SCADA - 欲練神功 引刀自宮
 Traditional SCADA system hooks up devices tightly for one single application purpose. When it transforms to MQTT bases, all devices need to be decoupled from each others. And then IT engineer can integrate data from MQTT to create OT SRP(Solution Ready Package). This is a big transformation to break up original SCADA design and then to grow up applications with MQTT spirit in it.
1. Demodulation is the first step to do MQTT.
2. Create OT solution.

Picture from Youtube video 



Hands-On MQTT

    In the following section, it shows you how easy it is to build MQTT connection between iPhone, NB and Raspberry Pi.

Prepare 
1. Install MQTT on Raspberry Pi. Refer to the detail and great instruction already post by
https://blog.gtwang.org/iot/raspberry-pi/raspberry-pi-mosquitto-mqtt-broker-iot-integration/
    Install: apt-get install mosquitto mosquitto-clients
    Subscribe: mosquitto_sub -t test
    Publish: mosquitto_pub -t test -m "Hello, world!"

2. Install MQTT Broker on PC NB. This is easier for monitoring MQTT msg communication thru Windows interface.



3. Install MQTTT app on iPhone


Testing

1. Open App in iPhone, Enter Broker IP address and Subscribe a topic.



2. Open MQTTlens in Chrome app and add Connection

3. Enter MQTT Broker IP address

4. Subscribe a topic and Publish it to test whether it works or not on this NB



5. Check iPhone MQTT msg

6. Use Putty terminal to subscribe a topic to NB broker and Subscribe the same topic on iPhone to syn the msg between NB, Raspberry and iPhone.



7. Try push msg from iPhone to Pi and check Pi msg in terminal.




8. Push msg from Pi to Phone




Conclusion
    With free open source MQTT, the communication between devices is really a piece of cake. After reading this article, you could have a better idea about MQTT and how to test it in just a few minutes. It gives you more time to create applications instead of spending effort on communications problem.
    As for SCADA system, is a flat structure with decoupled devices doable in SCADA? I think we need more time and cases to prove it.


留言

這個網誌中的熱門文章

[Python] For Loop for 9x9 Multiplication Table

 "Just Share and Record my learning track" #For loop to show 9 X 9 matrix i=1 j=1 for i in range(1,10,1): for j in range (1,10,1): print (i*j, end= " ") print() For Loop Example in One line     Check the following blog to know it. http://pythonnote.blogspot.tw/2010/01/blog-post.html

Demo MongoDB function in Raspberry Pi 3 with Node Red

Free source is every where on the internet especially for Linux system. Today, I wants to share how to run MongoDB on Raspberry Pi 3 and then use Node Red to get data and send data back to the database we just created. By doing this, you can just spend little money on Raspberry Pi 3 hardware and then you could start your way to build a data collection site with the latest flow-based programming tool, Node Red. Prepare  1. Refer to the detail and great instruction already post by http://recipes.item.ntnu.no/using-node-red-mongodb-to-gather-and-publish-data-on-a-raspberry-pi/ 2. Use SSH to log in Raspberry Pi 3 and start Node Red 3. Enter URL to Node Red at port 1880 and start draw the flow MonogoDB 1. Drag MongoDB block and Assign the Server IP address and DB name 2. Assign the Collection and Define operation as "Insert" 3. After Deploy, Go to Node Red UI and Test the switch function 4. Use SSH command to enter mongoDB shell and "use myDB"

PCI-1752U IDO Function Test with DAQNavi

When you have PIC-1752U IDO card function test request, you may try the following step to have a simple and quick function test. Prepare items:  HW: Windows Platform to insert PCI-1752U  SW: DAQNavi + PCI-1752U Driver Simple Steps: 1. Install and Open DAQNavi 2. Click Device Test Tap and select output 3. Fill in FF in textbox to turn on all output 4. Select Support Device to check Signal Connection 5. Wire PCI-1752U thru 100 pin SCSI cable to ADAM-39100, and use LED board to test the output function Finally, you could jump back to Device Test Page, and you may find the bug - all output channel show "turn off", but they are actually turning on. This may due to software bug not keeping DO status when switching pages.