First Steps With Pinguino

pinguino-logoI decided against Arduinos for my second self-made keyboard. Besides being a budget driven decision, the chosen Pinguinos outperform the Arduino Unos in every regard. The fact that I prefer to experiment with new things, instead of taking well-known paths, may have been the primary factor for the decision to switch.

Some weeks ago – shit, time really flies by – I completed the wiring of the right hand keyboard-matrix and soldered it to the Pinguino. I could have taken the first steps in programming the controller since then. Unfortunately I’m so easily distracted, that some things take much longer than they should.

I installed everything needed and started to write some code. But along the way I realized what a pain it is to set the development environment up. I made the Pinguino IDE work somehow. Not on my Mac. But on my old Ubuntu computer. In the end I couldn’t recall everything I did to make it work.

As a reference for myself as well as any other new Pinguino developer I decided to install everything from scratch in a fresh virtual machine and write those steps down. My host’s OS is Ubuntu 12.04 and I’m using VirtualBox. You don’t have to follow this path and might want to install everything into your main operating system. But you should consider using a VM. I learned over the years that it’s really convenient to being able to cleanly throw experiments away, without screwing your main working environment.

Installing VirtualBox and a Virtual Machine

The basic installation of VirtualBox is actually quite easy. And the result is sufficient for most situations. I wrote the following command:

sudo apt-get install virtualbox-4.2

into the shell, executed it by pressing <ENTER> and apt installed everything needed.

Afterwards, I started the Virtual Box Manager and created a virtual machine, by defining some basic settings: name, type and version, which I set to ‘pinguino-dev’, ‘Linux’ and ‘Ubuntu 64bit’. Then Memory, HDD and Processor, where I was basically following the recommended settings. I decided for the 64bit version of Ubuntu and attached the freshly downloaded Ubuntu 12.10 64 bit ISO image to the VMs virtual CDROM drive. Now the first problem popped up, the computer crashed everytime I meant to run the VM.

Google taught me that VirtualBox tends to crash, if you try to run a 64 bit virtual machine on a 32 bit host operating system. After I had fixed that (by using the 32 bit version of Ubuntu) and enable PAE in the VMs system processor settings, the VM finally started up.

The installation of the basic operating system – basically following the recommended settings -took some time, but went seamless. Afterwards, I had a fresh and clean system running in the VM and I could start installing everything necessary to run the Pinguino IDE.

Switching to LXDE

Well, almost … my old computer only has 2GB of RAM. Because of this, the guest system was reacting really slowly and bogged down the host as well. I decided to switch to LXDE as the windows manager for the VM. The following command installs it, along with a login manager.

sudo apt-get install lxde lxdm

While running the above command, I was prompted to select the default display manager. I switched to LXDM. After rebooting, the new login manager appeared, and I selected LXDE as the window manager while logging in. Now I had a system I could work with, without getting annoyed after a few seconds.

If your computer is low on resources like mine, you should consider downloading an adapted Ubuntu version (e.g. Lubuntu) in the first place.

Getting the Pinguino IDE

I decided to use the latest version of the Pinguino IDE and downloaded therefor the sources from the subversion repository hosted at google code:

sudo apt-get install subversion 
svn checkout pinguino32-read-only

Then the required libraries:

sudo apt-get install python-usb python-wxgtk2.8 python-svn

After this had completed I could start the IDE, with:

cd pinguino32-read-only/x.4 

Routing USB devices to the VM

The next step was connecting the Pinguino board with the computer. I fetched a Mini-USB cable and did so. I had to enter the boot loader mode. This way the board was recognized by the USB subsystem. This can be validated with:


The output should contain a device, named “Microchip” something. To actually enter the boot loader mode I had to hold down the button labeled <BUT> and press and release the button labeled <RST> once – this might be different on different boards. The two attached LEDs should flash alternately as a result.

That was the easier part. To make the board programmable in the VM I had to take a few extra steps. By now the USB subsystem should be totally invisible to VirtualBox. You can check that with:

VBoxManage list usbhost

At the current state, this did output nothing, literally. I needed to install a few things. I downloaded the “VirtualBox Extension Pack” (from here) on the host. This enables the VM to access the host systems USB 2.0 devices. I installed it by executing the downloaded file.

It was also necessary to install the so called “Guest Additions” in the VM. In the VMs menu I clicked “Devices -> Install Guest Additions”. This downloads the appropriate version and mounts it to the VMs CDROM drive. There, I executed ‘’ and did get some error message. Installing the following packages solved the problem and the Guest Additions installed successfully.

sudo apt-get install build-essential linux-headers-`uname -r` dkms

But still the command “VBoxManage list usbhost” showed nothing. I had to change my users group membership and put the UDEV rules in place, so that VirtualBox has the proper rights to access the USB devices.

I copied the matching UDEV rules from the subversion repository of the Pinguino IDE to the right system folder. I did that on the host as well as on the VM. You might share a folder between both systems to access the files. Or you check the sources out twice:

cp ~/pinguino32-read-only/x.4/extra/rules/26-microchip.rules /etc/udev/rules.d/
cp ~/pinguino32-read-only/x.4/extra/rules/41-microchip.rules /etc/udev/rules.d/

I added the group “microchip” to both systems:

groupadd microchip

And then I added my user to the created group and to the vboxusers group. The latter is only necessary on the host OS:

usermod -a -G microchip dirk
usermod -a -G vboxusers dirk

The End

Afterwards, I shut down the VM and rebooted the host system. After trying to restart the VM I got the following error:


After executing the proposed command in the terminal, which took a while to finish, I tried again and the VM started successfully up. I tried VBoxManage at the host, and the USB devices were found, even my Pinguino in bootloader mode. You can control the devices attached to the VM in the bottom-right corner of the VMs window. I attached the Pinguino and after starting the Pinguino IDE, I could theoretically upload my programs to the board. Unfortunately, the IDE behaved somewhat buggy. Starting the IDE with:


yielded better results. And I successfully uploaded the sample blinky code to the board. That’s it. Now I will go on and code the keyboard polling and post about it later.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.