Diferencia entre revisiones de «Mini-PI»

De WikiRobotics
Saltar a: navegación, buscar
(Sensors to explore)
 
(No se muestran 111 ediciones intermedias de 2 usuarios)
Línea 1: Línea 1:
Introduction
 
  
 +
[[Imagen:Raspberry-pi.jpg|thumb|350px|Raspberry PI]]
  
The scope of this page is to document the "MiniSkbot-PI" HowTo.
+
== Introduction ==
  
MiniSkybot-PI is the juntion of:
+
The scope of this page is to document the '''Mini-PI''' robot.
- The simplest robot: Miniskybot
 
- Raspberry-PI: cheapest Linux PC
 
  
The intend is to build a robot, very simple, but using the Raspeberry-PI as a main processor.
+
'''Mini-PI''' stands off:
 +
*'''Mini''': The simplest robot: Miniskybot
 +
*'''PI''': Raspberry-PI: cheapest Linux PC
  
I will start writing here the steps i am following to do it. I have been so many years without building a robot, and now, i feel excited about it. During this years i have been following all Juan's publications, and i will take advantage of all of them: 3D printers, python, Skymega, ...
+
The intend is to build a robot, very simple, using 3D printer, and with the Raspeberry-PI as  main processor (CPU).
  
 +
I will start writing here the steps i am following to do it. I have been so many years without building a robot, and now, i feel excited about it. During these years i have been following all [[Juan_Gonzalez:Main | Juan's]] publications, and i will take advantage of all of them: 3D printers, python, Skymega, ...
  
I am living in California now, that is one of the reasons i am writing this in english, another, is  because i would like to present this in my son's class in the school. The knew about my background in robotics and they would like me to present something. They have a strong team in Lego Mindstorms http://mindstorms.lego.com
+
About me:  I am living in California now, that is one of the reasons i am writing this in english, another, is  because i would like to present this in my son's [http://www.mtnview.goleta.k12.ca.us school]. They knew about my background in robotics and they would like me to present something. They have a strong team in   [http://mindstorms.lego.com Lego Mindstorms]... let's see what i can do!!
  
 +
== Raspberry-PI ==
  
[[Imagen:Skybot-foto.jpg|thumb|350px|Robot Skybot]]
+
The main webs of ''Raspberry PI'' are http://www.raspberrypi.org  and  http://elinux.org/R-Pi_Hub. The board was originally developed as an educational project, and has became very popular during 2012. I recommend to read this [http://www.raspberrypi.org/about  note] from the authors.
  
 +
I decided to use it because several reasons:
 +
* It is cheap
 +
* It is well documented
 +
* It is broadly used
 +
* It has an easy hardware
 +
* It has a GPIO bus with (IO, I2C, SPI, UART), and of course USB, ETH, ...
 +
* Supports Debian Linux
  
 +
So, after having used a lot of embedded kits (TI DMVA2, DM368, Hi3516, Freescale, Versalogic, DM667, ...) i found this kit really interesting for building ''low cost robotic applications''. It took me a while to find the right moment to start, but once i did it, i was surprised about how fast and easy was to set up everything.
  
== Introducción ==
+
I bought the Raspberry-PI here:
El '''Skybot''' es un robot móvil, que se desplaza mediante dos ruedas motrices y está dotado de sensores para reaccionar ante estímulos del medio. '''Es un robot "hola mundo"'''. Está pensado para aquellos que quieren '''iniciarse en el mundo de la robótica y los microcontroladores'''. A diferencia de otros, el Skybot '''NO es un juguete'''. Su electrónica es la misma empleada en robots más avanzados tanto comerciales como de investigación. Por ello, '''a partir de este robot es muy fácil desarrollar otros más complejos'''.
+
http://www.alliedelec.com/images/products/mkt/pb/rasp/rasp.aspx
  
{| {{tablabonita}}
+
There are two models A and B. In my case i bought the B because i wanted it to have Ethernet on the board. Option A is not a bad idea, for example  if you want to have Wifi then,  instead of buying the model B that has the ETH, you can buy the model-A (cheaper) and a USB-Wifi-Dongle... The PN i got is: E1313RS2V13B1.0
| '''¿Cómo empezar en robótica?'''. Lo mejor es comenzar construyendo un robot, entenderlo y luego modificarlo. Esa es la filosofía del Skybot: Aprende con un ejemplo, modifícalo a tus necesidades.
+
 
 +
=== Loading the linux image into the SDCard ===
 +
 
 +
The first thing i did was to flash the SDcard. I followed the following links:
 +
* http://www.raspberrypi.org/downloads
 +
* http://downloads.raspberrypi.org/download.php?file=/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip
 +
* http://elinux.org/RPi_Easy_SD_Card_Setup
 +
 
 +
In my case i have used '''Whezzy''' (Debian stable release by My,2013) as the distribution (the recommended for beginners), and i followed the instructions for MacOS users, and since i am a little bit old i decided to use the command line option. I didn't try the graphical tools, but i am pretty sure that they work and are as easy as the command line method. Once i got the SDcard flashed i put it in the raspberry-PI (model B) and it booted without any problem.
 +
 
 +
These are the instructions from [http://elinux.org/RPi_Easy_SD_Card_Setup Raspberry (Using command line tools (2)]
 +
 
 +
'''Note''': Some users have [http://www.raspberrypi.org/phpBB3/search.php?keywords=extra+files&t=8226&sf=msgonly reported issues] with using Mac OS X to create SD cards. 
 +
#These commands and actions need to be performed from an account that has administrator privileges.
 +
# Download the image from a mirror or torrent
 +
#* http://www.raspberrypi.org/downloads
 +
# Verify if the the hash key is the same (optional), in the terminal run:
 +
#* '''shasum ~/Downloads/2012-12-16-wheezy-raspbian.zip'''
 +
# Extract the image:
 +
#* '''unzip ~/Downloads/2012-12-16-wheezy-raspbian.zip'''
 +
#* ''(or: just double click the zip, it will extract automatically)''
 +
# From the terminal run '''df -h'''
 +
# Connect the SD card reader with the SD card inside
 +
# Run '''df -h''' again and look for the new device that wasn't listed last time. Record the device name of the filesystem's partition, for example, '''/dev/disk3s1'''
 +
# Unmount the partition so that you will be allowed to overwrite the disk:
 +
#* '''sudo diskutil unmount /dev/disk3s1'''
 +
#* ''(or: open Disk Utility and unmount the partition of the SD card (do not eject it, or you have to reconnect it)
 +
# Using the device name of the partition work out the raw device name for the entire disk, by omitting the final "s1" and replacing "disk" with "rdisk"
 +
('''this is very important:''' you '''will''' lose all data on the hard drive on your computer if you get the wrong device name). Make sure the device name
 +
  is the name of the whole SD card as described above, not just a partition of it (for example, rdisk3, not rdisk3s1. Similarly you might have another
 +
SD drive name/number like rdisk2 or rdisk4, etc. -- recheck by using the '''df -h''' command both before & after you insert your SD card reader into
 +
your Mac if you have any doubts!):
 +
#* For example, '''/dev/disk3s1''' => '''/dev/rdisk3'''
 +
# In the terminal write the image to the card with this command, using the raw disk device name from above (read '''carefully''' the above step, to be sure you use the correct rdisk# here!):
 +
#* '''sudo dd bs=1m if=~/Downloads/2012-10-28-wheezy-raspbian/2012-12-16-wheezy-raspbian.img of=/dev/rdisk3'''
 +
#* if the above command report an error(dd: bs: illegal numeric value), please change bs=1M to bs=1m
 +
#* (note that dd will not feedback any information until there is an error or it is finished, information will show and disk will re-mount when complete. However if you are curious as to the
 +
progresss - ctrl-T (SIGINFO, the status argument of your tty) will display some en-route statistics).
 +
# After the dd command finishes, eject the card:
 +
#* '''sudo diskutil eject /dev/rdisk3'''
 +
#* ''(or: open Disk Utility and eject the SD card)''
 +
# Insert it in the Raspberry Pi, and have fun
 +
 
 +
 
 +
The first think i saw was the '''raspi-config''' tool. The first time i didn't change anything, but once i finish investigating the X-options, i decided to turn off the X-Windows. I am going to run console programs and i will use ssh to connect with the raspberry-PI. In other words, there is no need to have it running now.
 +
 
 +
=== Connecting the RaspberryPI ===
 +
 
 +
==== Power Input ====
 +
 
 +
Raspberry PI (model B) works with 5VDC / 700mA. There are two ways to powering the board:
 +
* Using the power in ''micro-usb'' connector, or
 +
* Using the GPIO Bus (P1). Pins2 and 4 are directly  connected to the +5VDC line.
 +
 +
It has some protections in the main power line to prevent damages, but, since the 5VDC is also used in the HDMI, USB, etc... by adding a different voltage than 5VDC you never know if something else will break. That is why the recommendation is to stay with 5DV. 
 +
 
 +
 
 +
The power input connector is a micro-usb connector. For me this is not the best in robotics, however, it is very common in computer, mobiles, that makes not difficult to find  a power kit. And the design has been well thought and they still offer the GPIO as a solution, so i am glad to see that they thought in this as well. We will use the GPIO power input later in our robot, but now, let's use the simplest:
 +
 
 +
I am using the typical micro-usb to usb cable, and the Mean Well (GS05U-USB) Power supply. It has these capabilities:
 +
* Input: 100-240VAC, 50/60Hz, 0.15A
 +
* Output: 5VDC,  1A, 5.0 W MAX
 +
 
 +
These ratings are quite standard, for example iPhone, Samsung Galaxy use the same.
 +
 
 +
==== First Boot (Interfaces) ====
 +
When booting it for the first time, I recommend to use a
 +
* USB-Mouse
 +
* USB-Keyboard
 +
* HDMI output (If you don't an HDMI input in your TV/Monitor you can use the old RCA, however it doesn't give you the best)
 +
* Standard power supply that has 5VDC and 1A.
 +
 
 +
(Default login: Username: pi ,  Password: raspberry)
 +
 
 +
It will give you a mini PC, your keyboard, graphical interface, mouse. You can play and learn about it.
 +
For example, try to connect and Ethernet cable, discover the IP, do an SSH from another PC
 +
Basically, become familiar with it. As authors said: Have Fun!!!
 +
 
 +
==== Later configuration (Interfaces) ====
 +
Mini-PI robot is not going to use the graphical interface, so even if it doesn't take too long to boot, i decided to disable it. I ran the '''rasp-config''' as sudo and in boot options i seleceted "Disable graphical interface'. Then i disconnected all the cables, because from now on, i am accessing the system using SSH. The idea is not even use the Ethernet, i will add a Bluetooth module in the serial port, or another USB-Wifi to make it ''Wireless''. We will see this later on this article.
 +
 
 +
== Connecting Sensors ==
 +
 
 +
Well, now that i have the CPU up and running, i am going to start adding the sensors and motors.<br>
 +
Before starting, let's go to take a look to the RPI's [http://elinux.org/RPi_Low-level_peripherals hardware].
 +
 
 +
The most important note from creator is the following:
 +
 
 +
{| class="wikitable"
 +
|
 +
The GPIO (general purpose I/O) signals on the 2x13 header pins include SPI, I2C, serial UART, 3V3 and 5V power. These interfaces are not "plug and play" and require care to avoid miswiring. '''The pins use a 3V3 logic level and are not tolerant of 5V levels''', such as you might find on a 5V powered Arduino.
 
|}
 
|}
  
== Demostraciones con el Skybot ==
+
'''P1 Header Pinout'''  [http://elinux.org/RPi_Low-level_peripherals This a copy from RPI information]
El Skybot puede funcionar en modo autónomo ejecutando el software que está grabado en el microcontrolador o bien estar tele-controlado desde un PC.
 
  
=== Robot en modo autónomo ===
 
La aplicación típica es la de hacer que el robot siga una línea negra sobre un fondo blanco. Los sensores que lleva en la parte frontel le permiten distinguir los colores blanco y negro.
 
 
{| {{Tablabonita}}
 
{| {{Tablabonita}}
| <youtube>aZykkdvh2Bg|300|250</youtube>
+
| [[Imagen:GPIOs.png]]
El robot Skybot siguiendo una línea negra <br>
+
P1  Top View description
([http://www.youtube.com/watch?v=aZykkdvh2Bg Vídeo])
+
|| [[Imagen:RPi_P1_header.png]]
||
+
P1  Top View Layout
  [[Imagen:Skybot-siguelineas.jpg|thumb|300px]]
 
 
|}
 
|}
  
=== Robot Tele-controlado desde el PC ===
+
=== My assignment ===
El robot se conecta al ordenador por un cable serie y podemos hacer programas que lo tele-controlen. El cable se puede sustituir por un enlace Bluetooth. Una aplicación muy divertida es mover el robot con el mando de la wii.
+
* '''Serial Port'''
 +
{| {{Tablabonita}}
 +
|| RPi P1 || Signal || BCM pin
 +
|-
 +
|| pin6 ||  GND ||
 +
|-
 +
|| pin 8 || TXD || GPIO14
 +
|-
 +
|| pin 10 ||  RXD || GPIO15
 +
|}
  
 +
 +
* '''SPI'''
 
{| {{Tablabonita}}
 
{| {{Tablabonita}}
| <youtube>wQRc7OihJFE|300|250</youtube>
+
|| RPi P1 || Signal || BCM pin
Moviendo el skybot con [[Tarri-wheel]]!
+
|-
||  
+
|| pin19 ||  MOSI || GPIO10
<youtube>UTfLc-VckHw|300|250</youtube>
+
|-
Moviendo el Skybot con el mando de la wii...<br>
+
|| pin 21 || MISO || GPIO9
...al estilo "minority report" :-)
+
|-
 +
|| pin 23 ||  SCLK || GPIO11
 +
|-
 +
|| pin 24 ||  CE0 || GPIO8
 +
|-
 +
|| pin 25 || GND ||
 +
|-
 +
|| pin 26 ||  CE1 || GPIO7
 
|}
 
|}
  
== Características ==
 
[[Imagen:Skybot-partes.jpg|thumb|400px|Diferentes partes del Skybot]]
 
  
 +
* '''I2C'''
 
{| {{Tablabonita}}
 
{| {{Tablabonita}}
|
+
|| RPi P1 || Signal || BCM pin
* '''Robot Abierto'''. Toda la información está disponible y se conceden permisos para su estudio, modificación y distribución. El software para su utilización es libre.
+
|-
* '''Multiplataforma''': Linux/Windows/Mac
+
|| pin 3 || SDA || GPIO0
* '''Estructura mecánica''': Piezas de metacrilato de 3mm pegadas
+
|-
* '''Dos ruedas motrices''': Actuadas por servos Futaba 3003 trucados para girar 360 grados
+
|| pin 5 || SCL || GPIO1
* '''Sensores''':
+
|-
** Hasta 4 '''sensores de infrarrojos CNY70''' para detectar superficies blancas/negras,
+
|| pin 9 ||  GND ||
** Hasta 6 '''sensores de contacto''' (bumpers)
 
** 1 '''sensor de luz''' (ampliable)
 
** 1 '''relé'''
 
* '''Dimensiones''': 16 x 11 x 10 cm. aprox. (largo)x(ancho)x(alto)
 
* '''Microprocesador''': PIC16F876A ([[Skypic|Tarjeta Skypic]])
 
* '''Etapa de potencia''': Chip 293 ([http://www.iearobotics.com/proyectos/sky293/sky293.html Tarjeta Sky293])
 
* '''Alimentación''': Entre 4.5-6v. Se usan 4 pilas de tipo AA. Opcionalmente se puede utilizar una alimentación separada para los motores, comprendida entre 4-12 voltios. (Por ejemplo una pila de 9v). Con ello se consigue más velocidad.
 
 
|}
 
|}
  
== Mecánica ==
 
La estructura mecánica está compuesta por '''7 piezas de metacrilato''' de 3mm, dos '''servos Futaba 3003 trucados''' y una '''rueda loca'''. Es una estructura '''fácilmente replicable''' y se pueden emplear materiales como madera, PVC expandido, aluminio, etc. Las piezas se unen mediante pegamento y los motores se sujetan mediante tornillos normales de métrica 4. '''Tanto la tornillería como la rueda loca se encuentran en cualquier ferretería'''.
 
  
 +
* '''8 bits port'''
 
{| {{Tablabonita}}
 
{| {{Tablabonita}}
| [[Imagen:Skybot-mecanica-superior.jpg]]
+
|| RPi P1 || Signal || BCM pin
Chásis del Skybot. Vista superior
+
|-
|| [[Imagen:Skybot-mecanica-inferior.jpg]]
+
|| pin 11 || IO 0 || GPIO17
Chásis del Skybot. Vista inferior
+
|-
 +
|| pin 12 || IO 1 || GPIO18
 +
|-
 +
|| pin 13 || IO 2 || GPIO21
 +
|-
 +
|| pin 15 || IO 3 || GPIO22
 +
|-
 +
|| pin 16 || IO 4 ||  GPIO23
 +
|-
 +
|| pin 18 || IO 5 || GPIO24
 +
|-
 +
|| pin 22 || IO 6 || GPIO25
 +
|-
 +
|| pin 7 || IO 7 || GPIO4
 
|}
 
|}
  
Esta estructura ha sido diseñada por [[Andrés Prieto-Moreno]]
+
=== Sensors to explore ===
 +
* Done: Ultrasonic (I2C)
 +
* Not available : Inclinometer (Analog)
 +
* Done: Compas (I2C)
 +
 
 +
Motors
 +
* Futaba S3003
 +
* Robbe
 +
* Hittec
 +
 
 +
Output
 +
* Done: Display: 2C, 16*4 lines
 +
* Done : [http://openmicros.org/index.php/articles/94-ciseco-product-documentation/raspberry-pi/217-getting-started-with-raspberry-pi-gpio-and-python#2 LED]
 +
* Done : Relay
 +
* Done : TTL3v3 to Bluetooth link.
 +
 
 +
Input
 +
* Done : Switch
 +
 
 +
Almost all these sensors and actuators can be connected directly to the Raspberry-Pi, however, since it has an I2C bus, i want to explore connecting the Skymega as well. By doing this, i could have some others sensors connected using the A/D, and i could take advantage of using a micro for some tasks. It is too early to make decisions, now is time to explore everything.
 +
 
 +
=== Connecting the Serial Port ===
 +
 
 +
I was looking into all my old robotic's stuff from Spain and i found this cable:
 +
 
 +
* FTDI: TTL-232R-3V3 (USB cable with 6 way 0.1" pitch single inline connector with +3.3V signaling).  [http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf  Datasheet]
  
== Electrónica ==
+
The cable comes with a 6 pins connector (GND, CTS, VCC, TXD, RXD, RTS), but i only need three of them (GND, TXD, RXD) so i will put my own connector with only three wires. See the table below, to see ''my final pin out'' assignment.
El Skybot utiliza las tarjetas [[Skypic]] como procesadora y [http://www.iearobotics.com/proyectos/sky293/sky293.html Sky293] para los sensores y la etapa de potencia. Ambas se unen formando una torre, colocándose encima del chásis.
 
  
{| {{Tablabonita}}
+
{| border="1" style="text-align:center;"
| [[Imagen:Skypic-sky293.jpg|thumb|300px|Tarjetas Skypic y Sky293]]
+
| bgcolor="yellow"  | '''RPI P1 Pin Number''' || bgcolor="yellow" |  '''Description''' || bgcolor="orange" | '''FTDI Pin Number''' || bgcolor="orange" | ''' Description''' || bgcolor="lime" | '''My 3wires connector''' || bgcolor="lime" | '''Description''' ||  '''Notes'''
|| [[Imagen:Skypic-sky293-torre.jpg|thumb|300px|Tarjetas Skypic y Sky293 conectadas en torre]]
+
|-
 +
| bgcolor="yellow" | P1-06  || bgcolor="yellow" | GND || bgcolor="orange" | Pin1 (Black) || bgcolor="orange" | GND || bgcolor="lime" | Pin 1 (Black) || bgcolor="lime" | GND
 +
|-
 +
| bgcolor="yellow" | P1-08 || bgcolor="yellow" | TXD  || bgcolor="orange" | Pin 5 (Yellow) || bgcolor="orange" | RXD ||  bgcolor="lime" | Pin 2 (Yellow) || bgcolor="lime" | RXD || TTL 3.3v signal
 +
|-
 +
| bgcolor="yellow"  | P1-10 || bgcolor="yellow" | RXD  || bgcolor="orange" | Pin 4 (Orange) || bgcolor="orange" | TXD ||  bgcolor="lime" | Pin 3 (Orange) || bgcolor="lime" | TXD || TTL 3.3v signal
 
|}
 
|}
  
La electrónica es genérica e independiente de la estructura mecánica. Esto ofrece tres ventajas:
 
* '''Reutilización'''. La electrónica se puede emplear en otros diseños, bien para nuevos robots o bien para otras aplicaciones. Por ejemplos, el robot cuadrúpedo [[PuchoBot II]] o el robot gusano [[Cube Revolutions]] utilizan la [[Skypic]] como controladora.
 
* '''Usar otra electrónica'''. Sobre la estructura del Skybot podemos colocar otra electrónica diferente, como por ejemplo una diseñada por nosotros.
 
* '''Usar otra estructura'''. La estructura del skybot se puede cambiar por otra, usándo la misma electrónica. Por ejemplo hacer un chásis de aluminio y usar unos motores más potentes. Por ejemplo se ha usado para construir el primer prototipo del [[Robot_FlatBot]].
 
<br>
 
=== Enlace directo a los esquemas electricos ===
 
{|
 
|-------------
 
|style="width:48px;"|{{Click || image=icono_man.png | link=Skypic:Planos | width=48px | height=48px }}
 
|'''[[Skypic:Planos|Skypic Planos]]''' <br/>  Esquemático, PCB y ficheros de fabricación
 
|-------------
 
|style="width:48px;"|{{Click || image=icono_man.png | link=Skypic:Planos | width=48px | height=48px }}
 
|'''[http://www.iearobotics.com/proyectos/sky293/sky293.html#download Sky293 Planos]''' <br/>  Esquemático, PCB y ficheros de fabricación
 
|}
 
  
== Software ==
+
So, now the only thing we need is to modify the connector and connect it to P1 to see what happens...
[[Imagen:Multiplatform.png|thumb|300px]]
+
 
La [[Skypic|tarjeta Skypic]] lleva un microprocesador '''PIC16F876A'''. Existen muchas aplicaciones para la programación de los [http://en.wikipedia.org/wiki/PIC_microcontroller PIC], como o el [http://en.wikipedia.org/wiki/MPLAB MPLAB] de Microchip o el [http://www.ic-prog.com/index1.htm ICPROG], de un programador independiente. Todas ellas se pueden utilizar con el Skybot. Sin embargo, hemos seleccionado una serie de aplicaciones para disponer de '''un entorno libre y multiplataforma''', que permita manejar el Skybot desde '''Gnu/Linux''', '''Windows''', '''FreeBSD''' o '''Mac'''.
+
Ok, that was easy. I connected the FTDI USB into my computer (I am using a MAC today)  and the serial port was attached to ''/de/cu.usbserial-FTF5YQGL'', i configured to use my minicom in that port (115200,8n1) and i got the connection up & running.
 +
By default the serial goes to ''ttyS0'' in the Raspberry-PI, that means that we will see the booting from linux, access to the console, etc... It is a good option for "recovery" but i prefer to have it free as another port for my robots. I mean, instead of being used by linux, being use by custom applications.
 +
 
 +
To disable the ''console'' functionality in the serial port you need to do two things:
 +
* Edit the '''/etc/inittab''' and comment '''T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100'''
 +
* Edit the  '''/boot/cmdline.txt''' and remove the serial port from boot: '''dwc_otg.lpm_enable=0''' ''console=ttyAMA0,115200 kgdboc=ttyAMA0,115200'' '''console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait'''. Remove the cursive section.
 +
* reboot
  
=== Programa de pruebas: Skybot-test ===
+
You can find more information in: http://www.hobbytronics.co.uk/raspberry-pi-serial-port<br>
Para controlar el Skybot y leer el estado de todos sus sensores se puede utilizar el programa [[Skybot-test]]. Permite mover el robot y comprobar si los sensores están funcionando.
+
More information about Serial Port in:  http://elinux.org/RPi_Serial_Connection
  
{|
+
== Other interfaces ==
| [[Imagen:Skybot-test-pantallazo-linux.png|thumb|300px|Pantallazo de Skybot-test-1.0 en Gnu/Linux]]
 
|| [[Imagen:Skybot-test-pantallazo-win.png|thumb|300px|Pantallazo de Skybot-test-1.0 en Windows XP]]
 
|}
 
  
 +
A part of using P1 to connect sensors, I am exploring what else can i connect using the USBs.
 +
The Linux Kernel is supporting almost all the standard devices: Mouse, Keyboard, USB_Memories,...
 +
But, i have also tried:
  
=== Entorno usado en los talleres de robótica ===
+
=== USB 2.0 to Ethernet Adapter ===
Para los [[Taller Skybot|Talleres de robótica con el Skybot]], hemos optado por las siguientes alternativas:
+
With this module i am able to have two ethernets up and running. They go through USB, both of them, so the speed is limited to 100bt.
* '''Un [[PIC Bootloader|Bootloader]] grabado en el PIC''', lo que permite la rápida descarga de programas en la Skypic '''sin usar grabador'''.
+
I have used the following module: Rocketfish Model RF-PPC132
* '''Descarga de programas en el PIC''': Aplicación [[Pydownloader]], escrita en Python.
 
* '''Programación en lenguaje C'''. Utilizamos el compilador libre [http://sdcc.sourceforge.net/ SDCC].
 
* [http://www.iearobotics.com/talleres/generico-v14/sesion-3/index.html Más información]
 
  
=== Ejemplos de programación en C ===
+
=== 'WiFi USB Adapter ===
 +
ModelBelkin N150
 +
I just connected to the USB and it the new interface appeared in the ifconfig under wlan0.
 +
The module was detected by the kernel and i just needed to configure the wireless network.
  
[http://www.iearobotics.com/talleres/generico-v14/sesion-3/ejemplos/ejemplos-skybot-1.html#descargas Aquí están los ejemplos de programación del Skybot en lenguaje C] (usando la librería fácil).
+
'''sudo vi /etc/wpa_supplicant/wpa_supplicant.conf'''
 +
 +
network={
 +
ssid="YOUR SSID"
 +
proto=RSN
 +
key_mgmt=WPA-PSK
 +
pairwise=CCMP TKIP
 +
group=CCMP TKIP
 +
psk="YOUR WIFI-PASSWORD"
 +
}
  
== Documentación ==
+
And then i reboot the system... and that's it.
  
{| {{Tablabonita}}
+
By default the Raspberry uses DHCP, but you can also configure the WiFi interface as Static:
|
 
* [[Taller Skybot]]. '''Página principal'''. Montaje y programación del Skybot. Documentación usada en los talleres de robótica.
 
|}
 
  
=== Índice del taller del Skybot: ===
+
'''sudo vi /etc/network/interfaces'''
* [[Taller Skybot:Sesión 1|Sesión 1]] : Construcción de la estructura mecánica y trucaje de los servos
 
* [[Taller Skybot:Sesión 2|Sesión 2]] : Finalizar la estructura, conectar todos los sensores y probar el robot
 
* [[Taller Skybot:Sesión 3| Sesión 3]]: Instalación del software. Programa “hola mundo”.
 
* [[Taller Skybot:Sesion4:Programación del Skybot|Sesion 4]]: Programación del Skybot
 
* [[Concurso mogollón|Sesión 5]]: El concurso del Mogollón.
 
  
== Aplicaciones ==
+
allow-hotplug wlan0
Algunos ejemplos de manejo del Skybot y robots basados en él:
+
auto wlan0
 +
iface wlan0 inet manual
 +
address 192.168.1.100
 +
netmask 255.255.255.0
 +
gateway 192.168.1.1
 +
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
  
* [http://www.iearobotics.com/proyectos/friki-apps/wii-skybot/wii-skybot.html Control del Skybot con el mando de la wii]
+
=== '''USB Camera''' ===
* [[Wiilson]]: Skybot + Wii + PWM
+
I bought a couple of  ''PS2 Eye Cameras'' in the pre-owned market. The reason was because i read that they are well supported by the kernel and there is no need to deal with linux driver.
* [[Star Destroyer]]: Destructor de Star Wars movido con WII !!!
+
Then I installed '''GStreamer''' and started playing with it.<br>
 +
'''Important: All these examples are based on GStreamer 0.1''' which is deprecated but is what it is included in '''Whezzy'''. Later on i will move to 1.0.
 +
{| class="wikitable"
 +
|
 +
sudo apt-get upgrade<br>
 +
sudo apt-get update<br>
 +
sudo apt-get install gstreamer-tools gstreamer0.10-plugins-bad gstreamer0.10-plugins-good v4l-utils
 +
|}
  
== Fotos ==
+
Right now i have only used the ''gst-launcher'', i haven't built my own application (in C) yet. However, with the get-launcher for some of the applications is enough.<br>
{| {{Tablabonita}}
+
(In these tests i have my HDMI output connected to a monitor, i am not booting to X, i just boot to Console mode)
| [[Imagen:Skybot-pre.jpg|thumb|200px|Maqueta preliminar del Skybot]]
+
* Capture and display video
| [[Imagen:Skybot-v1.0-foto1.jpg|thumb|200px|Skybot v1.0. Vista lateral]]
+
{| class="wikitable"
| [[Imagen:Skybot-v1.0-foto2.jpg|thumb|200px|Skybot v1.0. Vista lateral]]
 
|----------------
 
| [[Imagen:Skybot-v1.0-foto3.jpg|thumb|200px|Skybot v1.0. Vista frontal]]
 
| [[Imagen:Skybot-v1.0-foto4.jpg|thumb|200px|Skybot v1.0. Vista frontal de cerca]]
 
 
|
 
|
 +
gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! ffmpegcolorspace ! autovideosink
 
|}
 
|}
  
== Lista de Correo ==
+
* Capture and display video with Overlay
{| {{tablabonita}}
+
{| class="wikitable"
|'''Lista de correo''' para el intercambio de información, discusión, etc, sobre el Skybot, la Skypic, Skycontrol y en general robótica y electrónica:
+
|
* '''Dirección''': ''skylista@googlegroups.com''
+
gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! timeoverlay halign=left valign=bottom text="Stream time:" shaded-background=true ! ffmpegcolorspace ! autovideosink
* '''Página web''': [http://groups.google.com/group/skylista http://groups.google.com/group/skylista]
 
 
|}
 
|}
  
== Repositorio ==
+
* Record JPEG video to foo.jpg file
* SVN del proyecto [http://svn.iearobotics.com/Skybot http://svn.iearobotics.com/Skybot]
+
{| class="wikitable"
 +
|
 +
gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! ffmpegcolorspace ! jpegenc ! multipartmux ! filesink location=foo.jpg
 +
|}
  
Para obtener la versión estable actual del SVN:
+
* Play recorded video
 +
{| class="wikitable"
 +
|
 +
gst-launch-0.10 filesrc location=foo.jpg ! multipartdemux ! jpegdec ! ffmpegcolorspace ! autovideosink
 +
|}
  
svn co http://svn.iearobotics.com/Skybot/skybot/skybot-2006
+
* Take a snapshot
 +
{| class="wikitable"
 +
|
 +
gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! ffmpegcolorspace ! pngenc ! filesink location=foo.png
 +
|}
  
== Descargas ==
+
* Stream H264 video
=== Electrónica ===
+
I still need to improve performance... not good in the client side. Now looking to upgrade to gstreamer 1.0 and using HW acceleration.
 +
{| class="wikitable"
 +
|
 +
gst-launch-0.10 \
 +
v4l2src !\
 +
video/x-raw-yuv,width=320,height=240,framerate=30/1 !\
 +
ffmpegcolorspace !\
 +
x264enc bitrate=1024 !\
 +
rtph264pay config-interval=1 pt=96 !\
 +
gdppay !\
 +
tcpserversink host=192.168.1.127 port=5000 sync=false
 +
|}
  
{|{{tablabonita}}
+
The good thing about the Pi is that there are hundreds of docs about projects that help a lot. In this case i used:
| [[Skypic:Planos|Skypic Planos]]
+
* From [http://www.geekytheory.com/acerca-de/ Mario Perez] this post: http://www.geekytheory.com/tutorial-raspberry-pi-3-eye-toy-camera-ps2-motion-system/
|| Esquemático, PCB y ficheros de fabricación
 
  
|--------------------
+
I have also tried with the '''mpeg-streamer'''. It is more or less same approach than GStreamer (conecting blocks) but is less powerful. However, the application is really nice, it comes with an embedded app that listens to Port XXX and offers a web page to manage your video coming from the camera. You can get access to that video from any mobile device. The good thing is that the CPU usage is much lower than streaming H264, and it works quite well. Until i improve the gstreamer this is what i use to stream video to mobile devices.
| [http://www.iearobotics.com/proyectos/sky293/sky293.html#download Sky293 Planos]
 
|| Esquemático, PCB y ficheros de fabricación
 
|}
 
  
=== Planos mecánicos ===
+
=== ''Console Serial Port'' over Bluetooth using a  '''Serial to Bluetooth''' device. ===
{|{{tablabonita}}
+
In this page  http://blog.miguelgrinberg.com/post/a-cheap-bluetooth-serial-port-for-your-raspberry-pi from ''Miguel Grinberg'' you can find an excellent description of how to interface the module. I was so lucky because i had that module and this link makes the integration very simple.
| [http://www.iearobotics.com/downloads/Skybot/V1.0/skybot-v1.0.zip skybot-v1.0.zip]
 
|| Planos del Sybot v1.0, en DXF. Se pueden visualizar con [http://en.wikipedia.org/wiki/QCad Qcad] o Autocad.
 
'''
 
|----------------
 
| [http://www.iearobotics.com/downloads/Skybot/V1.0/skybot-chasis.pdf skybot-chasis.pdf]
 
|| Piezas que componen el Chasis. Fabricación mediante corte por láser
 
|--------------------
 
| [http://www.iearobotics.com/downloads/Skybot/V1.0/Skybot-ruedas-G2.pdf Skybot-ruedas-G2.pdf]
 
|| Ruedas. Generacion 2. Incorporan una goma tórica para mejorar el agarre.
 
|--------------------
 
| [http://www.iearobotics.com/downloads/Skybot/V1.0/Skybot-ruedas-G1.pdf Skybot-ruedas-G1.pdf]
 
|| Ruedas. Generacion 1. Fabricación mediante corte laser. Pensadas para poner alrededor de ellas la goma de un globo
 
|}
 
  
=== Circuitos de pruebas ===
+
=== '''I2C''' and '''SPI''' ===
  
Circuitos para que el Skybot los siga. Imprimir en papel Din-A4 con impresora láser. Los circuitos en formato SVG se pueden editar con el programa multiplataforma [http://en.wikipedia.org/wiki/Inkscape Inkscape].
+
I removed both of them from the modules ''blacklist'' (/etc/modprobe.d/raspi-blacklist.conf)<br>
 +
i rebooted the RPi<br>
 +
sudo modprobe i2c-dev<br>
 +
sudo modprobe spidev<br>
 +
i2c-0, ice-1, spidev0.0 and spidev0.1 are now present in /dev <br>
  
{|{{tablabonita}}
+
To have these modules installed at boot time go to '''/etc/modules''' and add:
| [http://www.iearobotics.com/wiki/images/0/0b/Skybot-circuito-1.pdf Skybot-circuito-1.pdf]
+
root@raspberrypi:~# vi /etc/modules
|| Circuito 1. En PDF.
 
|--------------------
 
| [http://www.iearobotics.com/wiki/images/f/fb/Skybot-circuito1.svg Skybot-circuito1.svg]
 
|| Circuito 1. Fuentes en SVG.
 
|--------------------
 
| [http://www.iearobotics.com/wiki/images/3/37/Skybot-circuito2.pdf Skybot-circuito2.pdf]
 
|| Circuito 2. En PDF.
 
|--------------------
 
| [http://www.iearobotics.com/wiki/images/a/aa/Skybot-circuito-2.svg Skybot-circuito-2.svg]
 
|| Circuito 2. Fuentes en SVG.
 
'''
 
|}
 
  
== Enlaces ==
+
# /etc/modules: kernel modules to load at boot time.
* [[Skypic|Tarjeta Skypic]]
+
#
* [http://www.iearobotics.com/proyectos/sky293/sky293.html Tarjeta Sky293]
+
# This file contains the names of kernel modules that should be loaded
* [http://www.iearobotics.com/proyectos/cuadernos/ct3/ct3.html Servos Futaba 3003]
+
# at boot time, one per line. Lines beginning with "#" are ignored.
* [http://www.iearobotics.com/proyectos/skybot/skybot.html Antigua página del Skybot]
+
# Parameters can be specified after the module name.
 +
 +
snd-bcm2835
 +
i2c-dev
 +
spidev
 +
<br>
 +
Now that we have the drivers and devices lets go to the SW examples. First of all we will install some tools and python modules:
 +
* i2c-tools (''sudo apt-get install i2c-tools'') and now i am able to run '''i2cdetect -y 1''' to find the i2c devices that are connected. The Raspberry Pi designers swapped over I2C ports between board releases. Just remember: 512M Pi's use i2c port 1, 256M ones use i2c port 0. In both cases they are accessable through P1 connector
 +
* apt-get install python-smbus
  
== ¿Dónde comprar el Skybot? ==
+
'''Level shifter for the I2C''': Almost all my devices are 5v so i am using this [http://lightake.com/detail.do/sku.5_3V_System_IIC_I2C_Level_Converter_Module_for_Sensor___Blue-62966 module] to convert form RPi 3v3 to a 5v I2C bus.
El Skybot es '''un robot Libre''', cualquiera lo puede construir, modificar, distribuir o vender. Estas son algunas empresas que lo comercializan:
+
* AVCC connect to 5V system power
 +
* ASCL connect to 5V system SCL
 +
* ASDA connect to 5V system SDA
 +
* AGND connect to 5V system GND
 +
* BVCC connect to 3V system power
 +
* BSCL connect to 3V system SCL
 +
* BSDA connect to 3V systems SDA
 +
* BGND connect to 3V system GND
  
{| {{tablabonita}}
+
Interesting article about Low Level programming:
|-
+
* [http://www.pieter-jan.com/node/15 Low level I2C and GPIO]
| [[Archivo:Logo robot premiere.png|200px|link=http://robotpremiere.com/|Robot Premiere, by Quark Robotics]]
 
| [http://www.robotpremiere.es/product.php?id_product=11 Kit Skybot en Robot Premiere]
 
|}
 
  
== Historia ==
+
== Reminders ==
El Skybot es una evolución del [http://www.iearobotics.com/proyectos/tritt/tritt.html robot Tritt], que desarrollamos en 1997 para impartir talleres de robótica en nuestra universidad. Más tarde este robot fue comercializado por la empresa Microbótica S.L, de la que formábamos parte.
 
  
El Skybot nació en el 2004. La estructura de Tritt era de lego y el microcontrolador un 6811 de Motorola. Estos dos componentes quedaron obsoletos por lo que decidimos crear una estructura mecánica y electrónica nuevas. El nombre de Skybot viene de Skynet, el ordenador de la película Terminator. Usamos el prefijo SKY para identificar las diferentes tarjetas: Skypic, Sky293 y el robot Skybot.
+
* lsusb : List the USB devices attached to your system
 +
* modprobe i2c-dev : to load the i2c driver
 +
* modprobe spidev : to load the spidev driver
  
''' Resumen de la historia del Skybot''':
+
== Design ==
  
{| {{Tablabonita}}
+
* Raspberry PI Hardware main page: http://elinux.org/RPi_Hardware
| '''[Jul-2009]''' || Taller de robótica básico en las III Jornadas de Inicialización a la Universidad (UAM 2009) ([[III Jornadas de Iniciación a la Universidad| Más información]])
+
* Raspberry PI '''schematic''': http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2_027.pdf
|--------------
 
| '''[Jun-2009]''' || V Taller de robótica en la Universidad Autónoma de Madrid ([[V Taller de Robótica UAM 2009| Más información]])
 
|--------------
 
| '''15/Dic/2009''' || [http://www.robotpremiere.com/ Robotpremiere] vende su primer Skybot, a un particular en Madrid
 
|--------------
 
| '''20/Nov/2009''' || El Skybot lo empieza a comercializar la tienda [http://www.robotpremiere.com/ Robotpremiere]
 
|--------------
 
| '''[Oct-2008]''' || '''Skybot 1.5'''. Se sustituye el jack de elimentación por un interruptor. Taller Robótica Básica. Campus Party Iberoamérica.([[Taller Skybot Iberoamérica 2008 | Más información]])
 
|--------------
 
| '''[Jul-2008]''' || IV Taller de robótica en la Campus Party 2008 de Valencia ([[Taller Skybot CampusBot 2008| Más información]])
 
|--------------
 
| '''[Jul-2008]''' || IV Taller de robótica en la Universidad Autónoma de Madrid ([[Taller Robótica UAM 2008| Más información]])
 
|--------------
 
| '''[Jun-2008]''' || Skybot movido por primera vez usando la Wii-board. ([http://www.iearobotics.com/blog/2008/06/18/wii-board-moviendo-un-skybot/ Blog]) ([[Wii Board| Más información]])
 
|--------------
 
| '''[Abril-2008]''' || Skybot mostrado en la Jornadas para alumnos de altas capacidades de la comunidad de Madrid, en la UAM. ([[2008-04-12:UAM:Robótica Modular y Locomoción| Más información]])
 
|-------------
 
| '''[Dic-2007]''' || Skybot mostrado en la charla "La granja de micro-robots". Móstoles. Mádrid.
 
|----------------
 
| '''[Nov-2007]''' || Skybot mostrado en la charla "La granja de micro-robots". LudusParty. Lugo
 
|------------
 
| '''[Jul-2007]''' || III Taller de iniciación a la robótica en CampusBot. CampusParty. Valencia. ([http://www.iearobotics.com/talleres/campusbot-2007/index.html Más información]). ([http://www.iearobotics.com/talleres/generico-v14/index.html Documentación])
 
|-----------------
 
| '''[Jul-2007]'''|| '''Nace Skybot v1.4'''. III Taller de iniciación a la robótica Universidad Autónoma de Madrid. El robot es igual al v1.3, pero ahora se utiliza la librería Skybot de Javier Valiente para facilitar la programación. ([http://www.iearobotics.com/talleres/generico-v14/index.html Documentación])
 
|--------------
 
| '''[Mayo-2007]''' || Skybot mostrado en la charla "La granja de micro-robots". Nebrija Lan Party. Madrid ([http://www.iearobotics.com/personal/juan/conferencias/conf34/index.html Más información])
 
|---------------
 
| '''[Abril-2007]''' || Skybot mostrado en la charla "La granja de micro-robots". EbroParty. Miranda de Ebro. Burgos. ([http://www.iearobotics.com/personal/juan/conferencias/conf33/index.html Más información])
 
|-------------
 
|'''[Abril-2007]''' || Skybot mostrado en la charla "La granja de micro-robots". Enred@. Isla Cristina. Huelva ([http://www.iearobotics.com/personal/juan/conferencias/conf32/index.html Más información])
 
|-------------
 
| '''[Abril-2007]''' || Control del Skybot mediante el mando de la wii. ([http://www.iearobotics.com/proyectos/friki-apps/wii-skybot/wii-skybot.html Más información])
 
|-------------
 
|'''[Marzo-2007]''' || Skybot mostrado en la charla "La granja de micro-robots". I Jornadas de ARDE. Málaga.  ([http://www.iearobotics.com/personal/juan/conferencias/conf28/index.html Más información])
 
|-------------
 
| '''[Feb-2007]'''|| II Taller de iniciación a la robótica en la Universidad Autónoma de Madrid. ([http://www.iearobotics.com/talleres/uam-feb-2007/index.html Más información]) ([http://www.iearobotics.com/talleres/generico-v13/index.html Documentación])
 
|---------------
 
| '''[Nov-2006]'''|| Skybot mostrado en la charla "La granja de micro-robots". LudusParty. Lugo
 
|--------------
 
| '''[Julio-2006]'''|| II Taller de iniciación a la robótica CampusBot. ([http://www.iearobotics.com/personal/juan/eventos/evento17/index.html Más información]) ([http://www.iearobotics.com/talleres/generico-v13/index.html Documentación])
 
|-----------
 
|'''[Julio-2006]'''|| Skybot mostrado como parte de los robots de la "Granja de Micro-Robots" en la Party Quijote en Ciudad Real. ([http://www.iearobotics.com/personal/juan/conferencias/conf24/index.html Más información])
 
|--------------
 
| '''[Feb-2006]'''|| '''Nace Skybot v1.3'''. I Taller de Robótica en la Universidad Autónoma de Madrid. Se sustituyen las antiguas ruedas por las nuevas que usan una goma tórica para un mejor agarre ([http://www.iearobotics.com/talleres/uam-2006/index.html Más información]) ([http://www.iearobotics.com/talleres/generico-v13/index.html Documentación])
 
|----------------
 
| '''[Nov-2005]'''|| '''Nace Skybot v1.2'''. Taller de Robótica en la Universidad de Cádiz. La [http://www.iearobotics.com/proyectos/ct293/ct293.html tarjeta CT293] se sustituye por la nueva [http://www.iearobotics.com/proyectos/sky293/sky293.html  sky293]. ([http://www.iearobotics.com/personal/juan/eventos/evento06/index.html Más información]) ([http://www.iearobotics.com/talleres/uca-2005/index.html Documentación])
 
|----------
 
| '''[Jul-2005]'''|| '''Primer taller de robótica con el Skybot'''. Campus Bot. Campus Party 2005. Valencia. ([http://www.iearobotics.com/personal/juan/eventos/evento03/index.html Más información]) ([http://www.iearobotics.com/talleres/campusbot-2005/index.html Documentación])
 
|---------------
 
|'''[Junio-2005]'''|| '''Nace Skybot v1.0''' llevado a la V muestra de Microbótica en la Universidad de Málaga. ([http://www.iearobotics.com/personal/juan/eventos/evento02/index.html Más información])
 
|-------------
 
|'''[Abril-2005]''' || Prototipo mostrado en las Sesiones de robótica organizadas por la Comunidad de Madrid en la Universidad Pontificia de Salamanca. ([http://www.iearobotics.com/personal/juan/conferencias/conf8/index.html Más información])
 
|-------------
 
| '''[Nov-2004]'''|| Prototipo inicial mostrado por primera vez en la IV Semana de la Ciencia en Madrid en Universidad Pontificia de Salamanca en Madrid. ([http://www.iearobotics.com/personal/juan/conferencias/conf3/index.html Más información])
 
|----------
 
|'''[1997-2004]'''|| [http://www.iearobotics.com/proyectos/tritt/tritt.html Microbot Tritt], precursor del Skybot.
 
|}
 
  
== Autores ==
+
== Authors ==
 
*[[Andrés Prieto-Moreno]]
 
*[[Andrés Prieto-Moreno]]
* [[Juan_Gonzalez:Main | Juan González Gómez]]
 
* [[Ricardo Gómez]]
 
  
== Licencia ==
+
== Links ==
 +
* Raspberry.org: http://www.raspberrypi.org
 +
* Raspberry PI documentation: http://elinux.org/R-Pi_Hub
 +
* Raspberry PI Low level peripherals (GPIO, I2C, ...): http://elinux.org/RPi_Low-level_peripherals
 +
* Raspberry PI Serial Port: http://elinux.org/RPi_Serial_Connection
 +
 
 +
== License ==
 
{|{{tablabonita}}
 
{|{{tablabonita}}
 
| [[Imagen:Cc logo.png]] This work is licensed under a [http://creativecommons.org/licenses/by-sa/2.5/es/ Creative Commons Attribution-ShareAlike 2.5 Spain License].
 
| [[Imagen:Cc logo.png]] This work is licensed under a [http://creativecommons.org/licenses/by-sa/2.5/es/ Creative Commons Attribution-ShareAlike 2.5 Spain License].
 
|}
 
|}
  
== Créditos ==
+
== Greetings ==
* A [http://www.mundobot.com/ Alejandro Alonso] por confiar en el SkyBot y por todas las sugerencias para mejorar el concepto inicial
+
* [http://elinux.org/R-Pi_Hub  Raspberry PI community]. A lot of information comes from them. My congratulations because it is one of the best documentation i have ever read.
* A '''Ifara tecnologías''' por financiar y comercializar el Skybot v1.0, v1.2 y v1.3
+
* [[Juan_Gonzalez:Main | Juan Gonzalez]]: I don't need to present him to you, most of the articles of this page has been written by him. He is a good friend of mine and i learn everyday from him and his ideas.
  
== Noticias ==
+
== History ==
* '''30/Enero/2012''': Añadido enlace a RobotPremiere: Venden el Skybot
+
* '''11/Mayo/2013''': Creation of the page
* '''27/Julio/2009'''. Skybot añadido a un repositorio. Creado plano de las ruedas
 
* '''17/Junio/2008'''. Migración finalizada ([[Juan Gonzalez:Main|Juan González]])
 
* '''15/Mayo/2008'''. Comenzada esta página. Migración de la [http://www.iearobotics.com/proyectos/skybot/skybot.html documentación en HTML]
 
  
 
[[Categoría:Robots]]
 
[[Categoría:Robots]]
[[Categoría:Skybot]]
 
 
[[Categoría:Documentación]]
 
[[Categoría:Documentación]]
[[Categoría:Videos]]
 
[[Categoría:Skypic]]
 
[[Categoría:SVN]]
 

Revisión actual del 02:16 1 dic 2013

Raspberry PI

Introduction

The scope of this page is to document the Mini-PI robot.

Mini-PI stands off:

  • Mini: The simplest robot: Miniskybot
  • PI: Raspberry-PI: cheapest Linux PC

The intend is to build a robot, very simple, using 3D printer, and with the Raspeberry-PI as main processor (CPU).

I will start writing here the steps i am following to do it. I have been so many years without building a robot, and now, i feel excited about it. During these years i have been following all Juan's publications, and i will take advantage of all of them: 3D printers, python, Skymega, ...

About me: I am living in California now, that is one of the reasons i am writing this in english, another, is because i would like to present this in my son's school. They knew about my background in robotics and they would like me to present something. They have a strong team in Lego Mindstorms... let's see what i can do!!

Raspberry-PI

The main webs of Raspberry PI are http://www.raspberrypi.org and http://elinux.org/R-Pi_Hub. The board was originally developed as an educational project, and has became very popular during 2012. I recommend to read this note from the authors.

I decided to use it because several reasons:

  • It is cheap
  • It is well documented
  • It is broadly used
  • It has an easy hardware
  • It has a GPIO bus with (IO, I2C, SPI, UART), and of course USB, ETH, ...
  • Supports Debian Linux

So, after having used a lot of embedded kits (TI DMVA2, DM368, Hi3516, Freescale, Versalogic, DM667, ...) i found this kit really interesting for building low cost robotic applications. It took me a while to find the right moment to start, but once i did it, i was surprised about how fast and easy was to set up everything.

I bought the Raspberry-PI here: http://www.alliedelec.com/images/products/mkt/pb/rasp/rasp.aspx

There are two models A and B. In my case i bought the B because i wanted it to have Ethernet on the board. Option A is not a bad idea, for example if you want to have Wifi then, instead of buying the model B that has the ETH, you can buy the model-A (cheaper) and a USB-Wifi-Dongle... The PN i got is: E1313RS2V13B1.0

Loading the linux image into the SDCard

The first thing i did was to flash the SDcard. I followed the following links:

In my case i have used Whezzy (Debian stable release by My,2013) as the distribution (the recommended for beginners), and i followed the instructions for MacOS users, and since i am a little bit old i decided to use the command line option. I didn't try the graphical tools, but i am pretty sure that they work and are as easy as the command line method. Once i got the SDcard flashed i put it in the raspberry-PI (model B) and it booted without any problem.

These are the instructions from Raspberry (Using command line tools (2)

Note: Some users have reported issues with using Mac OS X to create SD cards.  
#These commands and actions need to be performed from an account that has administrator privileges.
# Download the image from a mirror or torrent
#* http://www.raspberrypi.org/downloads
# Verify if the the hash key is the same (optional), in the terminal run: 
#* shasum ~/Downloads/2012-12-16-wheezy-raspbian.zip
# Extract the image:
#* unzip ~/Downloads/2012-12-16-wheezy-raspbian.zip
#* (or: just double click the zip, it will extract automatically)
# From the terminal run df -h
# Connect the SD card reader with the SD card inside
# Run df -h again and look for the new device that wasn't listed last time. Record the device name of the filesystem's partition, for example, /dev/disk3s1
# Unmount the partition so that you will be allowed to overwrite the disk:
#* sudo diskutil unmount /dev/disk3s1
#* (or: open Disk Utility and unmount the partition of the SD card (do not eject it, or you have to reconnect it)
# Using the device name of the partition work out the raw device name for the entire disk, by omitting the final "s1" and replacing "disk" with "rdisk" 
(this is very important: you will lose all data on the hard drive on your computer if you get the wrong device name). Make sure the device name
 is the name of the whole SD card as described above, not just a partition of it (for example, rdisk3, not rdisk3s1. Similarly you might have another 
SD drive name/number like rdisk2 or rdisk4, etc. -- recheck by using the df -h command both before & after you insert your SD card reader into 
your Mac if you have any doubts!):
#* For example, /dev/disk3s1 => /dev/rdisk3
# In the terminal write the image to the card with this command, using the raw disk device name from above (read carefully the above step, to be sure you use the correct rdisk# here!):
#* sudo dd bs=1m if=~/Downloads/2012-10-28-wheezy-raspbian/2012-12-16-wheezy-raspbian.img of=/dev/rdisk3
#* if the above command report an error(dd: bs: illegal numeric value), please change bs=1M to bs=1m
#* (note that dd will not feedback any information until there is an error or it is finished, information will show and disk will re-mount when complete. However if you are curious as to the 
progresss - ctrl-T (SIGINFO, the status argument of your tty) will display some en-route statistics).
# After the dd command finishes, eject the card:
#* sudo diskutil eject /dev/rdisk3 
#* (or: open Disk Utility and eject the SD card)
# Insert it in the Raspberry Pi, and have fun


The first think i saw was the raspi-config tool. The first time i didn't change anything, but once i finish investigating the X-options, i decided to turn off the X-Windows. I am going to run console programs and i will use ssh to connect with the raspberry-PI. In other words, there is no need to have it running now.

Connecting the RaspberryPI

Power Input

Raspberry PI (model B) works with 5VDC / 700mA. There are two ways to powering the board:

  • Using the power in micro-usb connector, or
  • Using the GPIO Bus (P1). Pins2 and 4 are directly connected to the +5VDC line.

It has some protections in the main power line to prevent damages, but, since the 5VDC is also used in the HDMI, USB, etc... by adding a different voltage than 5VDC you never know if something else will break. That is why the recommendation is to stay with 5DV.


The power input connector is a micro-usb connector. For me this is not the best in robotics, however, it is very common in computer, mobiles, that makes not difficult to find a power kit. And the design has been well thought and they still offer the GPIO as a solution, so i am glad to see that they thought in this as well. We will use the GPIO power input later in our robot, but now, let's use the simplest:

I am using the typical micro-usb to usb cable, and the Mean Well (GS05U-USB) Power supply. It has these capabilities:

  • Input: 100-240VAC, 50/60Hz, 0.15A
  • Output: 5VDC, 1A, 5.0 W MAX

These ratings are quite standard, for example iPhone, Samsung Galaxy use the same.

First Boot (Interfaces)

When booting it for the first time, I recommend to use a

  • USB-Mouse
  • USB-Keyboard
  • HDMI output (If you don't an HDMI input in your TV/Monitor you can use the old RCA, however it doesn't give you the best)
  • Standard power supply that has 5VDC and 1A.

(Default login: Username: pi , Password: raspberry)

It will give you a mini PC, your keyboard, graphical interface, mouse. You can play and learn about it. For example, try to connect and Ethernet cable, discover the IP, do an SSH from another PC Basically, become familiar with it. As authors said: Have Fun!!!

Later configuration (Interfaces)

Mini-PI robot is not going to use the graphical interface, so even if it doesn't take too long to boot, i decided to disable it. I ran the rasp-config as sudo and in boot options i seleceted "Disable graphical interface'. Then i disconnected all the cables, because from now on, i am accessing the system using SSH. The idea is not even use the Ethernet, i will add a Bluetooth module in the serial port, or another USB-Wifi to make it Wireless. We will see this later on this article.

Connecting Sensors

Well, now that i have the CPU up and running, i am going to start adding the sensors and motors.
Before starting, let's go to take a look to the RPI's hardware.

The most important note from creator is the following:

The GPIO (general purpose I/O) signals on the 2x13 header pins include SPI, I2C, serial UART, 3V3 and 5V power. These interfaces are not "plug and play" and require care to avoid miswiring. The pins use a 3V3 logic level and are not tolerant of 5V levels, such as you might find on a 5V powered Arduino.

P1 Header Pinout This a copy from RPI information

GPIOs.png

P1 Top View description

RPi P1 header.png

P1 Top View Layout

My assignment

  • Serial Port
RPi P1 Signal BCM pin
pin6 GND
pin 8 TXD GPIO14
pin 10 RXD GPIO15


  • SPI
RPi P1 Signal BCM pin
pin19 MOSI GPIO10
pin 21 MISO GPIO9
pin 23 SCLK GPIO11
pin 24 CE0 GPIO8
pin 25 GND
pin 26 CE1 GPIO7


  • I2C
RPi P1 Signal BCM pin
pin 3 SDA GPIO0
pin 5 SCL GPIO1
pin 9 GND


  • 8 bits port
RPi P1 Signal BCM pin
pin 11 IO 0 GPIO17
pin 12 IO 1 GPIO18
pin 13 IO 2 GPIO21
pin 15 IO 3 GPIO22
pin 16 IO 4 GPIO23
pin 18 IO 5 GPIO24
pin 22 IO 6 GPIO25
pin 7 IO 7 GPIO4

Sensors to explore

  • Done: Ultrasonic (I2C)
  • Not available : Inclinometer (Analog)
  • Done: Compas (I2C)

Motors

  • Futaba S3003
  • Robbe
  • Hittec

Output

  • Done: Display: 2C, 16*4 lines
  • Done : LED
  • Done : Relay
  • Done : TTL3v3 to Bluetooth link.

Input

  • Done : Switch

Almost all these sensors and actuators can be connected directly to the Raspberry-Pi, however, since it has an I2C bus, i want to explore connecting the Skymega as well. By doing this, i could have some others sensors connected using the A/D, and i could take advantage of using a micro for some tasks. It is too early to make decisions, now is time to explore everything.

Connecting the Serial Port

I was looking into all my old robotic's stuff from Spain and i found this cable:

  • FTDI: TTL-232R-3V3 (USB cable with 6 way 0.1" pitch single inline connector with +3.3V signaling). Datasheet

The cable comes with a 6 pins connector (GND, CTS, VCC, TXD, RXD, RTS), but i only need three of them (GND, TXD, RXD) so i will put my own connector with only three wires. See the table below, to see my final pin out assignment.

RPI P1 Pin Number Description FTDI Pin Number Description My 3wires connector Description Notes
P1-06 GND Pin1 (Black) GND Pin 1 (Black) GND
P1-08 TXD Pin 5 (Yellow) RXD Pin 2 (Yellow) RXD TTL 3.3v signal
P1-10 RXD Pin 4 (Orange) TXD Pin 3 (Orange) TXD TTL 3.3v signal


So, now the only thing we need is to modify the connector and connect it to P1 to see what happens...

Ok, that was easy. I connected the FTDI USB into my computer (I am using a MAC today) and the serial port was attached to /de/cu.usbserial-FTF5YQGL, i configured to use my minicom in that port (115200,8n1) and i got the connection up & running. By default the serial goes to ttyS0 in the Raspberry-PI, that means that we will see the booting from linux, access to the console, etc... It is a good option for "recovery" but i prefer to have it free as another port for my robots. I mean, instead of being used by linux, being use by custom applications.

To disable the console functionality in the serial port you need to do two things:

  • Edit the /etc/inittab and comment T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
  • Edit the /boot/cmdline.txt and remove the serial port from boot: dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait. Remove the cursive section.
  • reboot

You can find more information in: http://www.hobbytronics.co.uk/raspberry-pi-serial-port
More information about Serial Port in: http://elinux.org/RPi_Serial_Connection

Other interfaces

A part of using P1 to connect sensors, I am exploring what else can i connect using the USBs. The Linux Kernel is supporting almost all the standard devices: Mouse, Keyboard, USB_Memories,... But, i have also tried:

USB 2.0 to Ethernet Adapter

With this module i am able to have two ethernets up and running. They go through USB, both of them, so the speed is limited to 100bt. I have used the following module: Rocketfish Model RF-PPC132

'WiFi USB Adapter

ModelBelkin N150 I just connected to the USB and it the new interface appeared in the ifconfig under wlan0. The module was detected by the kernel and i just needed to configure the wireless network.

sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

network={
ssid="YOUR SSID" 
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="YOUR WIFI-PASSWORD"
}

And then i reboot the system... and that's it.

By default the Raspberry uses DHCP, but you can also configure the WiFi interface as Static:

sudo vi /etc/network/interfaces

allow-hotplug wlan0
auto wlan0 
iface wlan0 inet manual
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

USB Camera

I bought a couple of PS2 Eye Cameras in the pre-owned market. The reason was because i read that they are well supported by the kernel and there is no need to deal with linux driver. Then I installed GStreamer and started playing with it.
Important: All these examples are based on GStreamer 0.1 which is deprecated but is what it is included in Whezzy. Later on i will move to 1.0.

sudo apt-get upgrade
sudo apt-get update
sudo apt-get install gstreamer-tools gstreamer0.10-plugins-bad gstreamer0.10-plugins-good v4l-utils

Right now i have only used the gst-launcher, i haven't built my own application (in C) yet. However, with the get-launcher for some of the applications is enough.
(In these tests i have my HDMI output connected to a monitor, i am not booting to X, i just boot to Console mode)

  • Capture and display video

gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! ffmpegcolorspace ! autovideosink

  • Capture and display video with Overlay

gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! timeoverlay halign=left valign=bottom text="Stream time:" shaded-background=true ! ffmpegcolorspace ! autovideosink

  • Record JPEG video to foo.jpg file

gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! ffmpegcolorspace ! jpegenc ! multipartmux ! filesink location=foo.jpg

  • Play recorded video

gst-launch-0.10 filesrc location=foo.jpg ! multipartdemux ! jpegdec ! ffmpegcolorspace ! autovideosink

  • Take a snapshot

gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! ffmpegcolorspace ! pngenc ! filesink location=foo.png

  • Stream H264 video

I still need to improve performance... not good in the client side. Now looking to upgrade to gstreamer 1.0 and using HW acceleration.

gst-launch-0.10 \ v4l2src !\ video/x-raw-yuv,width=320,height=240,framerate=30/1 !\ ffmpegcolorspace !\ x264enc bitrate=1024 !\ rtph264pay config-interval=1 pt=96 !\ gdppay !\ tcpserversink host=192.168.1.127 port=5000 sync=false

The good thing about the Pi is that there are hundreds of docs about projects that help a lot. In this case i used:

I have also tried with the mpeg-streamer. It is more or less same approach than GStreamer (conecting blocks) but is less powerful. However, the application is really nice, it comes with an embedded app that listens to Port XXX and offers a web page to manage your video coming from the camera. You can get access to that video from any mobile device. The good thing is that the CPU usage is much lower than streaming H264, and it works quite well. Until i improve the gstreamer this is what i use to stream video to mobile devices.

Console Serial Port over Bluetooth using a Serial to Bluetooth device.

In this page http://blog.miguelgrinberg.com/post/a-cheap-bluetooth-serial-port-for-your-raspberry-pi from Miguel Grinberg you can find an excellent description of how to interface the module. I was so lucky because i had that module and this link makes the integration very simple.

I2C and SPI

I removed both of them from the modules blacklist (/etc/modprobe.d/raspi-blacklist.conf)
i rebooted the RPi
sudo modprobe i2c-dev
sudo modprobe spidev

i2c-0, ice-1, spidev0.0 and spidev0.1 are now present in /dev 

To have these modules installed at boot time go to /etc/modules and add: root@raspberrypi:~# vi /etc/modules

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
i2c-dev
spidev


Now that we have the drivers and devices lets go to the SW examples. First of all we will install some tools and python modules:

  • i2c-tools (sudo apt-get install i2c-tools) and now i am able to run i2cdetect -y 1 to find the i2c devices that are connected. The Raspberry Pi designers swapped over I2C ports between board releases. Just remember: 512M Pi's use i2c port 1, 256M ones use i2c port 0. In both cases they are accessable through P1 connector
  • apt-get install python-smbus

Level shifter for the I2C: Almost all my devices are 5v so i am using this module to convert form RPi 3v3 to a 5v I2C bus.

  • AVCC connect to 5V system power
  • ASCL connect to 5V system SCL
  • ASDA connect to 5V system SDA
  • AGND connect to 5V system GND
  • BVCC connect to 3V system power
  • BSCL connect to 3V system SCL
  • BSDA connect to 3V systems SDA
  • BGND connect to 3V system GND

Interesting article about Low Level programming:

Reminders

  • lsusb : List the USB devices attached to your system
  • modprobe i2c-dev : to load the i2c driver
  • modprobe spidev : to load the spidev driver

Design

Authors

Links

License

Cc logo.png This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 Spain License.

Greetings

  • Raspberry PI community. A lot of information comes from them. My congratulations because it is one of the best documentation i have ever read.
  • Juan Gonzalez: I don't need to present him to you, most of the articles of this page has been written by him. He is a good friend of mine and i learn everyday from him and his ideas.

History

  • 11/Mayo/2013: Creation of the page