Sunday, March 6, 2016

Small magnetic single throw double pole circuit

Back when I was a wee lass I saw Jurassic Park and knew then I wanted to get into computers so that I could create special effects. When I was a bit older we were visiting San Francisco and I went on an Aliens themed "3D" ride around Fisherman's Wharf (or maybe it was in Seattle?) Anyway, I remember being blown away by the experience of the seats moving and air hissing and decided I wanted to do computer stuff that would effect the real world. Fast forward a couple more years and I was at UW, majoring in Computer Engineering with a focus on embedded systems. Fast forward a few more after that and I'm a web dev tinkering with JavaScript... whoops. Might have miss-stepped somewhere along the way... but my love of computers is sound.

I have an inkling of knowledge on how to do things In The Real World but it's pretty weak. Turns out EE is hard and intimidating. But my interest remains strong. This, combined with my experiences doing several Escape Room games and the delight I had playing in a friend's Harry Potter puzzle LARP has lead me to the obvious conclusion that I should organize my own escape game.

Settling in to craft

Happily we got a lot of rain this weekend here in San Francisco. Not only does it help the drought problem, it allowed me to stay inside most of the weekend coding and crafting. And boy howdy is there a lot of coding and crafting to be done for this project.

A majority of the project is computer systems/pure code which I've been chipping away at, but some elements are hardware related and I've certainly been avoiding working on them. I enjoy it! But... it's hard. Thankfully I made actual progress on one portion but also wound up scrapping a different portion after repeated failure. Lets focus on the positive though!

If there's a chance you'll be playing in the game (you know who you might be, my so few Readers), I'd recommend not reading the rest of this post.

Not even half of what I needed Failed ideas

The goal: Have a surface that players can place an object on. The object has several magnets embedded in it, which activate switches below the surface when aligned correctly. The switches are attached to an Arduino which informs the computer, which informs the game server, which then has an effect on the game.

Turns out the end portion of it- the Arduino talking to the server is suuuuuper easy given the pySerial library. So the question here is about the circuit. Magnetic switches in a small space. Not difficult, right?

First attempt: run a wire to a bent paperclip, tape the wire to the hidden "floor" below, and use the wire as a hinge. Have the "surface" above be wrapped in tin foil and ground that. Now the wire runs to an Arduino pin in `INPUT_PULLUP` mode. Boom! Done! Success! When the magnet moves above the paperclip, the paperclip jumps up and grounds itself against the "surface" above and you've got a closed circuit!

Problem: There's only a couple pins on the Arduino and I'd like there be be a number of sensors so that different configurations can be recorded. That means each sensor circuit needs to ground 2 pins so I can have more unique combinations (That's multiplexing... right? Maybe?)

Next attempt: ... somehow close 2 circuits with a single paperclip's movement rather than just 1 circuit.

Problem(s): The paperclips I bent all had a single point of contact where the magnet was. The wire hinge was a bit too ridged/constricting to allow smaller pieces to rise and fall. I tried many different shapes and sizes and padding/fringe along the top of the paperclip that contacted the surface above. The signal was finicky, rarely closing both circuits.

Not really "success," but acceptable

eventually... "success!" (the signal is still a bit finicky, but good enough to go forward for now)

The solution? Have lots and lots of craft items laying around your house... No, really. The solution? conductive thread & copper tape

Conductive Thread : something needs to hold the paperclip to the "floor", allow it to pivot, and make sure it's connected to the circuit. Wire hinges were proving to be too ridged along with folded tape or aluminum foil. Enter the ever magical conductive thread. Taking two strands and tying them to the paper clip solved this problem. The clip was bent to be flat along the bottom, one strand tied to each corner, then the strands taped down with masking tape. It was a smooth hinge and a reliable connection. I wrapped the floor with aluminum foil and grounded it so that each paper clip is grounded via it's conductive thread tie downs.

Copper Tape : originally acquired for stained glass purposes, it's great. One side sticky, one side copper & conductive. Note that the sticky side is not conductive (sadly). I used this to mark out the traces on the bottom of the surface, where the paperclip would connect to. The tape is already pretty thin but I was able to cut it in half and place very close to each other- like laying out a sticker circuit board. I cut the paperclip to be U shaped, anchoring it to the floor at the bottom of the U. Now when the clip jumps up towards the magnet and closes the circuit, it has 2 little points contacting the 2 different traces (rather than one broad one).