element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog A child friendly multimedia center  - Part 2: PiFace controlled XBMC
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: pdcleyn
  • Date Created: 19 Feb 2014 7:52 PM Date Created
  • Views 553 views
  • Likes 1 like
  • Comments 0 comments
  • rpibeginner
  • raspberry_pi_projects
Related
Recommended

A child friendly multimedia center  - Part 2: PiFace controlled XBMC

pdcleyn
pdcleyn
19 Feb 2014

Introduction

In this post I will describe my initial tests to use the PiFace to control XBMC. This post is part of a series which is indexed on its introductory post.

 

Installing and configuring needed software

I initially started with a vanilla RaspBMC to get my project started, but soon it turned out that installing the dependency needed to get all software together broke the base functionality. So instead of diving into the reasons why XBMC no longer wanted to run on my adapted RaspBMC, I restarted with a vanilla Raspbian and installed all needed components on top.

 

Installing and configuring XBMC

I installed XBMC following this very nice blogpost: XBMC for Raspberry Pi | Michael Gorven. In order to be able to use the remote interface, you will need to change some settings on your XBMC. In the System section, select Settings and look for Services. Here you should find the section Webserver. Enable the webserver, provide a username and password and select a port number. You can go with the default parameters. r change them if you want to increase your level of security.

 

image
Fullscreen 3704.contentimage_29922.html Download
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>
Fullscreen 1651.contentimage_29923.html Download
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>

We now have a webservice available on our  XBMC to control it. This can easily tested from command line with following commands:

 

pi@rpi ~ $ wget  -q --header='Content-Type: application/json' --post-data='{ "jsonrpc": "2.0", "method": "INPUT.right" , "id": 1 }' http://xbmc:xbmc@10.0.1.100:8081/jsonrpc?request
   

This should move the 'cursor' in XBMC one position right. As you can see, you just need to send the right JSON encoded commands to the webservice in order to control XBMC. Besides controlling XBMC, you can also fetch date from it like the item currently playing, the content of your database, basically all info needed to create a full blown remote interface. I'll probably add some more of this stuff when visualising feedback from the system.  The complete XBMC API is well documented.

 

Installing the PiFace and its libraries

 

The PiFace is an add-on board for the Raspberry Pi offering some easy to control inputs and outputs, some onboard buttons and LEDs and two relays. In the pictures below, you see the my Pi with the PiFace on top. In case you're wondering, the nice little wireless keyboard comes with the XBMC bundle.

Fullscreen 5751.contentimage_29924.html Download
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>

image

In order to control the PiFace, some additional software needs to be installed and the SPI kernel module needs to be activated. This is all well documented on the PiFace Digital Install Guide. These steps worked out pretty well for me.

 

piface-xbmc-remote

 

Using Python (my first python script, so don't be to hard on me ;-) ), it was fairly easy to create a script which catches the key which was pressed on the Piface (for now I just used the buttons on the shield it self) and send a command based on which key was pressed to XBMC.

 

I uploaded the code to GitHub so feel free to fork, extend and improve!

 

I copied the code below as well and it basically consists of two parts: a class 'face' which captures the key presses and a class 'remote' which sends the JSON commands.

 

 

Running the command without parameters will show following usage message:

 

$ ./piface-xbmc-remote.py
usage: piface-xbmc-remote.py [-h] [--debug] host port username password
piface-xbmc-remote.py: error: too few arguments
 

 

Following parameters can be specified at the command line:

 

  • host: the hostname or IP address where your XBMC is running
  • port: portnumber where the XBMC RPC API is reachable
  • username: username configured to have access to the remote API
  • password: password configured for above user

 

Optionally you can add the --debug flag which will show you some basic output when a key is pressed.

 

And finally, following video shows how it works:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Next up ...

 

Now that this basic setup is running, I will try to extend the setup by connecting external buttons. At least the 'enter' functionality is missing today to make this any useful ;-)

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube