Difference between revisions of "Weather station (Server side) - Team 03"

From eLinux.org
Jump to: navigation, search
(bakwaas)
Line 89: Line 89:
 
1.type in <code>phant</code> (command prompt)
 
1.type in <code>phant</code> (command prompt)
 
       phant starts up…
 
       phant starts up…
      2.  phant http server running on port 8080
+
        phant http server running on port 8080
          phant telnet server running on port 8081
+
        phant telnet server running on port 8081
      3.  telnet beaglebone.local 8081
+
   
  
 
You must create a stream on phat where data will be logged into. Note down the keys as you will need them later and you cannot re-generate them.  
 
You must create a stream on phat where data will be logged into. Note down the keys as you will need them later and you cannot re-generate them.  
  
 
Creating Stream :
 
Creating Stream :
 +
1.type in <code> telnet beaglebone.local 8081</code> (command prompt)
 
<div class="highlight"><pre>
 
<div class="highlight"><pre>
 
phant> create  
 
phant> create  

Revision as of 04:37, 27 November 2015


Team members: Tushar Jain,| Sanjeev Khare, | Merlin sundar

Introduction

This project is a part of larger project which aims at collecting, storing and analyzing weather related data of a given location, currently it is Mandi, H.P., India. This team has been tasked at maintaining a server to collect and to transfer data, from sensor team to display team.

Executive Summary

The goal of this project was to build and deploy a remote data network to gather environmental data from around campus and display it on a standard web interface.

The server runs an open­source data gathering software, Phant and relays data to display team to be presented in graphical form on a web server (Plotly, Flot, Google Charts, Initial State, etc.).

The Phant currently works on port 8080. Data must sent to the server by visinting a url which has public key of the stream and field values in it.The data can be access at any time by visiting a link in many formats like csv, json and jsonp.

As mentioned above phat runs on port 8080, which is also the default port of apache server running on the beaglebone. Thus we had to shut down apache server to run phant. Phant has also been susceptible to crashing down when the network is probed with nmap.


Equipment needed

Beaglebone to run a server on, Lan network and wifi adapter or wired connection or a system which has a port forwarded to the bone.

User Instruction

This server is almost completely automated. After installation you need power up the bone and make sure that it is connected to the network.

Installation Notes

Installing phant behind a proxy can be tricky.

Be sure to set npm proxy. Using

npm config set proxy http://10.8.0.1:8080 npm config set https-proxy http://10.8.0.1:8080

also you might have to give proxy as a cmd argument as

npm --http-proxy=http://10.8.0.1:8080 install -g whatevef

You can also pass proxy as environment variables, as

npm npm_config_proxy http://proxy:port

Then install phant via npm package.

root@beaglebone:~# npm install -g phant
 npm http GET https://registry.npmjs.org/phant
 npm http <span class="m">304</span> https://registry.npmjs.org/phant

This should install phant on the bone.

You must also export the system proxy on your bone with

export http_proxy=http://proxy:port export https_proxy=https://proxy:port

Make sure to export both http and https.

Post installation steps

You must stop apache running on 8080 and start Phant. for this sudo service stop apache2

1.type in phant (command prompt)

     phant starts up…
        phant http server running on port 8080
        phant telnet server running on port 8081
    

You must create a stream on phat where data will be logged into. Note down the keys as you will need them later and you cannot re-generate them.

Creating Stream : 1.type in telnet beaglebone.local 8081 (command prompt)

phant> create 
Enter a title> Data_Test
Enter a description> just_a_test
Enter fields (comma separated)> temp,wind,rain,humidity 
Enter tags (comma separated)> weather data

Stream created!
 PUBLIC KEY: ******
 PRIVATE KEY:  *****
 DELETE KEY:  *****

This creates a stream to log data.

A second and easier method is to the web gui provided in phant, which you can access by

http://beaglebone.local:8080/

Usage

Use the following step to log data to the server, you must enter this url on your web browser: http://beaglebone.local:8080/input/PUBLIC_KEY?private_key=PRIVATE_KEY&test=testvalue

where beaglebone.local:port = 192.168.7.2:8080, if you are logging data to a bone connected directly to your system, otherwise if bone is connected to a network enter the ip of the bone on the network.

And to retrieve Data we used the following url: http://beaglebone.local:8080/output/PUBLIC_KEY.<enter your desire format>


If your bone is not connected directly to the network, then to directly log data to beaglebone via an unconnected host we used postForward.sh which forwards the port to a connected host in turn connecting the desired host to the bone. This script is provided in the link given below in setup directory. This provided by Prof. Mark A. Yoder. https://github.com/MarkAYoder/BeagleBoard-exercises

The whole process can be automated by running a file which uses crontab, given here

https://github.com/sanjekhare/team1_server

Highlights

Also this is the server side of project thus it does not play a very visible role in it, it does has its special features. The server which we have setup is completely automated. All end user has to do is to power it up and be sure to provide it a static ip on the network.

This server also create a back up, in case of network failures.

Theory of Operation

Work Breakdown

Installing, setting up phant and port forwarding over the network was done by Sanjeev Khare, b13266. Automating the whole process of starting the phant server when the bone was powered on and creating a back up was done by Tushar Jain, b13236.

Current State

Completed

Future Work

We will then try to patch the nmap bug. Software to archive data so that it could be sent to display team needs to be investigated. Team Server This team of two students will look at the server that archives all the data. Currently the system uses Phant as the server, but there are other systems available. This team will discover what other options are available, install, test and evaluate them and recommend and implement one for the project. we may look into socket.io

Instruction to setup socket are provide here https://docs.google.com/document/d/1ifBIIhB8_Ozc-dCVj4NCb9MSygaXBei5mNQ7AB_S9Zg/edit?usp=sharing.

Links

Our google doc folder

https://drive.google.com/open?id=1pHZot5EtbzWs6ITb87KqPdPUZJ0W9H0twWsBsYtZ8Eo/.

Our Github repo

https://docs.google.com/document/d/1ifBIIhB8_Ozc-dCVj4NCb9MSygaXBei5mNQ7AB_S9Zg/edit?usp=sharing

Prof. Mark A. Yoders github repo

https://github.com/MarkAYoder/BeagleBoard-exercises.

Phant official website

http://phant.io/.

Conclusions