MQTT + Kafka + Raspberry Pi ElasticSearch Cluster [P016]






https://www.youtube.com/watch?v=coKGRMDqAJk


* GitHub : https://github.com/rdiot/rdiot-p016


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea : for Kafka Cluster

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 4ea : for ElasicSearch Cluster

- USB Power Supply

- Ethernet Hub


* Contents

1. Raspberry Pi ElasticSearch Cluster Setup

- version : elasticsearch 2.4.6

- master config
 : 
https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-master-01.yml

- data node config 

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-01.yml

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-02.yml

 : https://github.com/rdiot/rdiot-p016/blob/master/elasticsearch_es-pi-data-03.yml




2. logstash configuration

https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-airGrade.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-cds.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-humidity.conf

- https://github.com/rdiot/rdiot-p016/blob/master/logstash-kafka-elasticsearch-temperature.conf


3. start logstash script example

#!/bin/sh

export LS_HEAP_SIZE="500m"

/data1/logstash/logstash/bin/logstash -f /data1/logstash/logstash-kafka-elasticsearch-temperature.conf -l logstash.log &


4. Kafka logstash Monitoring


5. ElasticSearch data node shard


6. Grafana Setup

- Install in Raspberry Pi

$ sudo apt-get install libfontconfig

$ curl -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v4.0.1/grafana_4.0.1-1480722482_armhf.deb -o /tmp/grafana_4.0.1-1480722482_armhf.deb

$ sudo dpkg -i /tmp/grafana_4.0.1-1480722482_armhf.deb


$ sudo vi /etc/grafana/grafana.ini

# The ip address to bind to, empty will bind to all interfaces

http_addr = 192.168.0.20


$ sudo systemctl enable grafana-server

$ sudo systemctl restart grafana-server


- Connect Grafana WebAdmin

http://92.168.0.20:3000

id/pwd : admin/admin


- Add Data Sources : http://192.168.0.20:3000/datasources/new


- edit data source examples


7. Grafana Dashboard 

- Kafka-Sensor-Monitoring

 : Temperature, Humidity, Cds, AirGrade


Posted by RD IoT RDIoT

댓글을 달아 주세요

MQTT + Kafka + Amazon ElasticSearch Service [P015]

 

 




https://www.youtube.com/watch?v=-8B8Yp52XMY


* GitHubhttps://github.com/rdiot/rdiot-p015


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea : for Kafka Cluster

- USB Power Supply

- Ethernet Hub

 

* Contents

1. Amazon ElasticSearch Service Setup

 - Define domain

- Configure cluster


- Set up access

- Review


Amazon Elasticsearch Service dashboard


2. ES Information example 

- ElasticSearch Endpoint : https://search-rdiot-aws-es-2yolnmmxbjghreiywdbh4yrsay.ap-northeast-2.es.amazonaws.com

- Kibana URL : https://search-rdiot-aws-es-2yolnmmxbjghreiywdbh4yrsay.ap-northeast-2.es.amazonaws.com/_plugin/kibana/



3. MQTT - Kafka - Bridge (json)

- source : https://github.com/rdiot/rdiot-p015/blob/master/MqttToKafkaReConn.java

- result 

{"time": 1511884443315,"value":724}

{"time": 1511884444405,"value":724}

{"time": 1511884445488,"value":723}

{"time": 1511884446579,"value":724}

{"time": 1511884447657,"value":726}


4. install logstash : tested logstash-2.4.1 

$ cd /data1/logstash

$ wget https://download.elastic.co/logstash/logstash/logstash-2.4.1.tar.gz

$ tar zxvf logstash-2.4.1.tar.gz

$ ln -s logstash-2.4.1 logstash


$ sudo apt-get install ant texinfo openjdk-8-jdk build-essential

$ git clone https://github.com/jnr/jffi.git

$ export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-armhf"

$ cd jffi

$ ant jar

$ sudo cp build/jni/libjffi-1.2.so /data1/logstash/logstash/vendor/jruby/lib/jni/arm-Linux


5. logstash config : tested logstash-2.4.1 

- source : https://github.com/rdiot/rdiot-p015/blob/master/logstash-kafka-aws-es.conf

input {

   kafka {

   zk_connect => "kafka-pi-01:2181"

   group_id => "logstash"

   topic_id => "cds"

   consumer_threads => 2

   decorate_events => true

   

  }

}


filter {

  json {

    source => "message"

  }

  date {

    match => [ "time", "UNIX"]

    target => "time_new"


  }   

}


output {

  elasticsearch {

    index => "test-%{+YYYY.MM.dd}"

    hosts => ["https://search-rdiot-aws-es-2yolnmmxbjghreiywdbh4yrsay.ap-northeast-2.es.amazonaws.com"]

    codec => json

  }

  stdout {

    codec => "rubydebug"

  }

}


6. Amazon ElasticSearch Query Sample



7. Kibana : Search & Chart 


 



Posted by RD IoT RDIoT

댓글을 달아 주세요

ARTIK MQTT + Raspberry Pi Apache Kafka Cluster Bridge [P014]



* Arduino MQTT Client to ARTIK MQTT Broker


* ARTIK MQTT Broker & Raspberry Pi Kafka Cluster


* Run MQTT-Kafka-Bridge


* Kafka Console Consumer


* KafkaMonitor



https://www.youtube.com/watch?v=JIEIv-pEFFs


*GitHub : https://github.com/rdiot/rdiot-p014.git


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea

- USB Power Supply

- Ethernet Hub



* Contents

1.  ARTIK MQTT Start 

- mqtt broker (1883)

$ mosquitto &


2. Add MQTT Topics in the node-red

- node-red (1880)

$ node-red &


3. Arduino MQTT Client 

- source

https://github.com/rdiot/rdiot-p014/blob/master/arduino_mqtt_client.ino



4. MQTT Kakfa Bridge
- source

https://github.com/rdiot/rdiot-p014/blob/master/MqttToKafkaReConn.java

- maven 

    <!--  mqtt-client -->

<dependency>

    <groupId>org.fusesource.mqtt-client</groupId>

    <artifactId>mqtt-client</artifactId>

    <version>1.14</version>

</dependency>

<!-- kafka -->

<dependency>

<groupId>org.apache.kafka</groupId>

<artifactId>kafka_2.9.1</artifactId>

<version>0.8.2.1</version>

</dependency>


- run script

https://github.com/rdiot/rdiot-p014/blob/master/mqtt-kafka-bridge.sh

$ java -jar mqtt-kafka-bridge-0.0.1-SNAPSHOT.jar 

$ nohup java -jar mqtt-kafka-bridge-0.0.1-SNAPSHOT.jar > output.txt &


5. Kafka Console Consumer 

- run script

https://github.com/rdiot/rdiot-p014/blob/master/consumer.sh

$ /data1/kafka/kafka/bin/kafka-console-consumer.sh --zookeeper kafka-pi-01:2181,kafka-pi-02:2181,kafka-pi-03:2181 --topic $1


- run command

$ ./consumer.sh temperature,humidity,cds,airGrade

$ ./consumer.sh temperature


Posted by RD IoT RDIoT

댓글을 달아 주세요

Arduino MQTT Client & ARTIK MQTT Broker [P012]





https://www.youtube.com/watch?v=L44LwGBY9vw


*GitHubhttps://github.com/rdiot/rdiot-p012.git



* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]



Posted by RD IoT RDIoT

댓글을 달아 주세요

Video Streaming with ARTIK as RTSP Server [P010.8]




https://youtu.be/qy5IFr-HlsQ


*GitHubhttps://github.com/rdiot/rdiot-p010.8.git

Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 ARTIK Cloud using the Arduino IDE (REST) [P010.3]



https://youtu.be/RMUKZn--Rzw


*GitHubhttps://github.com/rdiot/rdiot-p010.3.git

Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 Publishing to ARTIK Cloud [P010.2]




https://youtu.be/a3JFdG9R3iI

Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 Web WIndow to MQTT [P008.3]



https://youtu.be/eQgMufUHbKg


*GitHubhttps://github.com/rdiot/rdiot-p008.3.git

Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 Returning Sensor Data from Edge Devices [P008.2]




https://youtu.be/nTk145sQzM4


*GitHubhttps://github.com/rdiot/rdiot-p008.2.git


Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 Using Debug Capabilities of Node-RED [P008.1]




https://youtu.be/Zc0JO2EGafU


*GitHubhttps://github.com/rdiot/rdiot-p008.1.git

Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 as MQTT Massage Broker [P008]




https://youtu.be/362rs4wVbrk


*GitHubhttps://github.com/rdiot/rdiot-p008.git

Posted by RD IoT RDIoT

댓글을 달아 주세요

Samsung ARTIK 5 (ARTIK5-V0.5) Blank LED with Arduino IDE [B023]






* Specs

APPLICATION PROCESSOR ARM Cortex A7x2 @ 1GHz

MEMORY 512MB LPDDR3 + 4GB eMMC

HW + SW SECURITY

 Open SSL + SE [TLS/DTLS]

 HW Embedded Security Element (eSE) + TLS (DTLS)

 ARTIK device authentication APIs of eSE

 Get signature, Get certificate, Get Random number

Trustonic Trusted Execution Environment (for customer with NDA and agreement)

DISPLAY 2-Lane MIPI DSI (960×540) @ 60fps

CAMERA 1x 2-Lane MIPI CSI up to 3MP @ 30fps (Supports YUV and MJPEG format only)

PMIC 5 Buck Converters + 25 LDOs

WIFI 802.11 a/b/g/n/ac

BLUETOOTH BT/BLE

ZIGBEE 802.15.4 (Thread planned)

GPIO 47 (2 PWM output including)

ANALOG CAPTURE 2 (0 – 1.8V range)

UART 2

I2C 3

SPI 2

I2S/PCM 1

USB 1 USB 2.0 Device

MMC 1 (T Flash)

MIPI 1 DSI (2 LANE) + 1 CSI (2 LANE)

CLOCK OUT 1 (24MHz) + 1 (32.768KHz)

INPUT POWER 3.4V – 5.0V

OUTPUT POWER 1.8V/100mA + 2.4V/100mA

POWER CONSUMPTION TBD

OS Fedora

Development Environments Arduino® IDE  C, C++, Java, JavaScript, Python

DIMENSIONS 29 x 25 x 3.5 mm

CONNECTORS 60pins (Panasonic AXT460124) x 2, 40pins (Panasonic AXT440124) x 1, (0.4 mm pin pitch, mating height 1.5 or 2.5mm)

HW AUDIO CODEC 1-channel PCM + 1-channel 24 bit I2S (External device support)

GPU Mali 400 MP2

NETWORK LW M2M CoAP MQTT IPv6 Audio/Video Streaming


* Contens

1. Connect to COM Port

2. Configure WIFI Access

# wpa_cli scan_results

bssid / frequency / signal level / flags / ssid

f0:b4:29:59:c5:5e 2457 -79 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS] HACK-2.4G

# wpa_passphrase  HACK-2.4G 'PASSWORD' >> /etc/wpa_supplicant/wpa_supplicant.conf

# systemctl restart wpa_supplicant

# dhclient wlan0

3. Control GPIO Port by Command

- Request Control on GPIO #135 

# echo 135 > /sys/class/gpio/export 

- Setup Mode

# echo out > /sys/class/gpio/gpio135/direction

- Setting Value (ON/OFF)

# echo 1 > /sys/class/gpio/gpio135/value

# echo 0 > /sys/class/gpio/gpio135/value

4. Arduino IDE 

- Download Arduino IDE hourly build for your Operating System

- Open "Board Manager" and install the latest "ARM Linux Boards" package

 : http://downloads.arduino.cc/packages/package_arduino.cc_linux_index.json

5. Install the Arduino ARTIK Installer

# curl downloads.arduino.cc/libArduino/install_artik_prereq.sh sh

 : http://downloads.arduino.cc/libArduino/package_arduino.cc_linux_index.json

6. Upload Test 

# ./watcher & 






Posted by RD IoT RDIoT

댓글을 달아 주세요