Feb 27

Friday Post: DIY Joystick

Hey All!

Happy Friday!  This week I took video of myself building a small Arcade Joystick for the Raspberry Pi.  I hope you all enjoy.  Let me know if you have any questions!

MagPi

The latest issue of the MagPi is out, and in this issue, not only have they announced that they are officially part of the Foundation, but they have also reviewed PiPlay, RetroPie, and Raspicade!

PiPlay received the “Best Features” comment, while RetroPie and Raspicade received “Best of the Bunch” and “Best for Newbies” respectively.

mp1 mp2

It’s a real honor to be mentioned in the MagPi 🙂

Have a good weekend all!

-Shea

Sep 25

Adding a Startup Movie to your Raspberry Pi

Hey All,

So I’ve been playign with trying to do a boot image or a boot movie with the Raspberry Pi for a while now, and all the comments and tips keep going back to a tutorial on how to boot a static image.  It works, but there are a lot of problems with it like failing gracefully and not returning the console window back if you aren’t booting to X.  So I decided to come up with another way.  This is based off the tutorial found here: http://www.edv-huber.com/index.php/problemloesungen/15-custom-splash-screen-for-raspberry-pi-raspbian and looks like this when finished:

Instead of using the program fbi, we will use omxplayer to playback a video file while the Raspberry Pi is booting in the background.

First off, you will want to copy the 15 to 20 second movie file to your Raspberry Pi device.  Anything shorter and the video will end before it’s finished booting and you will continue to see the kernel messages.  You can use any video file that omxplayer can play back, but I like .mov and .mp4 files.

  • You will need to edit your /boot/cmdline.txt file:
    • sudo nano /boot/cmdline.txt
  • Add quiet to the end of the line. It will look something like this:
    • dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet
    • Make sure that is all on one line.
  • Press ctrl-x, type y to confirm save, then press enter to return to the command line.
  • Copy your video somewhere to the Raspberry Pi.  I keep mine in /home/pi/ and call the video video.mov
  • You will now need to create a startup script that will run omxplayer at bootup.  I have modified the script from the above link.
    • sudo nano /etc/init.d/asplashscreen

#! /bin/sh
### BEGIN INIT INFO
# Provides:          asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:      
# Default-Start:     S
# Default-Stop:
# Short-Description: Show custom splashscreen
# Description:       Show custom splashscreen
### END INIT INFO

do_start () {

    omxplayer /home/pi/video.mov &  
    exit 0
}

case "$1" in
  start|"")
    do_start
    ;;
  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  stop)
    # No-op
    ;;
  status)
    exit 0
    ;;
  *)
    echo "Usage: asplashscreen [start|stop]" >&2
    exit 3
    ;;
esac

:

 

  • Press ctrl-x, y to confirm saving, and press enter to return to the command line
  • Now you need to set the file to be executable
    • sudo chmod a+x /etc/init.d/asplashscreen
  • And activate it
    • sudo insserv /etc/init.d/asplashscreen

You should now be ready to go!

Reboot your Pi and enjoy the startup movie.

-Shea

Aug 08

Youtube-Viewer

Hey all,

As you saw in my previous post / video, I was running Youtube videos in fullscreen on my little display.  I was using an application (really just a 2000+ line perl script) that does this for me.  The program is called youtube-viewer (github)

Gcala posted a nice guide on how to set it up and has given me permission to also repost it here.  I’m making some modifications as I had to do a couple changes, but it works.

  1. sudo apt-get install gcc-4.7
  2. export CC=gcc-4.7
  3. export CXX=g++-4.7
  4. sudo apt-get install libwww-perl
  5. sudo cpan -i XML::Fast
  6. sudo wget https://github.com/downloads/ssilverm/youtube-viewer/youtube-viewer -O /usr/bin/youtube-viewer
  7. sudo chmod +x /usr/bin/youtube-viewer

Now just type youtube-viewer on the command line and you are good to go 🙂

List of Commands
all               : play all the results in order
next              : go to the next page (same as <ENTER>)
back              : return to the previous page
login             : will prompt you for login
logout            : will delete the authentication key
[integer]         : play the corresponding video
i, info [i]       : show more informations about one video
c, comments [i]   : show video comments (e.g.: c 19)
r, related [i]    : show related videos (e.g.: r 6)
v, videos [i]     : show author's latest videos
p, playlists [i]  : show author's latest playlists
subscribe [i]     : subscribe to author's channel
like, dislike [i] : like or dislike a video
fav, favorite [i] : favorite a video (e.g.: fav 3)
[keywords]        : search for youtube videos
3-8, 3..8         : same as 3 4 5 6 7 8
8 2 12 4 6 5 1    : play the videos in your order
-argv -argv2=v    : set some arguments (e.g.: -u=google)
e, edit-config    : edit and apply the configuration
load-config       : (re)load the configuration file
/my?[regex]*$/    : play videos matched by a regex (/i)
reset, reload     : restart the application
q, quit, exit     : close the application

Let me know if you have any issues or questions!

-Shea

Aug 06

Youtube in my Raspberry Pi? or Is that an LCD in your pocket or are you just happy to see me…

LCD Screen

This weekend has been fun.  I got my 2.0″ LCD Display from Adafruit in!  It’s an amazing little screen.  Bright, Sharp, Colorful.  MAME, Quake, NeoGeo games all look great on it.  A concern I had was how to power the little screen.  It can take 5v – 12v, and the connector is just two bare wires for power.

After testing the screen with a regular power supply, I decided I wanted to see if I could power it via the GPIO power pins on the Raspberry Pi itself.  I was concerned about the amperage it would require, but after connecting it to pins 2 and 6 (5v and GND), and powering on the Pi, they both turned on and I was watching Raspbian bootup.

Youtube

On the Raspberry Pi Forums, gcala contributed a post with a how to on getting Youtube to play from the command line to omxplayer.

Here is a video I took after getting youtube-viewer running on my Pi:

Hope you all enjoy this!

-Shea