Pino's Raspberry Pi Weather Station
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Starting the weather.local api Apr 8, 2018
README.md
graph.py Added timer Mar 29, 2018
main.py
package.json Starting the weather.local api Apr 8, 2018
serve.js Starting the weather.local api Apr 8, 2018
typography.py Cleanup Mar 29, 2018

README.md

weather.local

This Raspberry Pi projects creates a IoT API for Pimoroni's Enrivo pHat, versioned with Dat. The API is accessible at http://weather.local/index.json, the sensor data is recorded through the Dat History, accessible with http://weather.local/index.json/?version=10.

Create the SD Card

Install Raspbian Lite and use Etcher burn it on a SD Card.

Setup WIFI and SSH

SSH

Insert the SD Card, and create a file named ssh.

touch /Volumes/boot/ssh

WIFI

Create a new file named wpa_supplicant.conf.

touch /Volumes/boot/wpa_supplicant.conf
nano /Volumes/boot/wpa_supplicant.conf

Network Settings

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
  ssid="<network_name>"
  psk="<network_password>"
}

Setup Basics

Connect to the device

The device's password should be raspberry.

ssh pi@raspberrypi.local

Setup

Activate both "Interface/SSH", and "Advanced/Expand FS".

sudo raspi-config

Reboot

sudo reboot

Update

sudo apt-get update
sudo apt-get upgrade

Rename

sudo nano /etc/hostname
sudo nano /etc/hosts

Setup Server

Install NPM

wget https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-armv7l.tar.xz
tar xvf ./node-v8.11.1-linux-armv7l.tar.xz
cd node-v8.11.1-linux-armv7l/bin
sudo cp ./node /usr/bin/
sudo ./npm install npm@latest -g
sudo npm update

Install Dat

sudo npm install dat -g

Install Forever

sudo npm install forever -g

Redirect incoming to Dat port

sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

Setup API

Cron

Added the scheduled tasks with crontab -e.

*/5 * * * * sudo python ~/weather.local/record.py

Start API

cd ~
git clone https://github.com/hundredrabbits/weather.local.git
cd weather.local/
forever start ./serve.js

This is the source code for the Pino Weather Station.