How to use Cyberfly IO platform?

Cyberfly
4 min readSep 8, 2022

--

In this tutorial we are going to monitor the temperature using cyberfly io platform

Let’s begin with test net

Before starting this blogpost please read the previous blogpost to know about what is Cyberfly IO?. if you already read you can continue this blogpost.

After three months of development the test net of the platform is here to be released.

Requirements for this tutorial:

  1. Raspberry Pi with linux operating system
  2. dht11/dht22 Temperature sensor
  3. Three Jumper wires

Cyberfly has it’s builtin wallet so let’s start with wallet creation.

Visit test net url https://dev.cyberfly.io/ you can see the following page.

Click create wallet button and enter the password and confirm password to create wallet. you can also import existing wallet by entering your seed phrase.

Backup your seed phrase in safest place and verify it in next step.

After seed phrase verification you can see this page

Account will be created automatically on kadena coin contract. Please be patience until the account get created.

Now your wallet is ready to use, you can open the wallet by clicking the address in top right.

You don’t need to hold any tokens as of now, we are integrated our wallet with kadena gas station. Thanks to kadena for bringing this gas less experience. Now you can close the wallet.

Then next step is to create a device by clicking new device button in top right corner, popup will be appear for fill device details such like device name, device public key.

You can name your device whatever you want, next is public key which is required for authentication and authorisation purpose so let’s create a key pair by clicking Key symbol which will be download a json file with KeyPair. backup this key pair in safest place, finally click submit button, wait some moments for confirm the transaction.

After device creation, navigate dashboard page to create dashboard and add widgets in dashboard.

Click the plus button to add widgets to dashboard
Resize the widget using handle and click pencil icon to edit widget config
Widget properties

give label as you want and choose device which will be connected with DHT11 temperature sensor and the data variable as you want, in my context it is ‘temp’. you should use same variable name in client program to feed data.

Now click set

Save dashboard by click save icon from floating button

Click save icon from floating button which is in bottom right and wait for transaction confirmation.

Now all set on UI side.

Let’s connect temperature sensor to raspberry pi and create client program to read temperature and feed data to UI.

Connect DHT11 sensor to raspberry pi as above picture

VCC → 3.3V

Data → GPIO 4

GND → GND

After the connection you can switch on raspberry pi, once os booted open the terminal and put the following commands to install Cyberfly client SDK called data shipper and DHT sensor requirements. Make sure your device connected to internet before executing the commands.

sudo pip3 install cyberfly-data-shipper
sudo pip3 install adafruit-circuitpython-dht
sudo apt-get install libgpiod2

Example Code:

You should replace key pair with your keyPair downloaded when you create a device like deviceId.json

Get you device keypair which is downloaded when you create a device like this d843cbb5–94e9–4cd7–9ea0-c8339b11b440.json

You can obtain your device_id in UI

Copy and paste the device id in your python script

Run Python script

python3 temp_test.py

now you can see widget in dashboard with live temperature value.

So what is next?

we need to do one thing, whenever the raspberry pi reboot, the python script need to run at startup. you can do this using systemd configuration by the following steps

sudo nano /lib/systemd/system/cyberfly.service

copy and paste the following content

Change username and file path before save
crtl+o
ctrl+x
sudo systemctl enable cyberfly.service
sudo reboot

Done.

if you facing any error please create an issue in github, we will try to give the solution as soon as possible.

Enjoy!

--

--