แสดงบทความที่มีป้ายกำกับ raspberry pi iot แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ raspberry pi iot แสดงบทความทั้งหมด

วันเสาร์ที่ 2 ธันวาคม พ.ศ. 2560

Raspberry Pi IoT Performance Monitor with ThingSpeak




Raspberry Pi IoT Performance Monitor with ThingSpeak

This project you can monitor raspberry pi or other embedded linux or Single Board Computer ( SBC ) such as CPU Temperature , CPU %,Memory and Disk Usage on ThingSpeak Cloud IoT service.
Code is python.

System Diagram






What is ThingSpeak.com?

ThingSpeak  is an Internet of Things (IoT) platform that lets you collect and store sensor data in the cloud and develop IoT applications. The ThingSpeak™ IoT platform provides apps that let you analyze and visualize your data in MATLAB®, and then act on the data. Sensor data can be sent to ThingSpeak from Arduino®, Raspberry Pi™, BeagleBone Black, and other hardware.
https://thingspeak.com/

Source Code and Library ( To install on Raspberry Pi )

PSUtil Python Library 
PSUtil is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python.

Run Command

sudo apt-get install build-essential python-dev python-pip
sudo pip install psutil

Python code on Github

https://github.com/amphancm/RaspberryPi_ThingSpeak


EDIT Code for your own KEY


















#!/usr/bin/env python
import psutil
import httplib, urllib
import time
import os,sys

from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

disk = os.statvfs("/")
used = disk.f_bsize * (disk.f_blocks - disk.f_bavail)

sleep = 30            # how many seconds to sleep between posts to the channel
key = 'ZG8WMLWF4PBQQVFB'  # Write Key Thingspeak channel to update

# THIS IS MY KEY for ThingSpeak Channel 238835
# YOUR MUST CHANGE to YOUR WRITE KEY


Run Python code

python performance.py

Result on ThingSpeak

Thingspeak Monitor Example  https://thingspeak.com/channels/238835



Option Add OLED Display



Wiring Diagram
You must install OLED Adafriut Library SSD1306
See this Raspberry Pi connect OLED I2C Display and use code performance_oled.py and Font.


Reference

http://www.iotleague.com/d-i-y-how-to-upload-your-raspberry-pi-sensor-data-to-thingspeak-website

https://thingspeak.com/


My Website

email : info@softpowergroup.net  , amphancm@gmail.com  Tel .6681-6452400 

Android Arduino IoT

วันอังคารที่ 7 มีนาคม พ.ศ. 2560

Raspberry Pi IoT connect CloudMQTT

Raspberry Pi IoT connect CloudMQTT

In Last Article we have made raspberry pi with dht sensor and OLED display. So, in this blog we will use that hardware to connect CloudMQTT.com for IoT application.

What is MQTT?

MQTT (aka MQ Telemetry Transport) is a machine-to-machine or “Internet of Things” connectivity protocol on top of TCP/IP. It allows extremely lightweight publish/subscribe messaging transport.


Broker , Publisher , Subscriber

CloudMQTT are managed Mosquitto servers in the cloud. Mosquitto implements the MQ Telemetry Transport protocol, MQTT, which provides lightweight methods of carrying out messaging using a publish/subscribe message queueing model.
So , you must sign up CloudMQTT

System Diagram

Hardware

  • Raspberry Pi Board ( we use Raspberry Pi3 board ) + SD card (8GB or more) we use 16 GB
  • DHT11 Temperature and Humidity Sensor with Resistor 4.7 K Ohm
  • I2C OLED Display ( 128 x 64 0.96' SSD1306 chip )

Wiring Diagram
Python Library

DHT Sensor
$ git clone https://github.com/adafruit/Adafruit_Python_DHT.git
$ cd Adafruit_Python_DHT
$ sudo apt-get install build-essential python-dev python-openssl
$ sudo python setup.py install

OLED
$ git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
$ cd Adafruit_Python_SSD1306
$ sudo python setup.py install


Source Code
https://github.com/amphancm/RaspberryPi_CloudMQTT
Reference
CloudMQTT Document https://www.cloudmqtt.com/docs.html
OLED Adafruit Python Library https://github.com/adafruit/Adafruit_Python_SSD1306



My Website
email : info@softpowergroup.net   Tel .081-6452400

Android and Arduino IoT



LINE : adunfong
FaceBook : https://www.facebook.com/adun.nantakaew
email: amphancm@gmail.com