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

Add leds usage in PiBook
author Christophe Lincoln <pankso@slitaz.org>
date Wed May 07 12:29:42 2014 +0200 (2014-05-07)
parents 89bcc2590e5b
children 2b098709d749
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="#picam">Pi Camera - Pi NoIR</a></li>
62 <li><a href="#piglow">PiGlow from Pimorini</a></li>
63 <li><a href="#pileds">Using leds with the RPi</a></li>
64 </ul>
66 <p>
67 The Pibook is complemented by the general documentation found in the
68 <a href="./.">SliTaz ARM Codex</a>.
69 </p>
71 <h2 id="install">Installation instructions</h2>
73 <pre class="box-up">
74 boot/ : Must be copied to a FAT32 partition
75 rootfs/ : Must be copied to an ext4 or btrfs partition
76 </pre>
78 <p>
79 Be sure the SD card has got 3 partitions (boot, swap, root). The
80 recommended partition sizes are 40Mb for /boot, 420Mb for swap and
81 using all available free space for root. Then you simply have to
82 run the install.sh script from the SliTaz Raspberry Pi release
83 directory:
84 </p>
85 <pre>
86 # ./install.sh
87 </pre>
89 <h2 id="firstboot">First boot setup</h2>
91 <p>
92 On the first SliTaz Raspberry Pi boot you will be prompted to configure
93 basic system settings such as the system keymap and the root password.
94 Then you will be prompted to create the default user with its password.
95 </p>
96 <p>
97 On any secure GNU/Linux system you will have to have at least the administrator
98 (root) and the default human user. In this way, users can fully use
99 the system but can't break it.
100 </p>
101 <p>
102 You can preconfigure the system before the first boot by editing the
103 configurations on the SD card and you can skip the post installation
104 steps. More info on the SliTaz ARM Codex:
105 <a href="system.html#firstboot">System configs</a>
106 </p>
108 <h2 id="config">System configuration</h2>
110 <p>
111 All SliTaz Raspberry Pi basic configurations can be done via a nice
112 Ncurses driven GUI with mouse support under an X session and via
113 a CGI/web administration interface. Please check the detailed
114 <a href="#remote">remote control section</a> in the book for more
115 information about the CGI/Web control panel.
116 </p>
118 <pre class="box-up">
119 tazberry : Dedicated tool for all Raspberry Pi specific configs
120 slitaz-config : Slitaz system configs such as keymaps, lang, users
121 </pre>
123 <p>
124 Tazberry and slitaz-config tool are accessible from the 'System Tools'
125 menu or can be run from a cmdline:
126 </p>
128 <pre>
129 # tazberry
130 # slitaz-config
131 </pre>
133 <h2 id="audio">Audio settings</h2>
135 <p>
136 The Raspberry Pi has two audio output modes: HDMI and headphone jack.
137 You can switch between these two modes at any time. SliTaz Raspberry Pi
138 provides a custom web admin plugin to graphically configure and check
139 audio settings locally or remotely. The web audio control lets you
140 switch audio output and play a sound to test settings. You can directly
141 access the audio control panel with a URL in the form of:
142 </p>
143 <pre>
144 http://192.168.x.xxx/adm/tools.cgi?audio
145 </pre>
146 <p>
147 You can also configure the Raspberry Pi audio output from the command
148 line where the last number is the output mode (0=auto 1=jack 2=hdmi):
149 </p>
150 <pre>
151 # amxier cset numid=3 1
152 </pre>
153 <p>
154 The desktop flavor includes Alsa audio mixer and mpg123 cmdline
155 audio player. Please check the Codex apps page for a common list of
156 <a href="apps.html#multimedia">multimedia applications</a>.
157 </p>
159 <h2 id="update">System &amp; kernel update</h2>
160 <p>
161 It is always a good idea to check for updates! It will bring you fixes
162 and new features. With SliTaz Raspberry Pi you have to upgrade all
163 the installed packages and the custom Linux Kernel. Updates can be done
164 via spk-dialog and tazberry found in the "System Tools menu" or directly
165 from a command line:
166 </p>
167 <pre>
168 # spk-dialog
169 # tazberry
170 </pre>
172 <h2 id="add-apps">Installing new packages</h2>
174 <p>
175 After your system is configured and connected to the web, you may want
176 to install new packages to add functionality to your SliTaz system.
177 You can install new applications via spk-dialog GUI or from the command
178 line with spk-add:
179 </p>
180 <pre>
181 # spk-add package package1 packageN
182 </pre>
183 <p>
184 You can find a list of packages on the SliTaz Raspberry Pi website
185 or by using the spk-find utility. You can search by package name, keyword
186 or description:
187 </p>
188 <pre>
189 # spk-find i2c
190 </pre>
192 <h2 id="def-apps">Installed applications</h2>
194 <p>
195 SliTaz Raspberry Pi can come in many flavors with a custom pre-installed
196 packages set. This section will cover the base and desktop flavors, more
197 information about a spécific flavor may be found on the SliTaz Raspberry
198 Pi website.
199 </p>
201 <h3>Base system</h3>
202 <p>
203 The base flavor provides a text mode system with cmdline only tools, all
204 Busybox applets are present. It supports wireless networks but no sound.
205 The default and most useful applications are:
206 </p>
208 <ul>
209 <li>Dropbear SSH client &amp; server</li>
210 <li>Busybox HTTPd, NTPd, FTPd servers</li>
211 <li>The CGI/Web admin interface and TazBerry</li>
212 <li>Clex file manager and Lynx web browser</li>
213 <li>TazIRC IRC client and Spk packages manager</li>
214 <li>Joe text editor and wget :-)</li>
215 </ul>
217 <h3>Desktop environment</h3>
218 <p>
219 The SliTaz Raspberry Pi desktop flavor focuses on providing a fast,
220 elegant, and easy to use desktop environment. The desktop is powered
221 by JWM window manger and you will find all the base applications plus GUI
222 programs:
223 </p>
225 <ul>
226 <li>Text editors: Adie + FLTK Editor</li>
227 <li>File manager: PathFinder</li>
228 <li>Web browser: Dillo</li>
229 <li>X terminal: Xterm</li>
230 <li>Audio mixer: Alsamixer</li>
231 <li>Audio player: mpg123</li>
232 <li>2 nice games: Blocks Attack + Sudoku</li>
233 <li>Fluid FLTK GUI designer</li>
234 <li>Lua programming language</li>
235 <li>SQLite database support</li>
236 <li>Htop processes monitor</li>
237 </ul>
239 <h2 id="pi-pkgs">Raspberry Pi Packages</h2>
241 <p>
242 Some custom tools and libraries have been packaged specially for the
243 SliTaz Raspberry Pi distribution. Here is a list of packages and
244 a short description:
245 </p>
247 <ul>
248 <li>slitaz-arm-rpi - Provides the CGI/adm plugins, tazberry and custom
249 config files.</li>
251 <li>raspberrypi-boot - Provides the R-Pi bootloader firmware.</li>
253 <li>raspberrypi-boot-x - Provides the R-Pi bootloader firmware with
254 Pi Camera support.</li>
256 <li>raspberrypi-vc -Raspberry Pi VideoCore Tools, including
257 raspistill and raspivid.</li>
259 <li>gst-omx - A gstreamer-1.0 plugin which can do hardware-accelerated
260 video decoding on the Raspberry Pi. </li>
262 <li>wiringpi - A GPIO access library written in C for the BCM2835
263 used in the Raspberry Pi.</li>
265 <li>wiringpi-piglow - The WiringPi tool for PiGlow, useful to handle
266 leds from SHell scripts.</li>
268 <li>picamera - Provides a pure Python interface to the Raspberry
269 Pi camera module.</li>
271 <li>libbcm2835 - Provides access to GPIO and other IO functions on
272 the Broadcom BCM 2835 chip.</li>
274 <li>rcswitch-pi - RCSwitch implementation for the Raspberry Pi.</li>
276 <li>python-rpi-gpio - Python class to control the GPIO on a Raspberry Pi.</li>
278 <li>python-rpi-pyglow - Control Piglow from Python. Includes a custom
279 SliTaz utility to easily play with PiGlow.</li>
281 <li>pi-blaster - Enables PWM on the GPIO pins you request of a Raspberry Pi.</li>
283 <li>(xorg-xf86-video-fbturbo) - Buggy Xorg server module for the R-Pi.</li>
284 </ul>
286 <h2 id="remote">GUI &amp; secure remote control</h2>
288 <p>
289 This section will cover remote control using the SliTaz CGI/Web admin
290 interface, SSH secure SHell connections and graphical desktop control
291 with VNC.
292 </p>
294 <h3>CGI/Web interface</h3>
296 <p>
297 The CGI/Web interface is a nice way to control your Raspberry Pi machine
298 using Dillo from the desktop or any web browser from another computer,
299 mobile or tablet device. Remote control via the CGI interface is enabled
300 by default. To stop/start the service or to use another port, please refer
301 to the SliTaz ARM Codex: <a href="system.html#cgi-adm">System page</a>
302 </p>
304 <p>
305 SliTaz Raspberry Pi provides plugins to easily handle your Pi. In a nifty
306 and clean interface you can: poweroff/reboot the system, configure boot
307 settings including blacklisted modules, set audio output and test sound,
308 play with GPIO pins and get I2C information, and turn on/off the green led :-)
309 The tool lets you do quite a few more handy actions that you will discover
310 browsing the interface.
311 </p>
313 <p>
314 First you must found out the local IP address of your Raspberry Pi machine.
315 On your SliTaz Pi you can use 'ipinfo' to get the IP, then connect using
316 this IP. To connect you must use 'root' as user name with the correct
317 system administrator password.
318 </p>
319 <pre>
320 $ ipinfo
321 </pre>
323 <h3>Secure SSH connection</h3>
324 <p>
325 By default all flavors provide Dropbear Secure SHell, a lightweight but
326 powerful and standard compliant SSH client and server. The server is
327 not started by default, you can start it manually from the cmdline or
328 edit /etc/init.d/rcS.conf to start it automatically on each boot:
329 </p>
330 <pre>
331 # startd dropbear
332 # editor /etc/rcS.conf
333 </pre>
335 <h3>VNC Desktop control</h3>
336 <p>
337 VNC is great tool for letting you remotely control a desktop. The steps are:
338 install and start the VNC server on your Pi, then install a VNC client on
339 your desktop machine, mobile phone or tablet. To install the server
340 and start it on your Raspberry Pi (via an SSH connection or with an
341 attached keyboard and screen):
342 </p>
343 <pre>
344 # spk-add x11vnc
345 # startd x11vnc
346 </pre>
348 <h2 id="setup">Pi setup suggestions</h2>
350 <p>
351 What can you do with your SliTaz Raspberry Pi distro? Use it as a tiny
352 desktop! Learn Linux, Lua, Python, SHell scripting. Play with some
353 electronics circuits, sensors, leds and Raspberry Pi pluggable boards.
354 Setup servers, use the cam for fun or security purposes, create a secure
355 wifi network, ...- So much can be done with a Pi!
356 </p>
358 <ul>
359 <li>Kids learn about computers with Scratch and games</li>
360 <li>Web server with SHell and Python CGI support</li>
361 <li>Secure and anonymous wifi network with Tor</li>
362 <li>Development system including a wide range of tools</li>
363 <li>Electronic circuits playground with breadboards</li>
364 <li>Security camera with infra red support</li>
365 <li>Audio player and streamer with MPD</li>
366 <li>Video player with MPlayer or gst-omx (provides hardware
367 accelerated decoding on the Raspberry Pi)</li>
368 <li>Video streamer with gst-omx or ffserver</li>
369 <li><a href="setup.html">Codex setup guides</a></li>
370 </ul>
372 <h2 id="desktop">Desktop customization</h2>
374 <p>
375 Your SliTaz Raspberry Pi Desktop can be customized to infinity! With
376 a little editing of configuration files and autostart scripts you can
377 configure the entire environment. The default window manager is
378 JWM, but it can be replaced by OpenBox, Enlightenment (e17) or the
379 DWM dynamic window manager.
380 </p>
382 <p>
383 JWM autostarted applications and themes are set in a xml.jwmrc file.
384 By default the system wide config is used, lets copy it to your home
385 folder as a .jwmrc hidden file and then edit it:
386 </p>
387 <pre>
388 $ cp /etc/xdg/jwm/system.jwmrc ~/.jwmrc
389 $ editor .jwmrc
390 </pre>
391 <p>
392 The system wide menu path is: <b>/etc/xdg/jwm/menus.jwmrc</b> and
393 is updated by SliTaz packages manager. You can also copy it to
394 your home folder if you want to customize it. See the official
395 <a href="http://joewing.net/projects/jwm/config.shtml">configuration documentation</a>
396 for comprehensive documentation on configuring JWM.
397 </p>
399 <h3>Icon bar &amp; panel</h3>
400 <p>
401 To have a transparent icon bar with the applications of your choice,
402 you can use Wbar2. Install it and test it:
403 </p>
404 <pre>
405 $ sudo spk-add wbar2
406 $ wbar
407 </pre>
408 <p>
409 To have a desktop panel with Openbox you can use Tint2. Install it
410 and test it:
411 </p>
412 <pre>
413 $ sudo spk-add tint2
414 $ tint2
415 </pre>
417 <h2 id="gpio">GPIO Pins &amp; I2C Bus</h2>
419 <p>
420 SliTaz provides all the necessary tools to work with the Raspberry Pi
421 GPIO pins and I2C bus. The CGI/Web admin interface lets you control
422 the GPIO pins and get I2C information. Pi I2C kernel module is
423 blacklisted by default and can be loaded manually, by on-demand scripts
424 or at boot by commenting the blacklist line in:
425 </p>
426 <pre class="box-up">
427 /etc/modprobe.d/rpi-blacklist.conf
428 </pre>
430 <p>
431 To have a full working I2C bus system we must also load the 'i2c-dev'
432 kernel module wich is not autoloaded by udev. In this cas we must
433 use SliTaz boot time configuration file, lets edit the config file
434 on modify the line LOAD_MODULES to look like below:
435 </p>
437 <pre>
438 $ editor /etc/rcS.conf
439 # Kernel modules to load earlier in boot.
440 LOAD_MODULES="snd-bcm2835 i2c-dev"
441 </pre>
443 <h2 id="picam">Pi Camera - Pi NoIR</h2>
445 <p>
446 Raspberry Pi onboard camera works flawlessly with SliTaz. You can
447 setup then shot, record and stream video with our easy to use and
448 home made tools and the official VideoCore Tools from The Raspberry Pi
449 foundation. Official documentation can be found on elinux.org wiki:
450 <a href="http://elinux.org/Rpi_Camera_Module">Rpi Camera Module</a>
451 </p>
453 <p>
454 To setup your camera from your Pi device, you can run TazBerry from
455 the desktop menu or directly start the cam setup from a cmdline:
456 </p>
457 <pre>
458 # tazberry cam-setup
459 </pre>
461 <p>
462 After reboot you can test the camera with 'raspivid' and take a picture
463 via the CGI/Web Camera plugin. To test the camera:
464 </p>
465 <pre>
466 # raspivid -d
467 </pre>
469 <h2 id="piglow">PiGlow from Pimorini</h2>
471 <p>
472 PiGlow is a fun and cheap little board to learn and play with leds. It
473 can do very nice effects and also supports easy on/off switches and brightness
474 settings. Plug in your PiGlow board, boot your Raspberry Pi, install the Python
475 PyGlow examples and utilities testsuite:
476 </p>
478 <pre>
479 # spk-add python-rpi-pyglow
480 # pyglow test
481 # pyglow help
482 </pre>
484 <p>
485 In the package database you will aslo find <b>wiringpi-piglow</b>
486 providing the 'piglow' utility. On the Python side, we provide some
487 examples that you can use to learn and code your own scripts. Have
488 a look to the folder:
489 </p>
491 <pre class="box-up">
492 /usr/share/pyglow
493 </pre>
495 <h2 id="pileds">Using leds with the RPi</h2>
497 <p>
498 leds can be used for many purpose such as notification or light show.
499 SliTaz Raspberry Pi provide a built-in utility to help setting up and
500 using leds. The RPi have on onboard green led (ACT) that you can
501 turned on or off:
502 </p>
503 <pre>
504 # pileds act
505 </pre>
507 <p>
508 Pileds also provide example and usable commands for Adafruit 7segment
509 LED Backpack and the 8x8 LED Matrix. Creating visual elements with
510 Kids is very fun and let them train mathematics in the ame sime since
511 the leds must be mapped (ie: 0, 3) on a gride. Let's display a nice
512 little boat and piled built in help:
513 </p>
515 <pre>
516 # pileds 8x8 --boat
517 # pileds help
518 </pre>
520 <p>
521 PiLeds use some example code from Adafruit and PiClass Git Hub
522 repositories. We have packaged them for easy install/update and
523 to provide some code right under the hand. Adafruit and PiClass
524 code examples are located in:
525 </p>
527 <pre class="box-up">
528 /usr/share/adafruit
529 /usr/share/piclass
530 </pre>
532 <!-- Close content -->
533 </div>
535 <div id="footer">
536 &copy; 2014 - <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
537 </div>
539 </body>
540 </html>