here i track my physical computing progress
physical computing at ITP

» 1 2 3 4 «
week 1 | class 1 in class
we discussed some basic electronics. mostly stuff i already know, but it's excellent to review.
we're using the arduino platform now. how cool.

some thought
the arduino. i'm very excited. the last time i was doing physical computing stuff (making an electronic prepared piano, almost two years ago), i was using a pic, a pic18f452, a versatile and quite good controller. it had its ups and downs, though. the problem was the development cycle. i had to use a windows pc, with some goofy c compiler that i (cough cough) "shared" with the music tech department. and the programmer (the thing that actually burns the program into the chip) was the cheapest one we could find, costing around $140. the few hundred dollar savings over the nice USB in-circuit debugging type programmers made it so that i had to yank my pic out of the breadboard, carefully latch it into the programmer, compile, burn, de-latch, re-install, [tweak my shoddy wiring], notice a bug, wash, rinse, repeat.
that made development not so fun.
now we're using the arduino. i bought one last night, online, shipped for under $33. it has a USB controller built-in, it programs itself, it has nice headers for all the i/o... it's a tinkerer's dream. and the code is all FOSS (free open source software) and will run on my macs or linux machines. goodbye, Walter, the dependable old PIII sitting in the closet for the sole purpose of programming pic chips.

my plan
i want to build a control voltage sequencer for my modular synth. some examples:
features i'm shooting for:
this is ambitious, quite, but mostly the challenge is getting all that input hooked up (and partly building a nice panel for it). otherwise, i don't think the code will be too daunting (well, i say that now).
to do
i need to get the arduino, play with it a bit, and think about moving up to the bigger equivalent atmel chip (the atmega128, which apparantly the Wiring board uses... maybe i'll get one of those? perhaps just build my own). i need to research multiplexing and other ways to get all this i/o in.
i did
nothing. well, this.
i've spent a fair amount of time playing with breadboards. i have decided to make a good amount of space in my apartment devoted to this stuff for now though (music gear can sit in a pile for a while. looks like this will be pretty time-consuming).

week 1 | class 2 in class
fun. tom lent each student an arduino and a piggyback board that sits on top of the arduino and has all the header pins and a breadboard. i can't believe how quickly we've gotten to programming and building simple circuits.
i wrote a program that blinks an LED and says "high" and "low" accordingly out the serial port.

some thought
i've been learning about multiplexing (chapter 14 in Physical Computing). basically, i'll hook up a bunch of analog inputs to a multiplexer IC (cd4067 if memory serves me correctly) and a control or two from the arduino and switch through them really fast. i'm thinking about doing a proof-of-concept directly on the arduino for the midterm assignment - maybe a 1x3 sequencer with step length control on the other 3 analog inputs, and a digital switch for overall speed, perhaps even portamento. i'll see how far along i get.
we have to make a 'combination lock.' interesting. essentially: it'll be some combination of digital inputs, a tricky sequence of things to do, resulting in a green light. fun.
to do
i need to visit home depot or similar and get some building materials. maybe i'll grab some project boxes from radio shack for now... but i'm thinking masonite or that cheap woody stuff they use for the backs of cheap bookshelves would be good. and maybe a trip to national wholesale liquidators to buy a junky drill and bit set.
my multimeter isn't really cutting the mustard either.

later this afternoon...
ok. got a new multimeter, and some wire and a stripper and some other.. stuff. stupid radio shack on broadway near houston DOESN'T HAVE HEADER PINS so i guess i won't use those for a while.
i'm set to go home and tinker now, and i can't wait.

progress! and a little bit of ssergorp
i wired up three momentary switches and an led, and set out to write a program that took a series of button presses as a code to open the lock - simple, but realistic.
i pretty much did it. i learned a lot in programming it - my mind thinks like the arduino now ;)

so i've learned: it helps to put a delay in when reading a button press. it goes something like this:
if (digitalRead(switchPin) == HIGH) {   // button down
  if (digitalRead(switchPin) == LOW) { // button up
    digitalWrite(ledPin, HIGH); // turn on an LED
    delay(200); // wait for 200ms
i tried a few different momentary switches, and they all seem to be pretty junky, and even if you're really careful about pressing the button only once, it will often trigger multiple times. this is NO good for entering a series of button presses.

it's also really nice to have some convenience functions:
void blink(int pin, int ms) {
  digitalWrite(pin, HIGH);
  digitalWrite(pin, LOW);

void multiBlink(int pin, int ms, int times) {
  for (times; times>0; times--) {
some problems
these endeavors weren't without error, though. once i got the one-LED version working, I found a 10-led thing (it kind of looks like a meter in a junky mixer), and since the code to open my lock is a series of 9 button presses, it seemed perfect. i wired up all the pins (actually, just the first 9 because i ran out of i/o) and wrote some convenience functions to turn all the pins on and off and make it blink. then i went through my code and replaced all the single-led functions with multi-led functions... just to make sure my wiring worked.
i had interesting results. my wiring is fine, and the program seems to work fine using just the LEDs, but serial communication is borked. it repeatedly spits out bizarre things. for instance, in setup() i do
Serial.println("Enter the code to open the lock.");
which worked fine before i went multi-led. afterwards, it would print something like
Enter the code ttttttttttttttttttttttt
and then more or less work fine as i was printing out debugging info ('received code part 1 of 9' etc).
when i strip out all the serial writes, the led stuff works fine (i think). i'm going to test more tonight, and probably make things a bit more complex. the bad part of all this is that i'm not as relaxed while working with the arduino. when i started this project, everything went, well, perfectly. i guess that shouldn't really be the case with this stuff - it certainly wasn't for me in the past. so i'll have to remember not to get spoiled.

this shows the very first iteration of the multi-led thing, where i have just one led wired up and i'm using the older one-led version of the code... and then the finished thing in the box. yummy.

the code!
week 2 | class 3 in class
analog input! we wired up some variable resistors (potentiometers, flex sensors, FSRs, etc) and saw some big numbers change. and we tried 'analog' output using pwm. everything went scarily well - the arduino is so easy to use.
for next tuesday: create a love meter! [feeling lucky?] i want mine to measure love between people. the obvious thing is resistance between people when holding hands, but thats kinda boring. i have some other ideas blossoming...
week 2 | class 4 the code!
week 3 | class 5 in class
serial communication. and i presented my boob-and-cock love-o-meter, with hilarious results thanks to gilles. video coming VERY VERY SOON I PROMISE [mikey! please!].
week 4 | class 8 midterm!
i presented the sequencer. right now it's a nifty panel (which i cut in the band saw, BAD BAD ME) with 8 pots for the sequence, one pot for the speed, and two jacks - speed control input, sequence voltage output. it has a breadboard and an arduino nervously mounted on the backside. it works well, fits in my synth, and is powered by it. pictures and code soon.
the problems
i need to rewire a bit. i'm going to make it run off a pic 18f252 (cheap cheap), or maybe even an 18f2320. i found some chips (uln2004a) that have multiple transistors on-board. i'm thinking that using separate power for logic and, well, power will fix the power draw problem. also, then, i can use an LED off the pic's output in-line with the transistor's base. drilling necessary.
week 5 | class 10 long time no see!
so i've slacked on updates, a lot. i swear i'll do better
final project
the CIRCLESEQUENCER. pictures are worth a kajillion words here. this is the old original plan.
the circlesequencer
and this is an older, mouse-based version of my Processing prototype. code available there. newer, arduino-controlled code available below.
the ideal idea is to make an interface where you stick your finger in a ring, drag it around in a circle (while playing with the radius), and when you get all the way around to where you started, the motors kick in and repeat what you just did at a steady pace. then you can grab the fader at any point and make changes to the sequence.
let's get real here
that's hard to do. getting power and signals in and out while this is spinning is going to be nuts. also, i need to couple a rotary encoder and motor AND the fader all on one shaft. SO. i'm thinking i might ditch the motor part at first and have it be turntable-style. so i'll have a circular platform, on one side of which is the rotary encoder (the base of it, not the shaft), and on the other side has the fader, breadboard, etc etc. the shaft of the rotary encoder will be mounted in something heavier, which will be the base. so the spinning part will be.. autonomous.
no, really. get real.
power! arrgghhhh... how to get power to it. two options. 1. use a power jack as a swivel (hey, why not) and clamp down the connector above the center of the platform and mount a connecter DIRECTLY in the center. OR (stroke of genius drumroll) why not use batteries!?!?
i hate to say the r-word again
duh. signals. so what if this thing can be battery-powered, spinning, etc, if I can't get a voltage out of it? this is where life sucks. i really really really don't want to use something wireless... that will just make life complicated, and it's really too late to order more parts.
so i'm going to go make a thinking cap and put it on.
the end parts
receiving parts was a disaster. the rotary encoder I bought had one bad pin (that's one of three... pretty necessary). the h-bridges didn't come until the evening of the last class.
luckily, and as always, tom had solutions. rotary encoder? garumph, make your own. i mounted an led and two photocells in a bottlecap (with copious amounts of hot glue, of course) and made a pattern of black and white stripes. the idea is that, since the photocells are spaced apart a little bit, and the led is providing quasi-uniform light, one pin will go high while the other is low. with some time and clever code, it can be made to work. in my case, it was too little too late - I was hacking this together the night before, and it ended up being completely unreliable. to make this work, it has to be in a dark enclosure so external light isn't a problem.
the other solution was for the h-bridges and was decidedly less clever - tom rooted around his office and found a few.
motorized faders
mikey came through here. he went to armen's musical instruments on 30th st. and haggled and fought, and eventually got 19 faders out of a broken yamaha promix 01. lesson: if you can't find motorized faders from a surplus store, you need to rip them out of gear. otherwise they cost $50.
it was surprisingly hard to find an appropriate turntable. i ended up getting a junky rubbermaid lazy susan from vercesi hardware on 23rd st. it didn't spin well, but it was better than nothing.
circlesequncer jack rotary encoder
the construction
i drilled a hole through the center of the turntable and mounted a 1/4" stereo jack (the female part). then i found a big scrap metal tube that happened to be the exact diameter of the base of the lazy susan AND have a notch cut in it on one side (so a piece of wood would sit nicely!). I cut some scrap wood, drilled a hole, and mounted a 1/4" stereo connector (male). the whole contraption could spin and worked quite well.
the biggest challenge with this project was the spinning part. i more or less solved that problem, though I forsook the motor. by using a 1/4" stereo jack setup, i had three leads going to or from the turntable. i decided on power and ground (to the turntable) and "return signal" (from the turntable). this was for the voltage coming through the resistive part of the motorized fader, and could be wired directly to the modular synth or go into an ADC on a microcontroller for a digital signal.
the top of the turntable thusly became a magical playground of circuitry... i could do whatever i wanted on top as long as it wasn't ridiculously heavy or way off balance.
what ended up working
things looked pretty grim in the end. i didn't get the rotary encoder to work, and i abandoned the motor. excitingly enough, the fader worked pretty well, and the turntable setup had no problems.
on the up-side
i did manage to finish the original sequencer. it now has LEDs lighting the way, and is controlled with a PIC. i have some plans for further expansion, including a gate output, a sync input, a step duration range switch (microseconds? milliseconds? seconds?) and a direction switch. still, things are peachy enough as is (and it is REALLY fun to play with) and i don't want to lose the joyous simplicity.