← Zurück zur Übersicht

IOT16 NETWORKING

Veröffentlicht am 2020-11-15 00:00:00.0


IOT16 NETWORKING

NETWORKING WITH IOT

TCP(2019-11-12)

The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered, and error-checked delivery of a stream of octets (bytes) between applications running on hosts communicating via an IP network. Major internet applications such as the World Wide Web, email, remote administration, and file transfer rely on TCP. Applications that do not require reliable data stream service may use the User Datagram Protocol (UDP), which provides a connectionless datagram service that emphasizes reduced latency over reliability.

IOT Networkprotokolls(2019-11-12)

  1. HTTP
  2. with REST
  3. Constrained Application Protocol (CoAP) based on UDP
  4. MQTT
  5. KAFKA
  6. Blynk

Mostly it is sensefull to use standardised protocols

IOT Networkprotokolls(2019-11-12)

Network

MQTT(2019-11-12)

The MQTT protocol runs on TCP / IP or other network protocols and provides an ordered, lossless, bidirectional connection. Features include:

  1. The publish / subscribe messaging pattern used, which provides one-to-many messaging for decoupling from the application.
  2. Message-masking mechanism for payload content.
  3. There are three Quality of Service (QoS) for transmitting messages:
  4. At most, messages of this level may be lost or duplicated, and message postings depend on the underlying TCP / IP network. That is: <= 1
  5. At one time, this level will ensure that the message arrives, but the message may be repeated. That is:> = 1
  6. Only once, make sure the message arrives only once. That is: = 1. In some demanding billing systems, you can use this level Data transfer and protocol exchange is minimized (protocol header only 2 bytes) to reduce network traffic
  7. Notification mechanism, notify the transmission of both sides when an exception occurs

MQTT - UseCase

UseCase

MQTT

MQTT

MQTT

MQTT

MQTT

MQTT

MQTT

MQTT

MQTT

MQTT

MQTT - Message structure

  1. topic
  2. payload

MQTT TOPIC

You can subscribe to a topic. You can just subscribe one special topic like

mosquitto_sub -h localhost -t channel/sensor/deviceid

  1. -t subscribe to topic
  2. -h The broker adress

MQTT TOPIC Wildcards

For subcribing you can use wildcards

mosquitto_sub -h localhost -t channel/#

mosquitto_sub -h localhost -t sensor/#

the # works only on the end of a subscribed topic

MQTT TOPIC Wildcards

mosquitto_sub -h localhost -t channel/+/temp

mosquitto_sub -h localhost -t sensor/+/90008

MQTT QoS (Quality of Service)

  1. At most once (0) called “fire and forget”
  2. At least once (1)
  3. Exactly once (2).

Configure the LG02 with MQTT

We used the LG02 to do it in some small projects

Configure the LG02 with TTN

We also tried some TTN-Configurations with TTN-Asia in the workshop

Configure Mosquitto

LORAWAN

LoRaWAN is a media access control (MAC) protocol for wide area networks. It is designed to allow low-powered devices to communicate with Internet-connected applications over long range wireless connections. LoRaWAN can be mapped to the second and third layer of the OSI model. It is implemented on top of LoRa or FSK modulation in industrial, scientific and medical (ISM) radio bands. The LoRaWAN protocols are defined by the LoRa Alliance and formalized in the LoRaWAN Specification which can be downloaded on the LoRa Alliance website.

LORAWAN

LORAWAN

LORAWAN Topology

![Topology](/img/600iotnet-lora.jpg

LORAWAN-UseCase

UseCase

The Dragino LG02 Gateway(2019-11-12)

  1. LG02 can be used to provide a low cost IoT wireless solution to support 50~300 sensor nodes.
  2. Except LoRaWAN mode, LG02 can support multiply working mode such as:
  3. LoRa repeater mode,
  4. MQTT mode,
  5. TCP/IP Client mode,
  6. TCP/IP Server mode

For MQTT Downlink/Subscribe you need to program with the Bridge-Library some extensions. I like to send some examples after being home.

to fit different requirement for IoT connection.

Dragino Gateway

Gateway

full featured LORAWAN-Gateways

You find a list of fullfeatured LORAWAN gateways here

  1. Example!

MOSQUITTO The Broker

I installed for you

mosquitto-Konfiguration and first experiments

  1. Config in the /etc/mosquitto/mosquitto.conf

  2. start mosquitto like this mosquitto -v

  3. Test mosquitto

  4. SUBSCIBE: mosquitto_sub -h localhost -t test

  5. PUBLISH: mosquitto_pub -h localhost -t test -m "Hello World!"

  6. create a password-file and a first password with

  7. sudo mosquitto_passwd -c /etc/mosquitto/passwd tptc (in this case the password I used tptc also as password)

  8. add further password to this file (Attention Use the same filename)

  9. sudo mosquitto_passwd -b /etc/mosquitto/passwd paulsen xxxx mosquittopub -h mqtt.thingspeak.com -p 1883 -u dragino -P QZXTAKE88V3S7O2J -i draginoClient -t channels/200893/publish/B9Z0R25QNVEBKIFY -m "field1=34&field2=89&status=MQTTPUBLISH"

  10. last not least use this for subscribe to the channel and store the messages into the file /home/paulsen/tmp/tptc-messages

  11. mosquitto_sub -h localhost -u paulsen -P xxxx -t channel/908020/temp > /home/paulsen/tmp/tptc-messages

  12. show the file content on linux with tail -f|less tmp/tptc-messages

    sudo mosquitto_passwd -c /etc/mosquitto/passwd tptc

mosquittosub -h localhost -t test mosquittopub -h localhost -t test -m "Hello World!" sudo mosquitto_passwd -c /etc/mosquitto/passwd tptc

Info

Diese Seite wurde dynamisch aus Groovy-DSLs generiert.


User: