Raspberry Pi
In this tutorial, you will connect a Raspberry Pi to WSO2 IoT Server and manage it. The following subsections explain how you can work with the Raspberry Pi device type:
Before you begin
- Make sure to have the following ready:
- A Raspberry Pi board that is Internet enabled (Wi-Fi or Ethernet).
- An Adafruit DHT11 temperature sensor.
- An LED bulb.
Navigate to the
<IOTS_HOME>/samples
directory and run thedevice-plugins-deployer.xml
file.cd <IOTS_HOME>/samples mvn clean install -f device-plugins-deployer.xml
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.
cd <IOTS_HOME>/bin ------Linux/Mac OS/Solaris ---------- ./broker.sh ./iot-server.sh ./analytics.sh -----Windows----------- broker.bat iot-server.bat analytics.bat
Let's get started!
Start the Raspberry Pi
Sign in to the Device Management console.
- Click Enroll New Device.
- Click Raspberry Pi to enroll a device of the type Raspberry Pi.
Connect the DHT11 Temperature Sensor and the LED to the Raspberry Pi board.
Set up your Raspberry Pi device as shown in the schematic diagram.
Ensure that your Raspberry Pi Board is Internet enabled, either via Wi-Fi or Ethernet.
- Download the device agent.
- Click Download Agent.
- Enter a preferred name on the download agent form.
- Click DOWNLOAD NOW to download the device agent on your machine.
- Unzip the downloaded agent file and copy the unzipped file onto your Raspberry Pi board.
Navigate to the downloaded agent that is on the Raspberry Pi board.
Example:cd <RASPBERRY_PI_BOARD>/agent
Test to confirm that the agent is working as expected.
./testAgent.sh
You can run the script on your local machine, on which the agent was downloaded.
Start and deploy the agent as a service on the Raspberry Pi board once you have tested the agent as explained in step 9.
The registered service will be loaded on boot up.
./startService.sh
Control the bulb
Once you start and deploy the Raspberry Pi agent, follow the steps given below to turn on or turn off the bulb connected to the Raspberry Pi board.
- Click Bulb On/Off under Operations on the Device Details page.
- Enter On to switch the bulb on and click Send to Device. Enter Off to switch the bulb off.
View device analytics
Click to monitor real-time data via the Device Details page.
Example:
What's next?
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 and check the available operations and monitor real-time data.