slitaz-forge view arm/codex/pibook.html @ rev 553

Add PiFace doc
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 08 00:34:52 2014 +0200 (2014-05-08)
parents 2b098709d749
children 2b3ae0ea8187
line source
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <title>SliTaz PiBook</title>
5 <meta charset="utf-8" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <link rel="stylesheet" type="text/css" href="../style.css" />
8 <link rel="stylesheet" type="text/css" href="../style-tiny.css" />
9 <link rel="shortcut icon" href="../favicon.ico" />
10 <!-- Raspberry color -->
11 <style type="text/css">
12 h2 { color: #bc1142; }
13 </style>
14 </head>
15 <body>
17 <!--
18 TODO: Overscan settings, GPU memory split, VideoCore Tools, Edu/Scratch
19 -->
21 <div id="header">
22 <div id="network"><a href="http://arm.slitaz.org/">SliTaz ARM</a></div>
23 <h1><a href=".">SliTaz ARM Codex</a></h1>
24 </div>
26 <nav id="nav" role="navigation" tabindex="0">
27 <ul>
28 <li><a class="nav1" href="faq.html">FAQ</a></li>
29 <li><a class="nav2" href="system.html">System</a></li>
30 <li><a class="nav1" href="apps.html">Apps</a></li>
31 <li><a class="nav2" href="setup.html">Setup</a></li>
32 </ul>
33 </nav>
35 <!-- Content -->
36 <div id="content">
38 <h2>SliTaz Raspberry Pi book</h2>
40 <p>
41 With the PiBook you will learn how to get started with SliTaz ARM and
42 the Raspberry Pi, configure the system, install additional software
43 packages, setup a custom desktop and use pre-installed applications.
44 The book also covers GPIO usage, add-on boards setup such as the official
45 Raspberry Pi Camera or PiGlow and basic electronic usage.
46 </p>
48 <ul>
49 <li><a href="#install">Installation instructions</a></li>
50 <li><a href="#firstboot">First boot setup</a></li>
51 <li><a href="#config">System configuration</a></li>
52 <li><a href="#audio">Audio settings</a></li>
53 <li><a href="#update">System &amp; kernel update</a></li>
54 <li><a href="#add-apps">Installing new packages</a></li>
55 <li><a href="#def-apps">Installed applications</a></li>
56 <li><a href="#pi-pkgs">Raspberry Pi packages</a></li>
57 <li><a href="#remote">GUI &amp; secure remote control</a></li>
58 <li><a href="#setup">Pi setup suggestions</a></li>
59 <li><a href="#desktop">Desktop customization</a></li>
60 <li><a href="#gpio">GPIO Pins &amp; I2C Bus</a></li>
61 <li><a href="#pileds">Using leds with the RPi</a></li>
62 <li><a href="#picam">Pi Camera - Pi NoIR</a></li>
63 <li><a href="#piglow">PiGlow from Pimorini</a></li>
64 <li><a href="#piface">PiFace Digital setup</a></li>
65 </ul>
67 <p>
68 The Pibook is complemented by the general documentation found in the
69 <a href="./.">SliTaz ARM Codex</a>.
70 </p>
72 <h2 id="install">Installation instructions</h2>
74 <pre class="box-up">
75 boot/ : Must be copied to a FAT32 partition
76 rootfs/ : Must be copied to an ext4 or btrfs partition
77 </pre>
79 <p>
80 Be sure the SD card has got 3 partitions (boot, swap, root). The
81 recommended partition sizes are 40Mb for /boot, 420Mb for swap and
82 using all available free space for root. Then you simply have to
83 run the install.sh script from the SliTaz Raspberry Pi release
84 directory:
85 </p>
86 <pre>
87 # ./install.sh
88 </pre>
90 <h2 id="firstboot">First boot setup</h2>
92 <p>
93 On the first SliTaz Raspberry Pi boot you will be prompted to configure
94 basic system settings such as the system keymap and the root password.
95 Then you will be prompted to create the default user with its password.
96 </p>
97 <p>
98 On any secure GNU/Linux system you will have to have at least the administrator
99 (root) and the default human user. In this way, users can fully use
100 the system but can't break it.
101 </p>
102 <p>
103 You can preconfigure the system before the first boot by editing the
104 configurations on the SD card and you can skip the post installation
105 steps. More info on the SliTaz ARM Codex:
106 <a href="system.html#firstboot">System configs</a>
107 </p>
109 <h2 id="config">System configuration</h2>
111 <p>
112 All SliTaz Raspberry Pi basic configurations can be done via a nice
113 Ncurses driven GUI with mouse support under an X session and via
114 a CGI/web administration interface. Please check the detailed
115 <a href="#remote">remote control section</a> in the book for more
116 information about the CGI/Web control panel.
117 </p>
119 <pre class="box-up">
120 tazberry : Dedicated tool for all Raspberry Pi specific configs
121 slitaz-config : Slitaz system configs such as keymaps, lang, users
122 </pre>
124 <p>
125 Tazberry and slitaz-config tool are accessible from the 'System Tools'
126 menu or can be run from a cmdline:
127 </p>
129 <pre>
130 # tazberry
131 # slitaz-config
132 </pre>
134 <h2 id="audio">Audio settings</h2>
136 <p>
137 The Raspberry Pi has two audio output modes: HDMI and headphone jack.
138 You can switch between these two modes at any time. SliTaz Raspberry Pi
139 provides a custom web admin plugin to graphically configure and check
140 audio settings locally or remotely. The web audio control lets you
141 switch audio output and play a sound to test settings. You can directly
142 access the audio control panel with a URL in the form of:
143 </p>
144 <pre>
145 http://192.168.x.xxx/adm/tools.cgi?audio
146 </pre>
147 <p>
148 You can also configure the Raspberry Pi audio output from the command
149 line where the last number is the output mode (0=auto 1=jack 2=hdmi):
150 </p>
151 <pre>
152 # amxier cset numid=3 1
153 </pre>
154 <p>
155 The desktop flavor includes Alsa audio mixer and mpg123 cmdline
156 audio player. Please check the Codex apps page for a common list of
157 <a href="apps.html#multimedia">multimedia applications</a>.
158 </p>
160 <h2 id="update">System &amp; kernel update</h2>
161 <p>
162 It is always a good idea to check for updates! It will bring you fixes
163 and new features. With SliTaz Raspberry Pi you have to upgrade all
164 the installed packages and the custom Linux Kernel. Updates can be done
165 via spk-dialog and tazberry found in the "System Tools menu" or directly
166 from a command line:
167 </p>
168 <pre>
169 # spk-dialog
170 # tazberry
171 </pre>
173 <h2 id="add-apps">Installing new packages</h2>
175 <p>
176 After your system is configured and connected to the web, you may want
177 to install new packages to add functionality to your SliTaz system.
178 You can install new applications via spk-dialog GUI or from the command
179 line with spk-add:
180 </p>
181 <pre>
182 # spk-add package package1 packageN
183 </pre>
184 <p>
185 You can find a list of packages on the SliTaz Raspberry Pi website
186 or by using the spk-find utility. You can search by package name, keyword
187 or description:
188 </p>
189 <pre>
190 # spk-find i2c
191 </pre>
193 <h2 id="def-apps">Installed applications</h2>
195 <p>
196 SliTaz Raspberry Pi can come in many flavors with a custom pre-installed
197 packages set. This section will cover the base and desktop flavors, more
198 information about a spécific flavor may be found on the SliTaz Raspberry
199 Pi website.
200 </p>
202 <h3>Base system</h3>
203 <p>
204 The base flavor provides a text mode system with cmdline only tools, all
205 Busybox applets are present. It supports wireless networks but no sound.
206 The default and most useful applications are:
207 </p>
209 <ul>
210 <li>Dropbear SSH client &amp; server</li>
211 <li>Busybox HTTPd, NTPd, FTPd servers</li>
212 <li>The CGI/Web admin interface and TazBerry</li>
213 <li>Clex file manager and Lynx web browser</li>
214 <li>TazIRC IRC client and Spk packages manager</li>
215 <li>Joe text editor and wget :-)</li>
216 </ul>
218 <h3>Desktop environment</h3>
219 <p>
220 The SliTaz Raspberry Pi desktop flavor focuses on providing a fast,
221 elegant, and easy to use desktop environment. The desktop is powered
222 by JWM window manger and you will find all the base applications plus GUI
223 programs:
224 </p>
226 <ul>
227 <li>Text editors: Adie + FLTK Editor</li>
228 <li>File manager: PathFinder</li>
229 <li>Web browser: Dillo</li>
230 <li>X terminal: Xterm</li>
231 <li>Audio mixer: Alsamixer</li>
232 <li>Audio player: mpg123</li>
233 <li>2 nice games: Blocks Attack + Sudoku</li>
234 <li>Fluid FLTK GUI designer</li>
235 <li>Lua programming language</li>
236 <li>SQLite database support</li>
237 <li>Htop processes monitor</li>
238 </ul>
240 <h2 id="pi-pkgs">Raspberry Pi Packages</h2>
242 <p>
243 Some custom tools and libraries have been packaged specially for the
244 SliTaz Raspberry Pi distribution. Here is a list of packages and
245 a short description:
246 </p>
248 <ul>
249 <li>slitaz-arm-rpi - Provides the CGI/adm plugins, tazberry and custom
250 config files.</li>
252 <li>raspberrypi-boot - Provides the R-Pi bootloader firmware.</li>
254 <li>raspberrypi-boot-x - Provides the R-Pi bootloader firmware with
255 Pi Camera support.</li>
257 <li>raspberrypi-vc -Raspberry Pi VideoCore Tools, including
258 raspistill and raspivid.</li>
260 <li>gst-omx - A gstreamer-1.0 plugin which can do hardware-accelerated
261 video decoding on the Raspberry Pi. </li>
263 <li>wiringpi - A GPIO access library written in C for the BCM2835
264 used in the Raspberry Pi.</li>
266 <li>wiringpi-piglow - The WiringPi tool for PiGlow, useful to handle
267 leds from SHell scripts.</li>
269 <li>picamera - Provides a pure Python interface to the Raspberry
270 Pi camera module.</li>
272 <li>libbcm2835 - Provides access to GPIO and other IO functions on
273 the Broadcom BCM 2835 chip.</li>
275 <li>rcswitch-pi - RCSwitch implementation for the Raspberry Pi.</li>
277 <li>python-rpi-gpio - Python class to control the GPIO on a Raspberry Pi.</li>
279 <li>python-rpi-pyglow - Control Piglow from Python. Includes a custom
280 SliTaz utility to easily play with PiGlow.</li>
282 <li>pi-blaster - Enables PWM on the GPIO pins you request of a Raspberry Pi.</li>
284 <li>libmcp23s17 - A simple C library for accessing an MCP23S17 port expander
285 found on PiFace board.</li>
287 <li>libpifacedigital - A simple library for controlling PiFace Digital</li>
289 <li>(xorg-xf86-video-fbturbo) - Buggy Xorg server module for the R-Pi.</li>
290 </ul>
292 <h2 id="remote">GUI &amp; secure remote control</h2>
294 <p>
295 This section will cover remote control using the SliTaz CGI/Web admin
296 interface, SSH secure SHell connections and graphical desktop control
297 with VNC.
298 </p>
300 <h3>CGI/Web interface</h3>
302 <p>
303 The CGI/Web interface is a nice way to control your Raspberry Pi machine
304 using Dillo from the desktop or any web browser from another computer,
305 mobile or tablet device. Remote control via the CGI interface is enabled
306 by default. To stop/start the service or to use another port, please refer
307 to the SliTaz ARM Codex: <a href="system.html#cgi-adm">System page</a>
308 </p>
310 <p>
311 SliTaz Raspberry Pi provides plugins to easily handle your Pi. In a nifty
312 and clean interface you can: poweroff/reboot the system, configure boot
313 settings including blacklisted modules, set audio output and test sound,
314 play with GPIO pins and get I2C information, and turn on/off the green led :-)
315 The tool lets you do quite a few more handy actions that you will discover
316 browsing the interface.
317 </p>
319 <p>
320 First you must found out the local IP address of your Raspberry Pi machine.
321 On your SliTaz Pi you can use 'ipinfo' to get the IP, then connect using
322 this IP. To connect you must use 'root' as user name with the correct
323 system administrator password.
324 </p>
325 <pre>
326 $ ipinfo
327 </pre>
329 <h3>Secure SSH connection</h3>
330 <p>
331 By default all flavors provide Dropbear Secure SHell, a lightweight but
332 powerful and standard compliant SSH client and server. The server is
333 not started by default, you can start it manually from the cmdline or
334 edit /etc/init.d/rcS.conf to start it automatically on each boot:
335 </p>
336 <pre>
337 # startd dropbear
338 # editor /etc/rcS.conf
339 </pre>
341 <h3>VNC Desktop control</h3>
342 <p>
343 VNC is great tool for letting you remotely control a desktop. The steps are:
344 install and start the VNC server on your Pi, then install a VNC client on
345 your desktop machine, mobile phone or tablet. To install the server
346 and start it on your Raspberry Pi (via an SSH connection or with an
347 attached keyboard and screen):
348 </p>
349 <pre>
350 # spk-add x11vnc
351 # startd x11vnc
352 </pre>
354 <h2 id="setup">Pi setup suggestions</h2>
356 <p>
357 What can you do with your SliTaz Raspberry Pi distro? Use it as a tiny
358 desktop! Learn Linux, Lua, Python, SHell scripting. Play with some
359 electronics circuits, sensors, leds and Raspberry Pi pluggable boards.
360 Setup servers, use the cam for fun or security purposes, create a secure
361 wifi network, ...- So much can be done with a Pi!
362 </p>
364 <ul>
365 <li>Kids learn about computers with Scratch and games</li>
366 <li>Web server with SHell and Python CGI support</li>
367 <li>Secure and anonymous wifi network with Tor</li>
368 <li>Development system including a wide range of tools</li>
369 <li>Electronic circuits playground with breadboards</li>
370 <li>Security camera with infra red support</li>
371 <li>Audio player and streamer with MPD</li>
372 <li>Video player with MPlayer or gst-omx (provides hardware
373 accelerated decoding on the Raspberry Pi)</li>
374 <li>Video streamer with gst-omx or ffserver</li>
375 <li><a href="setup.html">Codex setup guides</a></li>
376 </ul>
378 <h2 id="desktop">Desktop customization</h2>
380 <p>
381 Your SliTaz Raspberry Pi Desktop can be customized to infinity! With
382 a little editing of configuration files and autostart scripts you can
383 configure the entire environment. The default window manager is
384 JWM, but it can be replaced by OpenBox, Enlightenment (e17) or the
385 DWM dynamic window manager.
386 </p>
388 <p>
389 JWM autostarted applications and themes are set in a xml.jwmrc file.
390 By default the system wide config is used, lets copy it to your home
391 folder as a .jwmrc hidden file and then edit it:
392 </p>
393 <pre>
394 $ cp /etc/xdg/jwm/system.jwmrc ~/.jwmrc
395 $ editor .jwmrc
396 </pre>
397 <p>
398 The system wide menu path is: <b>/etc/xdg/jwm/menus.jwmrc</b> and
399 is updated by SliTaz packages manager. You can also copy it to
400 your home folder if you want to customize it. See the official
401 <a href="http://joewing.net/projects/jwm/config.shtml">configuration documentation</a>
402 for comprehensive documentation on configuring JWM.
403 </p>
405 <h3>Icon bar &amp; panel</h3>
406 <p>
407 To have a transparent icon bar with the applications of your choice,
408 you can use Wbar2. Install it and test it:
409 </p>
410 <pre>
411 $ sudo spk-add wbar2
412 $ wbar
413 </pre>
414 <p>
415 To have a desktop panel with Openbox you can use Tint2. Install it
416 and test it:
417 </p>
418 <pre>
419 $ sudo spk-add tint2
420 $ tint2
421 </pre>
423 <h2 id="gpio">GPIO Pins &amp; I2C Bus</h2>
425 <p>
426 SliTaz provides all the necessary tools to work with the Raspberry Pi
427 GPIO pins and I2C bus. The CGI/Web admin interface lets you control
428 the GPIO pins and get I2C information. Pi I2C kernel module is
429 blacklisted by default and can be loaded manually, by on-demand scripts
430 or at boot by commenting the blacklist line in:
431 </p>
432 <pre class="box-up">
433 /etc/modprobe.d/rpi-blacklist.conf
434 </pre>
436 <p>
437 To have a full working I2C bus system we must also load the 'i2c-dev'
438 kernel module which is not autoloaded by udev. In this case we must
439 use a SliTaz boot time configuration file, lets edit the config file
440 to modify the line LOAD_MODULES to look like below:
441 </p>
443 <pre>
444 $ editor /etc/rcS.conf
445 # Kernel modules to load earlier in boot.
446 LOAD_MODULES="snd-bcm2835 i2c-dev"
447 </pre>
449 <h2 id="pileds">Using leds with the RPi</h2>
451 <p>
452 Leds can be used for many purposes such as for a notification or as a light show.
453 SliTaz Raspberry Pi provides a built-in utility to help set up and
454 use leds. The RPi has an onboard green led (ACT) that you can
455 turn on or off:
456 </p>
457 <pre>
458 # pileds act
459 </pre>
461 <p>
462 Pileds also provides examples and usable commands for Adafruit 7segment
463 LED Backpack and the 8x8 LED Matrix. Creating visual elements with
464 Kids is fun and lets them learn mathematics at the same time, since
465 the leds must be mapped (ie: 0, 3) on a grid. Let's display a nice
466 little boat and pileds built in help:
467 </p>
469 <pre>
470 # pileds 8x8 --boat
471 # pileds help
472 </pre>
474 <p>
475 PiLeds uses some example code from Adafruit and PiClass Git Hub
476 repositories. We have packaged them for easy install/updates and
477 to provide some code right under the hood. Adafruit and PiClass
478 code examples are located in:
479 </p>
481 <pre class="box-up">
482 /usr/share/adafruit
483 /usr/share/piclass
484 </pre>
486 <h2 id="picam">Pi Camera - Pi NoIR</h2>
488 <p>
489 Raspberry Pi onboard camera works flawlessly with SliTaz. You can
490 setup then shot, record and stream video with our easy to use and
491 home made tools and the official VideoCore Tools from The Raspberry Pi
492 foundation. Official documentation can be found on elinux.org wiki:
493 <a href="http://elinux.org/Rpi_Camera_Module">Rpi Camera Module</a>
494 </p>
496 <p>
497 To setup your camera from your Pi device, you can run TazBerry from
498 the desktop menu or directly start the cam setup from a cmdline:
499 </p>
500 <pre>
501 # tazberry cam-setup
502 </pre>
504 <p>
505 After reboot you can test the camera with 'raspivid' and take a picture
506 via the CGI/Web Camera plugin. To test the camera:
507 </p>
508 <pre>
509 # raspivid -d
510 </pre>
512 <h2 id="piglow">PiGlow from Pimorini</h2>
514 <p>
515 PiGlow is a fun and cheap little board to learn and play with leds. It
516 can do very nice effects and also supports easy on/off switches and brightness
517 settings. Plug in your PiGlow board, boot your Raspberry Pi, install the Python
518 PyGlow examples and utilities testsuite:
519 </p>
521 <pre>
522 # spk-add python-rpi-pyglow
523 # pyglow test
524 # pyglow help
525 </pre>
527 <p>
528 In the package database you will also find <b>wiringpi-piglow</b>
529 providing the 'piglow' utility. On the Python side, we provide some
530 examples that you can use to learn and code your own scripts. Have
531 a look in the folder:
532 </p>
534 <pre class="box-up">
535 /usr/share/pyglow
536 </pre>
538 <h2 id="piface">PiFace Digital</h2>
540 <p>
541 The PiFace Digital board allows you to connect things like switches,
542 lights and motors so your Raspberry Pi becomes aware of, and can
543 influence the world around it. Plugin your PiFace board then install
544 the official C library including the 'pifacedigital' utility and
545 testsuite:
546 </p>
548 <pre>
549 # spk-add libpifacedigital
550 </pre>
552 <p>
553 To test your Piface Digital board on SliTaz Raspberry Pi you simply
554 have to run the testsuite from the cmdline. The tool will test GPIO
555 pns, leds and input button:
556 </p>
558 <pre>
559 # pifacedigital-test
560 </pre>
562 <p>
563 PiFace official website:
564 <a href="http://www.piface.org.uk/">www.piface.org.uk</a>
565 and <a href="http://www.piface.org.uk/guides/">guides</a>
566 </p>
568 <!-- Close content -->
569 </div>
571 <div id="footer">
572 &copy; 2014 - <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
573 </div>
575 </body>
576 </html>