Install KiCad on Arch Linux

I’ve been using KiCad on and off for a few years now. I like KiCad reasonably well but it doesn’t always play well with Mac OS X so I usually run it in a Linux Virtual Machine. Here are the install steps for Arch Linux assuming that the X Windows System, graphical interface environment, is already installed.

Screen capture of KiCad running on Arch Linux inside Virtual Box on Mac OS X

KiCad running on Arch Linux inside Virtual Box on Mac OS X

Install Instructions

# Update Pacman and download dependencies
sudo pacman -Syy
sudo pacman -S cmake bzr wxgtk glew

# Configure bzr username... 
# Even though I would prefer not to...
bzr whoami paretech

# Change into Arch User Repository download directory 
# or wherever the download should go.
cd ~/aur

# Download Bzr Tools (includes the necessary Bzr Patch plugin)
curl --remote-name

tar -xzvf bzrtools.tar.gz

cd bzrtools

# Inspect PKGBUILD first!

sudo pacman -U bzrtools*.xz

# Download Kicad AUR and name file same as remote name
curl --remote-name

tar -xzvf kicad-bzr.tar.gz

cd kicad-bzr

# Inspect PKGBUILD first!

sudo pacman -U kicad-bzr*.xz

That’s all there is to it on Arch. Good luck on your next PCB and Happy Hacking!

Hacking Apple Headphones for Assistive Technology

A while back I took opportunity to hack together a piece of Assistive Technology (AT) for a good friend of mine using a damaged pair of Apple Earphones with Remote and Mic. The first version, pictured on the right, is constructed with a three button array found on ebay.

The second version, pictured at the bottom, is constructed with large arcade buttons from Sparkfun and a custom enclosure that I made with sheet metal, a breaker bar and pop (blind) rivets. This version should be easier to use than the first as it has larger softer buttons, less dangling wires and a case that can withstand being squished between an electric wheel chair and a door frame.


If you are interested in what is inside the Apple Earphone controller, there is a wonderful tear down post.Image



Install Arch Linux as VirtualBox Guest OS

When I was an intern at Sandia National Laboratories I was introduced to the concept of using virtual machines to sandbox my projects. I have found this to be very helpful for many software experiments and development environments. I even use virtual machines to run my day-to-day Linux install. Here I give my notes on how to use Virtual Box to run an Arch Linux guest install on Mac OS X. Once a base install is complete it’s easy to make snapshots and spin up and destroy clones from the base install as needed.

Create New Virtual Machine

  • Download Arch Linux ISO Live CD

  • Create VirtualBox Disk Image (VDI) with desired settings.

  • Load the Arch Linux ISO as a CD/DVD image and select the “Boot Arch” option when the live CD boots.

Partition the drive(s)

# gdisk /dev/sda

Name Cmd # Start Stop Code Type
Boot n 1 0 +250M 8300 (Linux Filesystem)
Swap n 2 0 +2G 8200 (Linux Swap)
Root n 3 0 -0M 8300 (Linux Filesystem)
  • Use the n command and values (above) to create partitions using gdisk.
  • Print the the gdisk partition table with the p command.
  • Write the gdisk partition table with the w command.

Install and Configure System

# Format Partitions
mkfs.ext4 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 /dev/sda3

# Mount Partitions
mount /dev/sda3 /mnt

mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

swapon /dev/sda2

# Configure Mirrors

# Install Base System
pacstrap /mnt base base-devel linux

# Generate File System Table
genfstab -p /mnt >> /mnt/etc/fstab

# Set hostname
echo 'myarch' > /etc/hostname

# Change Root Directory
arch-chroot /mnt

# Configure language
echo LANG="en_US.UTF-8" >> /etc/locale.conf
echo LC_COLLATE="C" >> /etc/locale.conf
echo LC_TIME="en_US.UTF-8" >> /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen


ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc --utc

# Generate Ram Disk
mkinitcpio -p linux

# Install and Configure Bootloader
pacman -S syslinux gdisk
syslinux-install_update -iam

# Exit CHROOT, Unmount Drives and Reboot
umount -R /mnt

Post Install

The following isn’t really intended to be executed as a script.

# Setup Network
systemctl start dhcpcd
systemctl enable dhcpcd

# Virtual Box Guest Utilities
pacman -S virtualbox-guest-utils --noconfirm

modprobe -a vboxguest vboxsf vboxvideo

echo vboxguest >> /etc/modules-load.d/virtualbox.conf
echo vboxsf >> /etc/modules-load.d/virtualbox.conf
echo vboxvideo >> /etc/modules-load.d/virtualbox.conf

groupadd vboxsf

systemctl enable vboxservice
systemctl start vboxservice

# X Windows System
pacman -S xorg-server xorg-server-utils xorg-xinit xterm ttf-dejavu --noconfirm

pacman -S awesome

# User Configuration
pacman -S sudo --noconfirm

# use visudo to add  under "User privilege specification" before
# using sudo as 

# Replace user_name with desired user name.
useradd -m -g users -G optical,power,storage,vboxsf -s /bin/bash user_name

chown root.vboxsf /media

# Set  password using "# passwd "
# Set root password using "# passwd"

# Update Packages and System
pacman -Syy
pacman -Syu

Per User Config

Configuration for users other than root.

echo /usr/bin/VBoxClient-all >> ~/.xinitrc
echo "exec awesome" >> ~/.xinitrc

ln -s /media/sf_share_name/* ~/share_name

Mounting a USB thumb drive in Linux

At one point I was trying to install linux wireless drivers and since I didn’t have access to an ethernet connection I decided to transfer my driver to the computer in question via a USB thumb drive. But what do you need to do after plugging in the USB disk drive to the Linux machine in order to access the data?

Before connecting your USB device, execute the list block devices “lsblk -f” command. Then, connect your USB storage device and execute an “lsblk -f” command again. Notice anything different?

In my case I observed a new block device filesystem named “sdb1″ and its own UUID. Using the UUID, one can mount the USB device by executing “mkdir /mnt/usbdrive && mount -U YOUR_USB_DEVICE_UUID /mnt/usbdrive” as root. Take care when typing these commands, unlike most Windows/Microsoft systems I have used, *nix systems are case sensitive.

When you are finished with the device, you may “un-mount” it by executing “unmount /mnt/usbdrive” as root.

That was easy!

Calculating MSP430 BSL Checksum

Texas Instruments has a quick little java tool for calculating the checksum of a MSP430 dataframe. Recently, I’ve been seeing some forum posts looking for information on how to calculate the checksum so I thought I would post my quick Python 3 function for others.

def checksum_bsl_frame(frame):
  fmt = "<" + len(frame) // 2*"H"

words = struct.unpack(fmt, frame)

words_xored = 0;

for word in words:
    words_xored ^= word

checksum = words_xored ^ 0xFFFF

return checksum.to_bytes(2, 'little')

Here, framis a bytes or bytesarray object and checksum returns a bytes objects.

Remember, strings are strings in Python3 and bytes and bytearray are data in Python3. Of course, if you are running PySerial on Python3 then this is the format you will be using.

The above code could be simplified I’m sure but it’s nice to have endianness defined out and in the open.

When you want to “human” check the data frame there is an easy one liner way of printing a formatted output.

def print_bsl_frame(frame):
  print(" ".join('{:02X}'.format(byte) for byte in frame))

Now, it’s easy to do things like…

password = bytearray.fromhex("80 10 24 24 00 00 00 00" + 32*" FF")

The previous would print “80 10 24 24 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 5B CB” to the screen.

I hope this helps someone, it will help you more in a custom class definition.

Machine Mixing Cob for Barefoot Builder

Photograph of Christina Ott of Barefoot Builder

Christina Ott of Barefoot builder during her 2012 “Building with Cob Workshop” in Woodbury, Tennessee.

Christina Ott is a natural building consultant and owner/operator of Barefoot Builder, she also happens to be a very good friend of mine.

During the nice sun shining months of summer, Christina offers a number of natural building and permaculture related workshops. Christina hosts workshops at her home base outside Woodbury, Tennessee but she has also held workshops at various locations across the country.

During the summer of 2011, I had the unique opportunity of working with Christina on her “off grid” cob building workshop in Middle Tennessee. The workshop helped our friend Mati Karol, of the Daffodil Meadow Contemplation Center, grow his presence at the meadow.

This summer, Christina invited me back to work with her again as her tractor operator for her 2012 “building with cob” workshop at a different site in Middle Tennessee.  As the tractor operator, I was responsible for machine mixing the ingredients for cob (sand, clay, water and straw) in large quantities and delivering it to the building site as opposed to the labor intensive, but educational, foot mixing method.

Read the rest of this entry »


Using the MSP430 toolchain in Ubuntu 11.04 is very simple to set up but what about on Macintosh OS X? It turns out that the fink instructions on the MSPGCC wiki for Mac OS X are very good and work flawlessly, even easier than the Linux install. However, the MSP430 USB-Debug-Interface (MSP430UIF) didn’t work immediately, but here is the fix!
Read the rest of this entry »


Get every new post delivered to your Inbox.