This is a simple tutorial of connecting Raspberry Pi to OGC SensorThings API. We will show you how to use Raspberry Pi to upload temperature readings to the SensorThings API server.
Start TutorialThis is a simple tutorial to demonstrate how to connect a Raspberry Pi with GrovePi to a SensorThings API server.
GrovePi is an open source platform for connecting Grove Sensors to the Raspberry Pi. All the parts used in this tutorial are available in the GrovePi Starter Kit.
A fully set up Raspberry Pi board with Internet access
For information about setting up your Raspberry Pi, see Raspberry Pi Quickstart Guide.
Install GrovePi+ on the Raspberry Pi, please refer to Setting Up The Software.
Those information come from the STA Playground. If you didn't have one, please go to OGC SensorThings Playground and get the following variable values. If you don't know how to use STA Playground, please refer to the Tutorial: Create SensorThings Datastream in SensorUp SensorThings API Playground.
Make sure you edit the fields where it says DATASTREAM_ID_TEMP and network ACCESS_TOKEN, and SERVER_URL with your information.
Connect the DHT sensor to Port 8. Now power on the Raspberry Pi.
In the Raspberry Pi terminal, run the sta_sensor.py in python program in root (sudo):
sudo python sta_sensor.py
The program will start sending the live temperature data from the DHT sensor to a SensorThings API server every 30 seconds.
Note the dht_sensor_type below may need to be changed depending on which DHT sensor you have: