This project guides you through the process of creating an IoT Gateway using Eclipse Kura project and Orange Pi boards.
Introduction of Create an IoT Gateway
With the industry frantically catching up to the IoT boom, we find an ever present number of hardware/software manufacturers trying to provide solution that can cater to the hunger of the enterpise market.
But let's face it, IoT is nothing new, things were always connecting with WiFi and other wireless systems to transfer information. What IoT brings to the table is the ability for this data to be analysed and understood to make business decisions.
However, one of the factors that used to worry IoT engineers was the ability to convert existing WiFi/wireless products into cloud connected, enterprise-grade sensor networks. that meant that engineers has to think of gateways that can act as the communication channel for these devices to talk to the internet.
Soon engineers found this new tool called gateway can also be used to connect wired sensor networks as well to the internet. And now, gateways are an ever present part of the IoT world, connected TCP-IP and non-TCP-IP based devices to the cloud.
However gateways were costly and software took to much time to create as writing anything in C/C++ meant that they had to be compiled to a particular platform and the cost of maintaining the software would also be high. Also industrial-grade gateway chipsets were not available to mere-mortal engineers and were always an “enterprise” thing. Along with them propritarey software would mean tie-in to the sellers solutions which again resulted in heavy cost to customers.
Well, things were about to change for the better: Enter low-cost Linux boards and the affordable gateway designs.
Well we all know the Raspberry Pi story.
Affordable board + open source software = great success
Yes, RPi took the world by storm, but also brought with it this new belief that cheaper hardware meant individual developers could contribute to development of software/hardware. What was once an enterprise realm, became a playground to everyone. With this idea taking the world by storm, we saw other manufacturers taking this route with their products.
One such manufacturer, Orange Pi, creates a affordable range of Linux boards base on the Allwinner SoC. Ranging between 25-40 dollars, these neat little boards can do a lot.
This tutorial covers the Orange Pi Lite board as shown below, however the steps mentioned work for any of the Allwinner H3, H5 and H6 boards. My H based board is on its way and I will keep this post updated as I see fit.
Now all that is needed is software.
< DRUM ROLL > ENTERRRRRRR, Eclipse Kura
Eclipse Kura™ is an extensible open source IoT Edge Framework based on Java/OSGi. Kura offers API access to the hardware interfaces of IoT Gateways (serial ports, GPS, watchdog, GPIOs, I2C, etc.). It features ready-to-use field protocols (including Modbus, OPC-UA, S7), an application container, and a web-based visual data flow programming to acquire data from the field, process it at the edge, and publish it to leading IoT cloud platforms through MQTT connectivity.
So, Eclipse Kura seems to be a promising piece os software. However there are many such solution in the market. What makes Kura stand apart.
1) Based on Java, and hence super portable
2) Open source community effort: so there is no lock-in to proprietary software
3) OSGi bundles means ewfforless deployment of new software without disturbing the running gateways
4) Modular bundle approach ensures, each part of system can be individually updated as required
5) Support for all industry leading protocols, you name it kura must be having it
6) Access to te more bundles via market places, ensures you can benefit from constribution by other developers
7) Enterprise grade approach to the gateway ensures Kura comes in-between the linux subsystems and your application, making it a super tight secure platform for enterprises to create gateway software on.
Getting Started on the Hardware
Kura is definitely fascinating and I wanted to take it for a spin. SO out came my orange pi and raspberry pi. The installation on raspberry pi is quite straight forward as mentioned here:
However we will stick to Orange Pi as I didn't see a complete step-by step approach to getting Kura running on the Armbian.
I will be following this article on Ubuntu machine, but for Windows users ill keep notes for compatible or similar software options.
Download the Software
To download the Armbian software, head over to: https://www.armbian.com/download
Search for Orange Pi Lite, or your Orange Pi of choice, and download the image. It will be in 7z format. Download it and unzip it using 7zip or your tool of choice. You will get a folder with these files inside:
Keep a note of the folder location.
Prepping SD Card
You will need a 4-8 GB Sd card for the OS on the orange pi boards. ALso download etcher
Once downloaded, install it. In Ubuntu, it's an.AppImage file. Extract it and double click on it to install it.
1) Insert the card ina card reader and plug it in your PC.
2) Etcher will, most of the times, detect this card.
3) Next choose your image to burn. in the orange pi folder you extracted point etcher to the.img file (that would be the biggest file in size)
4) Make sure your drive is correctly selected, you don't want etcher to erase your desktop drive. 😛
5) Click flash.
6) Once flash is confimed, you can removed the SD card and install it into your Orange Pi board.
Booting for the First Time
Well now you have everything ready to boot up. Power up the Orange Pi board using your 5v 2amp power 4mm barrel jack plug. Connect an HDMI cable as well for first time config. also connect a keyboard as you will need it.
Once the OS bootloader finishes it configurations and system checks, it will show up a prompt for login creds.
1) Enter root as ID and 1234 as password.
2) You will be asked to enter a new password for security puposes, since this is a gateway I would recommend giving a nice password string enough for keeping the OS safe from prying hands.
3) You will also be asked to create another Unix user, and provide a password as well. complete this step as well.
4) Once all the above is done, the root prompt will open up.
Connect to WiFi and Keep the Software Up to Date
It's always advised to keep Debian OS distribution constantly updated for the latest software fixes and updates. But before that lets connect to Wifi
1) On the prompt, type:
The following screen will show up:
2) Select networking – > wifi.
3) Scan for the available wifi by selecting, “wireless” options.
4) It will show up all the available hotspots, select your hotspot SSID.
5) Provide the wpa passphrase and then once done, select activate menu item in the dialog box.
Your orange pi board should now have internet access and a local IP on the wlan0 interface.
Now to update your software type,
sudo apt-get update
sudo apt-get upgrade
This commands will take a while to finsih and once doen your board will be upto date on the software side.
Install Some Essential Dependencies for KURA
It's time to install some essential dependencies.
1) Java to install Java 8 we will use the openjdk distribution:
sudo apt-get install openjdk-8-jdk
This command will install OpenJDK 8 and you can check if it installed properly by typing:
root@orangepilite:~# java -version
openjdk version “1.8.0_171”
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-1~deb9u1-b11)
OpenJDK Client VM (build 25.171-b11, mixed mode)
Also setup you JAVA_HOME System env variable in ~/.bash. usually java will be installed in /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java if you installed using the above method.
Add these lines in ~/.bash_profile using an editor of your choice
Save the file and execute this line:
This will reflect your new edits in the environments vars.
2) Install Gdebi care software by typing this command:
sudo apt-get install gdebi-core
Install Kura Package
Now for the meat of the software, Kura itself.
1) First create a Downloads directory in the Armbian root
2) Download the kura distribution for Rapsberry pi 2-3 with all the features enabled”
3) This will download a.deb file into the downloads folder. install this file using the gdebi command
sudo gdebi kura_3.2.0_raspberry-pi-2-3_installer.deb
This will setup Kura and tell you to restart. Dont restart yet we have a few more commands to execute
4) NetworkManager conflicts with Kura network management, In the latest Armbian releases, type the following command to disable the network manager:
sudo systemctl disable networking
5) Enable all wireless interfaces:
sudo rfkill unblock all
Your almost done. You can restart now:
Setting Up the KURA Gateway
The Orange Pi board will now reboot and kura will start along with it automatically. When booting, Kura will enable the accesspoint mode for he Wifi chipset and the board will show up as a wifi accesspoint with SSID and othewr setting like this:
- Status: Enabled for LAN
- Configure: Manually (Static IP)
- IP Address: 172.16.1.1
- Subnet Mask: 255.255.255.0
- Wireless Mode: Access Point
- SSID: kura_gateway_<eth0_MAC_Address>
- Wireless Security: WPA/WPA2
- Passphrase: testKEYS
Log in to a separate Linux machine, maybe your ubuntu dekstop, or any windows/mac machine and connect to theis network. Passphrase will be “testKEYS.”
Once logged in, open a web browser of your choice and type the ip 172.16.1.1in the address bar. This will open up the Kura GUI:
You can now go ahead and COnfigure Kura again to connect to the correct Wireless SSID.
Click on the network menu on the left.
You will be presented with this screen:
Select the Status as “ENabled for WAN” and Configure as “Using DHCP”, leave the rest as they will configured automatically once you finsih the setup
Next click Wireless tab, and you will see this menu:
Set the wireless mode as “Station Mode.”
Next, Click on trhew magnifier icon in the Network name menu and this will scan for a few seconds and show up the variosu SSID available. CLick on your WiFi SSID.
Next, Enter your wifi password in the Wireless Password section and then click the double arrow icon below the test box.
Once done, there will be rotating gear icon that will come up and say the confguration was a success, now you can click apply button on the top.
Read More Detail :Create an IoT Gateway Using Eclipse Kura and Orange Pi Board