Contents
|
Know How for the Orange Pi
There are several versions of Orange Pi computers. I will describe here Orange Pi Lite and Orange Pi One (which seems to be no longer manufactured, since 2017-01).
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 basics are: (for the I/O please see at http://orangepi.com/orange-pi-lite)
CPU: Allwinner H3 (ARM A7-quad core)
RAM: 512 MB
Flash: micro SD-card
Linux software: Armbian is described well.
Power consumption: 5 V, Basic 0.3 - 0.5 A + external devices
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 below shows the Orange Pi Lite (WiFi and Bluetooth version) with the serial port connected to a USB to serial converter, in order to setup the WiFi interface.
The serial data wires RX, TX and GND (or RD and TD) are connected 1:1, 115200 Baud 8N1 no handshake.
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 Orange Pi version with WiFi and Bluetooth, without Ethernet port. A schematic is available.
A sample installation of Armbian on a micro SD-card (>= 8 GB, class 10) under Mac OS:
# cd to download folder of "Armbian" $ cd /Volumes/DAT/HDA8/INSTALL/NAS/OrangePi_Lite/Armbian_5.20_Orangepilite_Debian_jessie_3.4.112_desktop # find disk number of the SD-card $ diskutil list # SD-card is disk4 # unmount SD-card $ diskutil unmountDisk /dev/disk4s1 # copy Armbian image to SD-card $ sudo dd bs=1m if=Armbian_5.20_Orangepilite_Debian_jessie_3.4.112_desktop.img of=/dev/rdisk4 # eject SD-card
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 XFCE4 Desktop or Server version. Please read the Quick Start page for informations. I am using the Desktop version.
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 only), as shown in the picture above. In my case I did not need to cross RxD and TxD wires.
You can use in PuTTY the mouse scroll wheel switch to insert text from the clipboard.
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. Then you will be asked for a user name with some not so important details, and a user password. Preferably the user name is pi. Then it is much easier to copy and paste the terminal commands from my web page.
Then it is time to reboot, in order to login as a user:
orangepilite login: pi 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 /: 33% of 7.2G # 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 - orangepilite # 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 orangepilite 192.168.17.171 00:e0:4c:18:0f:ee WLAN 42 Mbit/s or $ sudo ifconfig ... wlan0 Link encap:Ethernet HWaddr 00:e0:4c:18:0f:ee inet addr:192.168.17.171 Bcast:192.168.17.255 Mask:255.255.255.0 ...
Then try a SSH connect for remote control, with a Terminal or PUTTY:
# Try SSH connect: $ ssh pi@192.168.17.171 ___ ____ _ _ _ _ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) | | (_) |_ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | | | | __/ _ \ | |_| | | | (_| | | | | (_| | __/ | __/| | | |___| | || __/ \___/|_| \__,_|_| |_|\__, |\___| |_| |_| |_____|_|\__\___| |___/ 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.171 CPU temp: 36°C Usage of /: 33% of 7.2G 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 # kernel 3.4.112-sun8i = linux-image-sun8i (5.25) # kernel 3.4.113-sun8i = linux-image-sun8i (5.26) # install the powerful file manager "midnight commander" $ sudo apt-get install mc # allow F10 key: Tab Edit->Preferences - remove mark from "Enable the menu accelerator key"
The following chapters concerning configuration and setup are common for the Orange Pi One/Lite.
Housing
While inserting the Orange Pi board into the housing, I unfortunately broke the micro SD-card, because of the land between micro SD-card outcut and camera cable outcut.
In order to avoid that in the future, I cut out the land, as you can see in the picture on the right. The lower housing still has the lend, while it was cut out in the upper housing.
Orange Pi One
It looks like, that this board no longer manufactured, since 2017-01.
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 XFCE4 Desktop or Server version. Please read the Quick Start page for informations. I am using the Desktop version.
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 # setup for DVI converter (proposal with DVI converter use: 1024x768) $ sudo h3disp -m 32 -d
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:
The password length must be between 5-8 characters. If it is longer, it will be truncated to 8.
# if there was time to the last update, do it now. # update first the software Repository $ sudo apt-get update # upgrade packages $ sudo apt-get upgrade $ sudo shutdown -r # prepare an install folder $ mkdir Install $ cd Install $ 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
In order to change the password, use the command:
# Path: $HOME/.vnc/passwd $ vncpasswd enter password ENTER enter password to verify ENTER
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 # 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". $ cat tightvncserver-init.txt # just show file or $ nano tightvncserver-init.txt # edit file # copy to the init.d folder $ sudo cp tightvncserver-init.txt /etc/init.d/tightvncserver # 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 stop $ sudo /etc/init.d/tightvncserver stop # Manual start $ sudo /etc/init.d/tightvncserver start # 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 for VNC use. $ sudo apt-get install autocutsel # enable auto start $ nano ~/.vnc/xstartup # edit file # insert at the third line the following 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 select: Goto/connect to server, Server address (e.g.): vnc://192.168.17.171: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 (e.g.): 192.168.17.171: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:
# example of /etc/sudoers Defaults env_reset Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" $ sudo cat /etc/sudoers # show file $ sudo nano /etc/sudoers # edit file # append the 2 following lines to the end of the file: Defaults env_keep += "DISPLAY" Defaults env_keep += "XAUTHORITY" $ sudo nano ~/.bashrc # edit file # Append the following line to ~/.bashrc: (for VNC + tkinter) if [ -z "$XAUTHORITY" ] ; then if [ -e $HOME/.Xauthority ] ; then export XAUTHORITY=$HOME/.Xauthority; fi; fi # check edit $ cat ~/.bashrc # restart, to make it work $ sudo shutdown -r # 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:
# for screen shot install: $ sudo apt-get install scrot eog # eog = Eye Of Gnome = picture viewer $ 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 -> edit value: delete text "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 # Menu Settings->Preferred Applications->Tab Utilities # Nautilus for file manager # Gnome-Terminal for terminal # click on button 'Close' $ sudo updatedb # for locate, to immediately index file names # "List View" + "tree view" in file manager Nautilus, version 3.14.1 # Click on folder icon in upper left edge of the window. # Select: Preferences-> # Tab Views: Default view->View new folders using: List View # Tab Display->List View-> check mark "Navigate folders in a tree"
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 # test if smb.conf is ok: $ sudo service smbd restart # for adduser to work, reboot: $ sudo shutdown -r # test if user was added to group "sambashare" $ groups pi dialout sudo audio video plugdev netdev bluetooth sambashare # set password for samba, same as user password $ sudo smbpasswd -a pi # create samba share with Nautilus select in Nautilus the folder /home/pi # user click with right mouse button on the icon click on "sharing options" in window " Folder sharing" mark "share this folder" share name: pi-orange comment: orange lite option: mark "Allow others to create and delete files in this folder" click on "Create Share" click on: add the permissions automatically # change owner for easier access: $ sudo chown pi:pi /var/lib/samba/usershares/pi-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
Date
In order to get the date below the time you can change in the clock properties, see the syntax:
# Clock Options->Format:Custom format: %H:%M%n%F # %n = new line # %F = Full date; same as %Y-%m-%d, e.g. 2017-04-17
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 CPU Frequency Monitor - click on Add System Load Monitor - click on Add Generic Monitor - click on Add + Close # Right click on Panel mem->properties: remove mark from "Uptime monitor" (usually not needed) # Click on 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/pi $ 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 # give file "execute" permission $ chmod ug+x cpu-temp_panel.sh # right click on the just installed panel plugin and select properties: Command: /home/pi/Install/cpu-temp_panel.sh # adopt the user name, if not "pi" Label: CPU_ (1 space) Period: 5 s
Now you should see the previous mentioned computer informations, like to see on the screen shot above.
Python, TKinter
Python2 is already installed, but some support is missing.
# Install Python TKinter package $ sudo apt-get install python-tk # Install Python integrated development environment $ sudo apt-get install idle
Python3 is already installed, but some support is missing.
# Install Python3 package installer $ sudo apt-get install python3-pip # Install Python3 TKinter package $ sudo apt-get install python3-tk # Install Python3 integrated development environment $ sudo apt-get install idle3
Test the Tkinter installation with a little program:
# create file $ touch Install/tkinter-test.py # edit file witth the following lines $ nano Install/tkinter-test.py # Python 2/3 Tkinter test program: tkinter_test.py # 2016-12-28 RudolfReuter try: from Tkinter import * except ImportError: from tkinter import * class Application(Frame): def say_hi(self): print("hi there, everyone!") def createWidgets(self): self.QUIT = Button(self) self.QUIT["text"] = "QUIT" self.QUIT["fg"] = "red" self.QUIT["command"] = self.quit self.QUIT.pack({"side": "left"}) self.hi_there = Button(self) self.hi_there["text"] = "Hello", self.hi_there["command"] = self.say_hi self.hi_there.pack({"side": "left"}) def __init__(self, master=None): Frame.__init__(self, master) self.pack() self.createWidgets() root = Tk() app = Application(master=root) app.mainloop() root.destroy() # end of file # must be started in the Terminal in the GUI $ python Install/tkinter-test.py $ python3 Install/tkinter-test.py
The screenshot on the right shows the started test program tkinter-test.py, which works as well with Python 2 as Python 3.
The used Terminal is the GNOME-Terminal.
The Graphical User Interface (GUI) desktop is xfce4.
The xfce4 desktop is shown in the RealVNC viewer on Mac OS.
Wobbulator
I have a home made Wobbulator, RF Network Analyzer working with a Raspberry Pi. I liked to know, if it also works with the Orange PI Lite, with a WiFi network connection to a laptop computer. That offers the possibility to run the application portable with a 5 V powerbank. The average power consumption in this case is about 0.4 A.
Fortunately the 26 pin flatcable connector was hardware compatible, just the software needed some modification. A patch file can be downloaded, to show the difference in hardware access from Raspberry Pi to the Orange Pi.
Install first OrangePiKnowHow#GPIO_Python.
The program wobbulator2.6.3o.py is already adopted to the Orange Pi. Because it is a Python3 graphical (TKinter) program, it must be started from the XFCE4 GUI, in a terminal, see a sample run:
$ sudo python3 ./wobbulator2.6.3o.py [sudo] password for pi: start pgm tk init start mainloop sweep bias [V] 0.8035714285714286 Dauer (s) 1.0870912075042725
The screenshot above shows the Orange Pi Lite desktop with the program wobbulator2.6.3o.py running.
The test object was a 10.7 MHz filter, scanned from 1 MHz to 31 MHz with an increment of 100 KHz (300 steps). The input RF-level to the filter was about 0 dBm. The sweep time was 1.1 seconds. You can see, that the filter has a side peak at about half the major frequency (5.35 MHz), which is about 23 dB below the filter working frequency amplitude (-9 dBm).
Clone SD-card
Because of different net storage capacity values, it is advisable to use 95% only of a SD-card. That avoids problems when cloning an image to a slightly smaller SD-card.
If a SD-card fails, it is the quickst way to restore it from a back up file. In order to make it easier, some example commands are shown:
# show the mounted mass storage $ df -h # save a SD-card image (16 GB) # change disk to a >16 GB free folder $ cd /media/<user>/<disk-folder> # unmount SD-card $ umount ../<SD-card-folder> # save image (class 10, duration about 20 min.) $ sudo dd bs=4M if=/dev/sdb of=orangepilight.img # remove SD-card ----------------------- # restore SD-card image # change disk to the SD-card image folder $ cd /media/<user>/folder # insert new SD-card # unmount SD-card $ umount /media/<user>/xxx # restore image (class 10, duration about 25 min.) $ sudo dd bs=4M if=orangepilight.img of=/dev/sdb # or other device # change file /etc/hostname, e.g. orangepilight1 # remove SD-card
Tipps
shutdown Orange Pi
$ sudo shutdown -h # Halt after shutdown (power off)
Add sbin and /usr/sbin to path:
# edit /home/pi/.bashrc, add the following line after the "esac" line export PATH="$PATH:/sbin:/usr/sbin" # activate $ source .bashrc $ echo $PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin
Build date of the software:
$ uname -a Linux orangepilite 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.
Check for Debian version:
$ cat /etc/issue Debian GNU/Linux 8 \n \l
Hardware IO
Here are documented hardware I/O related informations.
Analog
There is no Analog to Digital converter, but you have a Pulse Wide Modulation (PWM) output.
Audio
There is a microphone for Audio input. Audio output can be achieved via HDMI device (TV, Monitor).
GPIO
Wiring Orange Pi is a GPIO library, explained here, and can be clone with git, or downloaded and unzipped in user folder.
$ cd ~/Install $ git clone https://github.com/zhaolei/WiringOP.git $ cd WiringOP or with download $ cd WiringOP-h3 # make executable $ chmod +x ./build # build and install $ sudo ./build # 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 NOTE: To compile programs with wiringBP v2, you need to add: -lwiringPi to your compile line(s) To use the Gertboard, MaxDetect, etc. code (the devLib), you need to also add: -lwiringPiDev to your compile line(s).
The pin assignement for WiringOP is (see also BCM2835 GPIOs):
$ gpio readall +-----+-----+----------+------+---+-Orange Pi+---+---+------+---------+-----+--+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+ | | | 3.3v | | | 1 || 2 | | | 5v | | | | 12 | 8 | SDA.0 | ALT5 | 0 | 3 || 4 | | | 5V | | | | 11 | 9 | SCL.0 | ALT5 | 0 | 5 || 6 | | | 0v | | | | 6 | 7 | GPIO.7 | ALT3 | 0 | 7 || 8 | 0 | ALT3 | TxD3 | 15 | 13 | | | | 0v | | | 9 || 10 | 0 | ALT3 | RxD3 | 16 | 14 | | 1 | 0 | RxD2 | ALT3 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1 | 1 | 110 | | 0 | 2 | TxD2 | ALT3 | 0 | 13 || 14 | | | 0v | | | | 3 | 3 | CTS2 | ALT3 | 0 | 15 || 16 | 0 | ALT3 | GPIO.4 | 4 | 68 | | | | 3.3v | | | 17 || 18 | 0 | ALT3 | GPIO.5 | 5 | 71 | | 64 | 12 | MOSI | ALT4 | 0 | 19 || 20 | | | 0v | | | | 65 | 13 | MISO | ALT4 | 0 | 21 || 22 | 0 | ALT3 | RTS2 | 6 | 2 | | 66 | 14 | SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0 | 10 | 67 | | | | 0v | | | 25 || 26 | 0 | ALT3 | GPIO.11 | 11 | 21 | | 19 | 30 | SDA.1 | ALT4 | 0 | 27 || 28 | 0 | ALT4 | SCL.1 | 31 | 18 | | 7 | 21 | GPIO.21 | ALT3 | 0 | 29 || 30 | | | 0v | | | | 8 | 22 | GPIO.22 | ALT3 | 0 | 31 || 32 | 0 | ALT3 | RTS1 | 26 | 200 | | 9 | 23 | GPIO.23 | ALT3 | 0 | 33 || 34 | | | 0v | | | | 10 | 24 | GPIO.24 | ALT3 | 0 | 35 || 36 | 0 | ALT3 | CTS1 | 27 | 201 | | 20 | 25 | GPIO.25 | ALT3 | 0 | 37 || 38 | 0 | ALT3 | TxD1 | 28 | 198 | | | | 0v | | | 39 || 40 | 0 | ALT3 | RxD1 | 29 | 199 | +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+----------+------+---+-Orange Pi+---+------+----------+-----+-----+ BCM = Broadcom SOC channel wPi = Wiring Orange Pi Mode = I/O mode Physical = Pin number of 40 pin GPIO connector
The Pin assignement for the utility gpio in armbian (2016-09)
WiringPi vs. BCM, GPIO, Port Pin numbering WiringPi BCM GPIO-r2 Port Pin Function ────────────────────────────────────────────── 0 1 17 PA1 11 RxD2 1 110 18 PD14 12 (PWM) 2 0 27 PA0 13 TxD2 3 3 22 PA3 15 CTS2 4 68 23 PC4 16 5 71 24 PC7 18 6 2 25 PA2 22 RTS2 7 6 4 PA6 7 8 12 2 PA12 3 I2C: SDA0 9 11 3 PA11 5 I2C: SCL0 10 67 8 PC3 24 SPI: CE0 11 21 7 PA21 26 SPI: CE1 12 64 10 PC0 19 SPI: MOSI 13 65 9 PC1 21 SPI: MISO 14 66 11 PC2 23 SPI: SCLK 15 13 14 PA13 8 TxD3 16 14 16 PA14 10 RxD3 21 7 5 PA7 29 22 8 6 PA8 31 23 9 13 PA9 33 24 10 19 PA10 35 25 20 26 PA20 37 26 200 12 PG8 32 RTS1 27 201 16 PG9 36 CTS1 28 198 20 PG6 38 TxD1 29 199 21 PG7 40 RxD1 # Examples: # Switch LED on pin 11 (PA1) ON and OFF # gpio numbering $ gpio -g mode 17 output $ gpio -g write 17 1 $ gpio -g write 17 0 # or BCM numbering $ gpio mode 1 output $ gpio write 1 1 $ gpio write 1 0 # or 40 pin connector numbering $ gpio -1 mode 11 output $ gpio -1 write 11 1 $ gpio -1 write 11 0
A good information is here. An example:
$ sudo modprobe gpio-sunxi $ sudo ls /sys/class/gpio_sw/ PA0 PA10 PA14 PA21 PA6 PA8 PC4 PD14 PG7 PG9 PA1 PA13 PA2 PA3 PA7 PA9 PC7 PG6 PG8 $ sudo echo 1 > /sys/class/gpio_sw/PA1/data $ sudo echo 0 > /sys/class/gpio_sw/PA1/data
More Python GPIO examples are here.
orangepi_PC_gpio_pyH3 - Python GPIO library, see also: gpio pin numbering differences
GPIO Python
# Install $ sudo apt-get install python-dev git make gcc $ cd /home/pi/Install $ git clone https://github.com/duxingkei33/orangepi_PC_gpio_pyH3.git $ cd orangepi_PC_gpio_pyH3 $ sudo python setup.py install # also for Python3 $ sudo apt-get install python3-dev $ sudo python3 setup.py install # Install kernel module $ sudo modprobe gpio-sunxi # see, if loaded $ lsmod | grep gpio gpio_sunxi 8269 0 $ cd .. # create testfile led_pa1.py $ touch led_pa1.py # copy and paste (mouse) the following program in file led_pa1.py $ nano led_pa1.py # -*- coding: utf-8 -*- # 2016-12-25 program: led_pa1.py from pyA20.gpio import gpio from pyA20.gpio import port from pyA20.gpio import connector import time COUNT = 3 #LED = port.PA1 LED = connector.gpio1p11 # gpio1p11 = PA1 # PWR_LED = port.POWER_LED # does NOT work STAT_LED = port.STATUS_LED gpio.init() gpio.setcfg(LED, gpio.OUTPUT) # STATUS_LED is already set to output for _ in xrange(COUNT): gpio.output(LED,True) gpio.output(STAT_LED,True) time.sleep(1.0) gpio.output(LED,False) gpio.output(STAT_LED,False) time.sleep(1.0) # end of file +------+ LED # connect LED to pin 11 (PA1) of 40 pin connector: pin 11 -| 220R |--|>|- pin 9 0V (GND) +------+ # start test program: $ sudo python ./led_pa1.py # Status LED and LED on pin 11 should blink 3 times.
I2C bus
Also called TWI (Two Wire Interface, maybe clock stretching is not supported). I2C-bus was designed by Philips in the early ’80s to allow easy communication between components which reside on the same circuit board. Philips Semiconductors migrated to NXP in 2006.
Lets see, what is already on board:
~$ ls -ls /dev/i2* 0 crw------- 1 root root 89, 0 Dec 26 23:08 /dev/i2c-0 0 crw------- 1 root root 89, 1 Dec 26 23:08 /dev/i2c-1
Make armbian more user friendly:
# Install i2c-tools smbus $ sudo apt-get install i2c-tools python-smbus # change i2c device group from root to i2c $ sudo chown root:i2c /dev/i2c* $ sudo adduser $USER i2c # logout / login or $ sudo shutdown -r # test groups $ groups pi dialout sudo audio video plugdev netdev bluetooth sambashare i2c # Now i2c access needs no longer "root" rights, just group "i2c" rights. # If "i2cdetect" is not found, add "sbin" to the environment "path". # connect an Adapter PCF8574 (I2C address 0x27) to pin 3 = SDA and pin 5 = SCK $ /usr/sbin/i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- -- ...
There is a nice test program for I2C LCD (16 x 2 characters, Adapter PCF8574). It needs a little modification, then it works.
# LCD wire connection to 40 pin connector: GND to pin 6, +5 V to pin 4, SDA to pin 3, SCK to pin 5 $ cd Install # download example $ git clone https://github.com/sweetpi/python-i2c-lcd.git $ cd python-i2c-lcd # edit file lcddriver.py # change BUS = 1 to BUS = 0 # write the numbers 1234567 to the LCD $ python display.py 1234567 # the numbers show up
Infrared
The infrared Port is just a receiver only, see Links #2.
Links
Enable g_serial USB OTG console Orange Pi on Armbian]]
List of pages in this category:
-- RudolfReuter 2016-12-23 13:25:42
Go back to CategoryRaspberryPi or FrontPage