Categories
Projects

3D Printed Ornaments

This year, I made 3D printed ornaments for our Christmas tree. shrink_IMG_9806

My son is 18 months old, and he loves to run around and touch pretty things.  We have some really pretty, old and fragile Christmas ornaments from Amanda’s side of the family, but I was too scared to put them on our tree this year.

I designed some tree ornaments in Fusion 360, and printed them out.  I found a cool trick where I was able to get the printed ornament to be a single layer thick, and have a hollow bottom.  This means you can use a traditional metal ornament cap, or print one.  The thin walls also means they are pretty when you put them over your Christmas lights.

I uploaded the files for the Teardrop Ornament to YouMagine.

shrink_IMG_9817

shrink_IMG_9810

shrink_IMG_9798

shrink_IMG_9799

Categories
Projects

Making a trade show demo in a week, for Seattle Sport Sciences

I do a lot of things.  Professionally, I spent the bulk of my work week with Digi Wireless Design Services.  It rebrands every year or two, as these things tend to do.  It was Etherios Wireless Design, and previously Spectrum Design Solutions.

As part of the rebrand, the marketing folks asked me if I’d talk about a project I did this last year that everyone was really happy with.  Usually I work in a team, but for this project, I was the only engineer.  I built an interactive wireless network with some Teensys and XBees and Neopixels, and got it show-ready in under a week end-to-end using an Othermill and some other rapid prototyping tools.  The customer really liked it, as did the rest of the Digi team.  This project with Seattle Sport Sciences even ended up in the Digi quarterly earnings report press release!

Anyway, I outlined a short video for them, and they wrote it up on a whiteboard, and tada!

I’m relatively pleased how this video turned out.  7 minutes, no scene cuts, and while I’m not perfectly fluent, I think I did a pretty good job.

Categories
Projects

Initial release of check_projects

I wrote a tool for checking project directories.  It checks for a variety of things.

Typical usage often looks like this:

check_projects -d /foo/bar/baz

which would check /foo/bar/baz for the following:

  • a non-empty file in /foo/bar/baz with a name that starts with README
  • a non-empty file in /foo/bar/baz with a name that starts with LICENSE
  • /foo/bar/baz being in a git repository
  • /foo/bar/baz’s git repository having an empty stash
  • /foo/bar/baz’s git repository having remotes
  • /foo/bar/baz’s git repository having no uncommitted changes
  • /foo/bar/baz’s git repository having no unpushed commits

I’m definitely open to other checks and other version control systems. Let me know if there’s something you’re interested in.

check_projects seems to work for me, but please do not assume it works perfectly. If you’re using it for something critical, take a look at the code or let me know.

It’s written in Python. You can download it or take a closer look at https://github.com/adamwolf/check_project.

Now that we’re done with the business-y intro, the human side.

Even though I’ve been seriously programming in Python since 2004 or so, this was the first project I’ve ever uploaded to PyPI.  (You can see it at https://pypi.python.org/pypi/check_project.) This is pretty cool–it means that you Python programmers can just pip install check_project!

Second, if you are pretty sure you know you need something like this, but you need help installing this, let me know.

Third, if you use this and like it at all, please let me know. In 2015, many programs are still written by human meatbags, and we appreciate knowing our work is used and is helping someone.

Categories
Projects

Arduino Mandelbrot Set Viewer

Arduino Mandelbrot Set Viewer

I got a few 128×64 graphics LCDs for Christmas. One of the first things I did with them was make a Mandelbrot Set viewer–with zoom!

Video

The video is available in HD, and viewable in a larger size if you click through. The music is “Mandelbrot Set” by Jonathan Coulton.

Description

The Mandelbrot Set is a fractal. You can zoom on the border and get pretty pictures. There are a bunch of cool facts about the Mandelbrot Set at Wikipedia, and Jonathan Coulton has a sweet song about it.

Download

Download the Arduino sketch for the Mandelbrot Set viewer.

This requires a GLCDks0108 library available on the Arduino Playground. Currently, to run, this library needs a simple modification! In ks0108.h, move the line

void WriteData(uint8_t data); // experts can make this public but the functionality is not documented

to the public: section. This function allows you to write a byte to the display, and advances the cursor. After a cursory browsing of the datasheet, it appears the fastest way to write data to the screen. I’m in the process of getting this change made in the library so this modification won’t be necessary.

Code

The code for this isn’t too difficult. The actual drawing of the Mandelbrot set is pretty much exactly as described in this nice Mandelbrot Set tutorial. It goes over the theory and the code for drawing the fractal. The only change I made in drawing the fractal was that I calculate 8 points, and then draw them to the screen as a group. This matches how the screen wants to receive data, and wastes less time interfacing with the LCD.

The zooming functionality is taken care of by a simple state machine in the loop() loop.

If you want to run this on a different microcontroller, the C should be fairly portable.

Schematics

Mandelbrot Set Viewer Schematic

Parts

In terms of hardware requirements, I used a ks0108 graphics LCD. These are available from a variety of vendors–but be careful and check your pinouts! The specific one I used was this 128×64 graphics LCD from Sparkfun, but there are a variety of displays listed in the Arduino Playground site for the graphics library I used.

Besides the LCD, I used a 220 ohm resistor (R1) and switch (SW1) to toggle the backlight, a 10k potentiometer (VR1) for setting the display contrast, two buttons (SW2, SW3) for back and forward, and a 10k potentiometer (VR2) for the cursor.

Future Work

I would like to take a look at fixing some of the rounding issues. There are some places where the drawing “looks funny” after enough zooms. I’m pretty sure it’s due to rounding issues with the limited floating point precision.

I would also like to improve the “back button” functionality so that you can go back in the middle of the zooming process if you make a mistake.

The controls could likely be made more intuitive by using something with a joystick. The software interface matches the input paradigm of a knob and some buttons, but if there was a cursor, and then moving the cursor made a box, the zoom would likely be more intuitive. This could be implemented with the Wii nunchuck.

Photo Gallery

More photos are available at my Mandelbrot Set photo set.

Questions, comments?

Feel free to contact me.

References

Categories
Projects

Mediawiki Mail Notifications

I’ve set up little MediaWiki instances for small groups to do work in. One problem consistently encountered is a lack of awareness of updates and changes. The Recent Pages RSS is an ok step, but sometimes RSS isn’t an option. While there are RSS to Email services, the problem can also be solved directly in Mediawiki.

I used an extension I found on the Mediawiki, MailNotification. It provides a way to email all registered users of the wiki a summary page of all the changes made since the last time an email went out. Set up in cron, it’s an excellent way to make Mediawiki more suitable for small group collaboration.

The plugin doesn’t seem to be updated anymore, and it’s had a variety of issues for me everytime I update MediaWiki. I’ve been tinkering with the code, adding more details to the summary page and making sure it works with modern versions. I threw the code up on github last week, and provided a tagged release.

Feel free to let me know if you have any issues installing or using this plugin, and if you have any patches, feel free to send them my way.

Categories
Projects

inbox_count tells you how many email messages are in your inbox.

Today, I read a blog post where Thomas said he was graphing the numbers of messages in his Evolution mailbox to track himself and his progress at keeping his inbox empty.

I wrote and released a Python script that does the same for IMAP servers, called inbox_count.

It’s located at http://feelslikeburning.com/projects/inbox_count/.

Enjoy!

Categories
Projects

Klugephrase!

I made my own electronic handheld word guessing game similar to Electronic Catchphrase a few days ago.

Klugephrase

For more details, go to the Klugephrase website.

Categories
Projects

episode filer organizes your tv shows!

I’ve been playing around with git and github recently, and out popped this little project, episode filer. It files your tv shows into proper directories, taking just a little bit of monotony out of your day.

The project page is at http://feelslikeburning.com/projects/episode-filer/ and it’s on github at http://github.com/adamwolf/episode-filer/.

Categories
Projects

Multibooting Linux, Windows, and Mac OS X on a Mac and using them as Virtual Machines

Recently, I set up my Macbook to boot OS X, Ubuntu, and Windows XP, with a large common partition that they all can natively read and write.  Then I decided it’d be nice to be able to interact with these other systems through OS X in VMware Fusion, so I set that up as well.  This took many tries, and a lot of experimentation.  In the spirit of science, after I had everything working, I documented it, and then started from scratch to verify my instructions.  I wrote up my instructions along with a dabble of theory.  They follow.

Windows XP, Ubuntu Linux, and Mac OS X

This is what shows up when I boot.

rEFIt showing Mac OS X, Ubuntu Linux, and Windows XP

If you try this, make sure to have a backup of everything.

To multiboot a Mac with OS X 10.5.5, Ubuntu 8.10, and Windows XP SP3 circa November 2008:

Ingredients:

  • Intel Macintosh
  • OS X 10.5 Media
  • Ubuntu 8.10
  • Windows XP SP2 or higher media
  • VMWare Fusion (If you want to be able to run Windows and/or Linux inside of OS X.)

There are many ways to get this working, but also many ways that do not.  One way that works is this:

  1. Boot the Mac from the OS X install media.  Instead of installing right away, go Disk Utility.  Use Disk Utility to partition the hard drive into four partitions, Linux, Share, Windows, and Mac.  Set the first three to be MS-DOS (FAT).  Set the Mac partition to be Mac OS Extended (Journaled).  Apply this.  Quit Disk Utility.
  2. Install OS X on the Mac partition.
  3. Reboot and set up your administrator user.  Do all software updates.  Reboot.  Check for software updates again.  Reboot and repeat until no updates are available.
  4. Install rEFIt.  rEFIt is an EFI boot menu.
  5. Set the windows partition to be active (bootable).  This can be done in OS X through the terminal.  Open the terminal (/Applications/Utilities/Terminal.app) and run the command: sudo fdisk -e /dev/rdisk0
  6. You will likely get the error, “fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory”.  That’s ok.  Type p to print. You should see four partitions.  If you look carefully, the first partition is a 200 megabyte one and what you thought was partition one is actually partition two.  OS X put an EFI System partition in the first spot when you formatted the disk, so you actually have five partitions on the disk.  Your last partition, the Mac one, shouldn’t be visible from this screen.  The disk is a GPT disk, which contains inside of it a Master Boot Record (MBR). This MBR is how older OSes find partitions and bootloaders.  With Apple, this MBR doesn’t support extended partitions, so you can only have your four primary partitions.  That’s what you’re seeing here.  You have to type f 4 to set the Windows partition as bootable.  After that, press q to quit and then y to save changes.
  7. Insert the Windows XP media and reboot.  Select the Windows CD when rEFIt asks how it should boot.
  8. After loading drivers, Windows will ask where it should install.  Once again, it’s going to see four partitions.  The 200 meg EFI partition, and the first three partitions you defined.  I’ve tried this step in many, many ways, and the only times I’ve been successful I’ve done the following:  Make sure that the install partition is labeled C: and is the last partition shown.
  9. Select it, and format the partition.  A FAT32 quick format and long format both work.  I haven’t tested NTFS.  If I didn’t format the partition, after Windows reboots and tries to continue the install, I have gotten “Missing Operating System” errors, “hal.dll not found” errors, as well as any other excuse Windows can find for why it cannot boot.  If a different partition is labeled C: than the Windows partition that we created at the beginning, quit the install, reboot into OS X, and go back to step 5.  See if there is a little asterisk next the partition we’re trying to install to.  That means active and bootable.  From my experiments, it looks like Windows sets C: to the the active partition if there is one, otherwise it is first FAT/NTFS partition.  Why don’t we make this easy and install Windows to the first FAT/NTFS partition?  If Windows isn’t installed on the last partition in the MBR, it fails to install properly.  I’ve tried mucking around in boot.ini and other files with no luck. Windows will need to reboot twice while installing.  Finish the install.
  10. Insert your OSX 10.5 disk.  This has all the drivers you need for your system.  If you don’t have it, or you have a developer edition that doesn’t have those drivers built in, you can extract the drivers from the Boot Camp Assistant application or find them on the internet.  Go through the “Boot Camp” driver auto-installer that autoruns, and then reboot.  When rEFIt shows up, select the Windows install on the hard drive, and do all the Windows updates. Reboot and continue to do updates until there are no further updates.
  11. At rEFIt, select the partitioning tool to sync the GPT and MBR.  If it doesn’t need syncing, it will tell you.  Then select OS X and verify it boots properly.  Insert your Ubuntu media and reboot into the disk using rEFIt.
  12. Install Ubuntu as you normally would, with two exceptions: partitioning, and the boot loader.  At partitioning, select the manual partition option.  It will scan your disks, and show you yet another view of the drive.  Check the format box on the Linux partition, and set it to mount at /.  This will be sda2 if you’re following the partitioning layout.  Then proceed.  The installer will complain about a lack of swap space.  If you need swap space, you can set it up as a swapfile after the installer.  Acknowledge the complaint and move on. At the last step before you let the install finish, there is a little button labeled “Advanced”.  Clicking that button opens a window that includes a dropdown box for setting the location where the GRUB bootloader is installed.  If you leave this as the default, you’ll have to go through GRUB for both Windows and Linux, which you probably don’t want.  Instead, set this to be the Linux partition (/dev/sda2).  You won’t have to tell Windows about this bootloader because rEFIt will use it directly.  After clicking next on this screen, Ubuntu will install and prompt you to remove the media and reboot the machine.
  13. Verify Ubuntu, Windows, and OS X all boot by choosing them at the rEFIt menu.  Boot into OS X last, and remember which non-OS X OS you booted into last before choosing OS X. (You shouldn’t need to, but if you have issues see if you need to sync your partition tables between GPT and the MBR using the partitioning tool in rEFIt.)

At this point, if you don’t want to be able to use those installs in VMWare while booted into OS X, you’re done!  Otherwise, trek on, my faithful reader.

In OS X, install VMWare Fusion.  There’s nothing special about VMWare Fusion over any of the other products, its just the one I already have.  Start VMWare Fusion, and ignore the “Boot Camp Partition” entry.  There’s a bug filed at VMWare to allow people to remove it.  There’s not a real reason why you need to ignore it, but I’m going to teach you how to do it manually. You’re going to have to do it manually at least once to get Linux working, and its pretty easy.

To create a VM that points to a partition on the disk, so we can use a partition to boot into as well as run in a VM, we need to do the following.

  1. Use vmware-rawdiskcreator to create a disk file that points to the partition.
  2. Create a new VM, and remove any autocreated harddrives and add our raw disk file.
  3. Edit the vmx preferences file to disable snapshots and suspend.  With these enabled, its too easy to corrupt your partition.

vmware-rawdiskcreator is a command-line program that allows VMware VMs to directly address partitions instead of using a file as a hard drive.  It can only address the MBR, so there are the same restrictions on which partitions can be pointed to as with Windows.  At this point, I’m going to copy and paste the help.

tredegarh:~ wolf$ /Library/Application Support/VMware Fusion/vmware-rawdiskCreator –help
Usage:

/Library/Application Support/VMware Fusion/vmware-rawdiskCreator print <diskDev>
Print the partition table of a physical disk.

/Library/Application Support/VMware Fusion/vmware-rawdiskCreator hasBootCamp <diskDev>
Check if a physical disk has an Apple Boot Camp partition (exit
code is 0) or not (exit code is non-0).

/Library/Application Support/VMware Fusion/vmware-rawdiskCreator create <diskDev> <partNum> <virtDiskPath> <adapterType>
Create a VMware virtual disk backed by a partition of a physical
disk.

<diskDev> is a disk device, e.g. “/dev/disk0”.

<partNum> is the partition number as printed by the “print”
command, e.g. 3. 0 is special and means “the Apple Boot Camp
partition”.

<virtDiskPath> is the path of the virtual disk description file to
create, e.g. “~/Virtual Machines/My VM/My Raw Disk”. Two files
will be created: “<virtDiskPath>.vmdk” and
“<virtDiskPath>-pt.vmdk”.

<adapterType> is the virtual disk type. It must be one of “ide”,
“buslogic”, or “lsilogic”.

<virtDiskPath>.vmdk is a human-readable parameters file.  It identifies the vmdk as a raw disk and points to the device representing the partition.  When we’re done with this, the booted VM is going to see this raw partition as the only partition on a virtual device.  What’s going to happen when the VM wants to read the MBR and partition tables of the virtual hard drive?  Those aren’t stored in the partition we’re pointing to.  This is where the second file comes in–the <virtDiskPath>-pt.vmdk.  According to my experiments, this file is a copy of the drive’s (<diskDev>) MBR and some modified partition tables.  This is created when vmware-rawdiskCreator is run.  It isn’t dynamic.  This is why we have to remember which non-OS X partition we booted last.  rEFIt marks a partition active/bootable when we select it from rEFIt’s menu.  If we make a raw disk file pointing to a non-bootable partition, the bootloader won’t start right when loaded by the virtual machine.

Back to the doing!

Assuming we’re following my partitioning layout, and assuming we booted Linux last, we run
/Library/Application Support/VMware Fusion/vmware-rawdiskCreator create /dev/disk0 2 linux ide

Now we need to create a VM.  Open VMware Fusion, and create a new VM.  When it asks about install media, skip with “Continue without disk,” then “Create a custom virtual machine.”  Pick the closest OS you can, then finish the wizard.  Then VMware opens up the System Settings.  In the Hard Disks section, remove the automatically created hard disk.  If you want, remove the automatically-created vmdk files inside your VM.  You’ll have to close the virtual machine from inside of VMware in order to remove some lock files.  To remove the rest of the files, you can use the Finder or the Terminal or however else you want to remove files.  Virtual Machines are just directories but they look special to the Finder.  The VM will appear as a bundle (just like applications) probably inside of your Documents/Virtual Machines directory.  You can right-click on the virtual machine icon inside of the Finder and “Show Package Contents” to get to the contents of the virtual machine, or else you can just use the Terminal.  Everything ending with .vmdk inside of this new virtual machine directory is safe to remove at this point.

This is a good time to disable snapshots and suspending from this VM.  To do this, edit the .vmx file in the first level of the VM bundle.  Add the lines:

suspend.disabled = “TRUE”
snapshot.disabled = “TRUE”

and save the file.

Open VMware Fusion again, and get to the Hard Disks section of System Settings of your new virtual machine.  Add a new disk.  Choose an existing disk, and navigate to the place where you saved the .vmdk and -pt.vmdk file.  Select the .vmdk file.  Copy it or move it, depending on which you’d rather do.  Apply, and then start the virtual machine.

A common error at this point is “Missing Operating System” or VMware Fusion complains that there are no bootable devices.  This can be a problem with the raw disk files.  To fix this, remove the hard drive, rerun vmware-rawdiskcreator after rebooting into the OS through rEFIt and rebooting back into OS X in order to get the boot records correct.

At this point you can install VMware Tools.

To set up the VM for the other OS, reboot into it through rEFIt, and then back into OS X.  You could also use fdisk -e like we did earlier, but this way lets you verify that the other OSes are still bootable.  Once you’re back in VMware, create the disk for the other OS through rawdisk-creator and follow the same process we did for the first OS.

Now, you might notice an issue with the share partition.  The share isn’t accessible from more than one OS at the same time.  This is for filesystem consistency reasons.  If more than one OS were editing the drive at the same time, corruption would likely occur.

How do we fix this?

We can use file sharing through something like Samba or NFS, or Shared Folders through VMware for the VMs.  Windows and Ubuntu will still be able to access the share when they’re booted natively, and through Shared Folders when they’re in a VM.

At this point, you should have a triple-boot Mac OS X / Windows / Ubuntu Linux system.   From inside OS X, you can open the Linux and Windows partitions as VMs.  Each OS can see the share partition when natively booted, and the virtual machines can see the shares if you set up Shared Folders.

Why did I choose this partitioning layout?

It was a lot like a logic puzzle, with little facts teased out after repeated installations.

  • Windows needs to be in the last spot in the MBR or you get install issues on an Intel Mac with OS X.
  • The EFI System partition is rumored to be used in firmware updates, so I left that in the first spot, where it puts itself.
  • Grub needs to be installed on a partition located in the MBR, but Linux doesn’t.
  • Windows can only see partitions in the MBR.
  • OS X can see all the partitions.
  • Linux can see all the partitions.
  • I want a share partition that can be read by all OSes without installing programs.  This means FAT32.  To be seen by all OSes it needs to be in the MBR.
  • OS X doesn’t need to be installed in the MBR.

Let me know how it works out for you guys.

Categories
Projects

Adding an audio jack to headphones

IMG_0126

A few months ago, my headphones broke. They were Sony MDR-NC6s, pretty cheap but the noise-canceling really helps cuts out the HVAC in a cube environment. They failed when I stood up and the cord was wrapped around my chair. The cord pulled out of the bottom of the headphones. I took them apart, and saw that there was probably enough room to fit a headphone jack in if I used a Dremel and some creativity. The cord now goes out the side of the headphones instead of the bottom, but the repair only took an hour and didn’t cost more than five dollars either. I now use an audio patch cable to connect my headphones to audio sources, and if I stand up with the cord tangled, the cord pops out of either end without damage.

I posted some pictures of the process on Flickr at the photoset Repairing my headphones.

The only real lesson learned is that I wouldn’t use the Radio Shack 3.5 mm stereo jack. It doesn’t grip the cable well. I will have to replace the jack next time I order from digikey.