Data Upload
Requirements
- Using Software Libraries : You should have looked at the first steps for this purpose.
- Bees: Read this chapter to learn how the senseBox MCU can use Bees to establish a network connection to transfer data to openSenseMap.
Destinations of the station
In this station, the integration of a sensor into the openSenseMap is shown by way of example so that the data obtained is available online.
Materials
- WiFi-Bee
- At least one (arbitrary) sensor
Programming
In the Bees chapter you have already learned how to connect to the Internet, now let's see how we can continuously upload our metrics onto the openSenseMap. As already described there, we must first create the instances for the openSenseMap and provide our Wi-Fi network + access data.
Declaration of the objects
#include "SenseBoxMCU.h"
Bee* b = new Bee(); // Instance of the Bee
OpenSenseMap osem("senseBox ID",b); // Instance of the openSenseMap
HDC1080 hdc; // Instance of the temperature and humidity sensor
void setup(){
b->connectToWifi("SSID","PW"); // Vconnect to the Wifi
hdc.begin();
};
In the loop ()
-function we upload our measurements.
loop()
void loop(){
osem.uploadMeasurement(hdc.getTemperature(),"Sensor ID")
delay(5000);
};
Exercises
Familiarize yourself with openSenseMap (see Requirements) and register your senseBox with the sensors you have previously connected.Exercise 1
In the Arduino sketch, which you received when registering in Exercise 1, the reading of sensors is still missing. Extend the sketch from the OSeM registry so that your connected sensors are read out.Exercise 2