Setting up a Headless Raspberry Pi:Part 3

Now that you have found the IP address of the raspberry pi we can proceed further. We can log into the pi using ssh,the secure shell.
ssh [options] username@remote computer

By default the raspberry Pi has a username “pi” and the password “raspberry”(without quotes).
The complete command looks like:
ssh pi@192.168.0.101

As this is the first time the pi has been connected to, ssh will tell you that, “The authenticity of host [host name] can’t be established”. You don’t need to worry about this.Just proceed by typing yes.

First of all this is a text interface so mouse cannot be used. You move between the different items with the arrow keys and select them by hitting enter. If you need to select a check box on one of the later screens, you hit space, and when you’re done, you move between the list of actions and the buttons at the bottom by pressing the “tab” key.

Have FUN!!

Advertisements

Setting up a Headless Raspberry Pi:Part 2

So, now you have connected your pi to either your router, network or computer. Plug in the power supply and turn it on. You now have a working Raspberry Pi (HEADLESS!!) Let’s configure it. The first thing that we need to do is find the IP address of the raspberry pi.
Depending on how you connected the pi to your network , 3 cases may arise.
1.) Pi connected to computer :
You need to check the log of the computer to find the address assigned to the raspberry pi.In your terminal type:
tail /var/log/syslog

This command shows the last 10 lines of the log file.Look for a line which says dnsmasq-dhcp.If you don’t find it try typing :
grep dnsmasq-dhcp /var/log/syslog
This will search for dnsmasq-dhcp in the system log and return the results.The most recent connection made would be the raspberry pi.The IP address followed by the mac address of the raspberry pi will be printed.
2.)Pi connected to router :
This is simple.Just log into your router’s system setting and look for the routing table where the router registers the IP and mac addresses of the connections it has made.
3.)Pi attached to a network :
Install zenmap:
sudo apt-get install zenmap
Run zenmap as root:
sudo zenmap
Find out your IP range. We are interested in the interface that is connected to the same network as the pi. For example since I connected my raspberry to the router and my router has a netmask of 255.255.255.0, and my system IP is 192.168.0.100, so the router will give out IP address in the range 192.168.0.0-192.168.0.255.
For this case enter 192.168.0.* in the target box of zenmap and let it scan. The zenmap will scan the network and return the IP address alongside the mac address of the pi.

Setting up a Headless Raspberry Pi:Part 1

So you have bought a raspberry pi but missed to buy a screen for it and are clueless right now as to what are you going to do. This post is for you.
I am working on Ubuntu ,however the steps will be very much similar for any other operating system. I assume you do have an internet connection and a spare network socket(either in your system or you have a router).
Stuff required:
1.) A raspberry pi(Model B)
2.) Power adapter for raspberry pi
3.) An SD card(min 4GB)
4.) An ethernet cable(to connect the pi to internet)

Alright then, first you need to set up the operating system for the raspberry pi.
For general usage Raspbian is the most comfortable OS. Of the different distributions, there are a few different images you can get, which have different default setups, but don’t worry about them for now. Just go get the default Raspbian Image from Raspbian

Now, there are some nice easy graphical programs for writing images to disk. If you want to take this route, install usb-creator-gtk and write the raspbian image onto the SD card.
Now you can stick the SD card in the pi and power it up.
However to use it you need to connect it to a network.

If you need to setup a shared connection to your pi, click on the networking icon in the top right hand of your screen and select “Edit Connections” . In the dialog box that pops up, making sure you are on the “Wired” tab, click “Add”. Give the connection a name, click on the “IPv4 Settings” tab and select “Shared to other computers” (all the other fields can be left as they are, though if you aren’t going to be leaving the pi connected to the computer in this manner permanently, you might want to uncheck “Connect Automatically”). Then click ok.

Now click the networking icon again in the top right hand corner, and select the connection you just created (you might first have to disconnect a wired connection if one is set to connect automatically). This will set up a small network consisting of your computer and the pi that is connected to your main internet connection.

Raspberry Pi as a WebServer

Having your own web-server is really awesome if it is as cheap and so much fun as it can be.

Here are the steps to make your very own raspberry pi.

You should have a Raspberry Pi with an SSH connection and a static IP for this to work.

(If you haven’t done so I will soon post how to!!)

To install Apache and PHP:

sudo apt-get install apache2 php5 libapache2-mod-php5

Now restart the service.

sudo service apache2 restart

Now go to the web-browser on your computer and enter the static IP of the PI.
If you get a message saying : “It Works”..
then it sure does.

You can also install MySQL:

sudo apt-get install mysql-server mysql-client php5-mysql

Using WiFi Adapter with Raspberry Pi

It is really tedious to have an Ethernet cable always hanging around with your R pi. A WiFi adapter helps in making the pi module more mobile.In this post I will describe how to use one.

Things you need to have before you can do this:

  • A working raspberry-pi which you can control via your computer or using a screen.
  • A WiFi Adapter

Adding WiFi adapter to the Raspberry Pi:
The WiFi adapter does not start working as soon as you connect it to the Pi. You are still going to need some other means of being able to control the Raspberry Pi either via a keyboard or remotely using a wired network connection.
If you do not have a working Raspberry Pi I will soon post how to setup one.
Configuring the WiFi network:
On the Raspberry Pi (and on Linux in general) we configure our network settings in the file “/etc/network/interfaces”. To edit this file use the following command:

sudo nano /etc/network/interfaces

This opens an editor called nano. It is a very simple text editor that is easy to approach and use.After opening the file in nano to configure your wireless network you want to modify the file such that it looks like the following:

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
wpa-ssid "Your Network SSID"
wpa-psk "Your Password"

You will need to put your own SSID(network name) and password into the appropriate places.
To save the file and exit press Ctrl+X this will write the file to the disk . If nano asks if you want to Save modified buffer? press “Y” followed by hitting enter to confirm the filename.

At this point everything is configured – all we need to do is reload the network interfaces. This can be done by running the following command .

sudo service networking reload

After reloading the network interface (and re-connecting to the pi if you are using a remote connection) – you can now check the status of our WiFi connection by running:

ifconfig

The result should look something like this:

wlan0 Link encap:Ethernet HWaddr e8:4e:06:17:75:79
inet addr:192.168.0.102 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:134501 errors:0 dropped:173 overruns:0 frame:0
TX packets:72985 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:172631666 (164.6 MiB) TX bytes:6815325 (6.4 MiB)

If you see a valid IP address under “inet addr” you can now disconnect the network cable, and enjoy your freedom to move your Raspberry Pi around – because the WiFi connection is up and running!

SimpleCV with Raspberry Pi

This post is about installing SimpleCV onto your R pi .
First power up the pi and connect it to internet.
Next run the following command to install the necessary dependancies:
$sudo apt-get install ipython python-opencv python-scipy python-numpy python-setuptools python-pip

If you haven’t installed git you can do so by typing:

sudo apt-get install git

You can install SimpleCV from source.

mkdir ~/simplecv
cd ~/simplecv
git clone git://github.com/sightmachine/SimpleCV.git
cd SimpleCV
sudo pip install -r requirements.txt
sudo python setup.py develop

This will take a bit of time.
Next connect a compatible camera to the board input and open up the terminal.

raspberry@pi:~$ simplecv
SimpleCV:1> c = Camera()
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument

SimpleCV:2> c.getImage()
SimpleCV:2: 

SimpleCV:3> exit()

Congratulations, your RaspberryPi is now running SimpleCV!