Category Archives: Raspberry Pi

Sharing WiFi Internet connection with Raspberry Pi through LAN/Ethernet (Headless Mode)

After having setup the Raspberry Pi to work in headless mode directly without installing anything on it as described in this post, we then tinkered on to share WiFi internet connection with the Raspberry Pi through the LAN/Ethernet connection which we established in our earlier post.

 

What you want to do:

  1. Share PC/Laptop’s WiFi internet connection with Raspberry Pi through LAN/Ethernet connected to Raspberry Pi

What you have:

  1. Raspberry Pi running the latest Raspbian Wheezy
  2. PC/Laptop with WiFi Internet connection and a Ethernet Jack (LAN Connector / RJ45)
  3. A working SSH connection with Raspberry Pi (direct access, explained here)

What you don’t have:

  1. Display Device for the Raspberry Pi (HDMI enabled display unit / Old TV)
  2. Direct Internet connection for the Raspberry Pi (LAN or WiFi)

Extra Stuff you need:

  1. Standard Network Cable (Cat 5, Standard or Crossover)
  2. PutTTY Software (will be used to SSH into the Pi)
  3. SD Card Writer

Edit: 2nd Jan, 2015. Video Tutorial Added:

 

 

A large part of this post assumes you’ve read the earlier post on directly accessing the shell on Raspberry Pi through a Ethernet/LAN connection. In this post, we’ll go about setting up the Raspberry Pi to access internet through the Ras-Pi’s Ethernet/LAN port from a Laptop/PC’s shared WiFi connection.

Steps:

 

  1. Firstly, enable the WiFi adapter of the PC/Laptop and make sure it’s connected to a WiFi hotpspot. Open any Internet Browser and confirm internet access by opening any website.

raspi

Note: I’m using my Android device (Nexus One) configured as a WiFi hotspot J

  1. Now, go to Network and Sharing Center (Network Settings in Win XP) and then head to the Change Adapter Settings page. As shown below, we’re connected to ‘Wireless Network Connection’ on ‘Android 4’. Do remember the ‘Local Area Connection’ to which we’ll eventually share this connection

raspi

  1. Now, right click the above Network → Properties and then select the Sharing tab

raspi

  1. From the drop down list, choose ‘Local Area Connection’ and enable both the checkboxes and hit OK. Once done, head back to the Adapter Settings page and you should now see the Shared info message on the Wireless Network Connection

raspi

raspi

  1. Now, right click ‘Local Area Connection’ → Properties and then select Internet Protocol Version 4 and then click the Properties Button

raspi

Once the properties tab pops up, make sure that the ‘Obtain IP address automatically’ checkbox is selected. If not, check it and hit OK

raspi

  1. Now, power up the Raspberry Pi (making sure that the Ras-Pi and the Laptop/PC are connected to each other through the LAN/Ethernet cable) and wait a minute or two while the Ras-Pi boots. Now, repeat step 5 (previous one) to make sure ‘Obtain IP Address Automatically’ is still checked.
  2. Open up command prompt using the hotkey Windows Key + R and then typing in cmd or simply keying in cmd in the start menu (Win 7)
  3. In the command prompt, key in ipconfig and scroll to the top of the info shown

raspi

Note the IPv4 address which is 169.254.39.68 in this example. Please make a note of what you see as this will be required further.

  1. Now, power off the Raspberry Pi and plug the Ras-Pi’s SD card into a card reader and connect it to the PC. Once the disk opens up, open the cmdline.txt file in any editor

raspi

raspi

You’d probably have an entry as ip=169.254.39.71 which we set up in our previous post

  1. Now, to this entry, append the IPv4 which we got earlier preceded by two colons as shown below:

raspi

where the first half is the static IP for Raspberry Pi (169.254.39.71) and the other half is the IP of the IPV4 or Ethernet Adapter (169.254.39.68) which we obtained earlier.

  1. Save this file and plug the SD card back into the Raspberry Pi. Power up the Raspberry Pi and wait for a min or two. Establishg a direct SSH connection with the Raspberry Pi as explained in the previous post.
  2. Now, to verify if our Ras-Pi is Internet-Connected, type in this command in the Shell (PuTTY terminal connected to the Ras-Pi)

ping www.google.com

and you should see response from the servers as shown below:

raspi

Voila!!! Your Raspberry Pi is now connected to the World Wide Web 🙂

  1. Going one step further, lets direct access the Raspberry Pi’s desktop and open up the midori browser. Verify Internet connectivity on the Ras-Pi by opening any website

raspi

Please let me your feedback or questions through comments.

Thanks 🙂

References:

  1. http://pihw.wordpress.com/guides/direct-network-connection/super-easy-direct-network-connection/
  2. http://anwaarullah.wordpress.com/2013/07/16/direct-access-raspberry-pi-shell-and-desktop/

Direct Access Raspberry Pi Shell and Desktop on Laptop/PC without installing anything on the Raspberry Pi OS or connecting it to a Display Unit

Before you go neck-deep into this post, please check if this post is applicable for you:

What you want to do:

  1. Access Raspberry Pi’s desktop on Laptop/PC screen

What you have:

  1. Raspberry Pi running the latest Raspbian Wheezy
  2. Laptop (Windows 7 or XP with Internet connection, required to download one setup file)
  3. A working SSH connection with Raspberry Pi (direct access, explained below)

What you don’t have (and not required):

  1. Display Device for the Raspberry Pi (HDMI enabled display unit / Old TV)
  2. Internet connection for the Raspberry Pi (LAN or WiFi)

Extra Stuff you need:

  1. Standard Network Cable (Cat 5, Standard or Crossover)
  2. PutTTY Software (will be used to SSH into the Pi)
  3. SD Card Writer

There are hundreds of tutorials sprawling across the web that show you how to remote access your Raspberry Pi’s desktop from your laptop/PC. This will come handy if you don’t have (or don’t want) a display unit to see your Pi or want to use your Laptop/PC’s screen and keyboard/mouse itself. This mode of accessing the terminal and/or desktop of the Raspberry Pi without connecting it to any display unit (and not connecting any keyboard/mouse to the Pi) is usually termed as Headless mode.

In most of the remote desktop tutorials, you’d need to initially install TightVNC Server (software that streams the Desktop’s GUI to any VNC Client) on the Raspberry Pi and then install any VNC viewer on the Laptop/PC. Now, installing TightVNC server on the Raspberry Pi requires it to be connected to the internet. And here’s my problem: I don’t have a Router or Internet cable in my home. I essentially use a 3G dongle for all my internet needs.

We even tried installing XRDP onto Raspberry Pi (by copying the tar and running it on the Pi) but this failed as it tried downloading the missing dependencies.

We tried couple of methods to share our Laptop’s internet connection with the Raspberry Pi but they failed. Desperate still to access my Raspberry Pi’s desktop, we stumbled upon this setup which finally worked.

Before we proceed with remotely accessing the Raspberry Pi’s desktop, we first need to be able to SSH into it (access it’s shell, akin to command prompt in windows OS). The procedure for SSHing into the Raspberry Pi without the need of any Display Device for Raspberry Pi is explained below.

Direct SSH into Raspberry Pi in Headless Mode

In this tutorial, we’ll quickly setup our Raspberry Pi connected locally to our PC/Laptop using a standard Cat 5 Ethernet cable (crossover not required).

Edit: 1st Dec, 2015:

I compiled a quick video illustrating the following steps so that you can configure it more easily.

Please follow the below steps to have a working SSH connection:

  1. Install and burn the latest Raspbian Wheezy OS onto the SD card for the Raspberry Pi
  2. While the Raspberry Pi is switched off, connect one side of the Ethernet cable to Raspberry Pi and other side to the RJ45 jack of the PC/Laptop
  3. Open LAN properties and make sure that IPV4 properties are set to Obtain IP address automatically as shown below:ImageImageImage
  1. We now need to determine the IP of our PC/Laptop when it’s connected to the Raspberry Pi
  2. Now power on the Raspberry Pi while making sure that the network cable is connected on both ends
  3. Wait for a min or two. You’ll notice that the PC/Laptop will scan and then show a small warning indicating the presence of an unidentified networkImage
  1. Now, open command prompt and type ipconfig. Note the IP of the Ethernet Adapter Local Area Connection as shown below:Image

In our example, its 169.254.39.68

  1. Now, power off the Raspberry Pi and take out the SD Card. Plug in the SD card into a card reader and open it. You should see a couple of filesImage
  1. Open the cmdline.txt file and append this to the end of it:

ip=169.254.39.71Image

Please change the IP accordingly and assign a unique value (while making sure you don’t go beyond the subnet mask). Preferably, change only the last parameter

For example, if your LAN’s ip is 169.254.0.1, we recommend using 169.254.0.3 as the IP for Raspberry Pi in cmdline.txt

  1. Save the cmdline.txt file without making any other changes
  2. Plug this back into the Raspberry Pi and with the Ethernet cables connected, power on the Raspberry Pi
  3. Wait a couple of minutes while the Raspberry Pi tries to establish a local network connection with our PC/Laptop
  4. Once you see the network warning message as shown above, ping the Raspberry Pi to see if it’s live on the network as follows
    1. Open CMD prompt
    2. Type ping ipaddress_of_raspberry-pi

Ex: ping 169.254.39.71

If all went good, you should see the Pi responding back to the ping requests as shown below:

 Image 

  1. Now its time to SSH into the R Pi. Open PuTTY client and type in the IP address of the Raspberry Pi (169.254.39.71) and hit OpenImage

You should get a certificate trust warning message (if SSHing for the first time) which you should accept. Once done, you’ll see the login terminal:Image

Enter pi

The password should be raspberry

Once done, hit enter. You should now see bash prompt as shown below:Image

Voila, you’re now SSHed into the Ras Pi. It’s all yours now 🙂

Now, moving on to access the Raspberry Pi’s desktop, we first need to install Xming X Server for windows from this link:

http://sourceforge.net/project/downloading.php?group_id=156984&filename=Xming-6-9-0-31-setup.exe

Make sure you install the SSH components also when prompted to do so.

Once that gets successfully installed, simply click the Xming icon and make sure it’s running in the background

Image

Now, open PuTTY terminal and first enable X11 forwarding as shown below:Image

Now, direct SSH into the Raspberry Pi as explained previouslyImage

Image

Once inside, simply type in midori and this should bring the Midori browser as a window

Image

We’ll now hit in lxsession or startlxde and that should pop up the desktop of the Raspberry Pi:

Image

Have fun 🙂

In order to close this, go back to the PuTTY terminal and kill this process using Ctrl + C

Note: This for some reason is still not showing the lower part of the Desktop including Start menu and taskbar.

Update: The above bug issue been fixed and a solution is available here (http://anwaarullah.com/blog/fixing-the-missing-lxpanel-bug-when-direct-accessing-raspberry-pi-shell/)

References:

http://pihw.wordpress.com/guides/direct-network-connection

http://www.straightrunning.com/XmingNotes/pixming.php

Buying Raspberry Pi Online in India

There are now a couple of stores brewing around from where you can buy the Raspberry Pi online in India. Many of these stores also stock getting started kits and other accessories.

Since, I’m based out of Hyderabad, I’d like to recommend PotentialLabs for buying Raspberry Pi if you’re based in Andhra Pradesh. Buy from them at http://potentiallabs.com/cart. They ship same day or you can also pick up from their store.

The other stores include:

Simple Labs – http://simplelabs.co.in

Explore Labs – http://www.explorelabs.com

TenetTech – http://www.tenettech.com/

There are tonnes of other stores, but I’ve had a nice experience with the above ones.

Cheers!!!

Internet of Things framework for the Raspberry Pi

For a start, one of the primary reasons for me to start a blog was to share those many links which otherwise I’d bookmark and lose track of them when I actually needed something. Secondly, I make notes in many mediums and maintaining and indexing them all was getting troublesome as newere content was being added. Plus, sharing something on the web is a million times better than holding out stuff within self. 🙂

Now, this is awesome!!!

Internet of Things framework for the Raspberry Pi

Control, debug, and use your Pi’s GPIO locally or remotely, from a browser or any app

WebIOPi is the perfect Swiss-knife to make connected things with the Raspberry Pi

Developed and provided by Eric PTAK (aka trouch)

Features

  • REST API over HTTP and CoAP (draft-14) with multicast support
  • Server written in Python with zero dependency
  • Supports GPIO, Serial, I2C, SPI, 1-Wire with zero dependency
  • Supports more than 30 devices including DAC, ADC, sensors…
  • Full Python library for the Server, GPIO, Serial, I2C, SPI and devices drivers
  • Compatible with both Python 2 and 3
  • Extensible and highly customizable
  • Login/Password protection
  • Mobile devices compatible
  • Includes debug web apps
  • GPIO Header
  • GPIO List
  • Serial Monitor
  • Devices Monitor

Javascript client library built on top of jQuery

Python client library with HTTP and CoAP support More information on https://code.google.com/p/webiopi/

Cheers!!!

NOOBS introduced for RasPi

If downloading an Image, formatting it on a SD card and booting the image off the Pi wasn’t already easier, folks from the RasPi have come up with NOOBS for the RPi NOOBS 🙂

A single file (approx 1GB) that you now need to install on a freshly formatted SD card. After plugging it in the Pi and powering it up, it’ll present you with sleek bootup options including the choice to install one of the several operating systems into the SD card. And Voila, you’ve a RPi up and running.

A good feature that I liked about this app is it allows you to edit the config.txt and cmdline.txt by holding the Shift button on reboot.

To download and read more about this, head on to:

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

Cheers!!!

Using Raspberry Pi as an AVR Programmer

Cool things are getting revealed as days progress and folks crank out every single byte RAM from that mean power machine. Here we’ve come across an awesome project where a Pi is being used as an AVR programmer. I’m hoping this will be more handy and now make me not carry my heavy laptop.

Check it out at:

http://kevincuzner.com/2013/05/27/raspberry-pi-as-an-avr-programmer/

I’m hoping a LCD and some more controls can actually allow you to code and upload on the fly without even using pre-compiled .HEX files.

Cheers!!!

Learning Python the Hard Way :)

After getting the RasPi, I was all the more excited to learn Python. I started it from this link
http://learnpythonthehardway.org/book/

I’m currently in Exercise 22 which asks us to rewind what we’ve learned so far. So I made these notes and will post here for my quick reference.

# Ex 22

Asks to go back and revist all the symbols and words and understand what they all do..

I’m’ gonna begin from ex1

Continue reading Learning Python the Hard Way 🙂

Using Desktop Screen for streaming RasPi content

Fret not if you don’t have access to a HDMI input device or even a simple A/V TV. I don’t have either :), buy would still want to see the Pi in action.

Checkout this cool article on setting up the PCs screen to use with Pi with the help of a simple network cable.

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