Category Archives: Raspberry Pi

All things Raspberry pi

2012-12-16 20.26.28

Vintage Digital VT420 Terminal on Raspberry Pi

My first gig straight out of school involved supporting a large group of CAD drafters and engineers at a government facility. We used several different CAD systems at the time – AutoCAD on PC, DEC CALMA on Vax 11/785, and HP ME10 on quirky HP Apollo running UCSD P-System. Drafters using all of these systems submitted plot jobs to a big old Calcomp large-format electrostatic plotter. When I first took the job this was very much a manual process. The PCs were running a custom Ungermann-Bass network (ethernet came along a bit later) and plot jobs were sent to a central server on the network. I quickly grew tired of manually copying plot files around and developed a plotter queue application in C which would monitor a network share and automatically queued jobs to the plotter. The PC users loved it, as they got their hardcopy much faster than they had previously. The DEC and HP users quickly became jealous and begged me to extend this service to include them. A couple of classes and a lot of reading led to a very nice solution written in VAX assembly; the CALMA drafters got their plots much faster and the company ended up with another trained system admin for the 11/785.

Most of this initial development work was performed on Digital VT320 terminals. I always preferred the amber screens to green; they were much easier on my eyes, especially in the low-light environment that CAD drafters of the era preferred.

Fast forward a couple of decades. Sitting on my desk I have a $35 computer the size of a deck of playing cards with processing power an order of magnitude beyond that of the slightly more expensive VAX 11/785 that I used to support. What a cool industry.

A couple of weeks ago I was perusing eBay looking for treasures when I stumbled across an auction for a slightly used DEC VT420. The price was very reasonable, as was shipping. Since my Raspberry Pi is currently running headless, I thought it would be fun to put these two together and document the process. It was MUCH more straightforward than I had previously imagined.

The VT420 is a bit more modern than the 320 that I had used back in the day. The biggest advantage that I could see for this project is the 420′s multi-session support – it supports a whopping TWO SIMULTANEOUS SESSIONS running in either full-screen or “windowed” (split-screen) modes. The terminal supports text widths of 80 or 132 columns, and 25, 32, or 48 lines. Sweet!

Physical Connections

My terminal has two DEC MMJ (Modified Modular Jack) jacks on the back rather than the more ubiquitous DB9 or DB25 connectors that you may be accustomed to. From a purely physical standpoint, the MMJ jack looks like a 6-pin RJ45 with an offset latch connector. Fortunately, adapters are available online; I was able to find MMJ cables and DB9 adapters from a local firm, Pacific Custom Cables. If you are following along at home, I picked up two of each of the following: part number BC16E (DEC423 office cable, 3 foot length) and part number A9F12D (DB9F to DEC MMJ adapter). The office cable is available in custom lengths and is already configured as a null-modem (AKA “Crossover”) cable. The adapter has a molded-in female MMJ jack on one end and comes with a modular DB9F plug so you can configure the connection however needed. The following table shows how I wired the adapter:

MMJ Pin Color Desc DB9 Pin
6 White DSR 7
5 Black Rx+ 2
4 Red Rx- 5
3 Green Tx- 5
2 Yellow Tx+ 3
1 Blue DTR 8

Note: The offset tab on the MMJ connector is over pins 4-6. I clipped the metal socket off of the red pin and soldered it to the green pin prior to inserting it in the DB9 housing. For those interested in specific electrical details of this configuration, there is an excellent overview available at

I opted to use a USB-Serial adapter for this solution rather than using the on-board UART. There are many options available here – I’ve used several different Keyspan adapters with Linux in the past with excellent results. Since I did not have a spare adapter handy, I rolled the dice and ordered a cheap ($14 with free shipping) dual USB-to-RS232 adapter from eBay. The device I picked up did not claim Linux compatibility and is listed as a “Syba SY-ADA15033″ adapter. Turned out to be a good call – the Pi recognizes the device as an “IOCrest dual USB to serial adapter SY-ADA15033″; lsusb shows device ID 067b:2303, which is a Prolific Labs PL2303 chipset. Painless install; the Pi automatically loaded the pl2303 driver and created /dev nodes ttyUSB0 and ttyUSB1.

Configuring the Raspberry Pi

I am running the excellent Occidentalis Raspberry Pi distribution from the folks at Adafruit on my Raspberry Pi. Since this distribution is based upon Raspbian Wheezy, I would expect the setup instructions to be virtually identical.

This distribution did not ship with a termcap/terminfo file for the VT420. The requisite file(s) can be installed easily by installing package “ncurses-term” with apt-get or aptitude.

I added the following two lines to my /etc/inittab:

T0:2345:respawn:/sbin/getty -L ttyUSB0 19200 vt420
T0:2345:respawn:/sbin/getty -L ttyUSB1 19200 vt420

Just for fun, I also created a new pi-themed /etc/issue file. This is based upon a file sent to me by a friend who did not remember where he found it – if you happen to know the source, please let me know so I can properly attribute the source!

Configuring the VT420

Pressing F3 brings up the VT420 configuration screen.

The initial screen is the setup directory – you will need to select “save” after making changes to store your settings in non-volatile memory.

Global setup screen. The important setting here is “S1=Comm1, S2=Comm2″. This enables session control for our two serial lines.

Display setup. This screen allows you to specify number of columns (80 or 132) as well as number of lines (24, 36, or 48). Each session can be configured independently.

General setup. It’s important to select “VT400 Mode, 7 Bit Controls”, especially if you use Emacs, or your arrow key behavior will be really messed up.

Communications setup. I selected 19200, 8 bits, no parity, 1 stop bit.

Keyboard setup. I set F1, F2, and F5 to “FKEY”, leaving F3 set to “Set-Up” and F4 set to “Session”. I’d recommend this configuration if you’re using multiple sessions (more on this later). The rather odd setting labeled “,< and .> Keys” needs this configuration if you ever want to be able to type the “greater than” or “less than” symbol; the default configuration does not generate these characters.

Beautiful Results

The login screen is gorgeous and is based upon ASCII art sent to me by a friend. If you happen to know of the origin, please let me know so I can give the author proper attribution – he didn’t remember where he found it.

Emacs at 80×25. Works like a charm. You can switch between the two sessions by pressing the F4 key.

Pressing Ctrl+F4 toggles between full-screen and windowed sessions. “Windowed” is a bit of a misnomer here – it really is just a split-screen view. The split can be resized via Shift+F4+Arrow keys.

This picture shows session 2 displayed at 132 columns by 48 lines.

Issues, Problems, Etc.

So far I have ran into surprisingly few issues. I initially wasted several hours trying to get things configured with absolutely no success until I realized that you simply cannot run agetty from a user shell, even as root – THIS DOES NOT WORK. After beating my head against the wall for an inordinate amount of time I remembered fighting this exact same battle way back in 1998 or so with an old DEC VT100 terminal and Linux. Once I added the entries to /etc/inittab it just worked.

Flow control is a problem. While the cable does indeed pass through DSR/DTR and XOFF is configured, fast updates such as directory listings will often contain garbled characters. If anyone has a solution to this particular problem I’d love to hear about it.

I had hoped to use tmux to run multiple sessions, but I’m an emacs user and tmux changes the $TERM environment variable to SCREEN for some reason, which causes emacs to flip out over control characters (backspace and arrow keys). There’s probably an easy fix for this but tmux was a nicety in any case.


I really love this terminal. I spent many, many hours writing code on a nearly identical terminal at the beginning of my career, and there is something very comforting about returning to this configuration with my Raspberry Pi. Since this Pi is destined to become the central controller for my home automation solution, it will remain attached to this terminal. I hope that others find this blog post useful and give a new home to a VT420 or similar terminal with their Raspberry Pi. Have fun!


Cook Technologies Steel Raspberry Pi Case


I discovered this case while browsing through eBay looking at Raspberry Pi offerings. I’ve been looking for a slightly more rugged case for one of my Pis, and this one seemed to fit the bill nicely. Some may argue that spending $28 for a case for a $35 computer is excessive, but given how difficult it is to actually lay hands on a Raspberry Pi these days it seemed like an easily justifiable expense. I ordered two Raspberry Pis on November 1 and just received the first one a couple of days ago. I ordered this case from eBay on 11/28 and it arrived today (12/3).

Initial impressions of the case make it very clear that the case was designed and built by a competent, experienced manufacturer who actually cares about quality. The case is hefty, made of 19 gauge cold rolled steel, and is beautifully painted with a black powder coat finish. No sharp edges to be found. Screw holes line up evenly and are cleanly drilled and tapped. Cutouts for the Raspberry Pi line up precisely, have ample clearance for their intended use without providing too much of a gap. Inside the case the manufacturer has provided foam inserts to firmly hold the Pi in place and prevent any circuitry from shorting against the steel case. The Pi fits snugly within the lower half of the case without being “wedged in” to the provided space. Once assembled, the Raspberry Pi is held firmly in place and the case feels substantial.

I only have a couple of complaints about the case, and they are really minor quibbles. First, an option for mounting ears would be extremely beneficial; a provision for securely mounting the case to a cabinet would expand the case’s potential applications. Finally, the case really should have some kind of light pipe arrangement for the Pi’s LEDs. A hole is indeed provided for this purpose, but it seems odd given the otherwise stellar build quality of the case.

I am in no way associated with Cook Technologies, I’m just a VERY happy customer. It is, unfortunately, rare these days to discover a manufacturer who provides this kind of fit and finish in a product geared towards the hobbyist. This case is a pleasant exception to this unfortunate rule. The case is currently available for $28 USD from eBay seller cooktechinc with free shipping. Worth every penny, IMHO.

More pictures of the case follow…

Raspberry Pi: first impressions and bluetooth configuration instructions

I got my first Pi a couple of months ago and finally got around to testing it out. Initial impressions are very favorable – it’s a well-engineered little embedded board. Performance is not stellar, but is about what one should expect from a 700 MHz device. I chose to use the Occidentalis v0.2 distribution from the fine folks at Adafruit. Installation was painless, but I’ve been working with Linux for many years so your mileage may vary.

My Raspberry Pi is housed in the awesome Adafruit Pi Box, a really nice laser-cut acrylic enclosure. I also ordered a small sheet metal enclosure from an eBay seller which should arrive sometime next week with my second pi. I’ll post a brief review once I get the enclosure.

For connectivity, I’m using a little 802.11b/g/n dongle from Adafruit. The device worked out of the box with some minor configuration to set up my SSID and password. Although the Adafruit site claims that the device requires a powered USB hub, it is working just fine for me connected directly to the pi.

The power supply that I am using is a 5V, 1A Power Supply from Adafruit. It seems to be more than adequate for the task.

For storage, I’m using a SanDisk SDSDU-016G-AFFP Ultra 16 GB SDHC Class 10 Flash Memory Card. I’ve experienced no issues with the card so far, and disk speed seems more than adequate.

I’m using an old analog VGA monitor for display. Since the pi doesn’t natively support VGA, I’m using a Sanoxy ViewHD HDMI-D to VGA Converter. It works OK, but I do experience an odd blink on the display that I did not see when I connected to my flatscreen TV or a composite monitor. I’m not sure if this is being caused by the converter or the cheap flat-panel monitor (which I purchased about 5 years ago for $20 at a drug store, of all places.) Since this pi will likely be spending most of its time running headless (without a display), I’m not that worried about this glitch.

I’m using an Azio BTD-V201 USB Micro Bluetooth Adapter to interface with a Motorola bluetooth keyboard Motorola Wireless Keyboard and Motorola 89519N Bluetooth Mouse. Configuration was fairly straightforward after I installed the appropriate bluetooth modules. For the sake of posterity, these are the modules that I installed (via aptitude):

  • bluez
  • bluez-tools
  • python-gobject

Note that I DID NOT install the “bluetooth” meta-package, as it dragged in a large number of unnecessary packages and wanted to replace the Occidentalis-included versions of php and perl. The “python-gobject” package was required to resolve a missing reference required by the bluez tools.

The Azio bluetooth adapter shares a chipset with many cheap BT dongles available on eBay. The tool lsusb reports the device as ID 0a12:0001 with description “Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)”.

To configure the devices, I connected to my pi via SSH:

ssh pi@raspberrypi.local

After plugging in the device and booting up the pi, check to see if the keyboard is visible. My keyboard’s MAC address is 00:0F:F6:81:5D:C0. Type “hcitool scan” to list visible bluetooth devices. Once I verified visibility, I needed to pair the device:

sudo bluez-simple-agent hci0 00:0F:F6:81:5D:C0

The program prompts you to “enter pin”, I typed “0000″ at the SSH prompt and quickly typed the same on the keyboard. Timing is a bit picky, so this may take a couple of attempts.

Once paired, I needed to mark the device as trusted:

sudo bluez-test-device trusted 00:0F:F6:81:5D:C0 yes

And then connected the device:

sudo bluez-test-input connect 00:0F:F6:81:5D:C0

Once these steps are completed, the devices are automagically connected at startup.

I also installed a few additional packages:

  • ipython, an enhanced Python shell
  • emacs, my preferred text editor
  • lynx, my preferred CLI/text-only web browser
  • mosquitto, a MQTT 3.1 message broker
  • python-mosquitto, Python libraries for MQTT
  • mosquitto-clients, MQTT command-line tools
  • owfs, Linux support for 1-Wire devices via the excellent One-Wire File System tools
  • owfs-fuse, Userspace bindings to OWFS filesystem
  • python-ow, Python bindings for OWFS

I ordered two of the expanded memory Raspberry pis from Newark the day that they were announced, so my first pi will be going to my nephew tomorrow. He is a freshman in high school this year and is very interested in software development, so this is part of my continuing strategy to introduce him to Linux and other non-Microsoft technologies. Mojang’s announcement regarding a new Raspberry pi version of Minecraft was extremely timely and has helped to increase his excitement about experimenting with the platform.