By wh_hsn Follow
More by the author: About: Just me! More About wh_hsn »I ordered a Raspberry Pi to be my MQTT server for my Home Automation project. I also ordered an Orange Pi Lite to experiment with it. To my surprise, the second arrived first!
A $12 Pi with built-in wireless among other options is very tempting - 3 for the price of one!
Setting the board was a challenge to me; my UNIX/Lynx experience is ancient (early nineties!) so I preferred to get the RPI to start with a hassle-free setup then experiment with the OPI but "winds do not blow as the vessels wish"
So, I had to get the OPI to work!
Pi boards use an SD slot to boot.
SD Cards are not reliable, slow and its lifetime is not so good but this is how it works.
It is said that OPIs are not OK with slow SDs so a class 10 is recommended & that's what I already had, a 16G class 10 card.
I tried several disributions (OS's) for the OPI and ended up using Armbian which is Debian based which is a UNIX-like OS. I preferred to use Armbian Jessy Desktop (although I am intending to have a headless system but it is always good to have a remote desktop ready when needed)
There is also the very neat DietPi by Daniel Knight with a very small footprint and fast automated installation. There is distro for OrangePi One which is the wired version with no wireless module. I tested and it looks great but it has a minor issue with wlan0 after first reboot - I hope it will be fixed in the next version (v135).
We need to install the operating system for the OPI Lite using Win32 Disk Imager - just select the IMG file & press [Write], making sure that the right drive is selected.
In few minutes the SD will be ready for first boot.
Accessing Unix SD-cards it in Windows is not natively possible & since bad things happen, accessing the file system files on the SD if you can't boot Pi might save you from starting from scratch! - For that, I am using DietPi VirtualBox VM to have an easy way to brows, view & edit the files if needed.
For proper Pi operation you need a good power supply to avoid any heck-ups - DC 5V @ 2A (4.0mm/1.7mm barrel plug - center positive) or you may power the board via GPIO header pins.
The OPI Lite is supposed to consume low power but it is getting hot even with almost nothing running - so I decided to stick a heat sink & connect a small fan. just in case!
I improvised a case with a matchbox just for fun & because I don't have an HDMI monitor on my workbench I just connected a USB2Serial (same that I use for ESP8266 programming - check my other Instructable)
There is a 3-pin header near the OTG USB (check the photo above) - plug it in your computer & make sure that the right driver is installed.
Although the board has a wireless module, there is no wifi setup during the installation (DietPi has this to simplify the installation) so a terminal program such as KiTTY is needed to communicate with the headless board via the serial interface.
Run KiTTY & select the Serial connection type, set the COM port and set the speed to 115200.
Power the board & watch the boot process - do as in the photo sequence above.
Console commands in UNIX machines are not fun at all, so without going into much details, I list how I setup the wireless connection:
(My router is wpa2-personal security)
1- At the prompt type:
wpa_passphrase "YOUR_SSID" "YOUR_WIRELESS_KEY" > /etc/wpa_supplicant.conf
Replacing real values between quotes.
2- Check the output file just to make sure - type at the prompt:
root@orangepilite:~# cat /etc/wpa_supplicant.conf
You should get something like this:
network=(If you need DHCP setup, skip this step)
1- Type at the prompt:
root@orangepilite:~# nano /etc/network/interfaces
2- Delete all the lines in the file & add at the bottom:
auto lo auto wlan0 iface lo inet loopback iface wlan0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1 pre-up sudo /sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dnl80211 -B pre-up sleep 5 post-down sudo killall -q wpa_supplicant
Press then [ENTER] to save the changes.
(These steps are for DHCP setting only)
1- Type at the prompt:
root@orangepilite:~# nano /etc/network/interfaces
2- Remove all lines & add at the bottom:
auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp wpa-ap-scan 1 pre-up sudo /sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dnl80211 -B pre-up sleep 5 post-down sudo killall -q wpa_supplicant
Press then [ENTER] to save the changes.
In my case, for DHCP to work properly & run automatically at boot, I had to remove Network Manager components:
At the prompt type:
root@orangepilite:~# apt-get remove network-manager network-manager-gnome
1- Type at the prompt:
root@orangepilite:~# rebootIf all is OK then the wireless should be working after the reboot.
1- At the prompt type:
root@orangepilite:~# iwconfig
The output should be similar to:
lo no wireless extensions. tunl0 no wireless extensions. wlan0 IEEE 802.11bg ESSID:"YOUR_ESSID" Nickname:"" Mode:Managed Frequency:2.462 GHz Access Point: MA:C_:AD:DR:ES:S_ Bit Rate:54 Mb/s Sensitivity:0/0 Retry:off RTS thr:off Fragment thr:off Encryption key:****-****-****-****-****-****-****-**** Security mode:open Power Management:off Link Quality=99/100 Signal level=69/100 Noise level=0/100 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
(Note the YOUR_ESSID should be the one you have)
2- to verify the IP, type:
root@orangepilite:~# ip a show
The output should be similar to:
1: lo: mtu 16436 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: tunl0: mtu 1480 qdisc noop state DOWN group default link/ipip 0.0.0.0 brd 0.0.0.0 3: wlan0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:e0:4c:e0:e9:1e brd ff:ff:ff:ff:ff:ff inet 192.168.1.100/24 brd 192.168.1.255 scope global wlan0 inet6 fe80::2e0:4cff:fee0:e91e/64 scope link valid_lft forever preferred_lft forever
Now is the time to upgrade the installed package but before that it is better to back-up the SD Card first.
I like to keep a working configured image just in case I need to roll back to a know point.
Win32 Disk Imager will be used again for that - just select the file to write to (use a new file not an existing image - it will be over-written!) then click [Read] (not Write!)
Reboot again & we are ready to upgrade.
first we need to update the index file & update the list of installed packages:
root@orangepilite:~# apt-get update
This will take some time to finish, then do the actual upgrade:
root@orangepilite:~# apt-get upgrade
root@orangepilite:~#apt-get dist-upgrade
These will take quite some time to finish so be patient & never turn off the power to reboot as it will render the SD Card unusable & you need to do everything from the beginning . but we have a backup already, right?!
Once the board boots with an IP address it may be accessed wirelessly via SSH (Secure SHell) connection using KiTTY also.
It looks exactly the same & you may use it just like the Serial console. Select SSH connection type & leave the default port = 22 & connect.
You may Also access the board using a mobile SSH client - JuiceSSH is very convenient & has lots of features. There are other SSH client such as ServerAuditor & ConnectBot among others . chose what you like.
Another way to access the files on the SD Card by using FTP or SCP client.
SCP is supported by default & I use WinSCP portable. Download & unzip this archive to your tools folder.
Enter the OPI IP & username/password for the root. You better save the settings for easy reconnect.
With WinSCP you can brows, edit & even change permissions of any file.
If you are accustomed to GUI then remote desktop using VNC is the way to do it.
We need to install a server on the OPI & a viewer on the PC.
I am using TightVNCserver but there are many other - I appreciate if you share your experience in the comments.
To install the server:
root@orangepilite:~# aptitude install tightvncserver
Here I am using aptitude, a Debian utility that wrap the apt-get installer.
After installation you run the server - we need to add that user 'opi' (created during the installation) to the sudo group (to be able to run root commands without root login)
root@orangepilite:~# gpasswd -a opi sudo
root@orangepilite:~# su - opi
then run the server:
opi@orangepilite:~# vncserver
Enter the password and the server is ready.
You need to install a VNC client on the PC to access the OPI desktop - I am using UltraVNC - you connect to port 5901.
If you want more security, you better have VNC over SSH tunnel session. To do this you need to change the way you start the server & the way you run UltraVNC - you will need KiTTY for this.
Create a SSH secure tunnel using KiTTY:
Now when you connect with this setup it will login & issue the needed command to start the server - ready for PC remote desktop.
On the PC, run UltraVNC