Thursday 18 October 2012

Current Theorems - Am I on Track?

Perhaps my previous calculations of power consumption are too simplistic.

In researching green options, I discovered on some forums the use of a 5 port USB powered hub to deliver power to the RPi, and its peripherals, with the RPi delivering communications and data back to the hub.  I had been wondering about the concept of using one hub to power multiple RPis - would it be more efficient and greener?

Both the RPi and the hub run from their own transformers.  The RPi transformer has an input of 240V at 50-60Hz, drawing 150mA, and delivers a DC output of 1A 5VA.  To my limited knowledge of the calculations involved, this means that the input power is: 240 x 0.15 = 36 Watts, and the output is: 5 x 1 = 5 Watts.  This would imply that 31 Watts is lost to the resistance and impedance of the unit, and generates heat in the transformer.

When I look at the input and output of the USB hub's transformer, the input is: 240V at 50-60Hz, drawing 1A, therefore 240 Watts.  The output is 5V 1.5 A, therefore 7.5 Watts.

This would imply that whilst the powered hub supplied 50% more power, it draws 660% more power from the mains, and hence would not be a greener more efficient supply.

However, I know that my knowledge in this area is presently limited - am I using the right calculations and making the right deductions? Should I be calculating and comparing the power consumption of the transformers from their input or output values? Are these constant loads, or the maximum loads of each unit?

Anyone able to help?

Sunday 14 October 2012

Raspberry Pi - The Organic Way to a Green Network?

Epilogue to the Previous Post

There was life in my RPi, but not as I planned it Jim!

As a headless box, remotely operated through an SSH session, the Pi worked well - including its raspi-config tool.

But the wireless USB keyboard and mouse not working was my fault.  I didn't check the specs of the peripherals first.  If I had, I would have realised that they were not compatible with Linux.  Have since ordered a new set from Element14.

Going Green

Whilst waiting to get these goodies, I've been doing some thinking and planning.  My testing of the RPi and its abilities against other platforms is still in the planning process..  But in parallel I've had some other thoughts.


Looking at the power bills that we are getting out in a rural region - horrendous.  I'm certain that part of that excessive power usage is my small network of machines at home.  Yet I want to do more from home, with more machines.  That can only mean one thing - a bigger power bill.  Or does it?

Perhaps the RPi can come to the fore here.  Part of the problem is the machinery that I leave running most of the time.  My desktops and laptop are not so much of an issue if I shut them down overnight when not in use.  But looking at my network as it is now, and how I would like it to be, there are several spots in which I might wish to substitute in a RPi.  The list of appliances that I would like to have running 24/7 includes:

  • Firewall/Proxy Server
  • Dedicated Web Server
  • Dedicated Web App Server
  • Dedicated DB Server
  • Dedicated IDS/Honeypot
  • Dedicated Print Server

In considering the suitability of the RPi for any of these roles, I need to be able to compare apples to apples.  To do this from the power supply perspective, we need a way of comparing our traditional desktop power supply of 300 to 400 Watts, to the 1 Amp supply running the RPi.  To do this, we are going to make use of the equation;

          Watts = Amps x Volts

So, how many Watts does the RPi draw?  This is always going to be dependent upon the power pack used.  The power pack that I'm using currently has an output of 1 Amp at 5 VA.  But that is what it outputs to the RPi, not what it draws from the power socket.  What it draws from our power socket is 240 Volts at 150 milli-Amps.  Throwing these values into our equation;

          Watts = 0.15 x 240

          Watts = 36

But of course, I could compare this to a desktop or server with a 1KW PSU, and rave on about how much of a saving it should make, but it is not the size of the PSU that is important, but the amount of hardware that it supports.  From various sites you can utilise an online power calculator.  I went to eXtreme Outer Vision's calculator page.  Here I plugged in the values that were as close as possible to what my existing firewall machine has.  It is running a 300Watt PSU.  I calculated the power draw for it based upon a 90% CPU utilisation and it calculated that it would require a minimum of 198 Watts, but recommended 248 Watts to be sure.  For my comparison, I am going to take the conservative value of 198 Watts.  This is nearly 6 times more than the power draw of the RPi.  I think that there could be some real savings achieved.

To see how these potential solutions turn out, I have started a new page at: Raspberry Pi and Green Home Network

Tuesday 9 October 2012

Is there life?

Many ideas have been swirling in my head of late, for this project.  However, they are all far into the future for now.  Right now, the key critical thing is to get one of my RPi boxes active with a standard generic OS.

So, lets recap what ingredients I am putting into this stock-standard mix.
1 - Rpi Version 1 board inside a perspex case
1 - micro USB, 1A power supply
1 - HDMI -> DVI dongle
1 - 17" LCD monitor
1 - SanDisk 8GB 10 SD Card
Medion cordless keyboard and mouse

For the software side, I have the latest "Wheezy" image
2012-09-18-wheezy-raspbian.img

Setting up the SD Card
This went rather smoothly.  Simply follow the instructions presented at RPi Easy SD Card Setup.

Plug it in and Go!
Next was the easy step of plugging everything in and letting rip.  Since there is no on/off switch for the RPi, it starts as soon as you plug the micro USB adapter in.  Very quick to start up.  in under 20 seconds, Wheezy has loaded, and has opened the Raspi-config screen.  One small problem here for me, the wireless keyboard and mouse are not supported.

There are essentially two options that I have at this point.  The first, is to find a spare USB keyboard and USB mouse and plug them in - not so easy at 9:30 pm at night.  I do have a spare PS2 keyboard, and a semi functional USB mouse, but I'd need an adapter dongle.  The second option (I think), if the RPi has loaded its OS enough that it can network and accept telnet commands is to network it, and remotely take control - though I'm not sure how this will go given the config screen it is currently displaying.

Why Not Remote From Word 'Go'?
Perhaps I am over cautious, but one rule I have is not to network something until you have secured it.  Out of the box, the wheezy image is not secure.  It's preset login account has its name and password posted to the Internet.  However, if I can network it and remotely login, I should be able to secure it with a password change, and passwd the root account in a reasonably short space of time.  So I will try that.

Apart from a bit of cable management - my routers and switches needed some switching around to fit my RPi into the subnet that I wanted it - this step was fairly simple.  Thank goodness for good old PuTTY!  Started an SSH session with the RPi, and was able to reset the pi user password, and the root user password.

Interesting to note, that in the PuTTY session it has shown the message "NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'".  Excellent.  So that's the next step.



On running the config, you'll see a number of options.  The info screen is just a short paragraph that recommends using this config tool earlier rather than later - before making any major changes of your own to the set up.

'expand_rootfs' is an option that I'll explore later.  As noted in the RPi Easy SD Card Setup page, the standard image is only 2GB.  I'm running an 8GB SD Card - so there is spare space there.  The RPi Resize Flash Partitions page talks you through the options of expanding this existing partition, or creating a data partition.  For now, I'm going to leave this.

'overscan' is an option I have not heard of before.  When you enter the screen for it, there is simply the option to enable or disable.  I need to research this more.

'configure_keyboard' is an option I'd really like to fix - given my issues so far.  Upon entering this option, the screen reverts back to the command line for a few seconds to load the keymap.  It sets the preliminary keymap, and then returns to the config screen.

'change_pass' - already did that through the PuTTY session directly with the 'passwd' command.

'change_locale' is an interesting option.  Again, this will quickly leave the config screen to the command line to load some values, then brings up a new config screen.



For Australia, not sure what to pick on this screen so I will go with the advice of picking a UTF-8 locale code.  My selection leads to another config screen, which appears to indicate that I have selected a locale that has access to english_Great Britain character set.



Selecting OK here, then leads back to the command line, whilst the locales are generated.  When finished it will return you to the main config menu.

'change_timezone' - at the moment I need timezone Lima - UTC +11.  Lets see what's set.



First screen allows you to select the geographic area.  For those in Australia, simply scroll up this list to find it.  From there I'll select Canberra as the nearest city to where I live.



Done.

'memory_split' - I will investigate and get back to you.

'overclock' - I am interested in using this option as I have heard that the 700MHz CPU can clock up to 1GHz when performing particular operations.  For now, I'll leave it as stock standard.

'ssh' - This I suspect is as the menu describes, a toggle option for SSH server functionality.  Either enable or disable.  Given my current session was started under SSH, I'd say the server in the wheezy image is enabled by default.

'boot_behaviour' - this option gives you a vote to start straight to the desktop on boot - Yes or No.  For now, I'm going with No.



'update' - note the uncertainty of this option.  The menu description says 'Try to upgrade raspi-config'.  I suspect that from the description, this will not upgrade the kernel or any Linux modules, other than this very config module.

Back to the Books
So for now, there are some items for me to research and explore, and return to later.  So I'll finish with the config.  This leads to the option to reboot now, which I will.  Unfortunately, upon reboot, I am still in the state where I can not use the box on its own - I still need to configure the wireless keyboard and mouse.  Something more for me to research for the next post.