Tuesday, December 18, 2012

Looking for a good power adapter


As my server works 24/7, I spent a bit of time to find a good power supply for my Raspberry Pi

Recommendations for the Raspberry Pi are to use an 5V 700mA USB power adapter .

So I checked my stuff for what USB chargers I already had. I found several alimentions 500mA and 1000mA. They all work with my Raspberry Pi, but I feel these alimentations become too hot after a long usage.

So I started looking for a bit more powerful adapter, thinking that an over-sized power adapter should help to reduce heating and improve the life of the power adapter and of the Rasperry Pi

I found several chargers over 2000mA on the Internet, some with two USB ports, like this one, brand Bluestork:

Others with 1 USB port, like this one, brand Re-volt:


I have a preference for a model with one USB port, as some 2000mA models with 2 USB ports are in fact 2 x 1000mA

But ultimately, I chose this one, brand Apple:
€ 19.99 is a bit expensive for a power adapter, but it fits in the budget of the project. I found it in a local shop and I therefore saved shipping cost. In addition, the brand is well known, and I think I can benefit from the guarantee in case of problems.

After 2 days of usage, I feel this one a bit less hot than my older one.

Impact on the project: -19.90€

Monday, December 3, 2012

How to control the Raspberry Pi from Windows: Tight Vnc

TightVNC Home If the SSH console is not enough user friendly for you and if you want to remote control your Raspeberry Pi using a graphical user interface, VNC may be an good solution.

Install TightVNCServer
http://www.tightvnc.com/

TightVNCServer is a free and lightweight remote control software compatible with standard VNC software
The command to install it is:
"sudo apt-get install tightvncserver"

Start VNC server
To start the VNC Server from the Linux System, you have to execute this command:
"tightvncserver"

The system will ask you for a password (at least 6 caracters)

"You will require a password to access your desktops.

Password:
Verify:"


After that the software will ask you for an view-only password.
"Would you like to enter a view-only password (y/n)?"
You should answer no ("n") if you only need to control your system.

After that, your VNC will give you an X session number.
"New 'X' desktop is raspberrypi:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/raspberrypi:1.log"


Install TightVNCClient
You may use any VNC client, but why not continue with TightVNC?
You can download it here: http://www.tightvnc.com/download.php

When you install VNC, it may be a good idea to chose a custom installation if you don't need an VNC Server on your windows computer.




Use the VNC client 

To use VNC, you need to type the server adress and the session number.

The VNC client will ask for the password.

 Now you can use your Raspberry with the X interface.

Sunday, November 25, 2012

Google Analytics statistics


From the beginning of this project, I was curious to know if people would connect to my teapot. I initially planned to create a counter or a statistics module simple PHP. But after discovering Google Analytics, I finally decided to use it.

Of course, very precise statistics aren't necessary for a simple teapot project, but this module can be activated simply by adding a javascript code on the page to be checked, which made the task very easy.


Since the implementation of Analytics on November 4th, the teapot received 574 unique visitors. The first surprise came from a peak of 143 visits in one day, I can't explain it. But Google Analytics also provides impressive details on the website visitors. You can know the browser, the origin website, the used browser and other relevant information such as country of origin of visitors. This information was what I was most curious about.

As I mentioned my site to friends, I received many visits from France: 109. I also received 109 visits from the United States. What surprised me most is that the first country of my visitors is Finland with 110 visitors. But is it really a surprise that the country that gave us Linus Torvalds, Nokia phones and Angry Birds also hosts many geeks interested in the error 418?

Sunday, November 18, 2012

How to install a web server on Raspberry Pi - Lighttpd


http://www.lighttpd.net/Lighttpd (http://www.lighttpd.net/) is an open source webserver which has reputation of being very light. Therefore it looks perfect for an Raspberry Pi. Here are the commands I used to install it


Lighttpd installation
sudo apt-get install lighttpd





The directory containing the web pages is:
 /var/www"


The "pi" user does not have write permission to this directory.
You can give these rights with the following set of commands:

sudo chown www-data:www-data /var/www (to make the www-data owner of the directory)

sudo chmod 777 /var/www (to have full right to this directory)
sudo usermod -a -G www-data pi (to had the pi user to the www-data group)


You can now had your html file to the "/var/www" directory.

The configuration file is:
/etc/lighttpd/lighttpd.conf

The error log is:
/var/log/lighttpd/error.log

The command to restart the server:
sudo /etc/init.d/lighttpd restart

The command to reload the configuration
sudo service lighttpd force-reload

The server is ready. It is possible to use PHP and other services with Lighttpd, but I didn't do it so I can't explain it here.

Wednesday, November 14, 2012

How to exchange files between Windows and Raspberry Pi - WinSCP

In addition to be able to control the Raspberry from a Windows PC, you sometimes need to exchange files between the two systems. There are two protocols based on SSH for this, SCP (Secure CoPy) and SFTP (SSH file transfer protocol). These protocols are used to exchange files securely with a system using SSH and are equivalent, though SFTP is more recent..

WinSCP can use both protocols from Windows.

WinSCP
http://sourceforge.net/projects/winscp/
In the main interface you can choose between SFTP and SCP protocols, specify the IP address of the Raspberry Pi, the user "pi" and the password.



Once connected, you can browse in the Windows system on the left side and in the Linux system on the right side and exchange files between them by drag and drop.


Sunday, November 11, 2012

How to control the Raspberry Pi from Windows: SSHputty

Sometime your Raspberry Pi (or another Linux computer) is not physically accessible and that you can't connect any keyboard or screen. It may occurs when it is enclosed in a teapot.

It is necessary in this situation to find tools to drive it from another computer, connected in the same network.

I therefore suggest you to use the SSH (Secure Shell) service with the client software SSHputty

Activate SSH
To use this tool, the SSH  service should be active. It is activated by default in Raspbian. But if necessary it is very easy to turn it on, just call the command "sudo Raspi-config"

The following menu appears and then allows to enable the SSH service.


SSHputty
http://www.putty.org/



This is an SSH client that allows you to control any system compatible with SSH command line from a Windows PC.

After installing and running it, just chose the Raspberry Pi with its IP address (and port 22) and click on "Open" button

A command line interface will appear and ask for the username and password.

You can then control the Raspberry Pi with the command line interface, but not start the GUI.

Thursday, November 8, 2012

Useful commands for Raspberry Pi


Today I give you a few useful commands for an Raspberry Pi with Raspbian. I'll update this list in the future

Default login and password
login: pi    password: raspberry



Launch the GUI:
startx

Sht down the Raspberry Pi :
sudo halt

restart the Raspberry Pi :
sudo reboot

Know its IP address:
ifconfig eth0

Renew the IP address when in DHCP:
sudo dhclient eth0

Read a text file:
cat pathname

Edit a text file:
sudo nano or sudo nano pathname

Check the temperature of the Raspberry Pi:
sudo /opt/vc/bin/vcgencmd measure_temp

Raspberry Pi setup page:
sudo  raspi-config

From this page you can:
  • expand the partition
  • change the overscan (margins) of the screen
  • select keyboard layout
  • change the password of the user "pi",
  • change the local preference
  • change the time zone
  • manage shared memory,
  • enable the SSH
  • start on the GUI

System update
sudo apt-get update