In this blog series we look at how to connect a Raspberry PI 3 to the PAASMER IoT Platform.
The PAASMER IoT Platform makes it simple for Internet of Things companies to build and launch IoT-enabled hardware. PAASMER currently provides an SDK which can be installed on the hardware.
Modifying a few lines of code to provide the correct credentials and sensor information, it is ready to be connected to the PAASMER IoT Platform. The sensor data is then available on the PAASMER Developer Login, which can be utilized and actions taken by using the control fields to control various other sensors connected to the Hardware.
A pre-requisite for using the SBC-SDK is available of the Raspberry Pi 3 hardware running Raspbian Jessie OS. More hardware and software support would be added shortly.
An account created in http://developers.paasmer.co allows for a 30 day trial period to explore the PAASMER IoT platform. After creating and activating the account, the SDK for the appropriate hardware can be downloaded.
Given below are the detailed steps to be followed after downloading the SBC-SDK.
PAASMER IoT SDK for Single Board Computers Running Linux
The PAASMER SDK for Single Board Computers (SBC) like Raspberry-PI, Intel Edison, Beagle Bone is a collection of source files that enables you to connect to the PAASMER IoT Platform. It includes the transport client for MQTT with TLS support. It is distributed in source form and intended to be built into customer firmware along with application code, other libraries, and RTOS.
The SBC-SDK simplifies access to the Pub/Sub functionality of the PAASMER IoT broker via MQTT. The SDK has been tested to work on the Raspberry Pi 3 running Raspbian Jessie. Support for Other SBC’s running any flavors of Linux would be available shortly.
The SBC-SDK provides functionality to create and maintain a mutually authenticated TLS connection over which it runs MQTT. This connection is used for any further publish operations and allow for subscribing to MQTT topics which will call a configurable callback function when these topics are received.
Registration on the portal http://developers.paasmer.co is necessary to connect the devices to the PAASMER IoT Platform.The SDK has been tested on the Raspberry PI 3 with Raspbian Jessie (https://downloads.raspberrypi.org/raspbian_latest)
- Download the SDK or clone it using the command below.
- $ git clone github.com/PaasmerIoT/SBC-SDK.git
- $ cd SBC-SDK
- To connect the device to Paasmer IoT Platform, the following steps need to be performed.
- $ cd external_libs/mbedTLS/
- $ make
- $ cd ../../
- $ sudo ./install.sh
- Upon successful completion of the above command, the following commands need to be executed.
- $ sudo su
- $ source ~/.bashrc
- $ PAASMER
- $ sed -i ‘s/alias PAASMER/#alias PAASMER/g’ ~/.bashrc
- $ exit
- Go to the directory below.
- $ cd samples/linux/subscribe_publish_sample/
- Edit the config.h file to include the username(Email), device name, feed names and GPIO pin details.
#define UserName "Email Address" //your user name used in developer.paasmer.co for registration #define DeviceName "" //your device name #define feedname1 "feed1" //feed name used for display in the developer.paasmer.co #define sensorpin1 gpio-pin-no-for-sensor-1 //modify with the pin number which you connected the sensor, eg 6 or 7 or 22 #define feedname2 "feed2" //feed name used for display in the developer.paasmer.co #define sensorpin2 gpio-pin-no-for-sensor-2 //modify with the pin number which you connected the sensor, eg 6 or 7 or 22 #define feedname3 "feed3" //feed name used for display in the developer.paasmer.co #define sensorpin3 gpio-pin-no-for-sensor-3 //modify with the pin number which you connected the sensor, eg 6 or 7 or 22 #define feedname4 "feed4" //feed name used for display in the developer.paasmer.co #define sensorpin4 gpio-pin-no-for-sensor-4 //modify with the pin number which you connected the sensor, eg 6 or 7 or 22 #define controlfeedname1 "controlfeed1" //feed name used for display in the developer.paasmer.co #define controlpin1 3 //modify with the pin number which you connected the control device (eg.: motor) #define controlfeedname2 "controlfeed2" //feed name used for display in the developer.paasmer.co #define controlpin2 4 //modify with the pin number which you connected the control device (eg.: fan) #define timePeriod 15000 //change the time delay as you required for sending sensor values to paasmer cloud
- Compile the code and generate the output file.
- $ sudo make
- Run the code using the command below.
- $ sudo ./subscribe_publish_sample
- The device would now be connected to the Paasmer IoT Platform and publishing sensor values are specified intervals.
The support forum is hosted on the GitHub, issues can be identified by users and the Team from Paasmer would be taking up requests and resolving them. You could also send a mail to firstname.lastname@example.org with the issue details for a quick resolution.