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.




Wednesday, August 27, 2014

Baseball Scoreboard - Update to display Box Scores

Overview

In previous posts (1 2), I discussed having programmed all of the graphical hooks to support real time box scores but had been unable to implement due to a lack of freely available sports feeds.  By leveraging some resources Mike Metral uncovered in building his sports ticker, I was able to finally implement the functionality fully.  (More including video of the finished update after the jump)



Monday, August 18, 2014

Baseball Scoreboard - Start Here

   NOTE:  This is currently my 14th post on the subject of the baseball scoreboard.  Previous posts have covered each component of the scoreboard and what it took to create that part.  This post is intended to introduce the subject with references to the other 13 posts, depending on where your particular interests lie.


Background


    For  almost four years now, I’ve been scoring baseball games via GameChanger (https://www.gamechanger.com).   For those who don’t know, it’s a fantastic tool for scoring games.  The scorekeeper scores via an iOS/Android app that streams wirelessly to an internet server where fans who couldn’t make it out to the game can watch its progress.
    Last year at one of our games, I was put in the position of having to score via GameChanger while also operating the scoreboard at the game.  While I was able to pawn off scoreboard duties to an eager kid, in the back of my head I got this idea that it would be great if the GameChanger app could also update the team scoreboard.  At this beginning of this season, I decided to give scoreboard building a try (see results after the jump).

Baseball Scoreboard - Bill of Materials

    All said and done, the whole project cost a little under $400.  About twice what I was expecting to spend but still not unreasonable, all things considered.  For those interested in what went into the scoreboard, the bill of materials is included after the jump.

Baseball Scoreboard - Using the Scoreboard

    As I got to the all-in-one quick start, I quickly realize that I hadn't written anything about how to actually use the scoreboard.  This post will give a real quick introduction on using the scoreboard.

Baseball Scoreboard - All-in-One Quick Start Guide

    For those who don't want to dig through 9 different posts in order to figure out how to construct your own scoreboard, I put this all-in-one quick start guide together.  If you follow this from start to finish, you should be able to set up your own scoreboard in a minimum amount of time (Guide starts after the jump).

Sunday, August 17, 2014

Baseball Scoreboard - Things I'd Like to Improve

    While quite a bit of development has gone into this project thus far, there are still some things I see as shortcoming.  After the jump, I'll go through the things that I see as needed improvements.  If you see anything I may have missed, please feel free to chime in in the comments below.

Saturday, August 9, 2014

Baseball Scoreboard - The Web Server

    If you have followed along with the blog posts thus far, your scoreboard now is functional, but there may be some things you wish you could do above and beyond the basics (at least that was the case for me).  To provide a venue for accomplishing those routine tasks, I stood up a web server.  Quick start guide starts after the jump.

Friday, August 8, 2014

Baseball Scoreboard - The Parser

    While I'm presenting the parser near the end of this development, the initial work on this portion of the scoreboard occurred more than a year ago at the conclusion of last season when I was still toying with the idea of the project.  After initialization, the parser steps through the following loop:

  1. Wait for a file containing POST data,
  2. Unzip the gzipped POST data,
  3. Parse the resulting JSON to recover the game state (score/inning, etc),
  4. Send the appropriate serial command to the scoreboard,
  5. Parse the serial response until the ready prompt is received,
  6. Move the POST data file to the output directory

Before we step through how each part works, the quick start guide (starts after the jump):

Thursday, August 7, 2014

Baseball Scoreboard - The Transparent Proxy

    If you'd asked me at the start of this project how long I thought this portion would have taken me, I probably would have said a day or two.  Reality didn't work out that way for me.  Instead, I spent more than a month iterating through failures and then making the modifications to get tinyproxy (the transparent proxy of choice) to do what I needed it to.  But before we get to a recap of what I did, a quick start guide (after the jump).

Wednesday, August 6, 2014

Baseball Scoreboard - Network Configuration within the Control Box

    In this blog post, I'll discuss how to set up the networking for the control box.  If you do this correctly, by the end, you'll be able to join the WiFi access point (AP) in the control box and surf the internet via 4G (yes, I'm aware that the 4G hotspot does that on its own, but we're building to something here).  This post will cover the easy stuff first (selection and configuration of WiFi and 4G) and move onto the more complex (configuration of the Raspberry Pi).  But first, for those who are impatient, the quick start guide starts after the jump.

Friday, August 1, 2014

Baseball Scoreboard - Control Box Overview

   While the scoreboard gets all of the attention, all of the heavy lifting happens within the control box.  The control box is responsible for providing internet to the scorer while passively listening in on the GameChanger communications and relaying the score to the scoreboard.  Here's an overview of how data flows through the control box:

(More after the jump…)

Thursday, July 31, 2014

Baseball Scoreboard - Programming the Scoreboard

    For those who are interested in playing with code rather than reading about code, here are the instructions to get up and running in a minimum amount of time:

  1. If you haven't already, download the Arduino IDE and install (http://arduino.cc/en/Main/Software).
  2. The github repository for my code can be found here.  Check it out into your Arduino working directory (i.e., git clone https://github.com/ScratchesTheItch/ScoreboardArduinoCode.git).
  3. Fire up the Arduino IDE, open the GC_Scoreboard sketch file.
  4. Upload the sketch to the Arduino.
  5. Once loaded, select the Serial Monitor to begin interacting with the scoreboard. (I'd suggest starting with a "help" command to get the compact usage statement or "test" to see what the scoreboard can do).
If you're playing with the code at this point, I'll admit that the help statement is a bit terse.  Due to an issue that I was never able to resolve, the full help message is too long to be output via serial.  As a result, I commented out most of the explanation for the commands in the compiled code -- if you want to read the full text, scroll down to line 54 in the sketch file.

Wednesday, July 30, 2014

Baseball Scoreboard - Constructing the Scoreboard

    This post covers the physical construction of the scoreboard; programming of the scoreboard is covered in the next topic.  While this presented first in the development process, in reality, the physical construction actually did not occur until after the initial field tests.  For most the development cycle, the scoreboard was actually a cardboard box with holes cut out for the displays, a temporary solution that I used while ironing out the more difficult development issues (also covered in future posts).

Design Goals


    My design goals for this portion of the project were simple:  provide a solid mount for the electronic components of the project that wouldn't break the budget and whose aesthetics wouldn't make people wretch (as I heard copious complaints about the cardboard box form factor).  After walking around the craft store for a bit, I settled on a cork board as the base to build the scoreboard around.