Page Contents
Introduction
I have developed a full series of videos on the Beaglebone – an Embedded Linux device that is perfect for getting started and great for embedded Linux development. An alternative to the Beaglebone is the Raspberry PI – it is a great platform that is low cost and relatively powerful – however, it has one major advantage over the Beaglebone and that is in playing MPG4 and MPG2 video files as it has built in hardware decoders for these video formats. As a result my work with the Raspberry PI on this site, mainly discusses the use of the Raspberry PI for multimedia type applications.
The first use of the Raspberry PI here is in deploying XBMC on the Raspberry PI using the OpenElec Linux Distribution.
Building OpenElec for the Raspberry PI
In this video series I am going to explain how you can build a XBMC (xbmc.org) Media Player for a home television using the OpenELEC Linux distribution and deploy this on the Raspberry PI platform. This video starts from the very first steps and is aimed to be an introductory guide for those who are not used to compiling and building software under Linux.
Warning – Please make sure you have at least 15GB free on your building system and be warned that the compile could take up to 10-12 hours (or more) depending on the performance of your machine and the speed of your download link.
The Raspberry PI is a very low cost and small single-board computer developed in the UK by the Raspberry Pi Foundation. It is a powerful device and additionally it has hardware accelerated support for MPG4 and MPG2 decoding, making it a perfect choice for a home media centre.
Video 1 – Building and Deploying XBMC and the OpenElec Linux Distribution
Just to remind me – the default username is root and the password is openelec.
Adding IR Remote Control to XBMC on OpenElec/Raspberry PI
This video demonstrates how we can add infra red (IR) remote control functionality to the setup using a cheap IR receiver that is connected directly to the GPIO pins of the Raspberry PI.
The three electronics parts used for this video are:
1. An IR Receiver the TSOP34838 (google that code with digikey, farnell, mouser etc.) For example – digikey part number 751-1386-5-ND ~1.41 ea.
2. A 100 ohm through hole resistor (any power dissipation) For example – digikey part number P100BACT-ND ~0.08 ea.
3. A 4.7uF electrolytic capacitor (any voltage) – please note the polarity on this component. The +ve lead (longer one) needs to be connected to the 3.3V line (red) and the -ve lead (shorter one) to the GND line (black). For example – digikey part number P5177-ND ~0.17 ea.
For reference, here is my full lircd.conf file (/storage/.config/lircd.conf):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | # # this config file was automatically generated # using lirc-0.8.0(userspace) on Fri Jul 28 02:45:39 2006 # # contributed by Lloyd Williams <binary_frog|chatcircuit.com> # # brand: SKY # model no. of remote control: URC 1650-00 B00 - 9RC16P-1014 Sky+ Rev 6 # devices being controlled by this remote: SKY+ DVB-S receiver & PVR # # Modified by Derek Molloy for the Raspberry PI OpenELEC Distribution # begin remote name SKY+_DVB-S bits 8 flags RC6|CONST_LENGTH eps 30 aeps 100 header 2691 890 one 427 460 zero 427 460 pre_data_bits 17 pre_data 0x3FF3 gap 20000 suppress_repeat 4 min_repeat 1 toggle_bit 0 rc6_mask 0x100000 begin codes KEY_POWER 0xF3 KEY_EPG 0x33 KEY_BACK 0x82 KEY_EPG 0x81 KEY_POWER2 0x0A KEY_INFO 0x34 KEY_UP 0xA7 KEY_LEFT 0xA5 KEY_RIGHT 0xA4 KEY_DOWN 0xA6 KEY_OK 0xA3 KEY_CHANNELUP 0xDF KEY_CHANNELDOWN 0xDE KEY_TEXT 0xC3 KEY_EXIT 0x7C KEY_AUDIO 0x7E KEY_REWIND 0xC2 KEY_FASTFORWARD 0xD7 KEY_PLAY 0xC1 KEY_PAUSE 0xDB KEY_RECORD 0xBF KEY_STOP 0xC0 KEY_RED 0x92 KEY_GREEN 0x91 KEY_YELLOW 0x90 KEY_BLUE 0x8F KEY_NUMERIC_1 0xFE KEY_NUMERIC_2 0xFD KEY_NUMERIC_3 0xFC KEY_NUMERIC_4 0xFB KEY_NUMERIC_5 0xFA KEY_NUMERIC_6 0xF9 KEY_NUMERIC_7 0xF8 KEY_NUMERIC_8 0xF7 KEY_NUMERIC_9 0xF6 KEY_NUMERIC_0 0xFF KEY_MENU 0x7F TV 0x7B end codes end remote |
Adding Connectors to the Raspberry PI Header
Ideally you need leads with a female header so that they can connect to the male header of the Raspberry PI. These are often referred to 0.1″ as there is 1/10th of an inch between each pin. In metric they are referred to 2.54mm spacing leads.
This is a very quick video guide to working with custom PCB connectors. I recently had to make a custom connector for my Raspberry PI, which has a bank of male headers. I looked at a few different options and in the end I decided I would invest in a crimp tool to create my own custom cables. While the experiences are still fresh in my mind I decided I would make this video in case that it will be of benefit as an introductory guide to others who are trying to do the same sort of thing. The video will discuss regular ribbon cables, fixed length pre-crimped cables, and custom crimped cables. I will also give a guide to how to crimp 0.1″ male and female PCB interconnect cables and describe what a proper crimp connector should look like.
These videos are not as education focused as other videos that I have presented; however, it does allow us to build a platform on which I can demonstrate how we can integrate electronics devices in the home; in fact, a smart television is the perfect point to act as an information hub for the built environment… and to do this, we may need to integrate sensor inputs from all over a house together and provide aggregated intelligent analysis of that information to the householder.
Great Service to the Embedded Community and in particular the beginners
I found the second video very helpful, Derek, thanks. A couple of points however were not immediately clear to me, being a relative noobie to Linux.
First, the current issue of openelec (3.0.3) and xbmc (12.2 Frodo) arrives with the GPIO pins already configured. So, when I typed:
cat /sys/kernel/debug/gpio
I found the screen reporting:
gpio_16 (led0 ) out hi
gpio_17 (lirc_rpi ir/out) in lo
gpio_18 (lirc_rpi ir/in) in lo
and when I added the basic IR receiver components (IR Rx connected into pin 12 (GPIO_18), the RPi reported on the next reboot (I looked using your suggested “dmesg” command) that, yes, there was an IR receiver on that pin. No modprobe action was necessary.
Somewhere in the depths of the current openelec site, it suggests that there is built-in support for certain remote controls in openelec 3.0 and that it was unnecessary to add the lircd.conf file, but I couldn’t spot anything, and nothing much I tried seemed to make anything happen. So, following the outline of your video, I added the file, tested by remote control (a cheap universal remote from Radio Shack set to emulate a Philips DVD/TV combo remote (RC5 protocol), and that was (almost) that.
I also got the multiple button problem you reported at the end of the video. The cure for me was along the lines you suggested, except I kept gap set to 113500 as generated by the irrecord step you described, but had to set suppress_repeat to 6 and min_repeat to 1 to make it all calm down.
So now it’s all working nicely. Thanks again, Derek.
Oh, one or two minor things (and not criticisms). In the video, you zip over a few steps of typing things in, and the camera is too far away to see what those commands were. One was the editing of lircd.conf using the vi editor (Yes, I worked out after a while that you’d typed “vi” and some other stuff, around 21 mins into the video, and found a website with some basic commands for vi so I could figure out the rest) and another was something to do with chmod (uga+x? No idea) which fortunately I didn’t have to do. Also, you mention backing up the file at one point, but I’ve no idea the commands you entered to make that happen. Camera was too far away to catch it.
Anyway, for those following along, in the vi editor:
Typing “a” enters the “add text” mode, and hitting ‘esc’ exits the mode.
Typing “:x” after you’ve done your changes saves then and exits vi
Typing “:q” exits but doesn’t save the edits (That command was helpful once or twice!)
But, as I say, I got it all going, very much down to this video, and it was appreciated, Derek.
Thanks!
Thanks Andrew,
That is very useful feedback – thanks for taking the time as it will be helpful for others.
The “chmod ugo+x” was to set the executable flag on a file or to make a directory searchable by users, group and others. It may not have been necessary depending on where I did it, but hopefully it explains the step. Your guide for VI is also very useful.
Thanks again,
Derek.
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your posts, I guess I am not the only one having all the enjoyment here! Keep up the excellent work.
Hi Derek
Awesome tutorial and very eager to get this all started but have come up to a stumbling block straight off the bat. I am using Crunchbang bistro and when I try access my Raspmbc via ssh they way you have set out I am getting a incorrect password access denied.
I would really like to get this project working and truly hope that you can assest me.
Many thanks in advance.
Matthew
please ignore last comment went back and figured out that I was using the raspbmc build so following you first tutorial on the openelec build.
Matthew
Hallo Fachmann,zune4chst ein herzlichen Dank ffcr diese Website!Ich habe mir das neusete Image ffcr eine 4GB SD-Card gedownloaded und dieses mit 7Zip entpackt (ergab eine *.img.tar Datei), die ich dann mit win32disklmager auf die SD-Card geschrieben habe. Das dauerte auch ne Weile und ergab eine 3,69 GB RAW Partition. So weit so gut.Mein Raspberry tat aber nichts!???Kann es daran liegen, dass ich die Original Micro-SD meines HTC Desire verwendet habe? Ich glaube, da mal etwas gelesen zu haben.Nur erge4nzend: Das (Original HTC) Netzteil soll 1 Ampere Strom liefern.Ein bidfchen Hilfe wird erbeten. DANKE im Voraus!Grudf De Roony
Hi Derek
Ok tried to build that openelec version of xbmc and have come up against a wall of problems. I downloaded VirtualBox and followed your tutorial. First once I unmount my sd card I keep getting a message that it is being used no matter what I try I keep getting this message then when I tried to install java first time it froze after 3 hours and second time it froze right at the end of the install (4 and half hours later). It came up with a message that it couldnt find Python 2.7 and when I tried to download that it gives me a message newer version already installed. So now 3 am in the morning 12 hours after I started I am about ready to use a hammer to fix it all for good.
I was wondering if it is possible to find an already built version of the openelec version and if so can you point me in the right direction as much as I would love nothing more then to do it myself I am at my wits end.
Many thanks for the awesome tutorial and hope you have a kick ass day.
Matthew
Hi
Anyone out there able to help. Have gone through the Open Elec build step for step again for the 3rd time yesterday. All went well and I started the build at around 5 pm yesterday afternoon now fast forward to this morning 10:44am and the build is still going. I am using an old NB 500 Toshiba netbook with 2 gb ram and running CrunchBang OS. Is this in anyway normal or do I have an issue and need the end the build here.
Thanks
Matthew
Hi,
Anyone tried transmitting IR signals from the GPIOs on the beaglebone black?
Derek, any experience on using lirc for this purpose? Please help.
Hello Derek.
How do i use two independent transmitters using the pi? Tried SET_TRANSMITTERS but at a loss. In need of real help.
Hi, most of the Sky remote controls on eBay are the version 9 2014, is this compatible with the version 6 timing in your config file?
Thanks for sharing this. You made it look easy enough to want to do, and compared to soldering and heat shrinking wires like you showed us in the video I would indeed “save time” by learning from your experience! So thank you for sharing it!
Hi Derek,
Its is grateful that you are launching the Exploring Raspberry Pi book.
The Exploring Raspberry Pi Paperback would be Imported on 5 Apr 2016.
I would like to buy this book asap.
Could you please confirm me the date so that I would buy this book on 5th Apr 2016 from the below.link:
http://www.amazon.in/Exploring-Raspberry-Pi-Derek-Molloy/dp/1119188687?ie=UTF8&ref_=nav_custrec_signin
I am awaiting for this book from long time.
Thanks again.
Hi Derek,
By When “Exploring Raspberry Pi” Paperback would released. SO that we can buy this ASAP.
Please let us know. we are eagerly waiting for this BOOK.
Thanks.
Hi Rakesh, it is with the publisher now, so it shouldn’t be too long
Kind regards, Derek.
I was going through your book exploringRPI and it is pretty well written. Kind of surprised. I got stuck on a few parts where you introduce OOP. The program uses system calls inside c++ to write GPIO values. I tested your code in the book and noticed your board was a newer version than mine. Same software compiler. I had to re-arrange the location of one system call or it gave me errors. I think that is most likely due to the hardware inside the soc not having the updated version for the compiler? I got the program to compile but the systemcall that writes to the sys/gpio/gpioX/value I don’t think is working. The function is opening and closing the file but I don’t think it is writing the value’s of 1 or 0 to the gpiopin value. When displayState() is returned it doesn’t print the value? I checked and the gpio pins are exported (enabled) (direction) is good. I previously had an issue with one of the gpio pins not receiving commands due to the processor using that gpio for wlan or something. Couldn’t figure out how to re-assign the gpio. I am pretty sure there is a problem with cout::fstream in the program or needing an older version that would compile with the older raspi3 soc v4 instead of v7.
Thanks again for this great resource.
Hi Derek,
I just read “exploring Raspberry Pi” and really enjoyed it. One issue that I’ve been struggling with is imaging processing using OpenCV on a RPi3. Reading and decoding H.264 or MJPEG video frames to work with OpenCV uses a ton of CPU power. Yet omxplayer plays HD videos with effectively no cpu load. Have you come across any approach to utilizing the RPi3 GPU through OpenMax or MMAL in OpenCV?
Thx,
Dayle
Will this also work for Rpi 2 Model B ?
hi sir,
whatever you did in beagle bone black can i do with raspberry pi..
is raspberry pi is useful for linux device driver.
I review hundreds of products every year, including books, and for the first time in memory, I’m running a second look review of Exploring Raspberry Pi. Many of the challenges I face in my overarching cybernetic house project are already solved within its pages in ways I hadn’t noticed the first time through because I had been approaching the project differently.
I’m hopeful for some happy coincidences now, if you just happen to have manifested any of the following and can suggest chips for these tasks:
– An IR emitter that, from mid-ceiling, can send remote control codes to a TV (etc.) on any wall.
– A small audio amplifier that can drive a small (1″) speaker to play from an on-SD library of recorded short MP3 or WAV files to be audible in a 15 x 15 room that may have other audio sources playing
One more small challenge…
If you go to bed and doze off while watching TV, there’s no easy way for automation to know if the TV set is on or off… I’m thinking of monitoring current with a split-core transformer, knowing that background tasks in the set are likely to result in a non-zero off-state current. My intuition is to use a comparator and either a small reed relay or an optocoupler to deliver a 3.3V logic 1 or 0 over a wire pair to the RPi – any thoughts?
My congratulations again – and celebration – of the remarkable job you did with Exploring Raspberry Pi. My cybernetic house project puts about a hundred of them on a wired Ethernet network (with no WAN connection except NTP) and places a lot of reliance on a connected MySQL Server and MQTT for intercommunications. I also suggest to your attention the DALI 2-wire interface for controlling lighting, ceiling fans and so on – in some ways, it may remind you of I2C.