Tag: Raspberry Pi

Raspberry Pi 2 announced

I didn’t even expect this, was very surprised to see that a Raspberry Pi 2 has been announced. You can read more from the blog at Raspberry Pi as found here.

I currently have a Model B+, but I will also probably buy one of the new Raspberry Pi 2 units, as I wouldn’t mind seeing how fast it is compared to the previous model and also trying Windows 10 on it too.

 

Goodbye Raspberry Pi

You might not seen any more posts from me in regards to the Raspberry Pi, as I sold off my two units I had. I had fun with them and managed to do a number of things with them. In the end I just felt I didn’t have anything more I could do with them, so I decided to sell them on to someone who wanted the excitement to tinker.

Realtek RTL2838 DVB-T tuner on Raspberry Pi with TvHeadEnd success

I decided to give my DVB-T usb dongle (Realtek RTL2838) another go with the Raspberry Pi and TvHeadEnd. As I thought the newer version of Raspbian if available might address the condition I had previously where I had no dvb device after plugging it in. Older post found here.

It would appear it was a good to check this out again.

I downloaded the latest Raspbian available from the Raspberry Pi site. The version available at the time of this post is the one below;

2013-12-20-wheezy-raspbian.zip

I installed to an SD card and booted my Raspberry Pi.

I plugged in my Realtek RTL2838 tuner and it detected fine and when I checked for the dvb device structure, it was populated all correctly, which never happened previously at all.

[26848.628778] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
[26848.741110] usb 1-1.3: New USB device found, idVendor=0bda, idProduct=2838
[26848.741147] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[26848.741166] usb 1-1.3: Product: RTL2838UHIDIR
[26848.741183] usb 1-1.3: Manufacturer: Realtek
[26848.741199] usb 1-1.3: SerialNumber: 00000001
[26848.851456] usb 1-1.3: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
[26848.857238] usbcore: registered new interface driver dvb_usb_rtl28xxu
[26848.921368] usb 1-1.3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[26848.921447] DVB: registering new adapter (Realtek RTL2832U reference design)
[26848.965698] usb 1-1.3: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
[26849.001551] r820t 0-001a: creating new instance
[26849.014447] r820t 0-001a: Rafael Micro r820t successfully identified
[26849.021655] Registered IR keymap rc-empty
[26849.022183] input: Realtek RTL2832U reference design as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/rc/rc0/input0
[26849.022231] rc0: Realtek RTL2832U reference design as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/rc/rc0
[26849.022262] usb 1-1.3: dvb_usb_v2: schedule remote query interval to 400 msecs
[26849.035148] usb 1-1.3: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected

And device files

root@raspberrypi:~# ls -la /dev/dvb
total 0
drwxr-xr-x  3 root root   60 Jan  1 14:51 .
drwxr-xr-x 13 root root 3080 Jan  1 14:51 ..
drwxr-xr-x  2 root root  120 Jan  1 14:51 adapter0
root@raspberrypi:~# ls -la /dev/dvb/adapter0/
total 0
drwxr-xr-x 2 root root     120 Jan  1 14:51 .
drwxr-xr-x 3 root root      60 Jan  1 14:51 ..
crw-rw---T 1 root video 212, 4 Jan  1 14:51 demux0
crw-rw---T 1 root video 212, 5 Jan  1 14:51 dvr0
crw-rw---T 1 root video 212, 3 Jan  1 14:51 frontend0
crw-rw---T 1 root video 212, 7 Jan  1 14:51 net0

Next I configured other tools before compiling and installing the TvHeadEnd per the steps below;

sudo apt-get install unzip libcurl4-openssl-dev pkg-config git build-essential dvb-apps

cd ~
git clone https://github.com/tvheadend/tvheadend
cd tvheadend
./configure
make
sudo make install

At which point I executed the binary via “tvheadend -C” and I could now access the web interface for the TvHeadEnd software via http://raspberrypi_ip:9981/ where I could now see my dvb tuner was detected.

At this point you now have to configure the network and channels according to your region. Can be a bit tricky, but I followed the info available at the post here (step 14). This helped me make sense of the sequence of actions.

Below is a screen grab showing VideoLan Client from my Windows 7 desktop and a web browser in the background attached to the TvHeadEnd which is running on the Raspberry Pi with the RTL2838 tuner.

tvheadend_rtl2838_rpi_vlc

 

EDIT: And to get my TvHeadEnd to auto start with boot I performed the following additional steps.

Created /etc/init.d/tvheadend file with the contents below;

#!/bin/bash
### BEGIN INIT INFO
# Provides: tvheadend
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1
# Short-Description: start/stop tvheadend Server
### END INIT INFO

TVHNAME="tvheadend"
TVHBIN="/usr/local/bin/tvheadend"
TVHUSER="tvheadend"
TVHGROUP="tvheadend"
PIDFILE=/var/run/$TVHNAME.pid

start() {
if [ -e $PIDFILE ]; then
PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
if [ -n "$PID" ]; then
echo "$TVHNAME already running (pid $PID)."
exit 1
fi
fi
echo -n "Starting tvheadend: "
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user ${TVHUSER} --exec ${TVHBIN} -- 
-u ${TVHUSER} -g ${TVHGROUP} -f -C
echo "Done."
}

stop() {
if [ -e $PIDFILE ]; then
PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
if [ -n "$PID" ]; then
echo -n "Stopping $TVHNAME: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name ${TVHNAME}
echo "Done."
else
echo "$TVHNAME is not running."
fi
else
echo "$TVHNAME is not running."
fi
}

status() {
if [ -e $PIDFILE ]; then
PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
if [ -n "$PID" ]; then
echo "$TVHNAME is running (pid $PID)."
else
echo "$TVHNAME is not running."
[ -e $PIDFILE ] && exit 1 || exit 3
fi
fi
}

case "$1" in
start) start ;;
stop) stop ;;
restart) stop && sleep 2 && start ;;
*) echo "Usage: $0 [start|stop|restart|status]" && exit 1 ;;
esac

exit 0

Now set the script as executable using below;

sudo chmod 755 /etc/init.d/tvheadend

Create a tvheadend group

sudo groupadd tvheadend

Create a tvheadend user that is part of the video group and tvheadend group.

sudo useradd -g tvheadend -G video -m tvheadend

And now set the initscript tvheadend to startup and shutdown as system does

sudo update-rc.d tvheadend defaults

Raspberry Pi and Xbox 360 camera as a Webcam

Have wanted to configure an Xbox 360 camera as a Webcam on a Raspberry Pi. I’ve simple followed the post here.

I wasn’t interested in having the camera capture images with motion, as I want to act more like a traditional webcam that captures an image every set interval. To perform that task you just need to enable the option below in the motion.conf (/etc/motion/motion.conf) and you can test it by running “motion -n” as root (or via sudo).

# Make automated snapshot every N seconds (default: 0 = disabled)
snapshot_interval 120

With the interval set below it will create a file every 120 seconds. You’ll also get a lastsnap.jpg symlink which links to the last/latest capture.

I modified the configuration to also append some text to the webcam capture and overlay it on the picture. A demo of what I captured is below and how it looks.

01-20140101005600-snapshot

Raspberry Pi with RTL8188CUS 802.11n wifi adapter – Update

I’ve actually been playing around with my Realtek RTL8188CUS wifi adapter and found that the configuration of the wifi adapter without wpa_supplicant seems to be a better way to go.

The information I found below was taken directly from the source Far Robotics Website. Thanks to those folks for posting the 3 methods below;

Installing rtl8188cus and rtl8188eu based wifi adaptors for raspbian without using wpa_supplicant.

Edit the file /etc/network/interfaces using the following format for networks with WPA/WPA2 security. Use the command sudo nano /etc/network/interfaces to open and edit the file. Exit the editor and save the file using keys cntl-X, Y, Enter.  Enclose Your-Network-Name and Your-Network-Password within quotation marks as in the example below.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "Your-Network-Name"
wpa-psk "Your-Network-Password"

Edit the file /etc/network/interfaces using the following format for networks using WEP security. Use the command sudo nano /etc/network/interfaces to open and edit the file. Exit the editor and save the file using keys cntl-X, Y, Enter. Do not use quotation marks around Your-Network-Name and Your-Network-Password.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid Your-Network-Name
wireless-key Your-Network-Password

Edit the file /etc/network/interfaces using the following format for networks using no security. Use the  command sudo nano /etc/network/interfaces to open and edit the file. Exit the editor and save the file using keys cntl-X, Y, Enter. Do not use quotation marks around Your-Network-Name.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid Your-Network-Name

If you have success and/or failure, be sure to post a comment. Feedback is always most welcome.

Screenly OSE on Raspbery Pi demo

This post is a follow up to my previous one about using an Raspberry Pi as an Information Display, as found here.

I wanted to capture some videos that show what the output looks like on a TV when the Raspberry Pi boots for the first time and what the assets look like as they get displayed.

Below is two videos (both available in 720p) that will help demonstrate this. The first is the Raspberry Pi being booted.

The other clip shows the assets being displayed post the splash screen being displayed. I have a shortened video clip being displayed of a 1920×1080 movie trailer, followed by 2 test pictures.

The web interface to administer the Screenly OSE application is shown below.

Raspberry Pi as an Information Display

A few months back I was looking for a device that could display an image, a webpage and/or a video.

I had also been playing around with having a Raspberry Pi to perform this task, since it has HDMI out and they were fairly well priced. I thought this would make an excellent platform for what I needed.

I did some research and came up with some possible solutions and even tinkered with some of those options.

Eventually I settled on an application called Screenly which runs on the Raspbian distribution, or you can download a pre-made image for it. Screenly is a commercial application which has many added benefits, however has a price tag associated with it.

I noticed that they still make the Screenly OSE edition available and it did everything I needed, and what I imagine many small businesses would also want to use (who might not otherwise already have an information display).

Screenly OSE is the open source edition and is free.

Whats needed:

  • Raspberry Pi (recommend using Model B 512MB edition)
  • 8GB SD-Card
  • USB power lead
  • HDMI lead

Installation:

Install Raspbian onto the 8GB SD-Card (as downloaded from here). The procedure to perform this should be followed from the same website.

Boot the Raspbian SD-Card in your Raspberry Pi and follow the process/procedure as outlined here. Follow process under Option 2. This will enable you to install the Screenly OSE application and other dependent software.

Configuration:

If everything goes well, the Raspberry Pi when booted will pickup a DHCP address via the network port. This IP address is displayed during the boot of the Raspberry Pi. At which point you can access it via the http://aaa.bbb.ccc.ddd:8080 address. This is the management interface to the Information Display so you can add your assests. i.e. Images, Web URL and/or Video.

Please note that it only supports the following media types:

Screenly currently three types of media:

  • Videos (Screenly uses omxplayer as the video back-end. It is currently limited to MP4/h264-encoded videos.)
  • Images
  • Web-pages

Please note that Adobe Flash media is not, and will most likely never be, supported. Also, images and web-pages will be rendered in 1920×1080, so adjust your content for this size.

Post my successfully testing, I’ve subsequently gone on to configure two (2) Raspberry Pi’s running Raspbian and Screenly OSE within a business environment which render assests that include web pages and images. These have been running fine with little to no manual intervention since install. Over 45+ days uptime on the units.

I’ll post a video showing the boot sequence of a Rasberry Pi running Screenly OSE and it displaying some test assets in the next few weeks.

If you’d like more information and/or assistance with the installation of a Screenly OSE on a Raspberry Pi for your business (or organisation etc) you should contact me via the page here. This way I can quote you on a complete setup including/excluding hardware, and/or just consult you on part of the work etc.

RasPBX, FreePBX Trunk setup for MyNetFone

As per my previous posts, I use MyNetFone as my SIP provider and I run a Raspberry Pi with RasPBX (which is FreePBX for the Raspberry Pi ready to install/tweak and configure).

Below is a quick run down on how you can configure your SIP Trunk for MyNetFone on this device, which is working for me currently.

General Settings:

Trunk Name: mynetfone
Outbound CallerID: [configure based on your 09nnnn number or your DID if you have one]

Outgoing Settings:

Trunk Name: mynetfone-sip-out
Peer Details: (as below)
disallow=all
allow=alaw&ulaw
authname=09nnnn
canreinvite=no
dtmfmode=rfc2833
fromuser=09nnnn
host=sip00.mynetfone.com.au
insecure=very
nat=yes
pedantic=no
qualify=yes
secret=password
type=friend
username=09nnnn

Registeration String:

09nnnn:password@sip00.mynetfone.com.au/09nnnn

Raspberry Pi and RasPBX

Last week, on a Friday night of all things. Decided I would give RasPBX another go. After spending a bit of time on it had managed to configure my DID, my extension and setup inbound routes.

I configured enough to be able to leave it running until I can configure the other features I was using on my more manual setup. Which includes time based rules and IVR. Will get to those items in the next few days.

Will do another post shortly that shows how I got my SIP provider (MyNetFone) setup via the Trunks.

 

Raspberry Pi and Asterisk

I’ve had my Raspberry Pi and Asterisk setup running now for nearly 2 months. It hasn’t failed me once in this time.

If you remember back I ended up installing Raspbian and configuring Asterisk manually from command line. This setup suits me, as I want to learn about how it all works, not learn how to use one of the dedicated images that has a fancy web GUI (and learn how to use that). I might end up changing to that type of setup eventually, however what i have now works with all the features I need.

Will be sure to post back as time progresses with this setup.