Sunday, 29 July 2012

Raspberry Pi...the basics

After playing for a day with my Raspberry Pi, here I'm compiling a list of tools that would help you setting RPi up correctly. As I'm testing everything under Python and I want to control it using my laptop (Windows 7), I need different ways to be more productive and faster when developing on it. In my case I'll need a Python editor like geany, GPIO library and remote desktop using Xming and PuTTY via SSH. As stated in my previous post I'll build a small robot using the following mechanical and electronic parts (All of them bought from HobbyTronics) expending less than £50:
Update the system first:
root@raspberrypi:~# apt-get update
Installing Geany:
root@raspberrypi:~# apt-get install python geany xterm
Downloading GPIO RPi Python from Google code:
root@raspberrypi:~# wget
--2012-07-29 10:20:19--
Connecting to
HTTP request sent, awaiting response... 200 OK
Length: 10824 (11K) [application/x-debian-package]
Saving to: `python-rpi.gpio_0.3.1a-1_armhf.deb'

100%[======================================] 10,824      --.-K/s   in 0.1s

2012-07-29 10:20:27 (71.2 KB/s) - `python-rpi.gpio_0.3.1a-1_armhf.deb'
saved [10824/10824]
Installing the package GPIO RPi:
root@raspberrypi:~# sudo dpkg -i
python-rpi.gpio_0.3.1a-1_armhf.debSelecting previously unselected
package python-rpi.gpio.
(Reading database ... 54876 files and directories currently installed.)
Unpacking python-rpi.gpio (from python-rpi.gpio_0.3.1a-1_armhf.deb) ...
Setting up python-rpi.gpio (0.3.1a-1) ...
Testing the GPIO Rpi library:
Just open Geany and paste the following source code:

import RPi.GPIO as GPIO
import time


GPIO.setup(11, GPIO.IN)
GPIO.setup(12, GPIO.OUT)

#set up output 12 as true.

GPIO.output(12, GPIO.HIGH)

while True:
        input_11 = GPIO.input(11)
        print "%s %r" % ("Input 11 value is", input_11)

Compile it and run it. It should display the value of Pin 11. If you can change the state of that input, the display will show the change.

Starting up the SSH server:
root@raspberrypi:~# service ssh start

Download PuTTY and Xming and install them:
Once installed, run PuTTY and under Session options, use the IP of the RPi. (to get the IP just run the ifconfig command):

And enable the option X11 forwarding under connection options:

Once done, open the connection and use your credential to login (by default user: pi password: raspberry).

As soon as you are in, type startlxde and Xming will take over and it will display the RPi desktop on your local machine.

Check out the parameters for Xming as the short-cut should call: "...Xming.exe" -clipboard -rootless.

Related links:


Post a Comment