Search

Saturday 19 April 2014

Shell Scripting Basic Codes updated

Hello Friends,
If you love linux, I have created a page for shell scripting.
The page contains basic shell scripting codes to clear the basics of shell scripting.
You can find it Here.
Best,
Rushi Gajjar.

Wednesday 16 April 2014

Sharing Wi-Fi Internet Connection between Windows PC and Raspberry Pi : A Complete Easy Guide

Here is hassle-free, simple way to share an internet connection. Spent a lot of time to enable an internet on my Raspberry Pi through my Windows 7 based PC. Unfortunately didn't found the easiest guide on internet.

This post simplifies all. This post is also written for my future reference if I need to re-set the settings on my Pi.

So here is the list of what we need, and what not.
I assume that you have followed this post. (Meaning your Pi is having expanded root_fs)

What we need:
1. Windows 7 based PC/Laptop with ethernet port
2. Internet Connectivity
3. Putty(Download)
4. SD Card Reader (either inbuilt or an add-on SD Card reader)
5. Raspberry Pi (Obviously!)
6. An Ethernet cable (Must)
7. Editing of cmdline.txt in /boot file.

What we DO NOT need:
1. DHCP Server for Windows
2. No need to set Fixed IP address on adapter settings in Computer
3. USB Keyboard/mouse (we will use desktop/laptops's peripherals indirectly)
4. HDMI/RCA enabled Display

Here we go!

Step1:
Follow this link if you are setting up Rasperry Pi first time.
If you have already expanded Root_FS go to Step 2.

Step 2:
1. Remove SD card from the Raspberry Pi.
2. Insert SD Card to the PC's inbuilt or add-on SD card slot.
3. Upon opening, You will see multiple file's on the Disk.(The size of the Removable Media may be upto 20MB)
4. Open cmdline.txt you will be able to see this text.



dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,
115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4
elevator=deadline rootwait


5. Modify this file by putting the static IP of Raspberry Pi at the end of the line:



dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,
115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4
elevator=deadline rootwait ip=169.254.0.2

This is the static IP we provided for the Raspberry Pi. All the time from now onward, you have to access your Pi using this address.(you can have range of IP : 169.254.0.2.to 169.254.255.255 )

6. Save this cmdline.txt file and safely remove the SD card from computer and insert it into the Raspberry Pi.

7. Power-ON the Raspberry Pi, meanwhile connect the Ethernet cable to the Pi and Windows 7 computer.
    - You will see the multiple status LED's ON now; which indicates the Ethernet cable connected to it.

8. Easy Tweak
You can also check weather you Pi is connected with your PC or not by opening your command prompt on Windows PC by "ping 169.254.0.2"

9.Open Network Sharing center from Window's Control Panel > Change Adapter Settings > Right click on the Adapter where you are getting internet connection.(In my case it's wifi adapter, where I am getting an Internet connectivity.)
Click on Sharing Tab > Set to the "Allow other...." > Press OK

10. Open Network Sharing center from Window's Control Panel > Change Adapter Settings > Right click on Local Area Connection/Ethernet adapter > Properties > IPv4 Settings and Set to "Obtain an IP address automatically".

11. Open Command Prompt of Windows.

  1. Run > type cmd > Enter
  2. Enter "ipconfig"
  3. Check the IP of the "ethernet connection."
  4. Note Down the IP address. Mine it is showing 169.254.121.232 (Your's will differ)
  5. Close Command Prompt.
12. Open Putty (Download) and make these changes

Select Session :

Select "Selection"

Select X11:
13. Save the Configuration on Raspberry Pi. Now Load the Configuration.
14.Now you will be able to See the Login of Raspberry Pi
  1. Enter The ID and Password of Raspberry.
  2. Default ID, password are respectively : pi and rapberry
15. Type this command

sudo su

This will take you in the root user.

enter the command "poweroff" to shutdown the Raspberry Pi.

16. Now we need to again edit the cmdline.txt to enter the PC's ethernet address we got after connecting the raspberry pi.

17. Remove SD card from Raspberry Pi and Insert that in to the PC. Using same method open cmdline.txt and modify the code like this. 


dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.0.2::your noted ip address
For Example::

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.0.2::169.254.121.232


In a simple language the :: between two IP states the interface and data sharing between these two IP's.

18. Save the cmdline.txt and insert the SD card back to the Pi.
19. Power-ON the raspberry Pi and do the Procedure as specified in Step 13 and Step 14.
20. Check whether the internet connection is active or not.

Enter this command:
ping -c 4 www.google.com

Success!!!

now you first type these command to make your Pi up-to-date.

sudo apt-get update
sudo apt-get upgrade


That's all.!!
Thank you!! Share the Link!!

Saturday 29 March 2014

Setting Up Raspberry Pi for the First Time : DIY

Downloading The Operating System:

There are a  number of operating systems that you can install on your Raspberry Pi, if you are a beginner, then do not consider anything except one of the Linux distributions, and if you are an advanced user, then you probably won't be reading this anyway.
The most popular and Stable Operating system is "Wheezy-Raspbian" It is the Raspberry Pi recommended distribution, best for those that want the 'default standard' - nearly every Pi out there runs Raspbian.
You can download The Wheezy-Raspbian Image file from Here.

Setting Up Operating System for Raspberry Pi (From now onwards I will call it "Raspi" :D ):

When you buy a RasPi, it may or may not be sold with an SD card. The SD card is important because this is where the Raspberry Pi keeps its operating system and is also where you will store your documents and programs.
If your Pi did not come with an SD card then the minimum size you should get is 4GB, but buy a bigger SD card if you think you will need the space.



What You will Need to Write an Image on SD Card:



  1. A 'regular' computer with a built-in SD card reader, or an add-on USB SD card reader.If you are having MicroSD card adapter, to insert the smaller card into it, that also works good!
  2. Format your SD card using the SD Card Association’s formatting tool.
  3. Win 32 Disk Imager (Download)
  4. RCA or HDMI cable (Must)
  5. USB Keyboard (Must)
  6. Old NTSC/PAL Color TV or Projector with RCA Cable connector or HDMI Based LCD Display. (Note that these displays will only required to setting up Raspi for the first time, then the next post will help you to start session on your Windows Based Computer)
  7. A good quality, micro USB power supply that can provide at least 700mA at 5V to our Raspi
Ffff.. List is too long right? So these all we need to setup our Raspi. :)

So Lets start the process.

  1. Insert the SD card in to the Built-in SD card reader or to the USB cable.
  2. Format the SD card using the SDformatter downloaded from the Link provided in the List.

  3. Open Win32 Disk Imager and Locate the "Wheezy-Raspbian Image file" and Write the image file to the SD card by selcting the right device in the Device drop down menu.(Tip: To avoid the mistakes,remove all other removable devices like Pendrives and other memory cards from card reader, only keep SD card in which you want to burn the Image of Raspbian)
  4. After writing the Image successfully,remove the SD card from your computer .
  5. Now carefully connect the Display Device with the Raspi using RCA/HDMI cable.
  6. Insert the same SD card in Raspi in which you imported the Image using Win32 Disk Imager just now.
  7. Connect Power supply (700mA at 5V, Samsung Android Mobile Charger will Work, but before connecting it to the Raspberry Pi, please check the rating at the back of your charger, Charger of High-end devices like Note1 and Further, S2 and Further provides high current ratings upto 2Amps!! Beware of it!! It can spoil your Raspi)
  8. Switch it on!
  9. Now you will be able to see the Configuration window on the screen.
10. Now go to the expand_rootfs and Press Enter (Obviously, from the Keyboard connected at the USB port of the Raspi)
11. You will be able to see the window shown here.
  • That's all.!! The Operating system is ready to use. Press Enter, which will take you back to the Configuration Window.
  • You can set the change_locale, change_timezone and enable the SSH server for sharing the display to the Windows based PC.
  • Overscan Option in Configuration window: Being designed to work with TVs, you may find that your Pi is only using the middle portion of the screen and there is a big unused area all round the screen. You can enable it to solve the Problem.
  • The options described above are those which could pretty much be considered essential when running your Raspberry Pi for the first time. There are some other options listed that are worth describing briefly.
      1. configure_keyboard – as it implies allows you to chose from a long list of keyboard layouts.
      2. change_pass – allows you to change the system password for the user 'pi' the default user on the system. By default, this password is 'raspberry' so those preoccupied with security may wish to change the password.
      3. change_locale – For non-English speakers, you can select which locales should be available on the system and which should be the default for the operating system.
      4. memory_split – allows you to adjust how much of the shared system memory is available for graphics and how much for the main processor. If you plan to run graphics hungry games, or video playback, then you may decide to alter these settings.
      5. ssh – in a later tutorial we will look at remote controlling your Pi from another computer using ssh. This option allows you to enable ssh so that you can do that.
  1. So now, reboot the Raspberry PI and You will be able to see the screen of the command shell of raspberry pi asking you for Username.
  2. By Default the User name is : pi
  3. Password is : raspberry
  4. After Successful login you will see the command line shell of Raspberry Pi asking you to enter any linux command.
    • pi@raspberrypi~$
    • type 'startx'
  5. Now you will be able to see the screen of the Raspberry Pi with UI.
  6. You can start playing with that now.
ENJOY!!!!!!!
Thank you for Reading, geeks!!



Raspberry Pi updates Coming



Dear Friends and Geeks all around the globe,
Hold your breath, new raspberry pi hacks and updates will be available to you to add colors to your electronics projects.
Here is the list of the upcoming posts.
All Simplified, Tried, Experimented, Working. (Yes, All Details Revealed)
1. Setting up Raspberry Pi for the first time
2. Sharing Home Screen of your Raspberry pi to your Windows Based PC
3. Sharing Internet connection with Raspberry Pi
4. Updating your Facebook wall Post using Raspberry Pi
Here we Go!!
Next Post coming in next 1 Hour.!!
1230IST