Skip to content

pferland/PiWeM

Repository files navigation

Random Intervals -> PiWeM -> Read-me

A set of highly configurable PHP & Python scripts to gather weather data and log it.

Project Phase: Beta
Project Version: v2

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License version 2, as published by the 
Free Software Foundation.   This program is distributed in the hope that it 
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General 
Public License for more details. You should have received a copy of the GNU 
General Public License along with this program; if not, you can get it at: 
	
	Free Software Foundation, Inc.,
	51 Franklin St, Fifth Floor
	Boston, MA  02110-1301 USA
	
Or go here:  http://www.gnu.org/licenses/gpl-2.0.txt

  Requirements:
	Hardware:
		Raspberry Pi (any version)
			One or more of the following:
			PiCamera
			DHT11, DHT22, AM2302*
			BMP085, BMP180**, BMP280
			PCF8591***
			Photoresistor analog module
			Thermistor analog module
			INA219 or INA3221 (optional) if you are getting negitive current, then the wires are hooked up backwards.
		
* = As soon as I figure out the am2302 library it will be supported.
** = In theory it works, don't have the hardware yet though, so it is untested.
*** = 8bit 4 channel analog to digital converter. Used for the photo-resistor, analog thermisitor, and maybe some other things in the future

WWW:
	PHP 8 or later
		PDO & PDO-MySQL
		Smarty (If not using the one that PiWeM comes with)
	MariaDB
	Apache
	A Web-browser (doh!)

Daemon:
	Python 3
		MySQLdb
		RPi.GPIO
		json
		math
		uuid
		urllib
		PIL
		Picamera
		Adafruit_BMP.BMP085
		dht11
		PCF8591
		bmp280
		smbus
		configparser
	MariaDB or MySQL

Summary:
/PiWeM/CentralServer
  piwem
	The Public Web Viewer for the PiWeM collected data. Can either be used on the Raspberry Pi
	to view the data, or on a central server to have several PiWeM nodes upload their data to.

  Scripts
	If you do use the central server model, you will need to run the scripts in this folder to
	register the PiWeM Nodes to the central server. This is so that the nodes can have an API Key
	generated and their Station Hash stored to associate with it. You will also need to
	set an environment variable $PiWeM_Home to the path of your PiWeM install.

/PiWeM/WeatherStation
	settings.ini
	Holds all the settings for the PiWeM Daemon. What sensors are enabled, what to log and when, 
	do you want a picture taken? Read the settings.ini file fore more information on each of the 
	values.
	
	monitor.py
	The main script of PiWeM. If no arguments are set then it will only run once. If you pass 
	-d then it will run in a daemonized mode and run one loop every time period set in the 
	settings.ini time_sleep value.
	
	run.sh
	This bash script is what I had to use to get the script to run as a crontab job. That was the
	most stable that the script would run as. Running it with the -d argument can run into issues
	over a long period of time. It is preferred to run it as a crontab job. You will also need to
	set an environment variable $PiWeM_Home to the path of your PiWeM install.
	Recommended crontab line is once ever hour:
	0 * * * *    root    /opt/PiWeM/run.sh

/PiWeM/DesktopClient
	This was a work in progress. Supposed to be a client that can connect to the Central Server.
	In theory, you would be able to see what was going on, like what WeatherStations are connceted,
	What is the currently history for uploads, stats about stations. That was all for now that I
	could think of. More might be added after the inital set is compeleted.

Installation:
	Copy /PiWeM/CentralServer/piwem/ to your HTTP servers public folder.
	Run the SQL file blank.sql against your MySQL Server.
	Edit the settings.ini file to your liking.
	If you are running the WebViewer as a centralized server for many PiWeM Nodes, then you will 
	need to setup the /www/Scripts/ folder also. It is not recomended to have that folder on the 
	http server, but to run it from the command line.
	Example command for the RegisterNode.php script is:

(piwem) piwem@weather_station:/opt/piwem $ python register.py -StationName="West Saugerties Weather Station"

Then run the monitor:

(piwem) piwem@weather_station:/opt/piwem $ python monitor.py --Daemon --Verbose


Done!

Support:
	Create an issue on GitHub. https://github.com/pferland/PiWeM/issues
Enjoy!
    The RanInt Dev team
	-PFerland

About

A Raspberry Pi Weather Monitor using python, multiple sensors, camera, and a Web API to upload weather data to be stored and viewed. Weather Underground upload supported.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors