How to use Cyberfly IO platform?

(Monitoring temperature)

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.

  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.

Login page

Navigate create new wallet tab and enter the password and confirm password to create wallet. you can also import existing wallet.

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

After seed phrase verification you can see this page

Wait until the account get created

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

Account Creation done

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

Builtin wallet

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 feature. You can now close this wallet.

Next step is create device by click new device button in top right, pop up will be appear for fill device details such like device name, device public key.

Device Create Form

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 entering the following commands in your computers terminal.

sudo pip3 install pypact-langpython3 -c "from pypact.pact import Pact;kp=Pact().crypto.gen_key_pair();print(kp)"
Save these keyPair in safe place which will require in raspberry pi client program

Copy public key from keyPair and paste it in above device creation form and submit, wait some moments for confirm the transaction.

Device Creation Done

After device creation navigate dashboard page to add widget in dashboard

Click Create new dashboard button
Name your dashboard and submit
Click pencil button to open dashboard edit mode
Click plus button to add widget
Click on gauge widget and close widget menu
Resize the widget as you want using widget handle and click pencil icon to open widget properties
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

Click save button

Click save button 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 previously you generated

You can obtain your device_id in UI

Click Eye icon
Copy device id and paste it in python script

Run Python script

python3 temp_test.py

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

Live Temperature data

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!

--

--

Building Decentralised IoT platform

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store