Thursday, December 13, 2012

Headless Raspberry Pi with Windows 7

I got my Raspberry Pi (the B version) yesterday and struggle to access it via LAN because I didn't have an SDCard w/ size > 1GB. I bought 8GB SDCard just now (costs Rp. 50.000, i.e. ~ $5), it all works without any problems, I can access the Raspberry Pi via SSH. Note that the connection is via normal (not crossed) ethernet cable to my Windows 7 Laptop.
Here's what I did:

  1. Prepare a >= 2GB sdcard and a cellphone charger with 5V and 700mA-1200mA output. I used my friend's Blackberry cellphone charger at the moment, which outputs 5V and 700mA. After further tests, a Samsung smartphone charger with 4.75V and 550mA output works just fine. Perhaps, that's because I didn't load the USB ports with anything at the moment. The sdcard I used is 8GB (V-Gen).
  2. Download the debian "wheezy" distro from link at http://www.raspberrypi.org/downloads. I use this version: 2012-10-28-wheezy-raspbian.zip. Once installed, this version shows this in SSH:
    pi@raspberrypi ~ $ cat /proc/version
    Linux version 3.2.27+ (dc4@dc4-arm-01) (gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08) ) #250 PREEMPT Thu Oct 18 19:03:02 BST 2012
    
  3. Decompress the debian "wheezy" image and write it to the sdcard with Win32DiskImager available from http://sourceforge.net/projects/win32diskimager/. Becareful to make sure you used the correct sdcard drive (E:,G:, etc.), because you could delete your valuable data if you happen to use the wrong drive when running Win32DiskImager.
  4. Run DHCP server in your Windows 7 machine. I use DHCP Server V2.3.5, available for free at http://www.dhcpserver.de/dhcpsrv.htm. I set the IP address range of the DHCP server to 192.168.0.1-6 (subnet mask 255.255.255.248) and set the IP address of my laptop ethernet to 192.168.0.1.It turns out the DHCP server gives the Raspberry Pi the IP address of 192.168.0.2. I could ping the Pi without problems.
  5. If you could now ping the Raspberry Pi without problems, it's time to move to the next stage. Use an SSH client to SSH to the Pi. I used PuTTy. The default user name is: pi and the default password is: raspberry.
I did experienced a glitch on the ethernet and had to reboot the Raspberry Pi to access the ethernet. Probably that's because the cellphone charger I used delivered power at the lower limit of what the Raspberry Pi requires.
Now, screenshot time.First, cpuinfo:


Second, the debian linux version:


Now, you could make changes to the Raspberry Pi in Windows 7 without problems. The next step would be the cross-compilation and creation of applications. Stay tuned.
So far I have tried compiling some hello world code in C and python directly on the Raspberry Pi without problems. But, for some really serious application development, using the cross-toolchain would be preferred.

Because I mostly work with Raspberry Pi as headless machine, it's quite annoying to have dynamic IP address all the time. I decided to make my Raspberry Pi use static IP. All I have to do is edit /etc/network/interfaces file, change eth0 setting to static like so:
iface eth0 inet static
address 192.168.137.2
netmask 255.255.255.0
gateway 192.168.137.1
This hardcodes the Pi's eth0 tp 192.168.137.2. This is how it looks like from Pi's remote console (SSH):


I have also "packaged" my Raspberry Pi in a makeshift enclosure made from bricked Abocom WAP252 access point enclosure to ease working with the Pi. I felt the board is too fragile in my workspace without any sort of enclosure, also because of its size, it's quite hard to hold when you're attaching or disconnecting connectors (USB, eth, HDMI, etc.) from the board. Here's how it looks like:

Perspective view

Audio Out and Video Out Side View

 SDCard and micro-USB power cord Side View

HDMI out  Side View

Ethernet and USB  Side View

The enclosure has not been adapted to work with the ribbon cable for the GPIO yet, but it should be easy to do.


Post a Comment

No comments: