Wednesday, March 2, 2016

Bash script for converting sheet music into 3D printer G-code

In my last post, I posted G-code for the startup and shutdown tunes I play on my Rostock Max v2 3D printer.  Those were proof of concept, manually computed using a spreadsheet.  However, once I started, I saw that it would be easy to write a short script to automate turning sheet music into the required G-code to make the printer play music.  Before I explain how it's all done, here's a little of the Tetris Theme to whet your appetite (full explanation and downloads start after the jump):


Sunday, February 28, 2016

Start/Stop your Rostock Max V2 with Mario Brothers Theme Music

About 3 months ago, I bought a Rostock Max v2 for use in the various projects I've been working on.    It's been a series of ups and downs learning how to use it, but it's been great overall.  Having gotten the printer calibration nearly locked down, I decided to give the printer a little pizzaz -- a short musical number to play before and after a print job completes.  Using what I learned from http://tim.cexx.org/?p=633, I was able to reliably generate single notes in any key I like.  Look for a more generic approach in a future post (i.e., more explanation on how to generate music on a Rostock and some proof of concept code to generate the needed G-code).  For this post, I've included videos my start-up and shut-down music (Super Mario Brothers World 1-1 level start and level completed music) as well as G-code after the jump.

Rostock Max v2 Startup - Super Mario Brothers World 1-1

Rostock Max v2 Shutdown - Super Mario Brothers Level Complete

Saturday, November 28, 2015

Web Controlled Dart Gun

I've had this 99% done for quite some time, the last 1% has taken quite a few months (I've unfortunately had to put it on the back burner due to other things).  Without further delay, here's a short Youtube video demo'ing my web controlled Dart Gun (construction details follow after the jump):


Sunday, March 29, 2015

CloneVM scripts for Free ESXi 5.5

Overview

    Update:  In an earlier version of this post, I advertised the clonevm.sh script as producing a linked clone.  In reality it was producing a full clone.  I have since gone back and written a script to perform linked cloning (linkedclonevm.sh) and renamed the clonevm.sh script to fullclonevm.sh to more accurately capture it's function.

    For users of VMWare Workstation or (finally) VMWare Fusion, clones are a highly useful feature.  Full clones are a simple copy of the original hard drive, useful for quickly creating standalone copies of a VM.  Linked clones make copies that are one better.  For those not aware of this feature, linked clones allow you to use one VM as the basis for multiple clones.  Each clone uses the base VMs hard drive as the basis for its own hard drive leaving the clone responsible only for tracking its own changes (vs. maintaining a full hard drive).  The practical benefit of doing this is ESXi storage savings.  For instance, without cloning, 5 identical VMs each with a 20GB hard drive will take up 100GB of storage.  With cloning, the 5 clones all use the same hard drive resulting in an initial allocation of 20GB for all 5 VMs that slowly grows as the 5 VM hard drives diverge from the source disk.

    While ESXi has facilities for producting a full clone of a hard drive using vmkfstools, it stops well short of what is required for a fully functioning clone.    For linked cloning, ESXi provides even less support.  As a comparison, both Workstation and Fusion clone not only the hard drive, but also all of the associated virtual hardware needed to run the VM.  A friend of mine tells me that the full up vSphere install behaves similarly, but at $5K+/year, that's not a solution that is going to work at my price point.

    Not finding what I was looking for on the internet, I decided to write my own ESXi clone scripts (get them from my github repo here).  For linked clones, the script is by-and-large based upon the following post at sanbarrow.com.  The target ESXi version for these scripts was 5.5 and they have only been tested against 5.5 so if you have a different version, your mileage may vary.  Here's what they do:

fullclonevm.sh
  • Create a dummy VM with the name you specify
  • Delete the dummy VMs hard drive 
  • Clone the specified source hard disk into the dummy VMs directory
  • Add the cloned hard drive to the dummy VM
  • Add the requested number of network interfaces to the VM
  • Add the requested amount of memory to the VM
linkedclonevm.sh (must snapshot source VM first, as it is the basis for the linked clone)

  • Create the linked clone's directory
  • Copy the target VMX and snapshot VMDKs into the linked clone directory
  • Edit the snapshot VMDK to point back to the source VMs VMDK file
  • Change the memory allocated to the linked clone, if requested
  • Change the display name of the linked clone
  • Register the linked clone with the system
  • Change the number of NICs, if requested


What follows is a how-to on installing and using my tools, fullclonevm.sh and linkedclonevm.sh

Tuesday, November 25, 2014

Arduino-Powered Going Away Gift

    Recently, one of my coworkers departed the office.  He's one of those folks who rails against the Arduino -- in his opinion, Arduinos are overkill for almost everything, people just need to get back to op amps and 555 timers, dag nabit!  So of course when we learned he was leaving, the entire office agreed -- his going away gift had to include an Arduino and it had to be used in a way that seemed like as much overkill as is humanly possible.  Given that the normal going away gift for our office is a challenge coin, here's what I came up with:

Challenge coin replaced with silver dollar in this photo.

Its a challenge coin with a blinking light.   Flip the coin over and...

Behold the power of the Arduino Micro!

…an Arduino Micro!  At first glance, it's all of the majesty of an Arduino used, essentially, to alternate the voltage value on a pin between high and low, switching an LED on and off.  Of course, I couldn't let all of that horsepower go to waste, so read on to find out what easter eggs I managed to cram under the hood.

Sunday, November 2, 2014

Arduino Controlled Halloween Light/Sound/Smoke Effects

    As mentioned in the previous post, I had been working on some Halloween effects with the kids this year.  The last post discussed the digitally controlled smoke machine I created to make this project possible.  This post seeks to discuss the rest of what we put together.

Overview

    Using an Arduino, we were able to set up an IR beam to act as a motion detection trigger.  When the beam between the two is unbroken, the Arduino controls an AC socket, powering a friendly Jack-o-lantern and porch light.  Once the IR beam become broken, the Arduino:

  • kills power to the AC socket, extinguishing the lights,
  • starts the smoke machine, and
  • sends a message to my MacBook, causing the MacBook to start playing back spooky sound effects.

After a delay of 3 seconds, the Arduino:

  • turns on LED circuits 1 and 2, lighting up the eyes of an evil looking Jack-o-lantern.

After a delay of 27 seconds (total elapsed time is 30 seconds), the effect is considered over.  Correspondingly, the Arduino:

  • turns off LED circuits 1 and 2,
  • stops the smoke machine, and
  • turns power back on to the AC socket, lighting the friendly Jack-o-Lantern and porch light back up.
To whet your appetite,  I've included a clip of our first test in the basement of my house.  A discussion of how to build the system starts after the jump.


Monday, October 27, 2014

Smoke Machine Modified for Digital Control

This year, my kids and I are working on some motion-activated effects for the trick or treaters.  As part of that project, we have some desired effects we want to be able to remotely control.  Most of them (i.e., sound effects, lights) have been easy to create.  However, remote control of a smoke machine was more of a challenge.  This project details how I combined a Powerswitch Tail 2 DC Controlled Power Switch and 400W Fog Machine  to create a digitally (i.e., computer/Arduino)  controlled smoke machine.

Full details after the jump; here's a video of the smoke machine in action, connected to an Arduino using infrared motion detection as a trigger.