Build Retro Gaming Console with Raspberry Pi PiPlay Gaming OS

In this post I take a journey into the past and relive the days of arcade games. My colleagues at the Hackerspace Phnom Penh decided to make a game arcade using Raspberry Pi running PiPlay (formerly called PiMAME) and couple of old Xbox controllers.

What you need?

  • Raspberry Pi
  • 8GB or 16GB SDCard
  • USB Wifi adapter
  • Two Xbox Controllers
  • Keyboard
  • Powered USB Hub
  • Female-to-Female USB cable
  • HDMI Cable
  • TV

Download the PiPlay 0.8.0 Beta 6 image. The Raspberry Pi can't power all peripherals. You'll need a compatible powered USB hub to power both Raspberry Pi and Xbox controllers. The additional USB slots on the hub could used to connect keyboard during configuration.



# Download the latest PiPlay SD Card.

$ unzip ~/Downloads/piplay-0.8-beta6.img.zip
Archive:  ~/Downloads/piplay-0.8-beta6.img.zip
  inflating: piplay-0.8-beta6.img

# Write to card using unetbootin or dd command. Be Patient, This process takes some time.
$ sudo dd if=./piplay-0.8-beta6.img of=/dev/mmcblk0 bs=1M

# Boot the Raspberry Pi. The default username and password is 'pi' and 'raspberry'.
# Use 'raspi-config' to expand the file system.
# (Optional) While you are at it, You might want to configure timezone change keyboard layout as well.

$ sudo raspi-config

# Configure Wifi using command-line or visual tools http://raspberrypihq.com/how-to-add-wifi-to-the-raspberry-pi/

# If you don't get any sound over HDMI: Try adding the following line to /boot/config.txt

$ sudo nano /boot/config.txt
hdmi_drive=2

#Download some game ROMs and upload them to Raspberry Pi. 

More instructions about the setup are on my HackADay.io Gaming Console with Raspberry Pi PiPlay page.

Game on, Fight!

Fixing Nexus "Red light of death"

Encountered the LG Nexus "Red light of death" problem this morning. The battery had completely discharged itself, trying to charge with power adapter didn't work. Instead of familiar charging animation, the phone had a tiny red light. Web searches suggested to remove the battery and charging it, the process similar to charging a dead car battery using jumper cables. The LG Nexus mobile phone has an internal battery and removing it takes bit of work.

Fortunately I found this forum post that provided a simple solution.

Guys this is complete overkill. There is a documented process for fixing the red light of death. Basically you need to do a battery pull and then let it charge for awhile. HOWEVER, there is a way of simulating a battery pull without actually doing it:
  1. Unplug phone from charger
  2. Press and hold the volume UP button plus power button for 60 seconds.
  3. Release buttons.
  4. Plug into charger.
  5. Wait about an hour for it to charge.
That's it. This is a documented and published fix from LG and Google. The pressing of the buttons does something to simulate a battery pull - probably some sort of flushing of any remaining current out of the phone or tripping some sort of e-fuse like feature.

That fixed the 'Red light of death' problem for me. Hope this helps for you too!


Quake style drop down terminal for Gnome-Shell

Have you ever craved for Quake style drop down terminal?. In this post I'll share how to setup one on Gnome-shell desktop. Let's get started by installing the Drop down terminal extension from extensions.gnome.org. Let's test if it works. Press '~' to active the drop down terminal. Usually U assign 'Alt+F12' hotkeys on my computer. Here is the video of drop down terminal in action.

Let's customize the drop down terminal to launch in full screen mode. In the extension preferences I have set the terminal height to 800px. You have play around with transparency settings to show the underlying windows.

Gnome-shell Drop down terminal extension settings

Another good customization is to launch tmux. You can do this by setting custom command to run instead of launching the default shell.

That's it folks! Now you can enjoy the Quake style drop down terminals on Gnome-shell. Here is video of my setup.

Phnom Penh: A Cultural History

Few months after moving to Phnom Penh, I started to read Milton Osborne's Phnom Penh: A Cultural History. The book really helped me appreciate the city as I walk through its numerous streets and alleyways.

Milton Osborne writes beautiful prose that takes one back to beginning of Cambodia's capital city and its troubled history. I would highly recommend this book to travelers visiting Phnom Penh, Cambodia.


Phnom Penh: A Cultural History (Cityscapes) by Milton Osborne

As a one-time resident of Phnom Penh and an authority on Southeast Asia, Milton Osborne provides a colorful account of the troubled history and appealing culture of Cambodia's capital city. Osborne sheds light on Phnom Penh's early history, when first Iberian missionaries and freebooters and then French colonists held Cambodia's fate in their hands. The book examines one of the most intriguing rulers of the twentieth century, King Norodom Sihanouk, who ruled over a city of palaces, Buddhist temples, and transplanted French architecture, an exotic blend that remains to this day. Osborne also describes the terrible civil war, the Khmer Rouge's capture of the city, the defeat of Pol Pot in 1979, and Phnom Penh's slow reemergence as one of the most attractive cities in Southeast Asia.

About the Author

Milton Osborne is an Adjunct Professor in the Faculty of Asian Studies at the Australian National University, Canberra. He is the author of nine books on the history and politics of Southeast Asia.







Server Monitoring with Monit Tutorial

As you sit down for a lovely Christmas dinner with family and friends, your phone rings. The frantic client is on the line shouting that the server just went down. Don't you wish you had a helpful program that automatically monitors and restarts the servers automatically.

Monit is an open source process supervision program that monitoring your server processes and restarts failed services. It is easy to setup and relatively painless to use.

Here is a quick tutorial to configure Monit to monitor Apache and MySQL servers.


$ sudo apt-get install monit 

# Monit Configuration settings
$ sudo nano /etc/monit/monitrc 
  set daemon 60 
  set logfile /var/log/monit.log
  set idfile /var/lib/monit/id
  set statefile /var/lib/monit/state
  set eventqueue
  set httpd port 2812 and
   use address localhost
   allow localhost
   include /etc/monit/conf.d/*

# Create Apache2 monitoring file 
$ sudo nano /etc/monit/conf.d/apache2 
check process apache with pidfile /run/apache2.pid
    start program = "/etc/init.d/apache2 start" 
    stop program  = "/etc/init.d/apache2 stop"


# Create  MySQL monitoring file
$ sudo nano /etc/monit/conf.d/mysql 
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
    start program = "/etc/init.d/mysql start"
    stop program = "/etc/init.d/mysql stop"

# Check monit configuration for syntax errors 
$ sudo monit -t 


# Start Monit daemon
sudo service monit start 

# Check Monit status 
$ sudo monit status
The Monit daemon 5.3.2 uptime: 4m 

Process 'mysqld'
  status                            Running
  monitoring status                 Monitored
  pid                               2676
  parent pid                        1
  uptime                            4d 8h 1m 
  children                          0
  memory kilobytes                  256380
  memory kilobytes total            256380
  memory percent                    12.5%
  memory percent total              12.5%
  cpu percent                       0.0%
  cpu percent total                 0.0%
  data collected                    Wed, 10 Dec 2014 08:43:13

Process 'apache'
  status                            Running
  monitoring status                 Monitored
  pid                               4230
  parent pid                        1
  uptime                            4d 8h 1m 
  children                          27
  memory kilobytes                  11556
  memory kilobytes total            391484
  memory percent                    0.5%
  memory percent total              19.1%
  cpu percent                       0.0%
  cpu percent total                 0.0%
  data collected                    Wed, 10 Dec 2014 08:43:13

System 'system_foobar.org'
  status                            Running
  monitoring status                 Monitored
  load average                      [0.00] [0.01] [0.05]
  cpu                               0.0%us 0.0%sy 0.0%wa
  memory usage                      666736 kB [32.6%]
  swap usage                        140 kB [0.0%]
  data collected                    Wed, 10 Dec 2014 08:43:1

That's all folks! Now you have a wonderful Christmas!