In this tutorial, you will connect an Arduino UNO board to the WSO2 IoT Server and visualize the data gathered. The following subsections explain how you can work with the Arduino device type:
Before you begin
- Make sure to have the following ready:
- An Arduino UNO Board.
- An Adafruit Wi-Fi Shield for Arduino.
- An LED bulb connected to Pin 13. If you do not have an LED bulb, use the one on the Arduino board. The one on the board is connected to pin 13 by default.
- A Resistor (example: 330 ohms)
- Download the Arduino software.
Navigate to the
<IOTS_HOME>/pluginsdirectory and run the
Start the WSO2 IoT Server broker, core and, analytics profiles in the given order. For more information, see how to start the WSO2 IoT Server.
Let's get started!
Starting the Arduino
Sign in to the Device Management console.Click here for more information.
- Click Enroll New Device.
- Click Arduino to enroll a device of the type Arduino.
- Mount the Wi-Fi shield onto the Arduino-UNO board.
- Connect the LED bulb to the Arduino as shown below.
- Download the Arduino agent:
- Click Download Sketch.
- Enter a preferred name on the download agent form.
- Click DOWNLOAD NOW.
- Create a folder by the name
ArduinoBoardSketchand move the downloaded agent and the source files to it.
- Configure the following fields in the
ArduinoBoardSketch.hfile, which is in the Arduino agent file you downloaded.
WLAN_SSID- Provide the SSID of your Wi-Fi network.
WLAN_SSIDcannot be longer than 32 characters.
WLAN_PASS- Provide the password of your Wi-Fi network.
SERVICE_PORT- Provide the
httpport of the WSO2 IoT Serve
server- Provide the IP address of the WSO2 IoT Server.
deviceIP- Provide the static IP address of Arduino.
Burn the sketch onto your Arduino board and run the program.
When the Arduino starts it will publish the internal temperature to the WSO2 IoT Server.
Control the bulb
Once you start your Arduino, follow the steps given below to turn on or turn off the bulb connected to the Arduino board.
- Click Control Bulb under Operations on the Device Details page.
- Enter On to switch the control bulb on and click Send to Device. Enter Off to switch the bulb off.
View device analytics
Clickto monitor real-time data via the Device Details page.
Follow the options given below to see what you can do next:
Navigate to the Device Management page to view all the devices created by you.
- Select a device from your device dashboard to check the available operations and monitor real-time data.