Saturday, November 2, 2013

Turn your Raspberry Pi into a WiFi Console Cable

Thanks to one of my co-workers for coming up with the idea for this one.

Ross Taylor has earnt himself a beer.
We were thinking about a relatively cheap way of being able to establish a console connection to a device without having to be physically cabled to it.

The idea came from one of the contractors showing off his wireless console device which got us to thinking about different ways of wirelessly connecting to a console port.

My partner in crime is still pursuing the Android phone path but I thought I'd make use of some hardware I already had kicking around :)

This guide is designed to use a USB to Serial Adapter.

If you're feeling adventurous you could take it a step further and wire up a serial cable directly to your RPi.

Step 1) Turn your Raspberry Pi into a WiFi Hotspot

Download SDCard Formatter and Raspbian distro:

Install Raspbian.

To setup the hot spot follow the instructions over here:

Note 1: You only need to follow the WiFi hotspot guide up to but not including step 4 for the purposes of making a wifi hotspot you can connect to and then console out from.

In theory following the rest of the guide should be fine and provide you with a hotspot for internet access as well (via the ethernet interface) but you don't need it for a console connection.

Note 2: For the Edup Edimax based adapter you will need to enter the following commands as per to install a copy of hostapd that works with the edimax chipset:

sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
sudo mv hostapd /usr/sbin/hostapd.edimax 
sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd 
sudo chown root.root /usr/sbin/hostapd 
sudo chmod 755 /usr/sbin/hostapd

Once you've install the Edimax release of hostapd edit /etc/hostapd/hostapd.conf and comment out the line:

One other thing worth doing is setting hostapd to start at boot:
sudo update-rc.d hostapd defaults

Step 2) SSH to Raspberry Pi from Client

Fire up Putty and SSH to the IP Address

You should now be logged into your Raspberry Pi over WiFI.

Step 3) Install Connect Up

sudo apt-get install cu

Step 4) Figure out the Connection Name of your USB to Serial Adapter

Run dmesg and look for your USB to Serial Name.
This is usually something like ttyUSB0 or similar.

Step 4) Connect Up via USB to Serial Device

cu -l /dev/ttyUSB0 -s 9600

Step 5) Winning.

1 comment: