Create device
This guide will walk you through the process of starting your secure OCF Device using IoTivity library on the Raspberry Pi.
Requirements
- Raspberry Pi board with a microSD card with Raspberry Pi OS
- Optional: HDMI monitor and cable, USB keyboard and mouse for the Pi
- Ethernet or Wi-Fi connection between a DHCP-enabled network and the Pi
- Personal computer(Linux/MacOS recommended) on the same network as the Pi
Setting up the Raspberry Pi
To set up your Raspberry Pi, please follow this step-by-step tutorial.
Enable SSH via the Desktop
- Launch ‘Raspberry Pi Configuration’ from the ‘Preferences’ menu
- Navigate to the ‘Interfaces tab’
- Select ‘Enabled’ next to ‘SSH’
- Click ‘OK’
Or enable SSH via raspi-config
on the terminal
- Enter ‘sudo raspi-config’ in a terminal window
- Select ‘Interfacing Options’
- Navigate to and select ‘SSH’
- Choose ‘Yes’
- Select ‘Ok’
- Choose ‘Finish’
Connect to the Raspberry Pi via SSH
More information how to access Raspberry Pi remotely can be found here.
ssh pi@{raspberryPiIpAddress}
Install essential build tools
sudo apt-get update & apt-get install build-essential git curl openssl
Install IoTivity Cloud Server example
Checkout IoTivity-Lite:
# execute commands on the Raspberry Pi git clone https://github.com/iotivity/iotivity-lite.git --recursive cd iotivity-lite
Build Cloud Server example in the
port/linux
folder:cd port/linux make CLOUD=1 SECURE=1 MNT=1 CREATE=1 OICRES_OBSERVABLE=1 OSCORE=0 cloud_server
Run Cloud Server example in the
port/linux
folder:./cloud_server
Now, the Cloud Server example running on your Raspberry Pi allows you to discover your device and connect it to the plgd hub.