sâmbătă, februarie 14, 2015

Life of RaspberryPI: Remote Desktop through VNCViewer

Hi everyone,



If you run RaspberryPI headless because you don't have a monitor, you might want to see the RaspberryPI's Desktop remotely.
For this, you need to set up a VNC server on RaspberryPI and a VNC client on your laptop.
The connection will be made via LAN cable, the same you are using for SSH control.

1. Set up VNC server on RaspberryPI

Connect with Putty to your device and send this commands:
root@raspberrypi:~# sudo apt-get install tightvncserver
Type y and press Enter in order to allow installation. 
root@raspberrypi:~# tightvncserver
Set up a password of 8 characters and an optional password for view only.

root@raspberrypi:~# vncserver :0 -geometry 1024x768 -depth 24

Launch a Desktop with 1024x768 resolution.

2. Install VNC client on your laptop


Download VNC Viewer and install it.
Open the program, type the IP of RaspberryPI and click on Connect.
Type in the password you set above and you are ready to go!

Life of RaspberryPI: Connect the PI to the internet.

Hi everyone,

In the previous post I showed you how to install Raspbian and how to connect to you Raspberry PI.
Now, you may want to connect it to the internet. There are many ways to do it.

1. USB tethering from mobile phone

This method saves your RJ-45 port which you can continue to use for SSH connection.

First, you have to connect your mobile phone to one Raspberry PI USB port via microUSB cable.
In your phone go to Settings > Tethering > USB Tethering. Check the button to enable the connection.

On RaspberryPI send the command:
root@raspberrypi:~# sudo dhclient usb0
root@raspberrypi:~# ping google.com
PING google.com (80.97.208.35) 56(84) bytes of data.
64 bytes from 80.97.208.35: icmp_req=1 ttl=53 time=49.6 ms
Now you can see that the internet is working if you ping Google.

2. Share your Wi-Fi through your LAN cable

Let's say your laptop is connected to a Wi-Fi hotspot (e.g. your router).
The RaspberryPI is connected with your laptop through LAN cable.

Go to Control Panel > Network and Internet > Network and Sharing Center
Click on Change Adapter Settings (left panel).
Right click on the Wireless Network Connection > Properties > Share
Check Allow other network .... and select Local Area Connection. Press Ok.

Now, click on Local Area Connection > Properties > IP v4 > Properties
and make sure it will take an IP automatically:
Start Menu > Run > cmd  and type ipconfig:


Now, copy this IP and add it to cmdline.txt located on the microSD card:

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

You can do this by either plugging the microSD into the laptop and edit the file with Notepad, or you can edit the file through Putty:

root@raspberrypi:/# cd /boot
root@raspberrypi:/boot# vi cmdline.txt




Similarly, edit the file /etc/resolv.conf to look like this:
root@raspberrypi:~# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
These two lines are the Google DNS servers. It helps your device locate websites and hostnames. Now, reboot your device:
root@raspberrypi:/boot# reboot
Broadcast message from root@raspberrypi (pts/1) (Sat Feb 14 11:02:52 2015):
The system is going down for reboot NOW!
After reboot:

root@raspberrypi:~# ping google.com
PING google.com (80.97.208.24) 56(84) bytes of data.
64 bytes from 80.97.208.24: icmp_req=1 ttl=53 time=598 ms
64 bytes from 80.97.208.24: icmp_req=2 ttl=53 time=34.3 ms
So it works!

Life of RaspberryPI. Hello World!

Hi everyone,

So far I have only been using microcontrollers in my projects. They were doing fine the tasks they were supposed to (usually one), but had their limitations such as low clock speed (20MHz) and more important, it was extremely hard to implement a real time operating system and to run parallel tasks.

A RaspberryPI microcomputer is a tiny board that offers both the performances of a real computer and the features of a microcontroller: IO pins, small dimensions and programmability.

RaspberryPI B+

I bought this from a local store in Bucharest and I was so excited that this little toy will run Linux for me!

They recommend us all to use the NOOBS installer. But if you don't have a monitor available, it's an impossible mission to have it running. So what I will show you next, is how to run the RaspberryPI headless (no monitor, no keyboard, no mouse).

Run headless RaspberryPI

RaspberryPI boots from a microSD card. To install an operating system on it, you have to download the latest Raspbian image: via torrent or direct link.
Unzip it and you will obtain a .img file, such as: 2015-01-31-raspbian.img

Download Win32 Disk Image, install it and Write the image to a microSD card (4GB or above).
Make sure you select the right device. Check My Computer for your microSD letter assigned.

Once the process completes, edit the file cmdline.txt located on the microSD card and assign an IP to your RaspberryPI:

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

You can eject the microSD card from your computer and plug it into your RaspberryPI.

Now, connect a LAN cable between the RaspberryPI RJ-45 port to your laptop's RJ-45 port.
Power on the device via microUSB port. You should see the LEDs flickering.



You can now connect to your Raspberry PI using Putty.
Just type in the IP you set above and click on open:

You will be asked for your credentials:
login as: pi
pi@169.254.1.1's password: raspberry


Now you can administer the PI as you want! Have fun!