The IOTA Weather Node is a Weather Station built with a Raspberry Pi and the add-on board Sense HAT . The Weather Station send and receive data over the new IOTA Protocol
The IOTA Weather Node waiting until a client send a transaction with >0 IOTAs and a message. With the message the client tell the node what is his request and an address on which the node can send his answer. So can be send a command is arrived over the IOTA Protocol. After this he read the Weather info from the Sense HAT and send them back or just show a promotion on his 8x8 LED Matrix.
The weather client can send request to the weather node. He can request the weather or he can send a promotion to the node. Both function costs 1i IOTA.
For additional information and the source code go toWhat you need to run the Rapberry Pi Weather Station?
Required:
- Install the latest IOTA release from : IOTA Node
- Install the latest iota python package iota
- the python package sys, json, urllib2 are also required
- Raspberry Pi
- microSD card with installed Linux as example: Ubuntu MATE 16.04 LTS
- Raspberry Pi Sense HAT
- Sense HAT python package
The installation
If you don't have a Sense HAT you can simulate the Sense HAT. There are two members one is the node (the weather station) and the other is the client how send a request to the node. Both can be installed as a Python package which is very easy to run with a script or you can use the GUI. If you don't have a Sense HAT you also can simulate it with the GUI or the script. Choose here what you wanna do:
How to install the weather node on a Raspberry Pi
Step 1 - Prepare the SD Card for your Raspberry Pi.
First download the Ubuntu Mate image from this source: Ubuntu Mate
Next you can install the image on the microSHDC. You can follow the official Raspberry Pi tutorial for easy installing. Installing Images
Step 2 - Installing Ubuntu on the Raspberry Pi
Insert your micro SD card into your Raspberry Pi and connect him to the power. The Raspberry Pi will boot from the image on the microSHDC. It is very easy to go trough the installation of the Ubuntu Mate. So just follow the steps on the display.
Step 3 - Resize the system to use the full microSHDC
When you are gone succescfully trough the installation, on the first boot there is a Welcome screen. You can use Ubuntu MATE Welcome to resize automatically the partitions to make full use of your microSHDC card capacity. Simply click the large Raspberry Pi Information button on the Welcome screen, click the Resize button and then restart the Raspberry Pi.
You also can do it manually:
sudo fdisk /dev/mmcblk0
Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then:
sudo resize2fs /dev/mmcblk0p2
Step 4 - Installing Python and PyPi
First update the package list:
sudo apt-get update && sudo apt-get upgrade
Install Python and PyPi:
$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
Now you can install the sense HAT:
$ sudo apt-get install sense-hat
$ sudo reboot
Now you can install the iota and weather_iota package for Python:
$ sudo pip install iota
$ sudo pip install weather_iota
Step 5 - Installing IOTA node
Now you have to set up the IOTA Node:
Follow this tutorialStep 6 - Run the weather node
To run the weather node you have to run a script:
Open a new file and copy past this code:
import sys
from weather_iota import weathernode
seed=raw_input("Enter the seed of the IOTA Weather Node? ")
weather=weathernode(seed, temperature="32",humidity="50",pressure="1013", senseHAT=False)
weather.run()
print("End Iota Weather Node!")
And save the file as weather_node.py.
Step 7 - Run weather node
Now go to the directory where you have saved the weather_node.py and run the weather node:
$cd Tools/
$python weather_node.py
How to install the weather client
Step 1 - Installing Python and PyPi
First step you should setup python on your client:
Now install PyPi for python package source:
Step 2 - Install the weather_iota package
Now you should install the two package with pip. You must have administrator rights in the console for that. On ubuntu it looks like this:
$ sudo pip install iota
$ sudo pip install weather_iota
Under Windows you should run cmd.exe as administrator and then:
C:\Users\necropaz> pip install iota
C:\Users\necropaz> pip install weather_iota
Step 3 - Make a Python script
Open a new file an copy past this:
import sys
from weather_iota import weatherclient
address=raw_input("The address of the Weather Node? ")
seed=raw_input("The seed of you Weather Client? ")
char=raw_input("If you will send a weather request tip w, if you wanna send a promotion tip p.? [w/p]? ")
client=weatherclient(seed, address)
if char=='w':
client.requestWeather()
elif char=='p':
message=raw_input("What for a promotion you wanna send? ")
client.sendPromotion(message)
else:
print("Your Input is not [w/p]")
Now save the script as weather_client.py and remember the path where you saved it.
Step 4 - Run the script
Now go to the directory where you have saved the weather_client.py and run the weather node:
$cd Tools/
$python weather_client.py
How to install client with GUI
Step 1 - Prepare the SD Card for your Raspberry Pi.
First download the Ubuntu Mate image from this source: Ubuntu Mate
Next you can install the image on the microSHDC. You can follow the official Raspberry Pi tutorial for easy installing. Installing Images
Step 2 - Installing Ubuntu on the Raspberry Pi
Insert your micro SD card into your Raspberry Pi and connect him to the power. The Raspberry Pi will boot from the image on the microSHDC. It is very easy to go trough the installation of the Ubuntu Mate. So just follow the steps on the display.
How to simulate the weather node
Step 1 - Installing Python and PyPi
First step you should install python on your device:
Now install PyPi for python package source:
Step 2 - Install the weather_iota package
Now you should install the two package with pip. You must have administrator rights in the console for that. On ubuntu it looks like this:
$ sudo pip install iota
$ sudo pip install weather_iota
Under Windows you should run cmd.exe as administrator and then:
C:\Users\necropaz> pip install iota
C:\Users\necropaz> pip install weather_iota
Step 3 - Make a Python script
Open a new file an copy past this:
import sys
from weather_iota import weathernode
seed=raw_input("Enter the seed of the IOTA Weather Node? ")
weather=weathernode(seed, temperature="32",humidity="50",pressure="1013", senseHAT=False)
weather.run()
print("End Iota Weather Node!")
Now save the script as weather_node_sim.py and remember the path where you saved it.
Step 4 - Run the script
Now go to the directory where you have saved the weather_node_sim.py and run the weather node:
$cd Tools/
$python weather_node_sim.py