Getting started with the Raspberry Pi

The Raspberry Pi has been mentioned everywhere as being the next big thing to help educate and inspire people about computers – both software and hardware. I decided to jump on this bandwagon, so got  hold of a couple of Raspberry Pi units. Here are my notes on getting things going with the Raspberry Pi.
Note that I am an electrical and electronic engineer who dabbles in software when needed, so my knowledge of software and computer programming is limited. This is a collection of my thoughts and notes on getting the RPi running. I have chosen a couple of applications: a media centre, a home energy use monitor and a CNC machine controller.

I had a few uses for my Raspberry Pi’s:

  • A networked media centre
    • This will be an ‘on all the time’ media centre with a large USB hard-drive to contain all types of media (sound and visual).
    • It should connect to a projector
    • It should be able to stream video from the internet
    • This will be next to my router, so wifi connection is not required
  • A home energy monitor
    • This will be based upon the EVE platform, developed by CISECO and friends.
    • It will monitor:
      • electricity usage
      • Gas usage
      • Water usage
      • Room temperatures
      • Weather data
    • Data will be uploaded onto a website
    • High energy use will notify people via texts
    • This will require wifi connection to the network
  • A CNC milling or laser machine controller
    • Control 3 x Stepper motors for X-Y-X (via SPI stepper motor controllers)
    • Control power output stage (for spindle or laser)

So those are the plans. First I just need to switch the thing on….

Networked Media Centre

Background research

Looking around on the web finds a load of information, as usual.

XMBC

http://xbmc.org/

This is an open source media player and entertainment hub. It has been around for a while and has been used on various X-boxes. It is ideal for the Raspberry Pi,

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=35&t=30152

Openelec

http://openelec.tv/

Raspbmc

http://www.raspbmc.com/

This is a mimimal Linux distribution based on Debian that bring XMBC to the Raspberry Pi.

http://alexlittle.net/blog/2013/01/17/experiences-setting-up-raspberry-pi-as-media-server/

DarkELEC

http://darkimmortal.com/2012/05/darkelec-raspberry-pi-optimised-openelec-fork/

This is a Raspberry Pi optimised XBMC fork.

Installation

Note: it turns out these instructions have just been done on LifeHacker, so head there for proper instructions.

I decided to go with Raspbmc, mainly due to the line “No knowledge of Linux is needed. If you want to use the Raspberry Pi as an XBMC front-end you can do exactly that with no knowledge of how anything works.”. Its not that I don’t want to learn, I’d just like to get something working then move from there.

I was using Windows 7 so followed these instructions:

http://www.raspbmc.com/wiki/user/windows-installation/

I downloaded the installer program and installed it onto a blank SD card. This took a couple of minutes.

I placed the SD card into the RPi and applied power.

The red power light came on then all the lights switched on.

I am using a relatively cheap HDMI -> VGA adaptor (as I don’t have an HDMI monitor and didn’t want to upgrade the three monitors I already use. I also wanted to use a projector which has a VGA input).

The HDMI ->VGA adaptor is an active one (it uses some power and does conversion) which cost around £20. It works really well.

A blue progress bar appears – this takes a few minutes to run. You also need a wired network connection for it.

This took a while but installed perfectly.

It asked about a broken repository, but as I had no input device added then I could not choose an option. I plugged in a mouse and a keyboard, but they did not work.

I pulled the power lead and switched it back on with the mouse and keyboard plugged in. This time success – I could use the mouse.

It all looked like it was working great, but I had no files installed. I am wanting to use an external hard drive to store all the files. I used an old external powered hard drive and tried starting again.

This worked perfectly and showed all the info on the hard drive.

Great stuff.

To control the media center using my phone I used Yatse, on the advice of my brothers install.

This installed easily and connected straight to my XMBC RPi installation.

Now I have a controllable media centre for the house.

Wifi Adaptor

The last thing to do is to get the wifi working.

I had a relatively cheap wifi USB adaptor, which I plugged in and the switched the unit on/off.

This did not work straight away. I check this post for more info: http://anup.info/blog/2012/07/29/raspbmc-wifi

This also did not work – the ftp link does not connect.

Need to install the “network manager” plug-in.

Hmmm. not working.

I went through a few instructions my brother had given me:

Going to command prompt.

Type “lsub” to list the things attached to the USB.

One of them was the Ralink RT5370 wireless adaptor.

I ran a “sudo apt-get update”, to ensure things were up to date.

I then did “apt-cache search RT5370”. It took a while but came back with no errors.

I then followed this link (http://lucsmall.com/2012/09/21/ralink-rt5370-usb-wifi-dongle-raspberry-pi/ ) and went through the instructions at it started to work.

But then it stopped my Raspberry Pi. I had heard about the power supply issues and when the wifi adaptor switched ON (the blue light came on) then it shut down the display.

I needed a better power supply for the USB devices, so I set about makiing one from a £1 non-powered pound shop hub.

Powered USB hub from non-powered USB hub

The power supply issues stem from the fact that there is a small resettable fuse protecting each of the USB ports. They are each allowed to take a maximum of 150mA,which is much less than the USB standard of 500mA. The way to get around this is to use an externally powered USB hub.

I did not have one lying around, but I had done some work on switched mode voltage regulators, so had some of the components for them lying around. I decided to take a cheap non-powered USB hub and add an external power supply. In addition I could also make the unit run efficiently from a 12V DC source, which means I could technically directly plug it into my off-grid solar power system (but thats a project for the future…).

I decided to use the cheap and ubiquitous LM7805 linear regulator, with a view to upgrading to a switched DC/DC converter when I had the correct components.

The LM7805 can supply 1A maximum and, as I had a load of them, I decided to use one for each USB port and also one to power the RPi. This meant I could use one 12V power supply and power: the RPi board, the USB peripherals and the external hard drive, which uses a 12V 2A supply. In total I needed around 5A of head room at 12V. This is similar to many external LCD monitor screens, so I will use a PSU from one of them.

Here is the time-laspe film of me building a power supply for the RPi. This had 3 x 7805 linear regulators to supply 3 x 1A 5V supplies from the input voltage (12V DC expected). A pound shop USB hub is butchered to make the 4 x USB outputs. A 1N4001 diode stops any potential current backflow to the RPi board. The their outputs are wired to provide current to the RPi board, and one each for 2 x 2output USB ports.

I will be swapping this for a more efficient switched mode supply when I have the time/parts/money, but this is a proof-of-concept quick design.If you’d like to know any more info then please get in touch.

Trying DarkELEC

I’d been told about DarkELEC http://darkimmortal.com/tag/darkelec/ as an optimised XBMC install for the RPi. I downloadd the image file.

I then used these instructions to put the image onto an SD card: http://elinux.org/RPi_Easy_SD_Card_Setup#Copying_the_image_to_an_SD_card_on_Windows

This required installing another program onto my windows machine.

I tried it out but its basically jast a version of XBMC with a few plug-ins already installed (maybe I’m missing something here?…).

I decided to go back to raspbmc.

Accessing files via the network

One feature I wanted is for anyone on the network to be able to access the files on the external hard drive and upload/download to that hard drive. I decided to research that further.

It seems that this is an integrated feature in XBMC, called UPnP (Universal Plug and Play): http://wiki.xbmc.org/index.php?title=UPnP

Here is some more information about file sharing on XBMC:  http://wiki.xbmc.org/index.php?title=File_sharing and http://wiki.xbmc.org/index.php?title=Windows_File_Sharing_%28SMB/SAMBA/CIFS%29

I am using Windows 7 for my main computer and wanted to share files using that. I found this link: http://forum.xbmc.org/showthread.php?tid=63116 

Then when I actually tried this I realised that you just need to open a Windows Explorer window. Then click on ‘Network’ -> then click on ‘RASPBMC’. You can then see the files on any device connected to the RASPBMC. This means anyone can access and stream the files.

Adding iPlayer to the RASPBMC

I followed these instructions to install the iPlayer add-on: http://www.stus.net/blog/2012/08/16/add-bbc-iplayer-to-raspbmc-or-any-xbmc-illustrated-instructions/

Adding other on-demand TV to RASPBMC

I used the instructions on this link: http://djb31st.co.uk/blog/catch-up-tv-on-raspberry-pi-raspbmc-bbc-iplayer/

Conclusions

XBMC is pretty darn great and works well out of the box. My only issue was to do with USB wifi connector (Note: 22/1/13 still not solved).

Extra:

In trying a different version of RPi linux you will notice (in Windows) that the SD card only looks like a small card (typically 50MB). This is because it is partitioned. You must perform a full format of the SD card to then start using it again. I used this SD card formatter: https://www.sdcard.org/downloads/formatter_3/

This must be installed and then run using the full (overwrite) option, found thanks to this thread: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=13138

Media box

I built a laser cut box to hold everything and keep it looking nice:

alt

There is space for the 250Gb external hard drive and two shelves which hold the RPi and the powered external hub.

alt

alt

One day I’ll get the front panel to glow, but that’s another project.

alt

alt

Here it is connected up to the router and ready to run.

Home Energy Monitoring System

This was the second challenge for the RPi.

Background research

To Do

CNC machine controller

I have a small CNC machine which I control via a parallel port using EMC2 (also called LinuxCNC). I wanted to update this machine to use better/faster stepper motor controllers and have a base from which I could build a CNC machine or a laser cutter. I did not want to do anything heavy on this machine, I only

Background research

To Do

Leave a Reply

Your email address will not be published. Required fields are marked *