AirPiConsole part one

As a network engineer I spend a lot of time with my laptop connected via serial cable to various devices.

Physical serial connection is needed for initial device setup and sometimes per customer’s security policy I can’t access the network, so I can only use out-of-band management. I also configure many devices at staging lab that I call the “Theory room” because you know, in theory everything works ;-)

Long story short, in 2013 I bought an Airconsole and I really enjoyed the possibility to connect to serial ports over WiFi or Ethernet:

I miss so much my Airconsole, it broke too early. But I have a project in mind for a good replacement. Follow me on Twitter for updates.

A post shared by Gian Paolo Boarina (@gpboa) on

Airconsole to Nexus 7000, best friends!

A post shared by Gian Paolo Boarina (@gpboa) on

The problem is: Airconsole broke too soon, just after warranty expired.

I thought about replacing it with a new one but price + shipping + taxes was too high to justify the expense. On top of that I thought I could to something similar with more features and flexibility.

Then in February 2016 Raspberry Pi Zero W was released. It includes WiFi b/g/n and Bluetooth 4.1, it’s small and looks like a good candidate to replace an Airconsole.

Let’s try.

RaspberrypizeroW VS Airconsole

A post shared by Gian Paolo Boarina (@gpboa) on

Step 1 - get the hardware

Bought a starter kit on Amazon that includes:

  • Raspberry Pi Zero W board
  • offical case
  • miniHDMI to HDMI adapter
  • micro-USB to USB adapter
  • other accessories and camera cable I don’t need right now

I added a 32GB micro-SD card and a micro-sub to Ethernet dongle that includes 3 USB 2.0 ports:

News toy for Raspi0W

A post shared by Gian Paolo Boarina (@gpboa) on

Total expense: 60 EUR

Step 2 - install OS and utils

The initial setup is well documented in many places, I’ll skip the details here.

  • download Raspbian
  • Burn on SD card with Etcher
  • put the SD card on the slot and boot
  • expand FS with raspi-utils
  • set ssh autostart with raspi-utils

Default credentials: pi / raspberry.

Connect to an HDMI monitor, connect a keyboard and start the setup.

It is possible to complete the setup without monitor and keyboard if you prefer so, plenty of guides available online.

Done!

Step 3 - connect to WiFi

To upgrade and install software on Raspbian we give WiFi connectivity to the board.

Generate WPA pass-phrase with:

wpa_passphrase MY_SSID >> /etc/wpa_supplicant/wpa_supplicant.conf
<enter password and press enter>

Final result for /etc/wpa_supplicant/wpa_supplicant.conf should be like this:

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="MY_SSID"
    psk=fsfhjfhr8y98y9f83f99wer5f4r65e4rg6re45ge6r4gre
}

Set WLAN0 to get an IP address via DHCP editing /etc/network/interfaces:

allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

Reboot, it should now connect to your wireless network.

Verify

root@piconsole:~# iw dev wlan0 link

Connected to c4:da:fd:16:dd:43 (on wlan0)
        SSID: MY_SSID
        freq: 2437
        RX: 382313 bytes (3046 packets)
        TX: 167102 bytes (1021 packets)
        signal: -22 dBm
        tx bitrate: 72.2 MBit/s
        bss flags:      short-slot-time
        dtim period:    1
        beacon int:     100

If it doesn’t work double-check PSK and SSID name.

Now upgrade the software:

apt-get update; apt-get upgrade -y

Step 4 - Bluetooth

Install bluez:

apt-get install bluez

Add this line to file /etc/bluetooth/main.conf under [General] section:

DisablePlugins = pnat

Enable bluetooth:

root@piconsole:~# bluetoothctl
[NEW] Controller AA:BB:CC:DD:EE:FF raspberrypi [default]
[bluetooth]# discoverable yes
Changing discoverable on succeeded
[bluetooth]# pairable yes
Changing pairable on succeeded

Now open Bluetooth preferences on your laptop/smartphone/tablet, you should see *raspberrypi” listed. Complete the pairing.

Create a BT serial port, details HERE. No need to install Bluetooth Serial Terminal app.

Now you can use your favorite terminal app to connect via Bluetooth to the Raspberry. opening a serial connection. Parameters are 9600/8/N/1, verify you use the newly created “outgoing” serial port.

Step 5 - Power

Raspberry must be powered via micro-usb cable. Many switches and routers today have an USB port that could be used but usually they provide low power. I prefer a solution that allows to freely move the board without the need to reboot every time and permits enough work time, at least one full day.

I found an old power bank sitting useless around my lab, it’s a 3000mAh model, that looks fine for the task so let’s measure how long it lasts.

Create this simple script in cron:

root@piconsole:~# cat /etc/cron.d/uptimelog     
*/5 * * * * root uptime >> /var/log/uptime.log

and left it on overnight with BT and WiFi turned on.

Check the result:

root@piconsole:~# more /var/log/uptime.log

05:50:01 up  9:17,  2 users,  load average: 0.00, 0.00, 0.00

Over 9 hours looks good!

I noticed afterwards the power bank wasn’t fully charged at the beginning but that’s ok, plenty of time already.

We should expect less autonomy with actual traffic and some console cables/usb adapters connected.

Wrap-up part one

We should now have a working Raspberry with WiFi and Bluetooth connectivity to access the console.

Stay tuned for part two to add more features to this tiny but powerful board.

 
comments powered by Disqus