Posts

Spotted – First Raspberry Pi Prototype at Trinity College Dublin

While wandering around the Fail Better exhibition at the Trinity Science Gallery I spotted the first hand-built Raspberry Pi prototype!

raspberrypi prototype

Prototypes are great!

This one sports an Atmel processor. Now I would love to see the protype software that ran on this early raspberry pi, anybody?!

Mathematica to be bundled with Raspberry Pi

The register reports that Mathematica is to be bundled with the RaspberryPi which to my ears is fantastic news as Mathematica is by far my favourite mathematical tool even if the forces of convention force me to use the slightly duller Mathlab most of the time…

sudo apt-get update && sudo apt-get install wolfram-engine

Fedora released for Raspberry Pi

Another OS option for your Pi – Fedora Remix has been released for the Raspberry Pi, it is based on the Fedora ARM secondary architecture project, more details can be found here:

http://zenit.senecac.on.ca/wiki/index.php/Raspberry_Pi_Fedora_Remix_FAQ

I love the 4th. item in the FAQ, it is entitled – “Why is the Remix slow?” lol

It makes me very curious, just how slow is it? I guess I will have to install it to find out! :-)

Raspberry Pi – Restart / Shutdown your Pi from Python code

Here’s something that you probably won’t want to do, but how can you restart or shut-down your Pi from software in python code?

 

Well it’s both quite simple and quite tricky all at the same time, but in summary you can run some python code like this to shell out to the shutdown command:

 
def restart():
    command = "/usr/bin/sudo /sbin/shutdown -r now"
    import subprocess
    process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
    output = process.communicate()[0]
    print output
 

Executing this python code is like running the following in bash:

 
sudo shutdown -r now
 

Which will reboot the system. Note that the shutdown command is sudo’d and that the full paths to sudo and shutdown are specified.

 

Now for this code to work it must be run in the context of a user that has sufficient privileges (e.g. the pi user). If the python code is being executed by a user that does not have the necessary permissions then the it will not work – for example when running this code as part of my Web2py application the code initially had no effect as it was being run as the apache www-data user.

 

To fix this problem you need to add the user in question (in my case www-data) to the sudoers file (for the shutdown command). Edit the sudoers file by issuing the following command in bash:

 
sudo visudo
 

Then add the following lines to the end of the file remembering to ‘www-data’ to your target user:

 
 
www-data ALL=/sbin/shutdown
www-data ALL=NOPASSWD: /sbin/shutdown
 
 

And hopefully that should do it!

 

Machine Vision on the Raspberry Pi anybody?

Here’s is a blog post that has some pictures of the (hopefully) soon to arrive camera for the Pi.

 

http://www.raspberrypi.org/archives/3224

 

It will be interesting to see what cone be done from a machine vision or computer vision point of view with the Pi once cameras are available.

 

Raspberry Pi – Install boost 1.50 C++ Libraries on Wheezy

If you are doing modern C++ development these days you will be using the boost libraries. I have started using the Raspberry Pi as a stand-in ARM platform for some smart-cam development while I wait for the actual hardware to become available and as such need to install boost. To this end, the boost 1.50 libs can be installed on wheezy as follows:
[crayon lang=”Shell”]
sudo apt-get install libboost1.50-all
[/crayon]
Now for a little example of using and building with the libs, consider this little test program that uses the boost regex library:

[crayon lang=”cpp”]

#include
#include
#include

int main() {

std::string text(“a fat cat sat on the mat”);
boost::regex re(“\\w+”);

boost::sregex_token_iterator i(text.begin(), text.end(), re, 0);
boost::sregex_token_iterator end;

for( ; i != end ; ++i ) {
std::cout << *i << ' '; } std::cout << std::endl; return 0; } [/crayon] If we stick this code into a file called it.cpp then we can build it using C++0x (C++11 ish), the standard c++ lib and the boost regex lib like this:

 

[crayon lang=”Shell”]
g++ -std=c++0x -lstdc++ -lboost_regex it.cpp
[/crayon]
This will output to a.out, which can then be executed like this:

./a.out
 

Games For the Raspberry Pi

When setting up the Raspberry Pi for the kids I initially found it quite difficult to find any good games to install, the python games are great for learning to program etc, but as video games they are a bit dull.

 

Then I came across this list of games that was put together by the The MagPi, they have tested them on the Pi – this saves you the hassle of having to weed out the bad or half-working games yourself. The list can be found here:

 

http://www.raspians.com/Knowledgebase/1-debian-wheezy-games-repository-sudo-apt-get-install/

 

If you are wondering which games to try for young kids (3->5 years) you might try supertux, it is great fun with good graphics and sound. To get the most out of these games you will need to have audio working, depending on your set-up this can prove tricky but it is worth it!

 

Setting up EdiMax WiFi on Raspberry Pi (EdiMax EW-781Un)

Here is a good article about how to setup a wifi dongle on your Raspberry Pi.

 

http://dembtech.blogspot.ie/2012/09/how-to-install-wifi-on-raspberry-pi.html

 

I used the terminal version of wicd – wicd-curses over SSH to set-up my EdiMax EW-781Un as I don’t have a screen connected to my smart-cam simulator. You don’t have to install any other software as a driver for this hardware is bundled in the Rpi build.

 

The wicd-curses UI is a little confusing so be careful what you press on in there as you can easily disconnect your existing wired network and leave yourself with no network connection (as I did!), if this happens you may have to power cycle your pi to get a network connection back.

 

In the UI you should see a list of the available WiFi networks, use the up/down arrows to highlight the one that you want to connect to and then press the right arrow key (donated as -> in wicd-curses) to get to the configuration screen where you can set-up the WiFi key etc.

 

Once you have configured the connection you can connect by pressing C in the main screen, when you connect to WiFi you will be probably dumped off the wired network connection so you will have to SSH in again on the new IP address that was assigned to the WiFi adaptor.

 

Web2py and Apache running on Raspberry Pi

As part of my smart-cam simulation project I have installed web2py and Apache on a Raspberry Pi, the idea here is to simulate the ARM platform on which the smart-cam web UI software will eventually run by using the Pi until the real hardware is sorted out and available. This will allow me to do some proof-of-concept software development sooner rather than later.

 

I was expecting a difficult enough install but it turned out to be very easy, I just executed the automated set-up script that is documented here, under the section called ‘One step production deployment’ (ubuntu).

 

To summarise the steps, with the Pi connected to the network, open a terminal window and execute the following:

 

[code]
wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
chmod +x setup-web2py-ubuntu.sh
sudo ./setup-web2py-ubuntu.sh
[/code]

 

Running setup-web2py-ubuntu.sh took a good while (15 mins?), but when it was complete I was immediately able to view the web2py welcome page from another computer on the network!

 

Kids Drawing and Painting app for Raspberry Pi

If you are setting your Raspberry Pi up for the kids you may have noticed the lack of a bundled paint and drawing app, well not to worry TuxPaint is available for a quick install, just launch a terminal and run the following command to install it:
[code]
sudo apt-get install tuxpaint
[/code]
Then you can launch it from one of the program folders off the main menu (can’t remember which!)

 

Happy Christmas! Have fun with your Raspberry Pis!