Raspberry Pi – Jack of all trades.

Raspberry Pi is a sort of jack of all trades when it comes to being a single board computer based on the Arm processor. It can be a desktop, media player/streamer, web server, forensics machine, and do most of what all linux based machines can do. Pictured is the Raspberry Pi with some of it's arm based cousins.
it is not a good idea to run the raspberry pi off another computers usb port.
If you need a power adapter, consider: http://www.instructables.com/id/Raspberry-Pi-power-cable-adapter/
Another Arm based install: http://www.instructables.com/id/Give-your-Cisco-Linksys-NSLU2-some-muscle-part-1/ Yet another arm install is in the linux hints instructable.
Quickie monitor: http://www.instructables.com/id/McGuyver-monitor/
Note: if you ever want to get back to the first boot menu
$ sudo raspi-config

Step 1: Network setup.

You will want to go to the services tab on your router to make the IPaddress of the Raspberry Pi semi-permanent. Get the mac address of your Raspberry Pi and then decide what address you want to use. We used for whatever reason.

Llater when you want to SSH into the unit it will make it easier. One thing to note is that you must use a username on the Raspberry Pi to log into it.

$ ssh [email protected]

better (use whatever name you set up for the raspberry pi in the router):

$ ssh pi@raspberrypi

Also see: http://www.instructables.com/id/Red-October-network-discovery/

Note: By using ssh means you do not have to leave a keyboard attached to the Raspberry Pi. Saves energy and less cables to deal with.Raspberry Pi - Jack of all trades.

Step 2: Debian install hints.

If you are installing the Debian install for Raspberry Pi, there are a few hints and tips that can make things easier,

With the opening menu that comes up when you first run the image, be sure to enable ssh, set your time zone and CHANGE YOUR PASSWORD.

You want to get the system updated:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

It should take a while, but that is ok.

What kind of disk space do you have

$ df -h

What kind of memory do you have?

$ free

You may want to add some software package sets.

$ sudo apt-get update
$ sudo apt-get tasksel

With tasksel, you have to be careful, Any item unchecked will remove that item if it is already installed. (i.e gui environment. For a headless server that is no big deal.

To install the web server just choose that option and ssh. The apache and sqllite  will be installed. The sql is for postgresql for most debian versions and you may not need that for most things.

$ sudo tasksel

You will want to take advantage  of the full space of your memory card. Generally it only used 2 gigabytes leaving the rest free, if your card holds more than 2 gigabytes. Programs like Gparted and stretch out the free space to take full advantage of the card. You will have to run gparted pon another machine. Do not forget to shut down the raspberry pi
before removing the memory card(s).

Normally the Debian linux install starts up with the text or command line environment. If you want to start up the gui use:

$ startx

You can make the gui the default start up mode but I recommend against it.

You will also want to install screen so you can detach remote sessions.

$ sudo apt-get install screen

For details see: http://www.instructables.com/id/linux-screen-play/

$ screen

Other linux instructables that can be of assistance:


Step 3: Memory useage.

(Try this at your own risk and it is subject to change).

Changing RaspberryPi RAM CPU:GPU Ratio

The Raspberry Pi comes with 256MB of RAM, included in the Broadcom BCM2835 System on chip, which also contains the CPU, GPU and DSP in the same package.

That 256MB of RAM is split between the CPU and GPU at boot time of the Pi, and by default is a 50:50 split, 128MB each. This works well for video decoding and 3D graphics, but if you know you won’t be using such graphically intensive applications, you can change this split to give the CPU a bit more.

To do so, you just need to copy the pre-made .elf files to the start.elf file in /boot, and reboot:

For 192MB for the CPU and 64MB for the GPU:

sudo cp /boot/arm192_start.elf /boot/start.elf

For 224MB for the CPU and 32MB for the GPU:

sudo cp /boot/arm224_start.elf /boot/start.elf

For the default equal split of 128MB for both CPU & GPU:

sudo cp /boot/arm128_start.elf /boot/start.elf

Step 4: Minimal web server hints:

The most simplest web server you can set up on the Raspberry Pi is to use python. Go to a directory that you want to sever out and use:

$ python -m SimpleHTTPServer

Go to your web browser and point it to the Raspberry Pi using port 8000

Alternatively, you could add a simple web page called index.html:

Hello,  World!

Note This server is not secure so use carefully!

If you wanted something simple, but light you could also consider Nweb, Goto http://www.ibm.com/developerworks/systems/library/es-nweb/index.html for the details.

You can also install a light apache web server and sqilite with

$ sudo tasksel install web-server

For a blog install see: http://www.instructables.com/id/Raspberry-Pi-simple-blog-server/

Do not forget to check out: http://www.instructables.com/id/Web-related/

Step 5: Write your own programs!

Two popular languages are C (compiled) and Python (interpreted). You can use Nano to edit the source files. Here are two simple hello world examples. You can use nano to edit your files. I prefer vim, but it has to be installed

$ sudo apt-get update
$ sudo apt-get install vim

To edit a file:

$ nano filename.ext


#include <stdio.h>
int main ()
  printf ("Hello World!\n");

$ gcc helloworld.c -o hw


print “Hello, World!”;

$ python helloworld.py

You may want to keep all your executalbes in one place and not have to use the ./ prefix.
$ mkdir ~/bin
$ PATH=$PATH:~/bin

Move your programs to that directory.

$sudo mv hw ~/bin/.

Step 6: Teaching your Raspberry Pi to talk.

First you need to add some drivers:

$ sudo apt-get update
$ sudo apt-get install alsa-utils
$ sudo modprobe snd_bcm2835
$ sudo aplay /usr/share/sounds/alsa/Front_Center.wav

You need to add some software:

$ sudo apt-get install festival espeak

Plug in the speakers.

You need to check the sound out put level with alsa mixer. Mine was set way low. Use the up arrow to increase the volume.

$ alsamixer


$ echo now is the time for all good men | festival –tts

Read a file out loud.

$ festival -tts index.html

More Information at: http://www.instructables.com/id/Text-to-speech-with-linux/

Step 7: LTSP – thin client.

You can use your Raspberry pi as a thin client for the ltsp server (see: http://www.instructables.com/id/Another-almost-free-computers-thin-client-set-up/). it does not support etherwake though yet. I used an older version for testing and it connected to an Ubuntu 10.04 ltsp server. Also worked with a composite monitor, but you need one that will support the higher resolution.

Go to  http://www.berryterminal.com/doku.php/start and download the image zip

$ wget http://www.berryterminal.com/dl/berryterminal-20120602.zip
–2012-10-28 14:37:46–  http://www.berryterminal.com/dl/berryterminal-20120602.zip
Resolving www.berryterminal.com (www.berryterminal.com)…
Connecting to www.berryterminal.com (www.berryterminal.com)||:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 24450329 (23M) [application/zip]
Saving to: `berryterminal-20120602.zip'

100%[======================================>] 24,450,329   622K/s   in 40s

2012-10-28 14:38:32 (592 KB/s) – `berryterminal-20120602.zip' saved [24450329/24450329]

Unzip it.

$ unzip berryterminal-20120602.zip
Archive:  berryterminal-20120602.zip
inflating: berryterminal-20120602.img
extracting: berryterminal-20120602.img.md5
inflating: berryterminal-20120602.img.sha1

Copy it to your memory card (sudo dd if=berryterminal-20120602.img of=/dev/sd?)

In my case

$ sudo dd if=berryterminal-20120602.img of=/dev/sdb
Safely remove the card from your pc and insert it into the Raspberry Pi

Make sure your ltsp server is up and running. Connect the raspberry pi to the ltsp network and boot.

Bingo!! you have a thin client!

Step 8: Media player.

Installation Script on a took a while, but it completed without a hitch. Everything is menu driven and for the most part pretty straight forward. Using an old B&W tv for testing purposes. If you use an hdmi monitor, you have have to change some settings to work correctly. There is a menu to help with those settings. Weather detected the area of the isp and grabbed the weather info easily. Streamed music from the web from a nearby radio station without a hitch. Even supports local media streaming from upnp and other protocols. Streamed video from the usb stick. When the Mythtv server is back up, I will give you an update.

Somehow the memory card becamed foobarred, so I plan to reinstall raspbmc.

See: http://www.raspbmc.com/download/

Use the xbox remote: http://wiki.xbmc.org/index.php?title=How-to:Wire_your_XBOX_DVD-Remote_for_USB

Follow this simple procedure:

Open the receiver's plastic case using a small screw driver. Carefully pry around the case. Solder the wire to the receiver using the picture below

Note: This might damage the casing of the dongle.

1 Color Coded Pinout

If you're using a standard USB cable you should just be able to match the colors and solder away, but to be sure check your cable with a continuity tester according to the USB spec provided here.Raspberry Pi - Jack of all trades. schematic

Red = Positive Power (+5V DC) White = Data – Green = Data + Yellow = Unused Black = Ground (0V DC)

2 Lirc Config


#Chosen Remote Control REMOTE=”None” REMOTE_MODULES=”lirc_atiusb lirc_dev” REMOTE_DRIVER=”” REMOTE_DEVICE=”/dev/lirc0″ REMOTE_SOCKET=”” REMOTE_LIRCD_CONF=”” REMOTE_LIRCD_ARGS=”-r”


#Enable lircd START_LIRCD=”true”

#Don't start lircmd even if there seems to be a good config file #START_LIRCMD=”false”

#Try to load appropriate kernel modules LOAD_MODULES=”true”

# Default configuration files for your hardware if any LIRCMD_CONF=”lircd.conf”

#Forcing noninteractive reconfiguration #If lirc is to be reconfigured by an external application #that doesn't have a debconf frontend available, the noninteractive #frontend can be invoked and set to parse REMOTE and TRANSMITTER #It will then populate all other variables without any user input #If you would like to configure lirc via standard methods, be sure #to leave this set to “false” FORCE_NONINTERACTIVE_RECONFIGURATION=”true” START_LIRCMD=”” /etc/lirc/lircd.conf:

# brand: Microsoft Xbox DVD Receiever (also works with generic) # remote control: Xbox remote or any remote using RCA DVD player codes

begin remote

name XboxDVDDongle bits 8 eps 30 aeps 100

one 0 0 zero 0 0 gap 163983 toggle_bit_mask 0x0

begin codes LEFT 0xA9 UP 0xA6 RIGHT 0xA8 DOWN 0xA7 SELECT 0x0B 1 0xCE 2 0xCD 3 0xCC 4 0xCB 5 0xCA 6 0xC9 7 0xC8 8 0xC7 9 0xC6 0 0xCF MENU 0xF7 DISPLAY 0xD5 REVERSE 0xE2 FORWARD 0xE3 PLAY 0xEA PAUSE 0xE6 STOP 0xE0 SKIP- 0xDD SKIP+ 0xDF TITLE 0xE5 INFO 0xC3 BACK 0xD8 end codes

end remote If using the Xbox DVD IR dongle, add this line to the bottom of /etc/modprobe.d/blacklist.conf:

blacklist xpad
Note: With the latest raspbmc network install, I had to change the default sound output from hdmi to analog/You also may want to change the screen demensions. Not hard to do, but if you have not done it before, it can be a little scarry. Took a couple of tries for the raspxbmc to see my firefly music server, then it worked well. Local area network files work fine. Off network was a bit slow in loading, but still played at normal speed.. i.e. youtube

Step 9: All for now.

Gave you a bit much to chew so More instructables coming!!

To power down, there are several ways, but I like:

$ sudo poweroff

Check out: http://www.instructables.com/id/Linux-themed-instructables/

Step 10: Gpio Connector Cable:

You can use an old “AT” RS232 to motherboard adapter cable for the Raspberry pi. You may want to cut off the RS232 db25 end so you can tine the wire ends to use in some other adapter board. Actually I needed the DB25 end for a PC project, So, I killed two birds with one stone. One less thing in the storage box.Sdlo you can use old computer jumper wires if you do not need to use the whole header.

Note: Looks better than using a disk drive cable.

Update: Went to the local electronics store and bought a 26 pin adapter and used some unused ribbon from an old drive cable.

Step 11: Security Camera Server.

It is wonderful that the Raspberry Pi (aka RPi)  is supported by Debian linux. There already so much software for debian that the Raspberry Pi can take advantage of. One such pice of software is Motion. Motion is a security cam server software than does not require a gui, That is you can run Motion without a gui installed or activated on the Raspberry Pi.

Let's get your system up to date (might take a while if you have not updated very recently).

$ sudo apt-get update ; sudo apt-get upgrade
$ sudo apt-get dist-upgrade

Now let's install Motion

$ sudo apt-get install motion.

Does the RPi see your camera?  (aka list usb devices attached.)

$ lsusb

Bus 001 Device 004: ID 046d:08a9 Logitech, Inc. Notebook Deluxe

if not, you may need to get a more mainstream camera. usually Logitech sets the standard. I just used a cheap refurbished knickoff. Your output will vary..

Do a liittle configuration:

$ sudo nano /etc/motion/motion.conf

In here there are a few basic changes that you need to perform:

  •  Daemon = OFF to ON
  •  webcam_localhost = ON to OFF

You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.

To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:

sudo nano /etc/default/motion

Then change the value “start_motion_daemon=no” to “yes”

Let's get started:

Finally you can start the motion service to stream the web cam images

sudo service motion start

Then after about 30 seconds browse to the new web interface, which should be at the below URL (where is your Raspberry PI’s IP address yours may vary)

Hint: if you do not have direct access to your RPi, you can use https://www.instructables.com/id/Red-October-network-discovery/ to find iit on the network Frequently I will hook up the RPi to the network without a keyboard, mouse, or monitor and then remote into the unit,

for more information see: http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome

Note if you want to use an ipcamera it is easy but you have to know about the camera. I ended up going to the zoneminder wiki and found the answer for my camera. Setup is the same, but you have to add two lines to motion.conf.

netcam_userpass user:password

For us  it was:

netcam_userpass user:password

Step 12: Use Other Systems As a Teminal.

You can even use the Nexus 7, touchpad, or another computer  as a terminal. You just need to have what is know as an rdp client. Most of the touchpads have them now.

To access the raspberry pi, you will need to install a vnc server or use xrdp:

$ sudo apt-get install xrdp.

Note the gui does not need to be running on the raspberry pi. Better if it is not.

Step 13: New Installer!

There is now a new installer that will let you choose the setup you want. For more information go to:

Step 14: Simple Electronics Example.

Use at your own risk.

The Raspberry Pi per se does not have analog ports like the Arduino. though you can get converters that can be attached to the gpio or use an r2r setup. To light an led, you will need to use at least two pins. A gpio and a ground pin. You will also need an led and an appropriate resistor. Once you master these simple steps you can additional electronics and control quite a few things. Remember the gpio only uses very low voltage. Additional safety circuitry is needed for other projects.

Note: you can use jumper wires from  older computers if you do not need to use the whole header.

old version
# Turn light on
cd /sys/class/gpio
# Turn on pin but defaults to low.
echo 17 > export# Set port direction in this case we aredoing output.
echo out > gpio17/direction
# Set pin high and turn on led.
echo 1 > gpio17/value
#Turn light off
echo 0 > gpio17/value
New version: You have to use the full path with commands.
# Turn light on
cd /sys/class/gpio
# Turn on pin but defaults to low.
echo "17" > /sys/class/gpio/export# Set port direction in this case we aredoing output.
echo "out" > /sys/class/gpio/gpio17/direction# Set pin high and turn on led.
echo "1" > /sys/class/gpio/gpio17/value
#Turn light off
echo "0" > /sys/class/gpio/gpio17/value ================================ Using a button 

Controlling the LED with the button

Now let's put input and output together, and use the state of the button to turn the LED on or off.

The RPi has only one ground pin which you need to connect both the LED circuit and the button circuit to. If you have an M/M wire, you can easily do this by connecting the - column to ground like we did with the LED. If not, it might seem like there isn't space to have a resistor, a wire connected to ground, and the button all in one group of five columns. But to make extra space, you can place the button bridging the gap in the middle of the breadboard.

One possible configuration has:

  •  Wires connecting pin 3 to 7d, 6 to 9j and 11 to 1f.
  •  The LED connecting 1g (+) to 2g (-).
  •  The resistor connecting 2h to 9h.
  •  The button in terminals 7e7f9e and 9f.

With that set up, you can have the LED light up as long as the button is not pressed:

while true; docat gpio0/value > gpio17/value

(Use control-C to interrupt this and return to a prompt.) Or as long as the button is pressed:

while true; doread val < gpio0/value
    echo$(( ! val )) > gpio17/value

Or to toggle the LED every time the button is pressed:

while true; doread val < gpio0/value
    if((val== 0 &&last== 1 )); thenread state < gpio17/value
        echo$(( ! state )) > gpio17/value

(This last one makes use of the fact that if you try to read an output pin, it tells you its current value.)

If that all worked, congratulations! Now you should probably install an actual GPIO library, and turn your mind to more interesting projects.

People are now writing code to control servos with your Rpi:
See http://code.google.com/p/raspberry-gpio-python/wiki/PWM

Step 15: TBA.

Note do this at your own risk we will not be resoponcible for any or all issues. Contact a professional if you are the least bit unsure. Do not solder connections while anythiing is connected to the power supply..  Be also sure to properly cover any connections or open lines to prevent electrocution and or death..

Finally have the parts for the desktop based pc. coming soon.

AT case (Not ATX) with AT PS (An ATX  PS and case coould be adapted.https://www.instructables.com/id/Atx-to-At-ps-test-cable/)
Motherboard connectors for AT PS (MOdify an extsion cable or desolder from an old at motherboard.)
Several plain blades (some people call them tongues) for slot covers
1 – Female rca mounting
1 – Old stereo mini-plug cable
1 – rca mono cable
1 stereo cable
1 or more Taspberry Pi(s  in a case   (just one in this case.)
2 female ethernet adapter
1 backplane from on old unused ethernet card (have to use a dremel tool for the female adapter to and then super glue.)
1 unused ethernet cable to cut and splice into the female ehternet adapter.
Startedthe power cable, but not testeed.
Started making the audio/video blade for the back of the personal computer aka p.c. need to solder connections.

1 stereo cable > 1 – Old stereo mini-plug cable
1 – rca mono cable > 1 – Female rca mounting
1 ethernet cable > 1 female ethernet jack.glued into a blade.

Step 16: Freebasic.

So happy that I can run even if it is an old version of freebasic on the Raspberry Pi. Freebasic is a lot like but not exactly like qbasic. The first thing I did was to port a spreadsheet to the unit.

First thing I did was to download the tarball and the extract it.

$ tar xvf fbc-0.91.0-pi-debian.tar.gz

Install it.

$ sudo ./install.sh -i

And lastly install a few goodies to make the install complete.

$ sudo apt-get install libxext-dev libncurses5-dev libx11-dev libxpm-dev libxrandr-dev libstdc++6-4.4-dev

You should be able to write a test program to see if the install worked.

In an editor, type a simple program. vim test,bas

PRINT “hello!”

Compile it

$ fbc test.bas

Run it.

$ ./test hello!

The is more to it than that but that is a quickie starter.

Step 17: Rpi 2

Stacking the newer rpi's.

Source: Raspberry Pi – Jack of all trades.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top