raspberry

14
RASPBERY PI 1. Hardware 1.1. De qué está hecha la Raspberry Pi 1.1.1. SoC Un SoC (system o chip) es un integrado que incorpora todos los componentes del sistema. En el caso de la Raspi, lleva un Broadcom BCM2835 que incluye: el procesador (ARM1176JZF-S), la tarjeta gráfica con aceleración gráfica 3D y de video en alta definición, 512 Mb de RAM, tarjeta de sonido estéreo y bus USB. 1.1.2. Tarjeta de red Conector RJ-45 conectado a un integrado lan9512 -jzx de SMSC que proporciona conectividad a 10/100 Mbps además de buses USB 2.0. 1.1.3. Conexiones · Dos buses USB · Puerto ethernet RJ-45 · Salida analógica de audio estereo por jack de 3.5 mm. · Salida digital de video + audio HDMI · Salida analógica de video RCA · Pines de entrada y salida de propósito general 1.2. Elementos para usar Raspberry pi Como mínimo para dejar la placa funcionando es necesario: · Placa Raspberry Pi · Tarjeta SD de al menos 4 Gb · Adaptador de alimentación USB · Cable micro-USB Para instalar el sistema operativo además necesitamos · Ordenador · Lector de tarjetas SD Para poder conectar dispositivos USB (discos duros, teclado, ratón) necesitamos: · Hub USB alimentado Para poder conectar la placa a una pantalla necesitamos: · Cable HDMI o bien adaptador activo de HDMI a VGA

Upload: alejandro-hincapie-correa

Post on 21-Oct-2015

32 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Raspberry

RASPBERY PI

1. Hardware1.1. De qué está hecha la Raspberry Pi

1.1.1. SoC

Un SoC (system o chip) es un integrado que incorpora todos los componentes del sistema. En el caso de la Raspi, lleva un Broadcom BCM2835 que incluye: el procesador (ARM1176JZF-S), la tarjeta gráfica con aceleración gráfica 3D y de video en alta definición, 512 Mb de RAM, tarjeta de sonido estéreo y bus USB.

1.1.2. Tarjeta de redConector RJ-45 conectado a un integrado lan9512 -jzx de SMSC que proporciona conectividad a 10/100 Mbps además de buses USB 2.0.

1.1.3. Conexiones

· Dos buses USB· Puerto ethernet RJ-45· Salida analógica de audio estereo por jack de 3.5 mm.

· Salida digital de video + audio HDMI· Salida analógica de video RCA· Pines de entrada y salida de propósito general

1.2. Elementos para usar Raspberry piComo mínimo para dejar la placa funcionando es necesario:· Placa Raspberry Pi· Tarjeta SD de al menos 4 Gb· Adaptador de alimentación USB· Cable micro-USBPara instalar el sistema operativo además necesitamos· Ordenador· Lector de tarjetas SDPara poder conectar dispositivos USB (discos duros, teclado, ratón) necesitamos:· Hub USB alimentadoPara poder conectar la placa a una pantalla necesitamos:· Cable HDMI o bien adaptador activo de HDMI a VGA

2. Instalación y configuración de Raspberry Pi

2.1. Instalación de RaspbianPara la instalación del sistema operativo a la tarjeta SD de Raspi usando Windows. No se va a tratar de una instalación al uso, sino de introducir una imagen en la tarjeta de memoria. Primer paso es dirigirse a la web de descargas de Raspberry-Pi (http://www.raspberrypi.org/downloads) y descargar una imagen del sistema operativo.

Page 2: Raspberry

El archivo pesa cerca de 500 mb. Una vez descargado, se extrae su contenido (un archivo .img) a cualquier carpeta.

El segundo paso es descarga Win32 Disk Imager (http://sourceforge.net/projects/win32diskimager/files/latest/download), una utilidad que permitirá meter la imagen de Raspbian en la tarjeta SD. Se abre el archivo y se extrae su contenido a cualquier carpeta. Finalmente se ejecuta Win32DiskImager

Introducimos la tarjeta SD en el lector de tarjetas del ordenador, se selecciona la imagen que se ha extraído anteriormente y se hace clic en “Write”.

Una vez copiada la imagen, se introduce la tarjeta SD en la Raspberry pi

Page 3: Raspberry

3. Raspberry Pi como placa de prototipos electrónicosEl SoC Broadcom BCM2835 dispone de numerosos pines de entrada/salida de propósito general (GPIO) que proveen de un puerto SPI (puerto serie), un puerto I²C, salidas PWM y salidas/entradas digitales.

Estos pines permitiran comunicación con otros dispositivos TTL de forma directa como puede ser Arduino y microcontroladores varios sin contar que sobre ellos se pueden conectar dispositivos directamente Como LEDs, transistores, relés, etc.

Page 4: Raspberry
Page 5: Raspberry

4. SISTEMA OPERATIVOS

4.1 Arch Linux

Es una distribución Linux para computadoras i686 y x86-64.3 Se compone fundamentalmente de software libre y de código abierto,4 y apoya la participación comunitaria.5 El enfoque de diseño se centra en la simplicidad, la elegancia, la coherencia de código y el minimalismo. Arch Linux define simplicidad como «...una ligera estructura base sin agregados innecesarios, modificaciones, o complicaciones, que permite a un usuario individual modelar el sistema de acuerdo a sus propias necesidades». La simplicidad de su estructura no implica sencillez en su manejo.6

Inspirado por CRUX, otra distribución minimalista, Judd Vinet creó Arch Linux en marzo de 2002. Arch Linux utiliza un modelo de rolling release, de tal manera que una actualización regular del sistema operativo es todo lo que se necesita para obtener la última versión del software; las imágenes de instalación son simplemente «capturas» de los principales componentes del sistema.

4.2 Raspbmc

Raspbmc is a minimal Linux distribution based on Debian that brings XBMC to your Raspberry Pi. This device has an excellent form factor and enough power to handle media playback, making it an ideal component in a low HTPC setup, yet delivering the same XBMC experience that can be enjoyed on much more costly platforms. Raspbmc is brought to you by the developer of the Crystalbuntu Linux Distribution, which brings XBMC and 1080p decoding to the 1st generation Apple TV.

Here’s why you might like Raspbmc

Free and open source. Supports both wired and WiFi out of the

box! Multiple languages supported No knowledge of Linux is needed. If you

want to use the Raspberry Pi as an XBMC frontend you can do exactly that with no knowledge of how anything works.

It can be installed with a few simple clicks from a Mac or a PC running Windows or Linux.

It’s auto updating, meaning you constantly get new features, performance and driver updates. You can however turn updates off at any time.

It supports 1080p playback. Share your content from your PC over

NFS, SMB, FTP and HTTP and a USB drive in almost any format.

AirPlay and AirTunes support allow you to send music and video from your iDevice to the TV.

Page 6: Raspberry

Full GPIO support! As it is a Debian system, it is completely

expansive and you can install any

packages from Debian’s massive repository!

1080p DTS decoding in software.

Can be installed to SD card, USB drive, or run off an NFS share.

Has the following services embedded: Samba server

TVHeadend server FTP server SSH server

Secure out of the box – iptables restricts network to LAN only by default.

4.3 Pidora

Pidora is a Linux software distribution for the Raspberry Pi computer. It contains software packages from the Fedora Project (specifically, the Fedora ARM secondary architecture project) compiled specifically for the ARMv6 architecture used on the Raspberry Pi, packages which have been specifically written for or modified for the Raspberry Pi, and software provided by the Raspberry Pi Foundation for device access.

4.4 Open Embedded Linux Entertainment Center (OpenELEC)

Is a small Linux distribution built from scratch as a platform to turn your computer into an XBMC media center. OpenELEC is designed to make your system boot fast, and the install is so easy that anyone can turn a blank PC into a media machine in less than 15 minutes.

It's completely free

A full install is only 80-125MB

Minimal hardware requirements

Simple install to HDD, SSD, Compact Flash, SD card, pen drive or other

Optimized builds for Atom, ION, Intel, Fusion and more

Simple configuration through the XBMC interface

Plug and Play external storage

File sharing out of the box

4.5 Raspbian

Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.

4.6 Risc OS

Page 7: Raspberry

El sistema operativo RiscOS fue creado para la plataforma Acorn, una serie de ordenadores del reino Unido, en dichos países que conforman el reino unido y en parte de Alemania albergó, un creciente éxito.El gran auge de esta plataforma fue contemporáneo al uso mayoritario de ordenadores ATARI y Amiga. Lo que perduró fue cuando separaron el procesador ARM de su arquitectura para usarlo en todo tipo de sistemas electrónicos, no sin antes solucionar un gran problema y es que tenía únicamente un bus de direcciones d 26 bits, lo que hacía que los sistemas puros de 32bits tuvieran grandes problemas con las aplicaciones escritas, este tipo de problemas empezaron a desaparecer con la famlia strongARM, de la cual Digital y luego Intel fueron parte activa en la vida de ARM. Pero ahora se ha reeditado el sistema operativo y se ha hecho libre, además de que en la versión 5 del mismo y con pequeñas aplicaciones se puede disfrutar de todo el elenco de aplicaciones del que dispone este sistema operativo, del cual podemos asegurar que es un sistema liviano y realmente maduro. Se puede afirmar que ARM nació en riscos, y fue adaptándose a las necesidades que requería el sistema operativo, pero separarse de su plataforma original ha sido sin dar lugar a ninguna duda, la mejor decisión de ARM, y ARM aparece en escena cuando intentan licenciar parte del desarrollo del 286 e Intel les contesta que, Soy una empresa que vende chips, no desarrollos de los mismos, y menos aún parte de dichos desarrollos.

Al ser contemporáneos de ATARI y Amiga, también entró en el sector del mercado de la edición de video, hablamos de la plataforma Acorn.

Raspberry and ROS

Now just so that you are not confused about the potentials of the Raspberry Pi as a robotic

processor/controller, it has great potential for small computation and can run Linux and all the great features

that come along with it. But this is a Arm processor and not a typical PC cpu so it is limited by

its architecture and power capabilities. Some portions of Linux code have not been completely ported to ARM

processors so you will be limited at the moment to what programs you can install. But for most of ROS and

the programs I am going to cover in this tutorial, Pi is functional and can be useful depending on the demands

Page 8: Raspberry

of your project. But if you are planning to do any 3d/2d mapping/navigation with a Kinect/laser scanner at the

moment I am not sure its possible utilizing just the Raspberry Pi but with time who knows. In the future I will

also include another tutorial that connects the Raspberry Pi to a small robot to act as controller. So lets begin.. 

Step 1: Parts list

We are going to need the following items :

Raspberry Pi

http://www.zagrosrobotics.com/shop/item.aspx?itemid=895

Micro USB power supply 

USB keyboard and mouse

HDMI cable

Monitor with HDMI input

SD Card with at least 8GB    (Check this list of compatible cards )

And a computer with either Windows or Linux installed

Step 2: Writing the image to the SD card

Page 9: Raspberry

Now there are a couple of different ways to get Linux and ROS working on Raspberry PI. One way is to write

the Linux image to the SD card then download and install ROS form within the Raspberry Pi. This can

become difficult and time consuming for the beginner, but it is useful when creating a custom ROS

installation. These steps can be found here on the ROS WIKI

 Rosberry Pi 

However we are going to be using a Linux image that has ROS  pre-installed. Thanks to Jeremy Nicola

for providing the image in the form of a zip file which can be found here

 Rosberry PI Image

And in order to get our Linux image on to the SD Card we are going to use Image Writer for Windows, which

can be downloaded here 

https://launchpad.net/win32-image-writer

FOR WINDOWS :

Insert the SD card into your SD card reader, then locate and remember what drive letter the SD card was

assigned. 

Format the card and make sure there is only one partition (FAT32 is a good choice), otherwise

Win32DiskImager can corrupt your SD card!

Extract the Raspbian-ROS-full.img.7z file somewhere.

Install and run Win32DiskImager utility as Administrator. 

Select the Raspbian-ROS-full.img image file 

Page 10: Raspberry

Select the drive letter of the SD card in the device box. Make sure you select the correct drive, if you select

the wrong drive you can corrupt your data on that assigned drive.

Click Write and wait for the write to complete.

Exit the program and eject the SD card.

If all goes well you should have a bootable image on your SD card.

FOR LINUX :

Use DD in the terminal to write the image to the SD card

extract  Raspbian-ROS-full.img.7z 

copy and paste this after replacing the correct paths to your SD card and Raspberry Pi image

sudo dd if=/path/to/Download/img/file of=/path/to/SDcard

example 

sudo dd if=/home/username/Downloads/Raspbian-ROS-full.img of=/dev/sdc

 

Wait for the command to return. This may take some time so be patient .If all goes well you should have a

bootable image on your SD card.

Step 3: Starting our Rosberry for the first time

Insert the SD card into the Raspberry Pi's card slot. Connect the Raspberry PI to the HDMI monitor,

keyboard, mouse and power supply. Before you can get into the desktop screen you will have to enter your

username and password  

Username: pi

Page 11: Raspberry

Password: raspberry

And once Linux has booted to the desktop open a terminal screen [ Ctrl + Alt + t ] and enter the following :

roscore 

The roscore is now running and we are now ready to start the tutorials.

 

If you want some background on ROS commands and Syntax look to this Cheat Sheet for help.

or the ROS Start Guide .

Step 4: ROS tutorials

We are going to go over how to publish a message to the roscore then subscribe to that message. This concept

is the basics behind the ROS system which gives us a dynamic way to publish/receive data to control our

robot projects and get data from them. 

With roscore running in one terminal open another terminal and copy and paste

rosrun  roscpp_tutorials talker

This should start publishing something like this

Page 12: Raspberry

[ INFO] [1358365440.794845809]: hello world 0

[ INFO] [1358365440.895024702]: hello world 1

[ INFO] [1358365440.995006238]: hello world 2

[ INFO] [1358365441.095000473]: hello world 3

[ INFO] [1358365441.195000082]: hello world 4

Then open another terminal and copy and paste 

rosrun  roscpp_tutorials listener

This should output the same data that the first terminal is displaying

Now lets get an idea of what is happening inside the roscore by using rxgraph to display the nodes

and messages that are running in our system. Open a new terminal then copy and paste 

rxgraph

Now you should see the running nodes and their respective messages with arrows to point out there output

orientation, if you select all topics in the window you can see all the topics that are published and subscribed

within the roscore. 

For more ROS tutorials check out the ROS Tutorials page.