Copy empty ssh file to root directory on SD card (will enable ssh on boot). Empty ssh file is in this repository.
(optional) For Wi-Fi, copy wpa_supplicant.conf to root directory on SD card (will automatically log in to Wi-Fi on boot). Sample wpa_supplicant.conf file is in this repository. (You will need to edit this file to add your own SSID and password.)
Insert the SD card into the Raspberry Pi and connect power. It should boot and connect to the network (either Ethernet or Wi-Fi).
Create SSH connection to Raspberry Pi. (Use Connect to Server… menu on Mac) You could also just connect a keyboard and monitor directly to the Raspberry Pi.
If you get the message that it can’t connect due to security, edit ~/.ssh/known_hosts (on the Mac) and delete the line associated with the IP address causing trouble. Or, you can use this command:
ssh-keygen -R [IP address or hostname]
Install IoTivity or IoTivity-lite and its development system (This works on most Linux systems and Windows):
Install the development system (for IoTivity, IoTivity-lite or both) using the following commands on the Raspberry Pi (or other development system):
At this point, we have a working server that will show up on OTGC, implement all the resources and manipulate those resources. Now we just need to add the code to interface with the hardware board. (That’s what we’ll do next.)
For Raspberry Pi and Pimoroni board control stuff:
Install the Pimoroni libraries and examples for the Automation Hat (and pHat) and the Enviro pHat along with the Python interfaces to attach the modified C++ IoTivity code (or modified C IoTivity-lite code) to the Pimoroni Python libraries. This also installs the MRAA example to control the Enviro pHat light directly.:
Change to the development directory where the scripts are found:
cd ~/iot (for IoTivity) or cd ~/iot-lite (for IoTivity-lite)
Run the following development cycle scripts as needed
./gen.sh - generate the code, introspection file, onboarding file, etc.
(optional) To load new a new example: ./gen.sh automation-phat (or whatever example you want) This will copy the correct device description code and generate the .cpp code, introspection file, etc. The currently available examples are: automation-phat, automation-hat, enviro-phat, mraa-example, and example (original simple single switch with no board interface code).
./build.sh - compile and link everything
./edit_code.sh - edit the server source code. NOTE: This edits whatever server.cpp code is currently active. It does NOT edit the code in the example directories.
./reset.sh - reset the sever to RFOTM by copying a fresh onboarding file
./run.sh - run the currently compiled server in the appropriate directory
When doing the client control described below, you should see nice debug messages in the server terminal confirming that the messages are getting through.
Discover, onboard and control the server using OTGC
Discover, onboard and control the server using DeviceSpy