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 KuraEclipse 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 HardwareKura 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:
https://eclipse.github.io/kura/intro/raspberry-pi-quick-start.html
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 SoftwareTo 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 CardYou will need a 4-8 GB Sd card for the OS on the orange pi boards. ALso download etcher
Windows: https://github.com/resin-io/etcher/releases/download/v1.4.4/Etcher-Setup-1.4.4-x64.exe
Ubuntu: https://github.com/resin-io/etcher/releases/download/v1.4.4/etcher-electron-1.4.4-linux-x64.zip
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. :-P
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 TimeWell 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 DateIt'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:
sudo armbian-config
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
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java
export PATH=$PATH:$JAVA_HOME
Save the file and execute this line:
source ~/.bash_profile
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
mkdir Downloads
cd Downloads
2) Download the kura distribution for Rapsberry pi 2-3 with all the features enabled"
wget http://ftp.yz.yamagata-u.ac.jp/pub/eclipse/kura/releases/3.2.0/kura_3.2.0_raspberry-pi-2-3_installer.deb
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:
sudo reboot
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:
wlan0
- 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.1 in 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.
Its a good time to now restart your gateway for one last time.,
sudo reboot
Most of these process can be auotmated completely by external apps using remote configuration, but we will see those in the upcoming tutorials on Kura.
A Node on Armbian-config ToolA base utility for configuring your board, divided into four main sections:
- System - system and security settings,
- Network - wired, wireless, Bluetooth, access point,
- Personal - timezone, language, hostname,
- Software - system and 3rd party software install.
The tool needs root privileges to work and can be launched by entering sudo armbian-config
at the terminal prompt or by clicking to the armbian-config menu item on desktop images.
These are the menu items available and their usage:
System- Install - installs to SATA, eMMC, NAND or USB. It gives you an option to install the system to more resilient and faster internal or external media. You can also change filesystem type to ext2, 3, 4 or BTRFS (if supported),
- Freeze - freeze or unfreeze kernel and board support packages, to avoid upgrading,
- Nightly - switch between nightly automated beta and stable builds,
- Bootenv - edit boot environment and alter kernel boot parameters,
- Hardware - toggle board low level functions: UART, I2C, SPI, …
- Switch - switch to/between alternative kernels: default, next, dev,
- SSH - reconfigure SSH dameon. Permit root login, toggle ssh key and mobile phone authetication,
- Firmware - execute apt update and upgrade to update your system,
- Enable - toggle desktop on and off (on desktop images)
- Lightdm - change login managers from none to lightdm (on desktop images)
- RDP - toggle remote desktop from Windows (on desktop images)
- Overlayroot - toggle overlayroot (Ubuntu images)
- Minimal - install minimal Armbian XFCE powered desktop,
- Default - install Armbian XFCE powered desktop with web browser and extras.
- IP - choose to select dynamic or edit static IP address,
- Hotspot - create or manage wireless access point. If your wireless adapter is recognized by a kernel, then armbian-config utility auto selects best mode on the selected device. It can detect 802.11n, 802.11a and 802.11ac. It also knows how to handle some special Realtek adapters,
- IPV6 - toggle IPV6 for apt and system,
- Iperf3 - toogle network troughput tests daemon,
- WiFi - manage wireless networking. Connect with Wifi network. You can create multiple wireless connections at the same time. They are managed by Network Manager,
- BT install - pair Bluetooth devices without PIN code,
- Advanced - edit network config manually,
- Forget - disconnets and clear all wireless connections.
- Timezone - change timezone,
- Locales - reconfigure language and character set,
- Keyboard - change console keyboaard settings,
- Hostname - change hostname,
- Mirror - change to backup APT repository mirror in case of troubles,
- Welcome - toggle welcome screen items.
Software installation menu provides automated install of the following packages.
- softy
- TV headend (IPTV server)
- Syncthing (personal cloud)
- SoftEther VPN server (VPN server)
- ExaGear desktop (x86 emulator)
- Plex (Plex media server)
- Radarr (Movie downloading server)
- Sonarr (TV shows downloading server)
- Transmission (torrent server)
- ISPConfig (WEB & MAIL server)
- NCP (Nextcloud personal cloud)
- Openmediavault NAS (NAS server)
- PI hole (ad blocker)
- UrBackup (client/server backup system)
- MiniDLNA (media sharing)
- Monitor = simple CLI monitoring
- Diagnostics = create a summary of logs and upload them to paste.bin
- Toggle kernel headers, RDP service, Thunderbird and Libreoffice (desktop builds)
SO for folks who want to build Kura from source (after all its a java project). We can follow the instructions below:
Prerequisites
Before installing Kura, you need to have the following programs installed in your OS. (note: The local emulation mode will only work on the Linux or MAC OS X operating system.)
Java
- Install Java JDK 1.8 from Oracle here.
- Set the JAVA_HOME environment variable to the installation directory for the JDK.
- Add JAVA_HOME/bin to your system PATH.
- Verify Java installation by running: java -version
Maven
- Install Maven version 3.3.x from here.
- Note: You must use version 3.3.x or greater to have a successful build.
- Set the M2_HOME environment variable to the installation directory for Maven
- Add M2_HOME/bin to your system PATH.
- Verify Maven installation by running: mvn --version
All in One Procedure:
It is possible to build all Kura project with a single build step:
$ git clone -b develop https://github.com/eclipse/kura.git kura.git$ cd kura.git$ ./build-all.sh
Single Step Build
- Create a git directory for your cloned repository (ex: mkdir ~/git).
- The remainder of this document will assume ~/git to be the source code directory.
- Change to the new directory and clone the repo
git clone -b develop https://github.com/eclipse/kura.git
- Build the target platform
cd ~/git/kura/target-platformmvn clean install
- Build the core components
cd ../kura#Build with CAN supportmvn -Dmaven.test.skip=true -f pom.xml -Pcan clean install#Build without CAN supportmvn -Dmaven.test.skip=true -f pom.xml clean install
- Prepare the for the Eclipse workspace
mvn -f manifest_pom.xml eclipse:clean && mvn -f manifest_pom.xml eclipse:eclipsemvn -f pom_pom.xml eclipse:clean && mvn -f pom_pom.xml eclipse:eclipse
- If mvn clean install fails in Kura (unexpected element (uri:"", local:"snapshot-store")), try to delete /tmp/snapshot-store.xml
- If mvn clean install fails in test compilation run it with "-Dmaven.test.skip=true" option.
- Make sure a Java VM is installed on the target device
- After a clean install, archives for supported devices can be found in the kura/kura/distrib/target directory. The archives are of the format "kura-[target-device]_2.0.0-SNAPSHOT.zip" (e.g. "kura-raspberry-pi_2.0.0-SNAPSHOT.zip").
- If it does not exist, create an /opt/eclipse directory on the target device. Copy the appropriate archive to the /opt/eclipse directory and extract the contents of the ZIP file.
- To start Kura, execute the script located in the newly extracted directory: /opt/eclipse/kura-[device name]_1.0.0-SNAPSHOT/bin/start_kura_background.sh
- A log of Kura activity is stored in /var/log/kura.log. Kura activity can be continuously monitored by issuing the command:
tail -f /var/log/kura.log
Stopping KuraTo stop Kura from the command line, issue the command:
killall java hostapd named dhcpd
So guys, you now have a gateway board setup using Orange Pi board and Kura. This tutorial is first of the many tutorials I am planning to write for Kura and its configurations. Stay tuned!
Comments