Low-Tech Touchpad

touchpad

In this project, Peter and I had to combine high and low tech materials.  The inspiration for this project came from the High-Low Tech lab at MIT as well as Squishy Circuits among many others which you can find at the course webpage.

We constructed a low-tech touchpad that you could use to control a mouse, or anything else that could use one or two dimensions of input. Here’s a video showing it in action.

How does it work?

The touchpad has three layers. The top and bottom layer are resistive fabrics, which means they conduct electricity but not quite as easily as copper wire does – so more fabric between two leads increases the resistance between those leads. The middle layer is a conductive fabric, which means it conducts electricity just like a wire – with very little resistance between any two points on the sheet.  Here’s Peter’s concept sketch.

Concept Sketch of the Low-tech touchpadSo how does it produce an (X, Y) point reading?

Circuit diagram of one layer of the touchpad

Circuit diagram of one layer of the touchpad

Take a look at the image above.  It shows the top and middle layer of the touch pad.  The middle layer is connected to ground and remember since its very conductive connecting it to ground makes the whole sheet basically the same voltage.

The top layer is connected as if it were a resistor in a voltage divider. The sweet trick is that second resistor in this faux-divider is dependent on how much material is between the voltage source (top of the sheet) and ground (where you touch the top sheet to the middle sheet.

One technical detail is that the edge of the top sheet which has the power applied to it has conductive thread running through it so that the voltage is the same in the horizontal direction and only changes in the vertical direction.

Hopefully you see where this is going, the bottom layer is exactly the same as the top layer except rotated 90 degrees and bam, the reading from one layer gives you a vertical position and the other layer gives you a horizontal position.

Here’s a few more photos; some of early prototypes.  Thanks for reading!

Earliest Prototype - Graphite on paper with a copper tape layer.

Earliest Prototype – Graphite on paper with a copper tape layer.

Prototype - Conductive paint on normal fabric

Prototype – Conductive paint on normal fabric

Resistive fabric taped to cardboard with conductive fabric in between

Resistive fabric taped to cardboard with conductive fabric in between

Final prototype next to a graphite on paper switch

Final prototype next to a graphite on paper switch

Peter demonstrates the low-tech touchpad

Peter demonstrates the low-tech touchpad

 

Fuzzy Adventure: An Arduino Music Project

This semester I’m taking Jon Froehlich‘s Tangible Interactive Computing class.  For out first assignment we were tasked with creating an input device; no restrictions, it could be as narrow or as broad as we wanted.

My partner, Alina Goldman, and I decided to make a physical device for controlling electronic music called Fuzzy Adventure.  Our motivation was to bridge the divide between what you see and what you hear when experiencing an electronic music performance. What are the artists doing? How are their slider shifting, button pushing and knob tweaking affecting the sound? Sometimes its really hard to tell.

Enter Fuzzy Adventure, where physical artifacts or constants physical actuation are the only ways to manipulate sounds.

 Aside: Obviously, this is a tiny prototype and it's not *that* useful 
        for making music, but its the ideas we wanted to capture, 
        not a full-blown piece of DJ equipment.
Fuzzy Adventure Music Controller

Top view of the Fuzzy Controller Box

The Fuzzy Controller can manipulate the volume of three looping music tracks – drums, bass, and synth – as well as the level of a Bit Crush effect on each track. The music is started by placing the Power Cube onto its position.

Close up of the location for the Power Cube.  Power Cube is missing

No music plays without the Power Cube

Close up of the Power Cube completing the circuit to turn on the music

Placing the Power Cube on the leads turns on Fuzzy Adventure

 

 

 

 

 

 

The volume of the drum and bass tracks are controlled by adding weight to the cups on the left. This is an example of a physical manifestation of the intent to raise the volume of a track. The persistent change in volume is consistent with a persistent weight in the cups.

The drum track’s Bit Crush is controlled by crushing the Power Flower on the right of the box. Pipe cleaners give the flower structure such that a crushed flower remains crushed until its deliberately expanded. Again, in this way the artist’s desire for a constant sound change is accompanied by a physical, and visible, artifact.

The bass track’s Bit Crush is instead controlled by the proximity sensor in the blue circle. Only when something is within a few centimeters of the sensor will the effect be applied. This is an example of a transient effect that is only realized through a constant physical actuation by the artist. If they move away from the sensor, the change is revert and thus apparent to the audience.

Lastly, the Synth volume and Bit Crush are controlled by two touch membranes in the center of the box. These have the same property as the proximity sensor in that the artist much physical touch the sensors in order to include the synth sounds in their performance.

So enough talk, here’s a short demo video.  Enjoy!

)

Internals

Fuzzy Adventure is powered by an Arduino which reads input from 6 sensors and a switch and writes to a Serial port.  The inside looks like this:

Fuzzy Adventure Circuitry

Not the cleanest of wiring, but hey, its a prototype.

Then a Processing sketch reads from the Serial port and manipulates the music based on the sensor values. Here’s the source Code on GitHub.

npm thinks my modules are “extraneous”

The command

npm ls

lists the modules in your project. Trouble is I didn’t know that modules installed via

npm install [module name]

are considered extraneous since they are not listed in your package.json.

Instead, list your dependencies in package.json and use simply

npm install

and all your dependcies will be installed (just like before) but npm will not consider them extraneous.

If you’re coming from the Ruby work, what I was originally doing seems to be similar to installing gems via the `gem` command instead of putting them in a Gemfile and using bundler. Now, if only there was a node equivalent to Bundler…

This is what my `npm ls` was originally report. Emphasis mine.

serial-viz@0.0.1 /Users/chris/Projects/UMD/838f/1_viz_with_node
├── consolidate@0.10.0 extraneous
├─┬ express@3.4.8
│ ├── buffer-crc32@0.2.1
│ ├─┬ commander@1.3.2
│ │ └── keypress@0.1.0
│ ├─┬ connect@2.12.0
│ │ ├── batch@0.5.0
│ │ ├── bytes@0.2.1
│ │ ├─┬ multiparty@2.2.0
│ │ │ ├─┬ readable-stream@1.1.10
│ │ │ │ ├── core-util-is@1.0.1
│ │ │ │ ├── debuglog@0.0.2
│ │ │ │ └── string_decoder@0.10.25
│ │ │ └── stream-counter@0.2.0
│ │ ├── negotiator@0.3.0
│ │ ├── pause@0.0.1
│ │ ├── qs@0.6.6
│ │ ├── raw-body@1.1.2
│ │ └── uid2@0.0.3
│ ├── cookie@0.1.0
│ ├── cookie-signature@1.0.1
│ ├── debug@0.7.4
│ ├── fresh@0.2.0
│ ├── merge-descriptors@0.0.1
│ ├── methods@0.1.0
│ ├── mkdirp@0.3.5
│ ├── range-parser@0.0.4
│ └─┬ send@0.1.4
│ └── mime@1.2.11
├── mustache@0.8.1 extraneous
└─┬ serialport@1.3.1 extraneous
├── async@0.1.18
├── bindings@1.1.1
├── nan@0.7.1
├─┬ optimist@0.3.7
│ └── wordwrap@0.0.2
└── sf@0.1.6

Glitch Art Trials

Recently I’ve been inspired by the glitch art subreddit and other forms of data corruption art. There are a number of techniques for achieving this aesthetic, which I will post about in the future, but for now here are a couple examples that I finally got working.

Photo glitching with Audacity: How to

chris-stuff

Variety of effects applied to small regions

chris-wahwah

Wah wah effect applied to the whole image

chris-reverse

Reverse effect applied to most of the image

Photo glitching with Hexfiend. Giffed with GifFun:

(Click these thumbnails to see the animated gif.)

Sky glitch

Variety of hex edits.
source: http://images.nationalgeographic.com/wpf/media-live/photos/000/010/cache/mackerel-sky_1054_990x742.jpg

chris_2

Variety of hex edits

Datamoshing with ffmpegX and avidemux

(thanks to YouTube user datamosher for this video, BUT I haven’t got the technique figured out for OSX 10.7+ yet)

( Leaving this example out for now, until I can get posting videos nicely figured out.)

Pattern Matching and Matching Patterns: This clause is redundant.

I was following along Imp chapter of the Software Foundations textbook (found here at Benjamin Pierce’s webpage) and I got stuck pretty early on.  By follow along, I mean I was retyping everything in the chapter so that I could be an active participant in the “reading along process.”

Here’s what the chapter says to do:

 Inductive bexp : Type := 
  | BTrue : bexp
  | BFalse : bexp
  | BEq : aexp → aexp → bexp
  | BLe : aexp → aexp → bexp
  | BNot : bexp → bexp
  | BAnd : bexp → bexp → bexp.

Here’s what I wrote.

Inductive bexp : Type := 
  | BTrue : bexp
  | BFlase : bexp
  | BEq : aexp → aexp → bexp
  | BLe : aexp → aexp → bexp
  | BNot : bexp → bexp
  | BAnd : bexp → bexp → bexp.

Did you catch the difference? Well I didn’t, and neither did Coq, because frankly, it doesn’t care what you call your constructors – nor, should it.

Fast forward to the first time we tried to use the definition of bexp.

 Fixpoint beval (e : bexp) : bool :=
  match e with 
  | BTrue => true
  | BFalse => false
  | BEq a1 a2 => beq_nat (aeval a1) (aeval a2)   (* Error on this line*)
  | BLe a1 a2 => ble_nat (aeval a1) (aeval a2)
  | BNot b1 => negb (beval b1)
  | BAnd b1 b2 => andb (beval b1) (beval b2)
  end.

And we’re met with the supremely helpful message: Error: This clause is redundant.

Because the definition of bexp had a typo, there is no “BFalse” constructor. Instead, the BFlase in the pattern match of the defintion beval is a pattern match variable matching anything.  So between the BTrue case and the “everything else” case, all patterns are matched making anything below the seemingly correct “BFalse” redundant.

Yes, perhaps it was a careless typo that caused the problem, but a more descriptive error message would have been really helpful.  Having just run into this today, I don’t know if there exists some solution for catching this earlier, but here’s ideas I had.

  1. Warning mode: Warns when a “catch” all pattern is used. (Maybe only warns if the pattern is a variable instead of an underscore)
  2. Enhance the error message with “This clause is redundant because SomeOtherClause already caught this pattern.”

Compile that Buffer

I’ve just started using Coq, a proof assistant, – and a pretty cool one at that. But just like anything else, being new to Coq means I run into some silly problems sometimes (read: often). I’ll post those issues here in the hopes that some other newbie comes across it and doesn’t make my mistakes.

Here’s my setup at the moment:

  • OSX 10.7.5
  • CoqIde version 8.4

If you “Require Export Somelibrary” and you get this error, you may need to compile Somelibrary.

Error: Cannot find library Somelibrary in loadpath

Open Somelibrary into CoqIde and click Compile -> Compile Buffer.

Bootstrap with RVM

rvm –create –rvmrc use <ruby>@<gemset>

RVM will create a .rvmrc for you which will check that your project’s ruby and gemset are properly installed and if not, it’ll install them.  Plus as a bonus, if you have a Gemfile (i.e. you’re using bundler), it’ll check for that, install if necessary, and run a bundle for you in case you’re missing any gems.

Source: gist owned by saimonmoore

 

Ruby plays favorites with ‘boolean’ operators

I just came across a post from 2008 by Adam Loving where he points out a possible error in the way Ruby parses Boolean operators. From the post:

irb(main):001:0> x = false || true
=> true
irb(main):002:0> x
=> true
irb(main):003:0> z = false or true
=> true
irb(main):004:0> z
=> false

Ruby parses the line 3 as:

(z = false) or true

wtf Ruby?

Adam used Ruby 1.8.6. I’m using Ruby 1.9.2 and am seeing the same issue. It is not entirely unreasonable to assume that the two operators should behave the same way. So why does Ruby give || a higher precedence that ‘or’?

Well, it turns out that || and ‘or’ are not synonyms exactly and the reason is related more to linguistic semantics than computational logic. Check out the following two sentences taken from a blog post by prestonlee.com/.

  1. I’m either traveling by car or just staying home.
  2. I’m either traveling by car or by train.

In sentence 1, the semantics of ‘or’ is to describe the consequence of the first condition. Otherwise known as control flow. This is what the ‘or’ keyword is meant to represent. Indeed in Perl, a common idiom is:

do_something() or die "Something went wrong";

On the other hand, in sentence 2 the ‘or’ separates two arguments for which we are interested in their truth value. This is a more familiar case of wanting to test two conditions, ie what the first example was trying to do with z. Here’s how it should have been written not just because it produces the desired output, but because it is semantically correct as well.

z = false || true

If you’re interested in more complete explanation, below are the full links to the blogs which inspired this post. Special thanks to user rothsa in the #ruby IRC channel for pointing me in the right direction.

Equations in Google Docs

Love to use Google Docs to access your documents everywhere?  Miss your fancy-shmancy Greek letter and math symbols.

  • View -> “Show equation toolbar”
  • Click the “New Equation” button to start equation mode.
  • Use LaTex like syntax to add symbols.

It doesn’t have the full power LaTex but now my Google Docs can speak a little Greek.

( Also, this might have been around for some time, but I just found it. )