7/22/2012

Raspbian Optimizes Raspberry Pi

Raspbian Optimizes Raspberry Pi


If you haven't checked back in at Raspberry Pi Foundation lately, you might not have noticed that there is a new recommended download for the default operating system for the Raspberry Pi. That new Linux distribution is called Raspbian.

Raspbian is also based upon Debian, but has over 35,000 software packages rebuilt to be optimized for the Raspberry Pi architecture. Depending upon what you are doing with your Raspberry Pi, this means that could have up to a 41% increase in performance.

The omxplayer, which allows viewing HD videos, comes pre-installed in this image of the Raspbian operating system. I would not recommend compiling my fork of the omxplayer for this distribution at this time, as this image uses floating point calculations differently. I have not yet tested my version of omxplayer with this distribution.

The following are instructions detail how I installed Raspian using Fedora (Linux). Putting the image of Raspian on a SD card is very similar to how other operating system images is done. There is no reason to try to expand the file system manually, as that is automated is the raspi-config provided in Raspbian.

Installing Raspian on the Raspberry Pi

By default, on the first boot it runs sudo raspi-config which is somewhat helpful except for a couple of problems. You can run this later to make further adjustments.

Running sudo raspi-config allows you to perform many common tasks like expanding the filesystem, or updating the software. However, the keyboard layout and ssh options did not work correctly for me. Other items like changing the pi user's password and resizing the filesystem were useful.

In order to get my keyboard layout right, I still found it necessary to perform:
sudo apt-get install console-data
or if I want to change settings I would use:
sudo dpkg-reconfigure keyboard-configuration


In order to get the ssh server to work, I had to do:
sudo apt-get purge openssh-server
sudo apt-get install openssh-server


Since I was out of town last week, I haven't had too much time to play with Raspbian yet, just a few hours this weekend, but so far it looks good! Please feel free to comment about your experiences with it!


After trying out Raspbian, I do find it to feel faster for operations. One big problem for me was that the included omxplayer did not work for me! I've been hard at work at getting an omxplayer build to work with the hard instead of softfp handling. So far, I've had one successful build.

UPDATE: I have now published a post on Building Omxplayer for Raspbian on the Raspberry Pi, which  allows you to either install a pre-built omxplayer that works well, or to build it yourself from source.


ModMyPi for the Raspberry Pi

ModMyPi for the Raspberry Pi


The case from https://www.modmypi.com/ finally arrived! The two pieces of plastic fit together well very nicely. Above you see the top side in red, you can also choose white, black, blue and green. The Raspberry Pi board fits firm inside the case. All but one of the ports is very easily accessed. I found the power port to be slightly recessed making it slightly more difficult to align and connect correctly.

The Top Side

Visually, there is access to the GPIO pins through small diagonal slots above them. I imagine I could easily cut the slots above the GPIO pins for full access. Slots cut to look like a power icon, and several vertical slots exist to allow sight of the status LEDs. 

The Bottom Side


The underside of the ModMyPi case has seven holes in the center in a circular pattern with two more spread out close to the edge of the long horizontal axis in the center of the vertical axis. The center group of holes could be used to provide ventilation if the two outer holes were mounted on something like the standoffs used on the bottom of computer cases to mount motherboards to the case.
Inside the bottom are plastic standoffs, so the board does not sit directly on the plastic.

ModMyPi 

I had looked into buying this case at the time that it was still going to be 3D printed. They had so many orders that they used injection moulding instead. The strong ABS plastic pieces fit together well, and I can always take the top off if I need more access. They have five different colors to choose from for both the top and bottom. Their site https://www.modmypi.com/ has all the accessories you need, as well as start-up kits. However I have no affiliation with them, other than being their first time customer.
I was very impressed by how they communicated throughout the whole process of changing the manufacturing technique as well providing estimated shipping dates. They also help support the Raspberry Pi Foundation with the sale of stickers and according to their website, "ModMyPi LTD has pledged to donate 5% of all our profits to the Raspberry Pi Foundation."

So, all in all, I'm very pleased that my Raspberry Pi has a case that is portable and functional for casual use. I'm already imagining the ultimate experimentation case or expansion board, or...


7/15/2012

Building Omxplayer for Debian on the Raspberry Pi

Building Omxplayer for Debian on the Raspberry Pi

UPDATE: I have now published a post on Building Omxplayer for Raspbian on the Raspberry Pi, which should be referenced now for building omxplayer on either Raspbian or Debian.This post does contain some useful links and background information that you still may find useful.

NOTE: There is a new default operating system for the Raspberry Pi that includes omxplayer. The following post, assumes that you are using the original Debian image for the SD card image of your operating system. To learn more, please see my post Raspbian Optimize Raspberry Pi.
If you want a media player that takes advantage of the GPU of the Raspberry Pi, then building omxplayer is one solution. This solution allows you to run a standard Debian operating system, but be able to take advantage of hardware accelerated video decoding. So far, this has been tested using the original Debian build for the Raspberry Pi called squeeze.

There are other ways to play hardware accelerate videos as I've mentioned in Playing HD videos in Debian on the Raspberry Pi, and OpenElec for the Raspberry Pi. This solution allows you to download the source code for omxplayer and be able to tweak it if you want to be able to do that, download the source code for ffmpeg and adjust it according to your needs, and download and use the current firmware available for the Raspberry Pi.

Omxplayer was built to be able to create XMBC for the Raspberry Pi. One implementation of XMBC is OpenElec for the Raspberry Pi. I forked a repository from https://github.com/huceke/omxplayer to make my own version of omxplayer. Here are some key differences:

  • Default output is HDMI (no need for -o hdmi)
  • Clears the screen and doesn't output anything unless there is an error
  • Makefiles have been customized  to perform a native build on the Raspberry Pi
  • There is the ability to install or uninstall using the Makefiles
  • There is the ability to make git or make git_clean to download or remove the firmware and ffmpeg dependencies
  • Everything installs under /usr/local
Be sure that you have expanded the file system, or have /usr/local/src mounted on another device besides the default root file system. My post, A bigger slice of Raspberry Pi, covers how to expand the file system, make a swap partition and how to activate it.

Also, you need to make sure all the software and firmware is updated, as discussed in my post Keeping Your Raspberry Pi Fresh.

Build omxplayer using Debian Squeeze on the Raspberry Pi

  • These instructions are very similar to what is shown on my github repository: http://github.com/wrightrocket/omxplayer. Instructions at that site may be updated more frequently than this blog post.
  • Don't startx, either use the console or ssh into the system.
  • Install dependencies for build
    • sudo apt-get install libpcre3-dev libboost-dev git fbset
  • Configure the build directory permissions and change to it
    • sudo chown pi:pi /usr/local/src
    • cd /usr/local/src
  • Get the source code for the player, ffmpeg and the Raspberry Pi firmware. Depending on the speed of your Internet connection, then this might not take more than 5 or 10 minutes if you've got a fast connection, or else you might wish that you did. 
    • git clone https://github.com/wrightrocket/omxplayer.git
    • cd /usr/local/src/omxplayer/
    • make sources
git clone https://github.com/raspberrypi/firmware.git
Cloning into firmware...
remote: Counting objects: 9517, done.
remote: Compressing objects: 100% (5218/5218), done.
remote: Total 9517 (delta 4998), reused 7998 (delta 3489)
Receiving objects: 100% (9517/9517), 391.44 MiB | 1.09 MiB/s, done.
Resolving deltas: 100% (4998/4998), done.
git clone git://git.videolan.org/ffmpeg.git ffmpeg;
Cloning into ffmpeg...
remote: Counting objects: 234992, done.
remote: Compressing objects: 100% (55205/55205), done.
remote: Total 234992 (delta 184984), reused 228269 (delta 179406)
Receiving objects: 100% (234992/234992), 59.52 MiB | 737 KiB/s, done.
Resolving deltas: 100% (184984/184984), done.
cd ffmpeg; git checkout master; git checkout 13a7bd70c8d94c5a46c14e7ac23a170b77eff52e
Already on 'master'
Checking out files: 100% (794/794), done.
Note: checking out '13a7bd70c8d94c5a46c14e7ac23a170b77eff52e'.

  • Start the ffmpeg build process, which takes forever! Not actually, the first time I ran it it took about 140 minutes on a Class 6 SD card. After upgrading to a faster Class 10 SD card, it only took about 123 minutes. Expect between two to three hours for this part to complete.
    • time make -f Makefile.ffmpeg
      • first, the configure process for ffmpeg should run
      • next, just a couple of libavdevice files are made
      • followed by many items in alphabetical order, and much like the making of laws:
      • Important milestone, cheers!
Here's the time that was reported, using a non-overclocked Raspberry Pi and a Class 6 sd card, about 2 hours and 20 minutes.

real    140m28.435s
user    132m8.420s
sys     3m32.930s

Here's the time that was reported, using a non-overclocked Raspberry Pi and a Class 10 sd card, only about 2 hours.
real    123m9.197s
user    119m56.500s
sys     2m4.130s

  • After ffmpeg builds, install these libraries, and then start the omxplayer build process, which only takes about 6 minutes
    • time make -f Makefile.ffmpeg install
    • time make
strip omxplayer.bin
real 6m11.814s
user 5m56.810s
sys 0m8.860s


After the build process has completed, you are ready to install omxplayer
  • Make the file that is able to be distributed because this is built with GPL enabled, omxplayer-dist.tar.gz
    • make dist
  • If  make dist succeeded, then you are ready to install omxplayer
    • sudo make install



7/08/2012

Python on the Raspberry Pi: Roshambo

Python on the Raspberry Pi: Roshambo


While I was doing Python on the Rasberry Pi: GPIO, I came up with an idea. I wanted to use six GPIO pins for output, and three GPIO pins for input from a button. I have not yet wired this up, but I spent part of a day writing some Python code that would be the game to play with these three buttons, Roshambo.

Git the Code

In order to have access to all of the Python examples in this post, and more, you will need to have git installed, and clone my PythonOnTheRaspberryPi repository.

  • If you don't have the program git installed, then install it with:
    • sudo apt-get install git
  • Clone my PythonOnTheRaspberryPi repository:
    • git clone https://github.com/wrightrocket/PythonOnTheRaspberryPi.git
    • cd PythonOnTheRaspberryPi

Roshambo Interactive

Here's a short interactive demonstrating a dictionary named gameD storing and retrieving key and value pairs. The random module's choice function is demonstrated to show how a random selection of a certain key could be done, and to use it's seed function for better randomization. The function didPlayerWin(player, program) is pasted into the session, and it is imported from the rps.py module with the statement: from rps import didPlayerWin. This function shows how the logic works to determine which weapon won in a meeting between the player and the program.

pi@raspberrypi:~/PythonOnTheRaspberryPi$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 21:57:32) 
[GCC 4.4.5 20100902 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> gameD = {}
>>> gameD['r']='Rock'
>>> gameD['p']='Paper'
>>> gameD['s']='Scissors'
>>> print gameD
{'p': 'Paper', 's': 'Scissors', 'r': 'Rock'}
>>> gameD['s']
'Scissors'
>>> gameD.keys()
['p', 's', 'r']
>>> gameD.values()
['Paper', 'Scissors', 'Rock']
>>> gameD.items()
[('p', 'Paper'), ('s', 'Scissors'), ('r', 'Rock')]
>>> import random
>>> random.seed()
>>> # seed() is used for better randomization
... 
>>> random.choice(gameD.keys())
'p'
>>> random.choice(gameD.keys())
'r'
>>> random.choice(gameD.keys())
's'
>>> random.choice(gameD.keys())
'p'
>>> random.choice(gameD.keys())
'p'
>>> def didPlayerWin(player, program):
...     ''' determine if player beats program '''
...     if player == 'r':
...         if program == 'r':
...             return 'tie: rock meets rock'
...         elif program == 's':
...             return 'win: rock crushes scissors'
...         else:
...             return 'lose: paper covers rock'
...     elif player == 's':
...         if program == 'r':
...             return 'lose: rock crushes scissors'
...         elif program == 's':
...             return 'tie: scissors meets scissors'
...         else:
...             return 'win: scissors cut paper'
...     elif player == 'p':
...         if program == 'r':
...             return 'win: paper covers rock'
...         elif program == 's':
...             return 'lose: scissors cut paper'
...         else:
...             return 'tie: paper meets paper'
...     else:
...         ''' catch all for testing '''
...         return 'error: for unknown reason'
... 
>>> mypick = 'r'
>>> programChoice = random.choice(gameD.keys())
>>> didPlayerWin(mypick, programChoice)
'lose: paper covers rock'
>>> programChoice
'p'
>>> gameD[programChoice]
'Paper'
>>> del didPlayerWin # deletes the function or name from namespace
>>> from rps import didPlayerWin # you must have downloaded or created rps.py 
>>> mypick = 's'
>>> programChoice = random.choice(gameD.keys())
>>> programChoice
's'
>>> didPlayerWin(mypick, programChoice)
'tie: scissors meets scissors'

Rock, Paper, Scissors Game

As the game might be better known as Rock, Paper, Scissors, there are two modules available at my github repository that implement this game: rps.py and roshambo.py

rps.py

Very straightforward example of implementing the Rock, Paper, Scissors game using functions.
Uses a class to create object instances to represent the player's and the program's random choice. The rps class objects have a magical __cmp__ method that is automatically called when comparisons are made between two object instances like userObject > programObject.

Dictionaries are used to store key and value pairs for tracking the name or actions that a particular instance of an object like userObject has assigned to it. If the userChoice is 'r', then  userObject = rps(userChoice) creates a rps object which represents a rock.  For example, the key 'r' is used in the rpsTypeDict to be able to retrieve the name 'Rock' by using self.rpsTypeDict[self.rpsType] in the magical __str__ method that is used whenever the object is referenced as a string or printed.

Rock, Paper, Scissors, Lizard, Spock Game

There are two other modules which implement the more advanced game of Rock, Paper, Scissors, Lizard, Spock: roshambobigbang.py and roshambobigbang_solution.py.
Invented by Sam Kass, All hail Sam Kass!, the game of ROCK PAPER SCISSORS SPOCK LIZARD, was referred to on the Big Bang Theory several times, so I decided to name the file after the original game with the name of the television series added to it. I had initially noticed that the name of the game in Wikipedia is referred to as ROCK PAPER SCISSORS LIZARD SPOCK, which is why my code refers to the weapons in that order.

This example builds upon the previous roshambo, but extends the game to Rock, Paper, Scissors, Lizard, Spock. The game can be automated where the player's choice of weapon is also randomly selected. In order to keep track of the different actions of the weapons, as they meet other weapons, a dictionary within a dictionary is used. Statistics are also reported for the choice of weapon by the player and the program. A matrix of how many times each weapon met another weapon is also reported. This matrix is also represented by dictionaries within a dictionary. There are two challenges to the viewer of the code which would help to make the code more dynamic and flexible.

This solution to the two challenges presented in roshambobigbang.py is nearly identical to roshambobigbang.py except that the way the statistics and distribution matrix are printed.

Thanks!

Thanks to Sam Kass and the Wikipedia for having the information and images about these games available:
http://www.samkass.com/theories/RPSSL.html
http://en.wikipedia.org/wiki/Rock-paper-scissors
http://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock
http://en.wikipedia.org/wiki/File:Rock_paper_scissors.jpg
http://en.wikipedia.org/wiki/File:Rock_Paper_Scissors_Lizard_Spock_en.svg
http://en.wikipedia.org/wiki/File:Pierre_ciseaux_feuille_l%C3%A9zard_spock_aligned.svg

7/04/2012

Python on the Raspberry Pi: GPIO

Python on the Raspberry Pi: GPIO

If you want to experiment with GPIO on the Raspberry Pi, then be warned there is a danger to the Raspberry Pi. Please follow these instructions at your own risk. I make no warranty as to the correctness of the connections described, but they did work correctly for me without damaging my Raspberry Pi.

Understanding GPIO on the Raspberry Pi

One of the compelling things about the Raspberry Pi is that it includes GPIO pins. The Introduction to  Embedded Programming site has a great overview of GPIO, and how to wire various circuits. What can be confusing about the GPIO pins on the Raspberry Pi is how to locate them. The GPIO pins in the P1 header are the easiest to access, and will be the ones that will be referenced in this post on how to do basic output and input using them.

Reference Material

There is a pdf datasheet and a schematic hosted at RaspberryPi.org. The datasheet describes how GPIO works in detail, starting at page 89. 

The R-Pi_Hub for the Raspberry Pi has  also has several documents.

Referencing Pins

If you notice, in the first table in http://elinux.org/RPi_BCM2835_GPIOs there are two columns RPi connection, and RPi signal name. These are important to understand if you want to program a particular pin to perform a certain function. What I find most useful is the image on the page http://elinux.org/RPi_Low-level_peripherals shown below. If you are unsure as to what you are looking at locate P1 on the Raspberry Pi. It is next to P1-01. There are several methods to refer to a pin:
  • RPi Connection Method:
    • This refers to a physical pin on the board on the P1 header
    • Pins are numbered within the header from 1 to 26
    • If you look at the under side of the connector, the pin with a square pad is pin 1, or P1-01
    • The diagram shows the position of P1-01, P1-02, P1-25, and P1-26 just outside the white box
    • The pins in the bottom row have odd numbers P1-01 through P1-25
    • The pins in the top row have even numbers P1-02 though P1-26
    • For the person making a connection, this method makes the most sense. 
      • Locate a header like P1
      • Locate pin 1 by checking the underside of the connector for the square pad
      • Check diagram for correct numbering of pins
      • Count the position to the pin that you want to reference
      • For example,to access the functionality of GPIO18, or PCM_CLK, locate P1-12.
    • By default, the RPi.GPIO Python module references physical pin numbers like 12 for GPIO18.
  • WiringPi Method:
    • This method refers to the pin referenced in wiringPi functions
    • wiringPi functions are analogous to Arduino GPIO functions   
    • The author of wiringPi that has a table with the pin names and numbers
    • There is also a WiringPython Module based upon wiringPi
    • According to the wiringPi table, P1-12 (GPIO18) is referred to as pin 1.
  • GPIO Number Method:
    • This method refers to a pin by the GPIO number Broadcom gave it
    • This method makes the most sense in the implementation of the software
    • This method is independent of a specific physical implementation 
    • Reference the pin by the signal name, such as GPIO18, or 18.
    • The RPi.GPIO Python module can reference these names: GPIO.setmode(GPIO.BCM)
    • The WiringPython Module can also reference these names: wiringPiGpioMode(True)
    • This is the method that I prefer for any code I write

So What's The Confusion?

Depending on which library you are using, and what mode it is in, then the numbers or names used to reference pins may vary. However, with each of these libraries, it is possible to set the mode to reference the GPIO number, and then they all reference the same number. Let's take a simple example. 

An example using a LED connected

A LED cathode(-) is connected to a 270 Ohm resistor, which is then connected to ground on physical pin P1-06. At least, this ground pin is not referenced in any of the programs. The LED anode(+) is connected to physical pin P1-12, which is the GPIO18. As we will see, there are several ways to refer to this pin.

Using Python to control GPIO for output

There are a couple of Python modules to control the GPIO pins. The  RPi.GPIO Python module by default uses the physical pin number, but shown can refer to the GPIO pin. Likewise, the WiringPython Module use a different scheme to refer to pin numbers, but can be configured to use GPIO pin numbers. This module has more capabilities, and is based upon the wiringPi library.

Starting up Python for GPIO

First of all, make sure that both the RPi.GPIO Python module and the WiringPython Module modules installed. Second, due to root access being necessary to be able to read or write to the GPIO files, use sudo  to start Python

pi@raspberrypi:~/PlayingWithPython$ sudo python
Python 2.7.3 (default, Jun 18 2012, 16:19:55) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

RPi.GPIO Python module
>>> import RPi.GPIO as GPIO
# By Default References Physical 12 number
... 
>>> GPIO.setup(12, GPIO.OUT)
>>> GPIO.output(12, True)
>>> GPIO.output(12, False)
# If setmode(GPIO.BCM), then reference GPIO number
... 
>>> GPIO.setmode(GPIO.BCM)
>>> GPIO.setup(18, GPIO.OUT)
>>> GPIO.output(18, True)
>>> GPIO.output(18, False)

>>> import wiringpi
>>> # initialize the module
... 
>>> wiringpi.wiringPiSetup()
0
>>> # reference wiringPi pin by default
... 
>>> INPUT=0
>>> OUTPUT=1
>>> PWM=2
>>> wiringpi.pinMode(1, OUTPUT)
>>> wiringpi.digitalWrite(1, True)
>>> wiringpi.digitalWrite(1, False)
>>> # Change to reference GPIO numbers
... 
>>> wiringpi.wiringPiGpioMode(True)
>>> wiringpi.pinMode(18, OUTPUT)
>>> wiringpi.digitalWrite(18, True)
>>> wiringpi.digitalWrite(18, False)
>>> # wiringpi also support PWM mode only on GPIO18 or wiringPi pin 1
...
>>> wiringpi.pinMode(18, PWM)
>>> # pwmWrite(pin, 0) is off
...
>>> wiringpi.pwmWrite(18, 0)
>>> wiringpi.pwmWrite(18, 256)
>>> wiringpi.pwmWrite(18, 512)
>>> # pwmWrite(pin, 1023) is full power
...
>>> wiringpi.pwmWrite(18, 1023)
>>> wiringpi.pwmWrite(18, 0)

An example using a Switch and LED connected

A simple two wire switch is used in this example. One wire is then connected to ground on physical pin P1-06. Update: Also use a 270 Ohm resistor between ground and the first wire, as to provide extra protection. The other wire is connection to signal GPIO7 on physical pin P1-26. The LED is connected as in the previous example.

pi@raspberrypi:~/PlayingWithPython$ sudo python
Python 2.7.3 (default, Jun 18 2012, 16:19:55) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 


>>> import RPi.GPIO as GPIO

>>> # display variables and functions in GPIO namespace
... 
>>> dir(GPIO)
['BCM', 'BOARD', 'IN', 'InvalidChannelException', 'InvalidDirectionException', 'InvalidModeException', 'OUT', 'WrongDirectionException', '_BCM', '_ExportedIds', '_GPIO_PINS', '_GetValidId', '_MODE', '_MODES', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '_unexport', 'atexit', 'input', 'os', 'output', 'setmode', 'setup']
>>> # set the mode to use GPIO numbers
... 
>>> GPIO.setmode(GPIO.BCM)
>>> # set up the GPIO to read input
... 
>>> GPIO.setup(7, GPIO.IN)
>>> # read switch initial position
... 
>>> GPIO.input(7)
False
>>> # read switch after changing positions
... 
>>> GPIO.input(7)
True
>>> GPIO.input(7)
False
>>> # use the switch to toggle the LED
... 
>>> # setup GPIO18 for output
... 
>>> GPIO.setup(18, GPIO.OUT)
>>> # loop forever checking if switch is on or off
... 
>>> while True:
...     if GPIO.input(7):
...             GPIO.output(18, True)
...     else:
...             GPIO.output(18, False)
... 
# Press CTRL-c to exit the loop

>>> import wiringpi
>>> dir(wiringpi)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '_newclass', '_object', '_swig_getattr', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setattr_nondynamic', '_wiringpi', 'digitalRead', 'digitalWrite', 'pinMode', 'pullUpDnControl', 'pwmWrite', 'serialClose', 'serialDataAvail', 'serialGetchar', 'serialOpen', 'serialPutchar', 'serialPuts', 'shiftIn', 'shiftOut', 'wiringPiGpioMode', 'wiringPiSetup']
>>> INPUT=0
>>> OUTPUT=1
>>> wiringpi.wiringPiSetup()
0
>>> wiringpi.wiringPiGpioMode(True)
>>> wiringpi.pinMode(18, OUTPUT)
>>> wiringpi.pinMode(7, INPUT)
>>> while 1:
...     if wiringpi.digitalRead(7):
...             wiringpi.digitalWrite(18, True)
...     else:
...             wiringpi.digitalWrite(18, False)
... 
# Press CTRL-c to exit the loop

In and Out

This post only discusses how to use the GPIO pins for reading input or sending output. Hopefully, the references provided made it clear how to refer to a specific pin using both the RPi.GPIO and wiringpi Python modules. While there are many other possible functions for these GPIO pins, at least how to connect a LED for observing output, or a switch for observing input have been covered.

Update: There is now available at https://github.com/wrightrocket/PythonOnTheRaspberryPi a file called blinkgpio18.py, which also demonstrates the LED connected in these examples.

Gone Google with GPS Map

Gone Google with GPS Map

As WrightRocket, I have ten apps published on Google Play. My first, and most impressive app is GPS Map. I began work on it back in April 2010, and published it October 2010. Currently, it is also the most popular of my apps with about 150,000 downloads and over 25,000 active installs. What's made it so popular, I think, is it's integration with so many Google applications and services. 

GPS Map is supported by advertising, but for those who would like more space to view the map, who don't like ads, or who appreciate the work, I also publish GPS Map Pro as a paid application.

Motivation

Originally, I began work on GPS Map because of something my brother had said. He said he wanted an app with a map that he could put "Placemarks" on. Placemark is actually a kind of KML tag to represent a point on a map. Unfortunately, because I choose to base my app on the Google Maps Android API, my app still cannot meet one of his needs. As Google Maps for Android has begun allowing users to save map tiles for offline viewing, I'm hopeful that one day this will be allowed for applications based upon Google Maps Android API. 

Although GPS Map wasn't able to do offline maps like my brother wanted for traveling in areas without cell phone service, I found it was very useful to me in my travels around my own city, and especially useful for being prepared to travel to other cities.

Most of the features of GPS Map, I have added because I found them to be helpful to me to navigate from airport to hotel, from hotel to office, and from wherever I was to go eat or shop nearby. The ability to use a user provided Image for the Placemark icon, or Marker, was made by my first user or sent me feedback. The ability to display either decimal degrees or degrees in hours, minutes, seconds was another user suggestion.  

Dare I say, when I receive feedback from my users, it strongly motivates me to make changes to my app. The high rankings that I have for my Pro version reflects this, and I think I earned them by always responding and providing solutions quickly. 

I would love to actually get a chance to try to solve more issues that users have, rather than having the number of vague complaints that I can't address like so many that have been made on the ad-supported version. Top developers on Google Play are getting the ability to respond to users' comments, and I have already vocalized my own belief that all developers should have that right in several forums.

Going, Going, Gone Google!

The following are different APIs or Android applications that GPS Map can interface.

7/02/2012

Playing HD videos in Debian on the Raspberry Pi

Playing HD videos in Debian on the Raspberry Pi

UPDATED NOTE: There is a new default operating system for the Raspberry Pi that includes omxplayer. The following post, assumes that you are using the original Debian image for the SD card image of your operating system. To learn more, please see my post Raspbian Optimizes Raspberry Pi.

Update: I have now posted how to build omxplayer directly on the Raspberry Pi in Building Omxplayer for Debian on the Raspberry Pi. So, if you are having trouble getting the following to work, or want to see how software is compiled, check it out!

Browsing through the forums at RaspberryPi.org, I came across a way to get video to play back using the power of the Raspberry Pi's GPU. Using omxplayer it is possible to take advantage of hardware acceleration under Debian. This method will work for either Squeeze or Wheezy, however, you may have to recreate the symbolic link under Wheezy or Sid.

Here's the steps that I followed to make it work:
  • You download the package:
  • Install the package:
    • sudo dpkg  -i  omxplayer_0.0.1-arm.deb
  • Install the package dependencies:
    • apt-get -f install
  • Create a symbolic link (if you are running wheezy/sid):
    • sudo ln -s /usr/lib/arm-linux-gnueabi/libpcre.so /usr/lib/omxplayer/libpcre.so.1
  • Start the GUI (if not already running X Windows):
    • startx
  • Open a terminal and check out omxplayer options:
    • omxplayer --help
Usage: omxplayer [OPTIONS] [FILE]
Options :
         -h / --help                    print this help
         -a / --alang language          audio language        : e.g. ger
         -n / --aidx  index             audio stream index    : e.g. 1
         -o / --adev  device            audio out device      : e.g. hdmi/local
         -i / --info                    dump stream format and exit
         -s / --stats                   pts and buffer stats
         -p / --passthrough             audio passthrough
         -d / --deinterlace             deinterlacing
         -w / --hw                      hw audio decoding
         -3 / --3d                      switch tv into 3d mode
         -y / --hdmiclocksync           adjust display refresh rate to match video
         -t / --sid index               show subtitle with index
         -r / --refresh                 adjust framerate/resolution to video

Omxplayer key bindings (dependent on build)

KeyAction
1Increase Speed
2Decrease Speed
jPrevious Audio stream
kNext Audio stream
iPrevious Chapter
oNext Chapter
nPrevious Subtitle stream
mNext Subtitle stream
sToggle subtitles
qExit OMXPlayer
Space or pPause/Resume
-Decrease Volume
+Increase Volume
LeftSeek -30
RightSeek +30
DownSeek -600
UpSeek +600

Play a full screen 1080p video on the Raspberry Pi in Debian:

  • omxplayer -o hdmi /path/to/FeelGoodPeterLondonAndCrew.mp4

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.