Contents
|
Know How for the Orange Pi
The http://orangepi.com/orange-pi-lite is a palm sized (69 x 48 mm) computer that plugs into your TV and can use an USB keyboard and an USB mouse. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. The community page has some more details.
The Linux software Armbian is described well.
I will explain here some specific Know How concerning practical use. Please see the picture below for details (click on picture to expand).
The picture shows the Orange Pi Lite (WiFi and Bluetooth version) with the serial port connected to a USB to serial converter.
The serial data wires RX and TX (or RD and TD) are connected 1:1.
Please take care to use the 3.3 V version of the serial converter. A 5 V version can damage your Orange Pi.
If you are using a DVI adapter on your monitor, you will probably see no picture. The fix is explained later.
Orange Pi Lite
Orange Pi Lite is the version with WiFi and Bluetooth, without Ethernet port. A schematic is available.
Because it is so cheap (about 27 EUR ), it is very attractive to use it in all kinds of embedded computer projects. The offer is from https://www.aliexpress.com, search for Orange Pi Lite SET12, it contains an Orange Pi Lite + Transparent ABS case + power cable + 16 GB class 10 micro SD card.
Armbian software
The Armbian (Debian) software can be downloaded in a Desktop or Server version. Please read the Quick Start page for informations.
When the software on the micro SD-card is OK, the green LED blinks, or lits steady.
WiFi connect
Because the Orange Pi Lite does not have an Ethernet port, the WiFi connection must be configured via the serial port (115200 Baud 8N1). To make the connection to a computer with a terminal (PUTTY or CoolTerm), you need an USB to serial converter (3.3 V version), as shown in the picture above.
Next insert the programmed micro SD card into the socket of the board and switch on power. In the terminal you will see:
U-Boot SPL 2016.09-armbian (Sep 15 2016 - 07:09:20) DRAM: 512 MiB Trying to boot from MMC1 U-Boot 2016.09-armbian (Sep 15 2016 - 07:09:20 +0200) Allwinner Technology CPU: Allwinner H3 (SUN8I 1680) Model: Xunlong Orange Pi Lite DRAM: 512 MiB MMC: SUNXI SD/MMC: 0 *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found U-Boot script /boot/boot.scr 2789 bytes read in 144 ms (18.6 KiB/s) ## Executing script at 43100000 gpio: pin PL10 (gpio 298) value is 1 Warning: value of pin is still 0 gpio: pin PG11 (gpio 203) value is 1 ** File not found /boot/.verbose ** ** File not found /boot/.next ** ** Unrecognized filesystem type ** ** File not found .next ** 35912 bytes read in 400 ms (86.9 KiB/s) 3114597 bytes read in 307 ms (9.7 MiB/s) 5025168 bytes read in 455 ms (10.5 MiB/s) ## Loading init Ramdisk from Legacy Image at 43300000 ... Image Name: uInitrd Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 3114533 Bytes = 3 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK Using machid 0x1029 from environment Starting kernel ... [sun8i_fixup]: From boot, get meminfo: Start: 0x40000000 Size: 512MB ion_carveout reserve: 160m@0 256m@0 130m@1 200m@1 ion_reserve_select: ion chipid [0x2004620! ion_reserve_common: ion reserve: [0x56000000, 0x60000000]! Debian GNU/Linux 8 orangepilite ttyS0
Next you will be asked for the root password ("1234"), and need to change it to a new one. The you will be asked for a user name with some not so important details, and a user password.
Then it is time to reboot, in order to login as a user:
orangepilite login: rudi Password: xxxxx Linux orangepilite 3.4.112-sun8i #14 SMP PREEMPT Wed Sep 14 20:29:31 CEST 2016 armv7l ___ ____ _ _ _ _ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) | | (_) |_ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | | | | __/ _ \ | |_| | | | (_| | | | | (_| | __/ | __/| | | |___| | || __/ \___/|_| \__,_|_| |_|\__, |\___| |_| |_| |_____|_|\__\___| |___/ Welcome to ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i System load: 1.46 Up time: 32 sec Memory usage: 24 % of 494Mb IP: CPU temp: 20°C Usage of /: 16% of 15G # you see, there is not yet an IP number available!
Now it is time to connect to the WiFi router, with the setup. The network manager scans already for available hotspots (router):
$ sudo nmtui # network manager text user interface Set system hostname - orangepilite1 # for example Activate a connection Wi-Fi # scan for available hotspots (router) FRITZ-7360 - <Activate> # SSID for example ..... Password: xxxx <OK> connecting... <QUIT> # check in the router for the IP address # for example a Fritz!box orangepilite1 192.168.17.170 00:E0:4C:D7:FE:15 WLAN 42 Mbit/s
Then try a SSH connect for remote control, with a Terminal or PUTTY:
# Try SSH connect: $ ssh rudi@192.168.17.170 ___ ____ _ _ _ _ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) | | (_) |_ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | | | | __/ _ \ | |_| | | | (_| | | | | (_| | __/ | __/| | | |___| | || __/ \___/|_| \__,_|_| |_|\__, |\___| |_| |_| |_____|_|\__\___| |___/ Welcome to ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i System load: 0.00 Up time: 25 min Memory usage: 23 % of 494Mb IP: 192.168.17.170 CPU temp: 36°C Usage of /: 16% of 15G Last login: Thu Sep 15 07:30:19 2016 $ sudo date MMDDhhmmYYYY # M=Monat, D=Tag, h=Stunde, m=Minute, Y=Jahr
Now it is time to do an software update via internet:
$ sudo apt-get update $ sudo apt-get upgrade $ sudo shutdown -r # reboot
The following chapters concerning configuration and setup are common for the Orange Pi One/Lite.
Orange Pi One
Orange Pi One is the version with Ethernet port, without WiFi and Bluetooth. A schematic is available.
Because it is so cheap (about 25 EUR ), it is very attractive to use it in all kinds of embedded computer projects. The offer is from https://www.aliexpress.com, search for Orange Pi One SET7, it contains an Orange Pi One + Transparent ABS case + power cable + 8 GB class 10 micro SD card.
Armbian software
The Armbian (Debian) software can be downloaded in a Desktop or Server version. Please read the Quick Start page for informations.
When the software on the micro SD-card is OK, the green LED blinks, or lits steady.
Shared software additions
The following software additions will make it more comfortable to work with the Orange Pi.
Screen resolution HDMI
If you are using a HDMI to DVI adapter you will probably see no picture on your monitor. For changing the resolution on your monitor, and a fix for the DVI Adapter, a tool is provided:
Desktop size: 1024 x 768 # initial setup $ sudo h3disp Usage: h3disp [-h/-H] -m [video mode] [-d] [-c [0-2]] ############################################################################ This is a tool to set the display resolution of your Orange Pi by patching script.bin. In case you use an HDMI-to-DVI converter please use the -d switch. The resolution can be set using the -m switch. The following resolutions are currently supported: 480i use "-m 480i" or "-m 0" 576i use "-m 576i" or "-m 1" 480p use "-m 480p" or "-m 2" 576p use "-m 576p" or "-m 3" 720p50 use "-m 720p50" or "-m 4" 720p60 use "-m 720p60" or "-m 5" 1080i50 use "-m 1080i50" or "-m 6" 1080i60 use "-m 1080i60" or "-m 7" 1080p24 use "-m 1080p24" or "-m 8" 1080p50 use "-m 1080p50" or "-m 9" 1080p60 use "-m 1080p60" or "-m 10" 1080p25 use "-m 1080p25" or "-m 11" 1080p30 use "-m 1080p30" or "-m 12" 1080p24_3d use "-m 1080p24_3d" or "-m 13" 720p50_3d use "-m 720p50_3d" or "-m 14" 720p60_3d use "-m 720p60_3d" or "-m 15" 1080p24_3d use "-m 1080p24_3d" or "-m 23" 720p50_3d use "-m 720p50_3d" or "-m 24" 720p60_3d use "-m 720p60_3d" or "-m 25" 1080p25 use "-m 1080p25" or "-m 26" 1080p30 use "-m 1080p30" or "-m 27" 4kp30 use "-m 4kp30" or "-m 28" 4kp25 use "-m 4kp25" or "-m 29" 800x480 use "-m 800x480" or "-m 31" 1024x768 use "-m 1024x768" or "-m 32" 1280x1024 use "-m 1280x1024" or "-m 33" 1360x768 use "-m 1360x768" or "-m 34" 1440x900 use "-m 1440x900" or "-m 35" 1680x1050 use "-m 1680x1050" or "-m 36" Two examples: 'h3disp -m 1080p60 -d' (1920x1080@60Hz DVI) 'h3disp -m 720i' (1280x720@30Hz HDMI) You can also specify the colour-range for your HDMI-display with the -c switch. The following values for -c are currently supported: 0 -- RGB range 16-255 (Default, use "-c 0") 1 -- RGB range 0-255 (Full range, use "-c 1") 2 -- RGB range 16-235 (Limited video, "-c 2") Now trying to patch script.bin with your settings. Successfully finished. Please reboot for changes to take effect
VNC server
Virtual Network Computing (VNC) allows you, to show the monitor screen of a remote computer (VNC Server) on a local computer (VNC Client), also to use your local keyboard and mouse for control of the remote computer. That allows to control a remote computer which does not have its own screen, keyboard and mouse.
First you have to install on the Orange Pi a VNC Server, preferably the tightvncserver:
# update first the software Repository $ sudo apt-get update # upgrade packages $ sudo apt-get upgrade $ sudo apt-get install tightvncserver # start server $ vncserver :1 You will require a password to access your desktops. Password: raspberr # max 8 characters, e.g. raspberr Verify: Would you like to enter a view-only password (y/n)? n New 'X' desktop is raspberrypi:1 Creating default startup script /home/pi/.vnc/xstartup Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:1.log # finish VNC server daemon $ vncserver -kill :1
For an automatic start of the VNC server, you need a script, see at the links.
# Get the script $ wget http://www.penguintutor.com/otherfiles/tightvncserver-init.txt # copy to the init.d folder $ sudo cp tightvncserver-init.txt /etc/init.d/tightvncserver # Check the user name in line 16 and adopt if necessary. At the moment it is set to "pi". # For safety reasons the user should NOT be named "root". # Change user and group $ sudo chown root:root /etc/init.d/tightvncserver # Adjust the rights (execute) $ sudo chmod 755 /etc/init.d/tightvncserver # Put the script in the "run levels" $ sudo update-rc.d tightvncserver defaults # Manual start $ sudo /etc/init.d/tightvncserver start # Manual stop $ sudo /etc/init.d/tightvncserver stop # Check, if the process is active $ ps -Af | grep vnc pi 5135 1 0 06:42 ? 00:00:05 Xtightvnc :1 -desktop X -auth /home/pi/.Xauthority -geometry 1024x768 -depth 24 -rfbwait 120000 -rfbauth /home/pi/.vnc/passwd -rfbport 5901 -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
Unfortunately the clipboard just works in one direction only. The other direction can be enabled with the programm autocutsel on the Orange Pi:
# Install program to synchronise the clipboard $ sudo apt-get install autocutsel # enable auto start # edit ~/.vnc/xstartup # append at the third line: autocutsel -fork xrdb $HOME/.Xresources ... # stop the VNC Server $ sudo /etc/init.d/tightvncserver stop # start with "autocutsel" $ sudo /etc/init.d/tightvncserver start
Now you can establish a connection with a VNC client viewer.
It may be needed, to append the port numer 5901 to the IP address (Real VNC: Connection refused (61))
Password (was entered at setup, max. 8 characters): raspberr
Mac OS X Sierra 10.12.2:
In Finder you cab call: Goto/connect to server, Server address (e.g.): vnc://192.168.17.187:5901 . Unfortunately the build in VNC client does not support alt gr characters.
RealVNC: VNC-Viewer-5.1.1: supports the alt gr characters. Address (z.B.): 192.168.17.187:5901
- The window size default is 1024 x 768 Pixel.
Windows
- RealVNC: VNC-Viewer-5.1.1
VNC and sudo
In the VNC viewer, if you start a program with sudo, you can get an error _tkinter.TclError: couldn't connect to display ":1.0".
The solution is to setup XAUTHORITY, see more about at the links:
$ cd /etc/sudoers.d # create a new parameter file $ sudo touch xauthority # edit file $ sudo visudo xauthority # enter the following 5 lines and save to file: # setup for VNC with sudo Defaults env_reset Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Defaults env_keep += "DISPLAY" Defaults env_keep += "XAUTHORITY" # Add these few lines to ~/.bashrc: if [ -z "$XAUTHORITY" ]; then if [ -e $HOME/.Xauthority ]; then export XAUTHORITY=$HOME/.Xauthority; fi; fi # logout and login again # Please be care that for entering the password an ENGLISH keyboard is used! # for password "raspberry" you must type "raspberrz"!
Now it should be possible to start a X-Windows program with sudo.
VNC and Screen Shot
If you like to do a screen shot from your graphic window, type on the command line:
$ scrot -s -d 4 # option "-s" select a window, or a rectangle, with the mouse # option "-d 4" have a 4 s delay before the screen shot, in order to restore the window # and read "man scrot" # result: $ ls -ls | grep 2014-05-05 36 -rw-r--r-- 1 pi pi 33458 Mai 5 14:00 2014-05-05-140020_655x643_scrot.png
Terminal TAB command complete
Unfortunately the function command complete in the terminal with the TAB key does not work in XFCE, see here.
The quick solution is to use CTRL/STRG TAB instead TAB. The better solution is to work at the reason. XFCE has captured the TAB key for the funtion switch_window_key, but I think, the function command complete is more important. So what to do:
Applications Menu->Settings->Settings Manager->Settings Editor xfce4-keyboard-shortcuts <Super>Tab -> delete value "switch_window_key" # to make it work: $ sudo shutdown -r # reboot
Often use programs
In XFCE often used programs, like Terminal, File Manager, Texteditor and File Finder are on a low convenience level, to save resources. Because I often work with Ubuntu, I want to have the same often used programs. The installation is easy:
$ sudo apt-get install nautilus gnome-terminal gedit locate eog # Menu Settings->Preferred Applications # Nautilus for file manager # Gnome-Terminal for terminal $ sudo updatedb # for locate, to immediately index file names # "tree view" in file manager Nautilus, version 3.14.1 # Click on folder icon in upper left edge of the window. # Select: Preferences->Display->List View-> check mark "Navigate folders in a tree" # eog = eye of gnome, picture viewer
Samba share
For easier file sharing in the in-house network, I like to have a Samba share installed:
$ sudo apt-get install nautilus-share $ sudo apt-get install samba $ sudo adduser $USER sambashare # edit /etc/samba/smb.conf, add line in global section usershare owner only = false $ sudo service smbd restart # for adduser to work, reboot: $ sudo shutdown -r # test if user was added to group "sambashare" $ groups rudi dialout sudo audio video plugdev netdev bluetooth sambashare # set password for samba, same as user password $ sudo smbpasswd -a rudi # create samba share with Nautilus select in Nautilus the folder /home/rudi # user click with right mouse button on the icon click on "sharing options" in window " Folder sharing" mark "share this folder" share name: rudi-orange option: mark "Allow others to create and delete files in this folder" click on "Create Share" # change owner for easier access: $ sudo chown rudi:rudi /var/lib/samba/usershares/rudi-orange # test if you can connect the share
XFCE4 panel additions
I want to see in the panel some information from this computer:
actual CPU speed
CPU load, memory use, swap use
CPU temperature
For all those informations you can get plugins for the xfce4 panel. First you have to install them:
# CPU Information - CPU Frequency Monitor (About) $ sudo apt-get install xfce4-cpufreq-plugin # System Load Monitor version 1.1.1 - (About) # http://goodies.xfce.org/projects/panel-plugins/xfce4-systemload-plugin $ sudo apt-get install xfce4-systemload-plugin # xfce4-genmon-plugin 3.5 - Generic Monitor (About) $ sudo apt-get install xfce4-genmon-plugin
All plugins are installed in the panel in the same way:
Right click on Panel Panel Add new item Left click on <plugin name> to mark Button Add Button Close
While the first 2 plugins work immediately, the CPU temperature needs more effort. You need to prepare your own data collection file:
# create folder in /home/<user> $ mkdir Install # create control file $ touch Install/cpu-temp_panel.sh # edit control file $ nano Install/cpu-temp_panel.sh # insert the following text: #!/bin/bash # http://goodies.xfce.org/projects/panel-plugins/xfce4-genmon-plugin echo "<txt>"$(cat /etc/armbianmonitor/datasources/soctemp | sed 's/\ \ */ /g' | cut -f2 -d" ")"°C</txt>" # finish with: CTRL/STRG o ENTER CTRL/STRG x # right click on the just installed panel plugin and select properties: Command: /home/rudi/cpu-temp_panel.sh # adopt user name "rudi" to your own name Label: CPU_ (1 space) Period: 5 s
Now you should see the previous mentioned computer informations, like to see on the screen shot above.
Python3, TKinter
Python3 is already installed, but some support is missing.
# Install Python3 package installer $ sudo apt-get install python-pip3 # Install Python3 TKinter package $ sudo apt-get install python3-tk # Install Python3 integrated development environment $ sudo apt-get install idle3
Tipps
shutdown Orange Pi
$ sudo shutdown -h
Build date of the software:
$ uname -a Linux orangepilite1 3.4.112-sun8i #10 SMP PREEMPT Sun Oct 23 16:06:55 CEST 2016 armv7l GNU/Linux
find newer files, explanation:
# Syntax find /directory -newermt $(date +%Y-%m-%d -d '1 day ago') -type f -print # example $ find moin-1.9.9/wiki/data/pages -newermt $(date +%Y-%m-%d -d '1 month ago') -type f -print # Delete all Mac OS control files: $ sudo find . -name "._.DS_Store" -type f -delete
Test file system at boot time
$ sudo touch /forcefsck # Restart OrangePi $ sudo shutdown -r
Get root shell
$ sudo su # Exit root shell $ exit # or CTRL/STRG D
update/upgrade: If you login via serial port or SSH and get an upgrade message the action is:
# number of updated packages in total [ 16 updates to install: apt-get upgrade ] # update the package lists $ sudo apt-get update # install the upgrade packages (of the installed packages only) $ sudo apt-get upgrade
Wireless optical mouse and keyboard X1800 from RAPOO
I tested with good success the above mentioned wireless mouse and keyboard, see on the first picture on this page the wireless dongle. The benefit is, that you have now 1 free USB port.
Hardware IO
Here are documented hardware I/O related informations.
Audio
There is a microphone for Audio input. Audio output can be achieved via HDMI device (TV, Monitor).
GPIO
Wiring Pi is a GPIO library, explained here, and can be downloaded and installed.
# kernel modules: [Compile] wiringPi.c [Compile] wiringSerial.c [Compile] wiringShift.c [Compile] piHiPri.c [Compile] piThread.c [Compile] wiringPiSPI.c [Compile] wiringPiI2C.c [Compile] softPwm.c [Compile] softTone.c [Compile] softServo.c [Compile] mcp23008.c [Compile] mcp23016.c [Compile] mcp23017.c [Compile] mcp23s08.c [Compile] mcp23s17.c [Compile] sr595.c [Compile] pcf8574.c [Compile] pcf8591.c [Compile] mcp3002.c [Compile] mcp3004.c [Compile] mcp4802.c [Compile] mcp3422.c [Compile] max31855.c [Compile] max5322.c [Compile] sn3218.c [Compile] drcSerial.c # Device libraries [Compile] ds1302.c [Compile] maxdetect.c [Compile] piNes.c [Compile] gertboard.c [Compile] piFace.c [Compile] lcd128x64.c [Compile] lcd.c [Compile] piGlow.c
Test is with:
# Install kernel module $ sudo modprobe gpio-sunxi # see, if loaded $ lsmod | grep gpio gpio_sunxi 8269 0 # orangepi_PC_gpio_pyH3 - Python GPIO library # https://github.com/duxingkei33/orangepi_PC_gpio_pyH3 # Python test program # -*- coding: utf-8 -*- # 2016-12-25 program: led_pa1.py from pyA20.gpio import gpio from pyA20.gpio import port import time COUNT = 3 PIN = port.PA1 # pin 11 gpio.init() gpio.setcfg(PIN, gpio.OUTPUT) for _ in xrange(COUNT): gpio.output(PIN,True) time.sleep(1.0) gpio.output(PIN,False) time.sleep(1.0) #gpio.cleanup()
I2C bus
Infrared
The infrared Port is just a receiver only.
Links
List of pages in this category:
-- RudolfReuter 2016-12-23 13:25:42
Go back to CategoryRaspberryPi or FrontPage