Skip to content

Joycechocho/weather-station

Repository files navigation

EN5053-002 Embedded Interface Design

Developed by: ShuTing Guo, Joyce Cho

date: 12/10/2017

Content

  • Project Description and System Diagram
  • Project Features
  • File Organization
  • Setup
  • User Guide
  • Reference Sources

Project Description

With the goal in mind to get ourselves familiarized with communication on different protocols and continue to develop the QT interface, we have developed a demo that consists of two python programs, a server and a client. The server periodically interacts with the DHT22 sensors and handles temperature/humidity data acquisition as well as storage. It has a QT interface that display temperature/humidity data. When starting the connection with AWS, the server send the temperature and humidity readings to AWS IoT via MQTT every 5 seconds. In AWS, a Lambda function is created to receive the incoming temperature and humidity message and perform data processing before putting the data on a FIFO queue using the Simple Queue Service (SQS) eventually. On the other hand, the client retrieves messages from the SQS Queue and running a webpage that allows users to access the temperature/humidity data remotely. Moreover, after getting messages from Amazon Web Services, client would set up four protocols and communicate with sever back and forth. We provide a web interface to present the analysis between below 4 message protocols:

  • MQTT
  • COAP
  • WebSocket
  • AMQP

Below is the system diagram: Image 3

Project Features

1. MQTT/AWS Lambda function Implementation - Server

2. AWS SDK for Javascript on SQS Queue - Client

Amazon Simple Queue Service (SQS) is a fast, reliable, scalable, fully managed message queuing service. Before retrieving the messages in the queue, few more steps are implemented such as "Configure the SDK for JavaScript" and "Getting the URL for a Queue" in Javascript. AWS also provdes SDK for Javacript that can deal with the receive_message. We are using sqs.deleteMessages API to delete the messages that have been read to prevent the redundant message reading.

3. A Server-Client Websocket Implementation

4. A Server-Client MQTT Implementation

5. A Server-Client CAOP Implementation

6. A Server-Client AMQP Implementation

7. A Continuous Graph of Temperature/Humidity data with multiple lines

An open souce chart project is implemented to display the graph of the temperature/humidity data after the websocket connection is initiallized.

Image 3

8. A Bar Chart support multiple data input

Image 3

9. Flask framework Implementation (***)

Flask is a micro web framework written in Python and based on the Werkzeug toolkit and Jinja2 template engine. It is implemented in this project in order to call python backend from Javascript frontend.

10. Beautiful and Intuitive User Interface

Bootstrap is used in this project. It includes a powerful mobile-first flexbox grid system for building layouts of all shapes and sizes. It is a front-end web framework that was originally created by developers at Twitter to provide consistency across their internal tools. Today, it’s available to everyone through GitHub as a free and open-source collection of tools containing HTML and CSS-based design templates and JavaScript (JS) extensions.

11. Logging Interface Easy for Debugging (***)

Image 3

In the server side UI, HTML5 is integrated in the module stylesheet to facilitate the development and enhance the beauty of its presentation.

Setup

Hardware:

  • The setup tutorial of the Raspberry Pi can be found here
  • The wiring of DHT22 sensor to Raspberry Pi can be found here

The server-side software requires the installation of the packages listed below:

Packages Source
Python 3.6 https://liftcodeplay.com/2017/06/30/how-to-install-python-3-6-on-raspbian-linux-for-raspberry-pi/
sip 4.19.4+ https://riverbankcomputing.com/software/sip/download
PyQt5 https://riverbankcomputing.com/software/pyqt/download5
AWSIoTPythonSDK https://pypi.python.org/pypi/AWSIoTPythonSDK/1.0.0
paho-mqtt https://www.eclipse.org/paho/clients/python/docs/
tornado http://www.tornadoweb.org/en/stable/
aiocoap http://aiocoap.readthedocs.io/en/latest/index.html
pika https://pika.readthedocs.io/en/0.10.0/
rabbitmq http://blog.abarbanell.de/raspberry/2015/06/06/making-of-benchmarking-rabbitmq-on-raspberry/
mosquitto http://www.switchdoc.com/2016/02/tutorial-installing-and-testing-mosquitto-mqtt-on-raspberry-pi/

Note:

  1. In order to install the rabbitmq, below should be done first: add the following line in /etc/apt/sources.list/: deb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi

  2. config files for rabbitmq and mosquitto files can be found in: /etc/rabbitmq/ and /etc/mosquitto

  3. Stop both mosquitto and rabbitmq-server running as background service by default: sudo /etc/init.d/rabbitmq-server stop sudo /etc/init.d/mosquitto stop

User Guide

Server Side

The execution of the server program requires some additional authentication files for AWS connection and interaction. Multiple command lines are needed to run the program. Thus a script is developed to smooth the process:

$ cd python_program_server/
$ ./start.sh

Image 3

Client Side

After setting up the hardware, go to python_program_client/ and execute the client program,
$ cd python_program_client/
$ python web.py
The data for temperature/humidity and result for protocols would be shown on the main page.

Image 3 Image 3

Reference Sources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published