This tutorial shows using an open standard-compliant approach to connect Linklt One and the SensorUp SensorThings APIStart Tutorial
This tutorial shows using an open standard-compliant approach to connect Linklt One and the SensorUp SensorThings Playground. All interactions between the LinkIt ONE board and the SensorUp cloud is compliant with OGC SensorThings API.
Please refer to LinkIt One’s resources to prepare the development environment.
Then, simply register an account in OGC SensorThings Playground and follow the steps to create SensorThings entities for your LinkitOne. When it is finished, make note of the following variable values:
Now, let's begin by walking through the code, how to read the input from Grove Light Sensor and send the value to the SensorUp SensorThings Playgound.
To start off we need to set up the board to connect to a WiFi network, first you need to update the on board firmware. Then we need to attach the antenna to the board (the antenna for WiFi is the thinnest of the three antennas provided along the LinkIt One box). The antenna plugs onto the board where it says WiFi / BT, be careful while you plug it in.
Make sure you edit the fields where it says WIFI_AP and network WIFI_PASSWORD with your WiFi name and password.
Those information come from the SensorUp SensorThings 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 SensorUp SensorThings Playground, please refer to the Tutorial: Create SensorThings Datastream in SensorUp SensorThings API Playground.
* DATASTREAM_ID_LIGHT * ACCESS_TOKEN
Make sure you edit the fields where it says DATASTREAM_ID_LIGHT and network ACCESS_TOKEN, and SERVER_URL with your information.
Grove - Light Sensor is an analog output module, let’s connect it to A0 of Base Shield.
Start serial communication with a baud rate of 9600 followed by initiating WiFi communication. Prints a message “Connecting” to the serial output and in a while loop calls the connect() method of the LWiFi class every second until a connection is established.
Read the analog output from the connected pin.
1.Prepare the data for POST request. Package the sensor reading into a JSON string to send it in an HTTP POST request. The string is also sent to the serial output by calling println() method of the Serial class for the debugging purposes.
2.Sending the light sensor data to the SensorThings server. Establish a successful connection with SensorThings server and send the HTTP POST request to transfer data every < second(s).