Feb 21 2010

A New Workbench

Story Time. So, in Los Angeles I lived in this comically tiny studio apartment.  There, I did all my projects on this 3′ x 3′ table, which was also pre-landfill staging for junk mail and whatever else I was holding when I walked through my apartment door.  Here is it in action:

15% of surface area unusable due to feline possession.

Over time this table, which was never exactly heirloom quality to begin with, became so covered with assorted solder/glue/paint, burn marks (thermal and chemical), and power tool ‘oops’ Events, as to be only an article of furniture by virtue of its horizontality.

Table02

When I moved into my  spacious Portland apartment, I decided that I wanted a proper workbench, with room for cat storage and a soldering iron.  Specifically, I wanted to be able to work with a 4′ wide sheet of material, and something sturdy enough that it wouldn’t jump around when I used power tools, with storage for all the little necessaries like sharpies…

Completed-BenchThe tracks running perpendicular to the vise allow me to lock down any size material up to the length of the bench (6′).  It also has a compartment in the center to hold sandpaper, etc.   Here’s an exploded view (top and bottom) showing how it all goes together— the top is detachable to allow it to fit through a standard door.*

The Feet: I ordered the foot hardware from McMasterCarr, part #62805K42.  Then I took some 1/8″ thick steel plate, drilled a hole in it and tapped threads to screw the foot in.  I put a nut with an integral washer on it so that the weight of the bench would be distributed across the plate rather than resting on that 1/8″ worth of thread.  Here’s a picture to help make this clear:

Detail from the bottom of the foot hardware. This was taken while only the primer coat was on, before I did the red topcoat. Which looks fucking hot, IMO.

This has proven to be very sturdy.  The bench itself weighs about 150lbs I would guess, and I’ve stood/sat on it several times to work on something.

The Vise:  I used maple because I really like maple, and Rockler had an offal block of it that they let go for cheap.  It was subsequently pointed out to me that woodworking blocks are typically made out of a soft wood, to avoid marking up the work piece.  So take that under advisement, I guess.  The guides are just 1″ diameter pipe with flanges that I painted gloss black.  It looks really nice with the stainless steel screws.  The crank was made from a veneer clamp I got at Rockler.  The set screw that comes on the end part of the crank is some really odd thread size, and if you over-tighten the vise it will break the set screw.  If I was doing it again, I would drill out the hole, tap it with a more standard sized thread, and replace the set screw with grade 8 hardware.  But it hasn’t been such a problem that I would consider taking the whole thing apart to get at it.

Remark the First: It’s really goddamn heavy, y’all–mostly due to the layer of MDF on top.  This is good because it doesn’t jump around when you use power tools on it, but if you may consider using 1/2″ MDF on top and one-by framing material if that’s a concern for you.

Remark the Second: Having the vise in the middle of the front like it is has proven to be less than ideal.  I find that when I lock something down to work on it I would rather have it near the corner for ergonomic reasons.  You may consider moving the vise to one side or the other.

Remark the Third (*): It will fit through a standard 32″ door by detaching the top, standing the frame vertical, taking off the feet, and passing it through the door that way.  It will pass through a 30″ door if you have enough space to rotate the first legs through, then the second (and probably take the door off the hinges).  In my new San Francisco apartment, I have 29.5″ doors at the end of a narrow hallway, and I wasn’t able to get the frame through the door.

I modified the frame so that it is 30″ wide instead of 38″ to get it through the apartment door, which also had the advantage of moving the vise to one corner where it will be more useful, I think.

Plan downloads are available in Autocad DWG and Adobe PDF format.



Jul 12 2009

The Treatment by LEED® of the Environmental Impact of HVAC Refrigerants, Fuck Yeah!

Whiteboard

Today is 12 July.  There are 21 days left to study. I’ve decided to go up for my LEED GA accreditation exam on my own dime, to try an make myself a more competitive candidate if and when there are jobs again, anywhere, ever.  If you’re not familiar with it, LEED is a sustainable building program developed by the US Green Building Council.  I think it’s pretty great, because it addresses two problems I have with sustainable development as practiced today:

  • Greenwashing. Often, a company that wants to build some green cred will do something ostentatious like installing photovoltaics on their building.  It makes for great press releases, but for what they spent on solar cells (they’re insanely expensive, if you didn’t know), the company could have improved the insulation and windows, added daylighting controls, upgraded the outdated and inefficient HVAC system, retrofitted the plumbing fixtures with low-flow valves, instituted incentives for carpooling, and on and on and on.  The cumulative environmental effect of these small changes, many of which have short-term economic payback, far outweigh the big-dollar measures we associate with Green.  LEED requires a whole-building, life-cycle cost approach.
  • In the Future, there will be Robots. Media coverage of sustainable efforts tends to focus on Blue Sky research.  Cold Fusion.  Electrical power generation from sentient dirigibles.  Cars made out of sewage.  Fine and funding-deserving research all, I’m sure, but it leads to the impression that sustainability is something we will do in the Future, with Future Technology.  The thing is, LEED certified buildings have, on average, 13% lower maintenance costs, use 26% less energy, have 27% higher levels of occupant satisfaction, and emit 33% less CO2, right now, today.  While LEED rewards innovation, the majority of credits must come from existing, proven, cost effective technologies.

Anyway, I’ve been studying for about a week now, and have three more weeks to go.  The study materials cover a lot of subjects that are well outside my comfort zone: construction materials, plumbing, HVAC, sustainable purchasing.  As I alluded to in the post title, some of these subjects are more interesting to me than others.  But in the end I think it’s going to make me a much better lighting designer, in giving me some awareness of the trade-offs other disciplines deal with, and how my choices affect them.  If you’re interested, here are the primary exam materials and the secondary materials that seemed particularly interesting or relevant:

  • LEED for Operations & Maintenance Reference Guide-Introduction (U.S. Green Building Council, 2008)
  • LEED for Operations & Maintenance Reference Guide-Glossary (U.S. Green Building Council, 2008)
  • LEED for Homes Rating System (U.S. Green Building Council, 2008)
  • Cost of Green Revisited, by Davis Langdon (2007)
  • Sustainable Building Technical Manual: Part II, by Anthony Bernheim and William Reed (1996)
  • The Treatment by LEED® of the Environmental Impact of HVAC Refrigerants (LEED Technical and Scientific Advisory Committee, 2004)
  • Guidance on Innovation & Design (ID) Credits (US Green Building Council, 2004)
  • Guidelines for CIR Customers (US Green Building Council, 2007)
  • Green Building & LEED Core Concepts Guide, 1st Edition (US Green Building Council, 2009)
  • AIA Integrated Project Delivery: A Guide (www.aia.org)
  • LEED for Operations & Maintenance Reference Guide-Introduction (U.S. Green Building Council, 2008)
  • LEED for Operations & Maintenance Reference Guide-Glossary (U.S. Green Building Council, 2008)
  • LEED for Homes Rating System (U.S. Green Building Council, 2008)
  • Cost of Green Revisited, by Davis Langdon (2007)
  • Sustainable Building Technical Manual: Part II, by Anthony Bernheim and William Reed (1996)
  • The Treatment by LEED® of the Environmental Impact of HVAC Refrigerants (LEED Technical and Scientific Advisory Committee, 2004)
  • Guidance on Innovation & Design (ID) Credits (US Green Building Council, 2004)
  • Guidelines for CIR Customers (US Green Building Council, 2007)
  • Energy Performance of LEED® for New Construction Buildings: Final Report, by Cathy Turner and Mark Frankel (2008)
  • Guide to Purchasing Green Power (Environmental Protection Agency, 2004)
Book of Sorrows, 3rd Ed.

Book of Sorrows, 4th Ed.

My exam is on the 3rd, wish me luck!

Update: I passed!  I’m now a LEED Green Associate.


Jul 10 2009

Rev13 of the Arduino DMX Reception Software Released

New in this version:

  • Tested and working with IDE version 0016.
  • The number of channels to receive is now easily user-configurable.
  • Replaced static variables with #define statements for RAM optimization (+48 bytes, woot!).

You can grab it here or mosey on over to the original post for the instructions.


Jun 25 2009

What am I to do with this?

gamma1I bought this gamma ray counter for $15 from Surplus Gizmos, intending to use it as an enclosure for another project.  Any ideas?  It appears to be from the late sixties, and has a tube inside to amplify the signal from the particle chamber.

Thing is, it still works.  As near as I can tell anyway, not having a source of gamma rays to test it against.  And the quality of design and construction is so nice, now I feel bad about Frankensteining it.  In the coming zombie apocalypse, I’m sure it’ll come in useful.

gamma2

brainsss....


Jun 20 2009

Arduino Theremin/Synth Final Walkthrough

P1000478DNG

It’s Done! I gave it to my sister last weekend and she really liked it.  If you’re just tuning in now, I have posts about the hardware development, waveform crafting, an early demonstration, and the software algorithm.  The final version has the following features:

  • Four octaves of continuous pitch variation by moving your hand nearer or farther from an ultrasound sensor
  • Digital volume control
  • Continuous waveform variation–can generate a pure sine tone like a classic theremin, or one with overtones, which sounds like an 80’s synth organ.
  • Spectral glide–similar to a Wah pedal or the instrument used in Peter Frampton’s ‘Do You Feel Like I Do’
  • Decay/Sustain–envelope shaping to play notes
  • Distortion–sounds like the guitar effect.

Listen to the Tone of the Future:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

  1. 0:00-0:00 Pure tone, no effects
  2. 0:45 Waveform selection– no overtones
  3. 1:05 Decay effects
  4. 1:37 Wah
  5. 2:45 Distortion

And here is a video with me demonstrating the operation (and also explaining several key features completely incorrectly):


Keep reading for a walkthrough of the hardware and software…


Jun 4 2009

Arduino Theremin/Synth Update II

The Hardware, Oh the Hardware. I’ve been making some great progress on shaping the generated tone and getting some more musicality — I’ve programmed a decay function and that’s made a huge difference, depending on the input values I’ve got a pretty good harp simulacrum, and also something that sounds like an early 1980’s analog synth piano, which I <3.  I’ll try to get a demo up of where I’m at with tonality.  Mainly, I’ve been trying to figure out the analog inputs to control the tone sensing, as well as volume, attack, decay, echo, etc.  This is really two separate problems.  For the frequency control, I want to detect distance from 2″-3′ with good precision, stability, and ideally linearity.  For the volume and effects control, I want a 0-5V analog input over about 1-1.5″ of travel, that can be operated with a single finger.  Here’s what I’ve looked at:

  • Capacitance Sensing, which is what’s shown in the demo video from my last post.  One digital output pin on the Arduino charges up a foil plate, and then discharges it.  Another high-impedance input pin detects how long it takes for the plate voltage to cross the threshold from HIGH to LOW, or vice versa.  As you move your hand towards the plate, it increases the capacitance of the system, increasing the charge/discharge time.  My original plan was to use this method, but it wasn’t stable or accurate, and also since my enclosure is a metal box, the capacitance between the enclosure and the plate was much larger than that introduced by my hand, so I scrapped it.
  • Heterodyne Sensing, like a traditional Theremin.  In this getup, you have two RC oscillator circuits.  The capacitor part of one oscillator is connected to an antenna, and as you bring your hand nearer it increases the capacitance of the system, which reduces the oscillation frequency minutely.  Then, you use a NAND gate to heterodyne, or subtract out the matching frequencies of the two oscillators, leaving the mismatch.  From what I’ve gathered, there’s a lot of art involved in building a good Theremin sensor circuit, and in any case it’s not linear.  I played around with this some, but I couldn’t really get it to do what I wanted it to.
  • Light Detection with a Phototransistor. An infrared LED bounces light off your hand, which is detected by a phototransistor of matched spectrum sensitivity.  I tried this, but I couldn’t get much more than a binary sense input a few inches away from the sensor.  Sharp makes a line of infrared rangefinders (the GP2D12, e.g.) that use a linear ccd sensor to do angle detection rather than amplitude sensing, which can apparently detect objects accurately up to 6′ away.  Plus, they’re cheap and they output a simple 0-3V output.  However, I couldn’t source one locally.
  • Ultrasound. After trying and failing with the above, I ponied up $35 for a Parallax Ping.  They output distance as pulse length.  Not cheap, but I can’t argue with the results– It’s accurate, stable, and even linear.  I’m using it for the frequency control, as it can go out to 3′ without breaking a sweat.
  • Light Detection with a CDS Photoresistor. This is what I’m using for the volume and effects sensors, detailed below.

Goddamn Photoresistors: CDS photoresistors are cheap and easily available, but getting them to go through their resistance range smoothly is a real challenge.  Early on, I discovered that if I moved a green LED closer or farther away from the sensor, it gave a much smoother response than if I tried to modulate the ambient light.  So in my first attempt at creating a control, I used the humble toggle bolt.  I mounted it up with the led on top and the photoresistor on the bottom, like so:

toggle-boltlever1lever2lever3

This worked okay in near or complete darkness, but not so much during the day–even ambient skylight is larger than the LED output by a few orders of magnitude.  Which is a pity, because it would have looked cool, with all four levers mounted on the box and the wires coming out of them it had sort of a steampunk prosthetic hand look.  It’s possible that I could have improved it by mounting the photocell on the lever and the LED below, but it had other problems as well– the levers needed some kind of extension on them to keep your fingers from slipping off them, and the whole assembly was kind of fussy.

Next, I tried the hollow expansion bolts, with the LED and photocell mounted inside, like so:

push-buttonpush-button-2push-button-3push-button-4

This works smoothly over a dynamic range of about 700 with the default analogRead() function.  I’m thinking that I can put a tab on top of them to make them look like organ stops, which would be hot.  I’m going to try manually configuring the Arduino ADC for 8-bit mode to try and squeeze a little more speed out of them– five sensors x 100μS + processing time with the default analogRead() function may make the loop too slow, and an 8-bit data format would be more convenient for processing anyway.  The mechanism is going to be good for set-and-hold controls, but for the volume control I wanted something a little more dynamic, so prototype #3:

dome-sensor-1dome-sensor-2

The ping pong ball does a excellent job of diffusing the ambient light so that the response is smooth.

I’ve made a number of unneccesary holes in the enclosure, and also scratched it up some.  I’m not happy about that, and the lesson here is when you do a project that’s this complex, do a prototype.  But I’m kind of enjoying working fast and sloppy, too.


May 29 2009

Generate Real-time Audio on the Arduino using Pulse Code Modulation

TEK-434 1973-2009 RIP :(

TEK-434 1973-2009 RIP :(

So. There are a bewildering variety of options for generating sound via the Arduino, but I’m trying to make a real-time synthesizer, with the following features:

  • Arbitrary waveform shape, including the ability to add harmonics for a more musical sound
  • Generate any frequency dependent on sensor input
  • Efficient processor usage to allow for effects such as reverb, echo, envelope shaping, etc.
  • A minimum of external hardware

Audio output for the Arduino is pretty well-tilled soil, but surprisingly most of the previously published options are geared towards canned sound playback, or tone generation without a focus on musicality.  I’ve implemented an algorithm called Pulse Code Modulation, and I think it has a lot of potential.  Keep reading for an explanation of how it works and why it’s awesome.

Continue to page 2…


May 26 2009

Arduino Theremin/Synthesizer Update

Banana bread and chips were vital to the DAC processing

Banana bread and chips were vital to the DAC processing

An Update: I’ve made considerable progress in improving the quality of the audio output.  In the prior post, I was generating a square wave with the pulse frequency determined by an input from a capacitive sensor.  It sounded, to put it succinctly, awful.  Since I was generating it through the main loop() code, it was also susceptible to processor load problems, i.e. when an analogRead() was done, it would stop the waveform generation and start it again for ~100mS.  I’m now using interrupt-driven Pulse Code Modulation to generate an arbitrary waveform, and it sounds surprisingly decent, actually.

It’s Like This, Y’all: Since with this setup I can generate an arbitrary waveform, I first spent some time investigating what makes a tone sound musical, or not.  I started by taking a recorded piano key and doing a frequency spectrum analysis of it in Audacity.  Here’s what that looks like:

piano-waveform

The waveform of a middle C (261.626Hz) piano key

And the accompanying spectrum analysis:

piano-spectrum

You can see that the strongest tone is at the fundamental frequency of middle C, 261Hz.  But there are also spikes at the harmonics of that frequency, e.g. 523Hz, 784Hz, 1046Hz.  Interestingly enough, the strongest harmonics are those corresponding to powers of 2, i.e. f * 2n.  I’ve read that even-numbered harmonics are more pleasant-sounding than odd-numbered harmonics, and this would seem to support that idea.  Also, as you add in the odd-numbered harmonics, the waveform approaches a triangle wave, which is definitely less pleasant to listen to than a sine wave.

Thus Informed, I started working to create a waveform of my own.  I set up a frequency and a bunch of multiples of it in Audacity, and played around with increasing or decreasing the amplitude of specific overtones, until I had a sound I was happy with, like so:

middle-c-tone

On the left, you can see that I've varied the amplitude of the various overtones

From this I discovered that the undertone (1/2 * f) and other partials make a huge difference in the quality of the tone.  I wanted to post this file up so other people can play around with it, but apparently with the associated sample files it’s around 50Mb, so you’ll have to recreate it yourself.  I highly recommend it, it’s interesting.  For comparison, here is a recording of a piano, middle c tone:

grand-piano-fazioli-major-c-middle1

And here’s my generated tone:

middle-c-generated-rev1

The generated version sounds different because there’s no envelope shaping on it– it’s just a constant amplitude.  However, I if you listen to both a few times the tone is somewhat similar.

Next, I started working at digitizing a single waveform.  I couldn’t figure out an easy way to do this directly from my generated tone, so instead I built the values in Excel:


handcrafted!

handcrafted!

I then copied the summed values (column N) into a 48 element char array in my Arduino sketch.  If you want this spreadsheet, here ya go.  Finally, here’s another Unintended Comedy Amateur Hour video of me playing around with the generated sound in the Arduino:

I’m going to talk a little more about the specific programming techniques I used to make the Arduino do this in a separate post.


May 20 2009

Arduino audio output from a capacitive input

2009-05-20-210118

Lookee Lookee What I Did Today: So my sister is currently pursuing a PHD in music (theory) at the University of Chicago, and for her birthday, I thought I’d make her a sort-of theremin instrument.  Her birthday was three months ago, but whatever, right?  Today, I started playing around with how that would work using an Arduino.  In lieu of 1,000 words, here’s a YouTube video showing the setup (and also saying um a lot.  Web 3.0!):

And demonstrating the operation:

Right now I’m investigating capacitance for the input, but I may go for the authentic heterodyne sensing, if I can get it done in time (I’m visiting her in three weeks).

I based the sensor code off Paul Badger’s example here.  He documents it pretty well, and this is just a starting point anyway, so I’m not going to put up a schematic or example code right now.



May 12 2009

Rev12 of the Arduino DMX Reception Software Released

p1000328

New in this Version:

  • In-the-field addressing via two tact switches (works with the previously released I/O Shield, here).
  • Address is stored in non-volatile EEPROM, so it is retained when power is lost to the Arduino.
  • Addressing hardware allows full use of the pins (which is why I didn’t use the more conventional dip switch setup).
  • Some of the variables were localized, since the sketch is now getting pretty complex.

The latest software can be downloaded here, you may also want to check out the release notes here.

How to Set the Address:

I’m going to assume you’ve built yourself a DMX I/O shield, if not, you can take a gander at the schematic and set it up on breadboard.

There are two tact switches on the shield, a ‘1′ switch and a ‘0′ switch.

If you press and hold both switches, then hit the reset button, the starting DMX address will be reset to dimmer 1.  The pin 13 LED (marked as ‘ERR’ on the shield) will flash a few times in confirmation.

For other addresses, you’ll hold down either the 1 or 0 switch (but not both), then hit the reset switch.  The pin 13 LED will light up and stay on.  Then you’ll enter your desired address in binary, least significant digit first, by alternately hitting the 0 and 1 switch.  As you enter each bit, the LED will turn off for a moment to confirm that bit was set.  When all 9 bits are received, the ERR LED will flash a few times.  If you make a mistake, just start over by holding down one of the switches and hitting reset.

An Example: let’s say we want a starting address of 246.  246 in binary is 011110110.  You can get this number in couple of ways.

  • Mathematically,
    246 = 0*256+1*128+1*64+1*32+1*16+0*8+1*4+1*2+0*1
      =  29 + 28+27+26+25+24+23+22+21+20 = 011110110
    (Depending on how well you know your powers of 2, the above will be obvious or complete gibberish)
  • In Windows, by firing up the calculator, going to View>Scientific, entering “246″, and hitting the “BIN” radio button
  • In Google, by entering “246 in binary” in the search box
  • By looking it up in your familiar DMX dip switch chart, like this one here.

So thus far, the same process as addressing any other piece of equipment.  Now, hold down the 1 or the 0 switch, and hit reset.  The ERR LED will come on, signifying that we’re in addressing mode.

Now enter the above binary sequence, starting with the smallest number: hit the 0 switch, then the 1 switch, then 1, 0, 1, 1, 1, 1, 0.  The LED will briefly turn off every time you hit a switch.

After all 9 bits are entered, the LED will flash several times.  The board is now addressed to 246.

Another Example: Channel 131.  Hold down the 0 or 1 switch, hit reset, enter 1, 1, 0, 0, 0, 0, 0, 1, 0.

Note: Once the address is set, the pins 11 and 12 may be re-assigned for any other use.  That’s why I did it this way, rather than using a conventional dip switch, which would have taken up 9 pins on the board (I’d be lying if I said I wasn’t a little impressed by my own cleverness here).  The pins are configured with internal pull-ups in setup() as:

digitalWrite(pin0, HIGH);       //turns on the internal pull-up resistor for pin 11
pinMode(pin0, INPUT);           //sets pin 11 to input
digitalWrite(pin1, HIGH);       //turns on the internal pull-up resistor for pin 12
pinMode(pin1, INPUT);           //sets pin 11 to input

Pressing the switches grounds them, setting the pin to LOW.  So, exercise caution when using the pins for anything that doesn’t like to be grounded, is the only caveat.

Known Bug: for some reason, sometimes when you hit the 0 or 1 switch it doesn’t take.  I’ve programmed the LED to turn off briefly if the bit was successfully entered, so if you don’t see it go off, you’ll have to hit the switch again until it takes.  I don’t know why it’s doing this, if you have some time to wade through the logic let me know why and I’ll update the code.

The Astute Reader Will Wonder: why we don’t enter 000000000 for the first address.  True, DMX addresses actually run from 0 to 511, so dimmer 1 is actually listening to dmx address 0.  I’ve seen gear that takes this into account and automatically adds 1 to your desired address, and gear that you subtract 1 from your desired address.  Since there doesn’t seem to be any standard, I’ve opted to let the software do it for you because it’s easier.