# Raspberry Pi
The Raspberry PI is a family of cheap single-board computers very well suited for testing and evaluation purposes. It is also possible to use in production in some applications.
It is easy to integrate a Raspberry Pi to the IoT Open Platform.
# What do I get?
After completing this guide you will have a Raspberry Pi with local SSH access (and console access if you wish) that runs a local MQTT-broker and are connected to the IoT Open platform. If you have a Z-wave dongle and some devices they will also be connected. From here there are lots of things you can do. You can connect to the local MQTT-broker with any tool and you can install Node-RED on the Raspberry Pi to build local logics among many other fun stuff.
# Prerequisites
- An IoT Open Lynx account and an Installation
- A Raspberry Pi (RPi)
- The IoT Open Raspberry Pi Image
- An SD or Micro-SD card (depending on RPi version)
- A Zwave USB dongle
- At least one Z-Wave device
# Goal and steps to get there
The goal is to connect our RPi to the IoT Open platform and include some Z-wave devices to it. The devices will show up in the IoT Open platform ready for use.
The steps we need to perform are:
- Install the image on the RPi
- Create credentials for the RPi in our Installation
- Enter the credentials in the RPi
- Connect the RPi
- Include the Z-wave device(s)
- Test it out!
# Install the IoT Open RPi image
Download the IoT Open Image (opens new window) and save it. Then it needs to be installed to the SD-card (everything on the SD-card will be overwritten). This is done in different ways depending on your operating system and is well documented here (opens new window). Since you have the image already you can start reading under Installing images on ''Your preferred OS''.
In order to continue it is necessary to log in to the Raspberry Pi. There are several ways to do this. Easiest is to connect a screen (HDMI) and a keyboard to the RPi and log in to the console. If you are familiar with SSH that is also an option since SSH is enabled by default.
The default username and password are:
Username: iot
Password: open
Now is a good time to change the password to something you remember. To do
this type passwd
and follow the instructions.
Once logged in to the RPI you are ready to move on.
# Create credentials to the installation
To connect the RPi to the right installation in IoT Open there need to be a connection between them. This is done from the IoT Open standard user interface.
Navigate to the correct installation and open the Settings tab. At the very
bottom there is a link called Create credentials for edge Client
. Please
observe that clicking this link resets the current credentials When clicked
you get information about the new credentials. They will only be shown once, so
make a note of them.
Example:
Server https://lynx.iotopen.se
Client ID 45
User name 45
Password b7f61ff2235f6568e463b75e04ff00bc
Installation ID 45
Now let's continue to configure the RPi.
# Configure the RPi
On the RPi we have to enter the credentials in the file /etc/iot-open/iotopen.json
. If you are not used to Linux or Unix systems nano
is probably the easiest tool to use. Type sudo nano /etc/iot-open/iotopen.json
to open the file.
With the information above the file should look like below.
{
"api": "https://lynx.iotopen.se",
"client_id": 45,
"installation_id": 45,
"mqtt_broker": "lynx.iotopen.se:8883",
"mqtt_client_id": "edge-45",
"mqtt_password": "b7f61ff2235f6568e463b75e04ff00bc",
"mqtt_username": "box:45",
"timezone": "Europe/Stockholm"
}
Press CTRL-X
(then Y
, then Enter
) to save the file.
Explanation of the relation between the data in the files:
api
: Should be the same as Server
client_id
: is obviously Client ID.
installation_id
: is the same as Installation ID.
mqtt_broker
; is in most cases the hostname of the api and :8883 (see the example).
mqtt_client_id
: Doesn't matter as long as it is unique.
mqtt_password
: The same as Password.
mqtt_username
: "box:<client_id>" See the example.
timezone
: Timezone string. Should be the timezone of the RPi.
When done the RPi is ready to be connected.
# Connect the RPi
There are two ways to connect the newly configured RPi to IoT Open. Either
reboot it with sudo reboot
or run sudo iotopen-verify
. Make sure you
Zwave-dongle was connected when the RPi booted, otherwise connect it and
reboot.
# Include the Z-wave device(s)
To include the Z-wave devices there are two things we need to do.
- Set the Z-wave chip in inclusion mode
- Include the device by doing the special command on it (read the manual for the device)
There are several ways to set the Z-wave chip in inclusion mode. Easiest is to
use the Workbench tool. You can find it in IoT Open
Academy (opens new window). Log in and click on Tools -> Workbench
. Choose the right installation in the upper right corner.
Click on the Misc
button in the menu and Choose Inclusion
under the Z-Wave
drop-down. You can now include your device. There should be lots of traffic in
the MQTT window when the device is included.
# Verify that it works
Check that there were devices and functions created in the installation. Then everything should be good to go.
# Next steps
With this start you can do lots of fun stuff. E.g. you can run Node-RED on the Raspberry Pi. Write scriots in any language you like or run edge-applications on your Raspberry Pi.
The possibilities are endless!