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

Wednesday, November 7, 2012

How to wire an ethernet patch cable

To connect my Raspberry Pi to the network, from the teapot, I had wire my own cable. (Because the RJ45 connector didn't fit in the spout of the teapot)

Erevy time I had to do a cable, I ask for the same questions, so I decided to write an small tutorial here for "straight-through" cables.

What do we need?

  • patch cable
  • RJ-45 connector
  • boots
  • RJ458 crimper








1-Strip off the cable with the crimper.


2-Insert the boot, and untwist the pairs.

3-Align the wires in the right order and cut them to the same size.
The order is this one for T568B cable:
1-white/orange
2-orange
3-white/green
4-blue
5-white/blue
6-green
7-white/brown
8-brown



 4-Put the wires into the connector, and check they are still in the right order.

5-Be sure the wires are fully insered into the connector.

 6-Crimp the cable.
 

7-Just slide the boot.

The second connector is wired with the same order.

Just plug and enjoy!


Monday, November 5, 2012

It isn't fake!


I received some remarks saying that my pictures didn't show that the teapot really contains a functionnal Raspberry Pi. As an answer, I'm proud to give you some newer photos.



Sunday, November 4, 2012

Error 418 teapot beta version online



A beta version of my teapot is online at www.htcpcp.net.

I'll not give technical details in this post, but I use Raspbian with Lighttpd.

I'll write a longer post when my installation will be stable.



Saturday, November 3, 2012

Teapot purchased


The teapot was purchased today in an "Secours Populaire" shop (a french charity shop).

This geek operation is nearly a charity one now!

Impact on budget: -4€





Configuring the DNS - Episode 2

I have configured my DNS.

The two main domains following the Google instruction for blogger/blogspot sites.
-www.error418.fr for the french version of the blog
-www.error418.org for the english version.

In fact, I had to be patient and wait for the DNS propagation. You can track the propagation with some sites like http://www.whatsmydns.net/
Reducing the TTL may be an good idea, but you must do it the night before the change to be sure it is active.

The domain 418error.net is redirected to error418.org, with an .htaccess file 301 redirection.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.error418.org [R=301,L]

Other forms of redirection may be penalized by the Google search engine, which could be considered as "duplicate content".

To do the expriment I redirected www.error418.net with the simple redirection interface of my registar.

The www.htcpcp.net, domain will be used for my teapot, with an simple 'A' record.

Thursday, November 1, 2012

Configuring the DNS - Episode 1

I tried to configure my DNS today, and I realized that it was much more complicated than I thought, because it is necessary to consider the consequences for google referrals which penalizes the "duplicate content".

I tried several solutions:
-redirection (visible or invisible) proposed in the OVH interface: it is simple to implement, but may handicap referrals
redirection by. htaccess files seems powerful, but complex to implement, and requires host a site for each domain.
-html-forwarding: problems for referrals.
-create Cname and A records in the DNS: I have changed, and I made ​​my site inaccessible.
-blogspot interface to use a personnal domain worked a few minutes, and then made ​​my blog inaccessible

I really have to study DNS, but the blog may become inaccessible for some time.


A french version of the site

A small message, just to say that I finally decided to host a french version of the blog on the error418.fr domain. The adresses error418.net, error418.org, 418error.net and htcpcp.net, remain associated to the english version.

Wednesday, October 31, 2012

Raspberry Pi received!


Raspberry PiI received my Raspberry Pi today (B Model, 256 MB RAM).

I've tested it quickly with the Raspbian distribution, It works fine: serious matters start there!


Monday, October 29, 2012

Domains Names Reservation


I never reserved any domains before this project and I was surprised to look that domains are not so expensive that I thought.

For 7,16€, I can reserve an domain adress for one year.

Another question I had about domain reservation was the Whois registration. I haven't any terrible secret to hide, but I dont want to show my physical adress to the entiere world. I have found the OwO (OVH Whois Obfuscateur) service form the OVH provider. With that service, only my name can be showed in the whois server, and the postal adress is the adress of the registar.

With that price and services (and too much enthousiasm) I have decided to buy not 1 but 5 domain names:
  • error418.org
  • error418.net
  • error418.fr (maybe for a french version of this blog)
and beacause I'm a bit crazy, 2 less good domains
  • 418error.net
  • htcpcp.net
Impact on the budget: -35,80€

Domain name activation was very quick, but I'll will explain their configuration in another post.

Sunday, October 28, 2012

And the winner is Rasperry Pi

http://www.raspberrypi.org/
I have choosen my hardware platform:

The Toshiba Libretto is to big to fit in a standard Teapot, and I don't want to unmount it.

TP-Link router are sold around 35-40$ on chineses websites, but the delivery delay may be long, and the platform looks less powerfull.

I have found some Raspberry Pi to sell in France on Ebay at 36,5€ (+3,5€ Delivery cost)... so it will be my hardware platform. It can run Linux easily, so it is an perfect base for a small web server. I saw many project far more ambitious that mine on the very active official Raspberry Pi forum. I think it will be easy to find help and documentation.

I hope receiving it next week.

Saturday, October 27, 2012

Looking for the right server platform

At this point, I'm thinking about 3 solutions for the server solution:
  1. Reuse my old Toshiba Libretto 70CT: I realy like this awesome tiny machine but I dont use it any more. It's a true laptop with a Pentium processor running Windows 95. I Only need to find a 16 bits PCMCIA network interface but I'm not sure it can fit in a Teapot.

  2. Buying an Raspberry Pi. This fashion card seems to be supported by a big community. I'm sure it can be a good, and more modern solution, but it's still difficult to find those cards.

  3. Building an OpenWRT solution based on an TP-LINK router like the MR3020 or the MR11U. Cheap, easy to find and supported by the community of PirateBoxes projects.

Friday, October 26, 2012

Specifications and requirements

Like any project, this project will start with an initiating phase. What I want exactly do, and how will I do it?

For the first version of this project, I don't want to be too ambitious. The teapot will be a simple web server hosting an Error 418 html page. Maybe it can host the blog too, but I'm not sure it will be a good idea.

Hardware specifications
The hardware system is divided in two parts:
-the teapot
-the server

The teapot
The teapot have to be small enough to have an good WAF. A to bad WAF may cancel the entire project.
The teapot have to be big enough to support the server.
The teapot don't need to be used to brew tea.

The server
The teapot-server will be hosted at home, with my personnal Internet connection.
It will use an Ethernet connexion, as I don't like wifi.

Software specifications
Operating system and software may be open source, but it's not an strict constaint.

Budget
The budget for this project will be between 50€ and 100€ for buying hardware parts (including teapot and server) and domain name reservation.

Timeline
The deadline for the project is 2012-12-21: I really want to plug the teapot-server before the end of the world.

Thursday, October 25, 2012

Error 418 - I'm a Teapot


I start this blog about my personal project around the famous 418 error code. My goal is to improve my technical skills and to train my english language with a fun project.

This error code is specified in then HTCPCP protocol, referenced in RFC 2324 of the IETF. This RFC, published April 1, 1998, is obviously a joke, but is an interesting start point.

This document, is written with a very technical style like other RFC and describes a control protocol for coffee pot. It provides a complete set of queries and error codes, including the famous code 418 intended to be returned in the case where a user would attempt to brew coffee with a teapot.

So I decided to start a small geek project: implementation of the HTCPCP protocol, at least the 418 error.

Yes, I want to connect a teapot over the Internet.