Overview
Through this tutorial, you will learn how to connect your device to IoTConnect. Here, we have taken an example of Raspberry Pi to connect it with IoTConnect.
What you do
- Create template
- Whitelist your device on portal
- Set up Raspberry Pi
- Run a sample application on Pi to send sensor data to your IoTConnect device
- See live telemetry data
What you need
- IoTConnect login
- A Raspberry Pi 2/3/4
- DH11 sensors
- Internet connection
Create Template
Login into IoTConnect and Crete template.
Add following information to create your template
Basic information
- Template Code in the string to identify your template
- Template name in string
- Hardware firmware (Optional)
- Description (Optional)
- Authentication Type is Key
Press Save to create it.
Attributes
For example, you look to send temperature and humidity from R Pi to IoTConnect. For that, you need to create attributes for each consideration.
While creating attributes, enter “temperature” in local name and “Number” in data type. Click save.
Commands
Let’s say you want to make LED On/Off. To do that, you need to add commands.
Whitelist your device
Click on left device and press create device button
Note: Select a template that you created and enter Unique ID and display name for the device.
Set up Raspberry Pi
1. How to setup Pi Code – Get the information from the RaspberryPi Site
2. Install the Raspbian operating system for Pi & setup network
3. Configure Pi
We will connect DH11 sensor which provides the data for temperature and humidity. Below are the pin configurations for the Pi.
Start (Sensor) | End (Board) | Cable Color |
VDD | 3.3V PWR (Pin 1) | White cable |
GND | GND (Pin 6) | Brown cable |
DH11 | Pin 8 | Red cable |
Connect Pi
Use the built-in SSH client on Ubuntu or macOS. You may need to run ssh pi@<ip address of pi> to connect Pi via SSH. The default username is pi and the password is raspberry.
Install Python version 2.7, 3.6 and 3.7 with pip is compatible to the python version
- Download SDK from Download section
- Follow the instaltion steps available on the SDK page.
- Replace connection information
- CPID
- DeviceID (Unique ID)
- Environment
Get connection string for the device
CPID – Get your CPID from the company profile page.
DeviceID (Unique ID) – Get your Device ID from device list.
Test with command “python firmware.py”
Note: In case of you are getting any error, please see telemetry data on the IoTConnect.
See Telemetry data
Click on Unique Id to see details of device.
You can see live telemetry data of temperature and humidity, when you click “Live Data” tab.