Showing posts with label projects. Show all posts
Showing posts with label projects. Show all posts

20111003

Goggles Kits for VIA are Go !

Alright kids, as promised, flicker hallucination visor kits for VIA are packed and ready to go! We should have about 30 kits available at Assemble on Wednesday October 5, 4-7PM. There will also be drawdio kits and LED illuminated kites. The Visor kit is a sexy remix of the brain machine kit, which retails for $35. The Visor also cost that much to produce, but we're still looking for last minute sponsors to subsidize the Assemble workshop and bring that cost down a bit. The remainder of the kits ( about 50 in total ) will arrive by Saturday and will be available at the main event. Assembly instructions and additional information are hosted at www.treehovse.blogspot.com. If there are any extra kits, we've reserved a booth at the Pittsburgh Mini Maker Faire to make them available there. Let me know if you would like me to reserve you a kit. There also might be a very limited number of pre-built kits available, time permitting. By the way, this most excellent Visor cartoon has been brought to you by Austin Redwood.


20110206

Project : Atomic Sun

Progress and innovation let us build a world that departs increasingly from the environment for which we evolved. To resolve the mismatch between our genetic disposition and the world we build, we must either adapt our environment or adapt ourselves. Winters are pretty dark up here, some days I'm not sure the sun even rises. So, I built this lamp. Its on a timer, and functions to keep the circadian rhythm intact.
These are instructions for building a very bright lamp with 20 bulbs and a truncated icosahedral core. Development set me back about $120 total ( bulbs included ), but you should be able to build this for as little as $40 not including the light-bulbs or cost of plastic.
Parts :
Materials:
  • electrical tape
  • super-glue ( I used Gorilla brand )
Tools:
  • Pliers
  • 3D printer
  • razor knife
  • wire cutters
  • wire strippers
  • Phillip's head screwdriver
Assembly:
First print out the indicated quantity of all printed parts.
More detailed assembly instructions for the lamp socket brackets can be found on the thingiverse page. Trim the bracket until the black socket rests flush inside. This is important, since we need the hexagonal cover plate to bond to both the bracket and the socket for a good fit.
The orientation of the socket within the bracket will matter later. The socket has a wide ridge. Align this ridge with a side of the bracket for 10 pieces. Align the ridge with a corner of the bracket for the other 10. Aligning randomly also works, as long as you don't align all sockets so that the wide parts face a side.
Print out 12 pentagonal pieces. All pieces have extra plastic to stabilize the hinge while printing. This can be removed easily with a razor knife.
Perform a test assembly with just the hexagonal pieces. Leave out the pentagons for now since they are hard to remove once assembled. Ensure that all light sockets fit properly and don't collide. You may have to experiment, rotating and swapping between pieces, to get everything to fit well. If all else fails you can tap apart one of the brackets and re-orient it.
Carefully unfold your test assembly into an as-linear-as-possible planar arrangement like below. The exact arrangement doesn't really matter, just so long as there isn't too much branching.
The lamp sockets clip onto 12 to 14 gauge electrical wire. The only 12 gauge wire I could find had too thick of insulation to work with these sockets. I used 16 gauge wire instead, which just barely works. Using scissors or a knife, separate one end of the lamp cord. Protect the ends with electrical tape. Starting at the far end, clamp the sockets to the cable in turn. The sockets are difficult to close, so I had to use pliers to get enough force.

Before you get excited and attach the plug to test everything, slide on the pentagonal hook piece over the cable. The top of the printed piece should be facing away from the assembly, toward the plug. I neglected to do this, and had to dis-assemble my plug to add this piece.
To assemble the plug, use needle-nose pliers to remove the orange stopper from the front of the plug. Remove the prongs. Thread the lamp cord through. Split and strip about 13mm from the end of each wire. Wrap the exposed wire around the bolts attached to the prongs, and tighten the bolts well. Replace the prongs and stopper.

Test each of your sockets. Turn everything over and plug in some lightbulbs. I did it the dangerous way by adding and removing bulbs ( I only had 2 at the time ) while the thing was plugged in. People that don't want to die should un-plug the setup while moving the bulbs. Better yet, order the bulbs with the rest of your parts and put them all in at once to test.
The next step is tricky. Unplug the setup and remove the bulbs. Turn over the setup. You are going to need to fold the pieces back into the polyhedral shape. The lamp cord is inflexible and resists folding, but bending each joint beforehand helps. Adding in the pentagons while folding provides more stability. As the polyhedron becomes more complete, it becomes more difficult to add pieces. If you're having trouble getting a hinge to mate, pry up slightly the side that is already in the polyhedron. The hinges come together more easily if pushed together from the side, rather than if pushed down from above.
When it was all done, the compressed cable overpowered the super-glue on a couple brackets, thankfully this mistake is easily fixed with more super-glue and some patience. You should end up with an object that looks more than a little bit like the detonation mechanism for an atomic bomb. The final assembly is very strong and the hinges will hold together without additional glue.
The last piece you'll insert is the one that contains the power cord and the rope or chain for hanging the lamp. I would attach rope or chain before you add this piece. Don't use polypropylene rope like I did, it doesn't hold knots. A chain would look nicer anyway.
Thats it. You're done. Hang the lamp somewhere, insert bulbs, and power up your own miniature sun.


20100920

Project, preliminary


Keegan and I are working on a new project. It should look something like this. We have the electrical stuff worked out, but may need some assistance with the mechanical aspects. The basic idea is to make a conveyor belt of phosphorescent fabric, then write things on it using a bar of ultraviolet LEDs.

/>


20100902

Drop Day Octahedron

I was digging through the archives and I found some documentation for the CCFL Octahedron project from Drop Day that was never published. We don't have photos of the build process, just a text description and the source code, as well as pictures of the finished project in action. This should be good for inspiration and perhaps source code for a similar project, if not total duplication.

Physical construction

Each edge of the octahedron structure is a 2-foot piece of wooden dowel rod. A hole is drilled perpendicular to each rod at each end. The rods at each vertex are held together with a double loop of fishing wire through these holes. Rods and wire are spraypainted black.

The lights are cold cathode flourescent bulbs, as sold for lighting computer cases. A pair of bulbs are attached to the outside of each edge with cable ties. Each pair is powered through an inverter attached to the inside of the edge. I've left some spare bulbs in the elevator closet in alley 3. A pair of bulbs together with inverter can be purchased online for about $8.

A power cable runs from each inverter to a common vertex where they are bundled together and exit through one side. Each of the twelve cables is dual-conductor 18-gauge (?) speaker wire. One end terminates in a connector accepted by the inverter; the other is permanently soldered to the control board.

The control board is powered through a long three-conductor ribbon cable terminating in a Molex 8981 male connector, which will interface with a standard ATX computer power supply. (To make an ATX power supply turn on without a motherboard present, one must connect the ~PS_ON signal on the motherboard connector, normally green, to ground.)


Electronics

The control board is built around an ATtiny2313 processor, two CD4094BC 8-bit shift registers, and three ULN2068 quad-channel Darlington switch arrays. The processor is clocked by an external 16 MHz crystal. The fuse extended and high bytes are left at factory default. The fuse low byte is programmed to 0xFF: no prescalar, no clock output, external crystal, slow start-up. The shift registers are cascaded to act as a single 16-bit serial-in, parallel-out register. The processor has three outputs to the shift register: Data (pin PB3), Clock (pin PB2), and Latch (pin PB4). A single bit is loaded by setting Data high or low, setting Clock high for 4 processor cycles (250 ns), then bringing Clock low again. This is repeated 16 times, once per bit of a 16-bit word, with the least-significant bit first. After all 16 bits are loaded, the Latch pin is strobed high for 4 cycles, at which point the shift registers will present the 16 bits on their output pins.

12 of these 16 bits are wired to inputs of the Darlington switch arrays. When a switch-array input is at logic high, the corresponding output will sink current to ground, illuminating the corresponding lights. The unused bits of the shift register are (from LSB = 0) bits 6, 7, B, and F.

The power supply to the control board consists of ground, +5 V, and +12 V. The 12 V supply is wired directly to the positive side of each inverter's DC input. The negative side of each inverter's input sinks through a Darlington switch. When all bulbs are on, the system will draw about 5 amps on the 12 V line. It has an inline fuse holder loaded with a 10 amp fuse. The 5 V line is used for powering the logic chips only and should draw minimal current.

.. you see how much effort I'm putting here : screen shot of the monospace text figure

hdr2 is used to program the processor via a standard AVR programmer, such as the AVR ISP mkII. From top to bottom as oriented above, the pins are:

MOSI, MISO, SCK, VCC, ~RESET, GND

hdr1 is currently unused but is connected to the circuit. From top to bottom:

VCC, GND, not connected, PD4, PD5

This could be used to communicate with another board via a 2-wire serial protocol.

The push buttons will short PB5 or PB6 to ground when pressed. The switch will short PD6. Neither is used by the current software.


Software

See code at the end of this post. The software implements a few modes and switches between them. It includes a very simplistic random number generator (which is not random at all because the seed is hard-coded).


Bugs and quirks

Sometimes, especially when starting, the system will go into a bad state such as freezing or strobing synchronously in an unappealing fashion. I seem to have fixed this by adding another filtering capacitor on the 12 V rail, but the problem may return.

Sometimes after switching off the ATX power supply it will not turn back on for a number of minutes. Perhaps a large resistor between power and ground would fix this problem by acting as a stabilization load.

Many aspects of the circuit, such as the use of shift registers, an external crystal, and extra buttons and switches, are historical or arbitrary. Where the speaker wire meets the board it can short against unintended pins of the ULN2068 in ways that are not visually obvious. This can result in all four channels on that chip turning on when only one is activated in software.

You can pulse-width modulate a light channel in software, but it will not dim the light. Instead, it will light up part of the tube from one end, which looks cool and is probably very bad for the bulb.


Replacing the control board

The control board is a crufty prototype and it may be desired to replace it with something nicer: either a better-produced custom board or a totally off-the-shelf controller. Essentially all that is required is to switch on and off with some reasonable speed the sinking of ~ 500 mA current on each of 12 channels. This could be accomplished with any number of devices: Darlington pairs, power FETs, solid-state relays, etc. Optical isolation of the control signal may improve robustness. Many microcontrollers can provide the 12 I/O pins directly, so external shift registers are unnecessary.


Software


Here is the source code associated with the Octahedron. First, build-and-upload.sh, the bash commands used to compile and upload the program to the AVR.


#!/bin/sh -e


# build with avr-gcc suite
avr-g++ -o octahedron.bin -mmcu=attiny2313 -Wall -Winline -save-temps -fverbose-asm -Os octahedron.cpp
avr-size octahedron.bin
avr-objcopy -j .text -j .data -O ihex octahedron.bin octahedron.hex

# upload using AVR ISP mkII
avrdude -p t2313 -P usb -c avrispmkII -U flash:w:octahedron.hex


This is the straight up AVR C++. You'll need an in system programmer to upload it.



#define F_CPU 16000000L

#include <stdint.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <util/delay.h>

typedef uint8_t byte;

// a shitty "random" number generator
uint16_t xrand() __attribute__ ((noinline));
uint16_t xrand() {
static uint16_t y = 3;
y ^= (y << 13);
y ^= (y >> 9);
return y ^= (y << 7);
}

// delay by an amount known at runtime
void delay_ms(uint16_t ms) {
while (ms-- > 0) _delay_ms(1);
}


// Define pins for the shift registers
#define SREG_PORT PORTB
#define SREG_DDR DDRB
#define SREG_LCH (1 << 4) // latch, high to set
#define SREG_DAT (1 << 3) // data
#define SREG_CLK (1 << 2) // clock on rising edge

// Define pins for the buttons and switch
#define UI_PORT PORTB
#define UI_DDR DDRB
#define UI_PIN PINB
#define UI_BTN_A (1 << 6)
#define UI_BTN_B (1 << 5)

#define UI_BTN_A_DOWN (!(UI_PIN & UI_BTN_A))
#define UI_BTN_B_DOWN (!(UI_PIN & UI_BTN_B))

#define UI_SW_PORT PORTD
#define UI_SW_DDR DDRD
#define UI_SW_PIN PIND
#define UI_SW (1 << 6)
#define UI_SW_EN (DARK_PIN & DARK_SW)

// Init the shift registers
inline void sreg_init() {
SREG_DDR |= (SREG_LCH | SREG_DAT | SREG_CLK);
}

// Optional delay when setting pins for the
// shift registers.
// At 5V they will handle at least 12 MHz.
inline void sreg_delay() {
asm volatile ("nop");
asm volatile ("nop");
asm volatile ("nop");
asm volatile ("nop");
}

// Shift a bit into the shift registers.
void sreg_shift_bit(bool x) {
if (x)
SREG_PORT |= SREG_DAT;
else
SREG_PORT &= ~SREG_DAT;

sreg_delay();
SREG_PORT |= SREG_CLK;
sreg_delay();
SREG_PORT &= ~SREG_CLK;
}

// A full shift-register write.
// Shift 16 bits, then latch.
void sreg_write(uint16_t x) {
for (byte i=0; i<16; i++) {
sreg_shift_bit(x & 1);
x >>= 1;
}

sreg_delay();
SREG_PORT |= SREG_LCH;
sreg_delay();
SREG_PORT &= ~SREG_LCH;
}

// The bits corresponding to wired-up channels are:
// FEDC BA98 7654 3210
// XXX XXX XX XXXX
// This function maps 12 contig. bits onto these.
uint16_t lights_to_channels(uint16_t x) {
return (x & 0x003F) // 0000 0011 1111
| ((x & 0x01C0) << 2) // 0001 1100 0000
| ((x & 0x0E00) << 3); // 1110 0000 0000
}

// Set which lights are on according to a 12-bit value.
uint16_t lights = 0;
void set_lights(uint16_t new_lights) {
static uint16_t state = 0;
lights = new_lights;
uint16_t new_state = lights_to_channels(lights);
uint16_t mask = 0;

//if (new_state == state) return;

for (byte i=0; i<16; i++) {
mask = (mask << 1) | 1;
sreg_write((state & (~mask)) | (new_state & mask));
_delay_us(500);
}

state = new_state;
}


/*
inline void ui_init() {
// pull up both buttons and the switch
UI_DDR &= ~(UI_BTN_A | UI_BTN_B);
UI_PORT |= (UI_BTN_A | UI_BTN_B);

UI_SW_DDR &= ~UI_SW;
UI_SW_PORT |= UI_SW;
}

inline void ui_debounce() {
_delay_ms(50);
}
*/

#define L_R1 0x400
#define L_G1 0x002
#define L_B1 0x004

#define L_R2 0x008
#define L_G2 0x040
#define L_B2 0x010

#define L_R3 0x100
#define L_G3 0x020
#define L_B3 0x080

#define L_R4 0x001
#define L_G4 0x200
#define L_B4 0x800

/// RGBRBGGBRGRB
/// BRGR BGGB RBGR
/// 0101 0000 1001 = 0x509
/// 0010 0110 0010 = 0x262
/// 1000 1001 0100 = 0x894

#define ALL_R (L_R1 | L_R2 | L_R3 | L_R4)
#define ALL_G (L_G1 | L_G2 | L_G3 | L_G4)
#define ALL_B (L_B1 | L_B2 | L_B3 | L_B4)

#define ALL_LIGHTS (ALL_R | ALL_B | ALL_G)

const uint16_t tris[8] PROGMEM = {
L_R2 | L_G2 | L_B2,
L_R1 | L_G3 | L_B2,
L_R3 | L_G3 | L_B3,
L_R4 | L_G2 | L_B3,
L_R3 | L_G1 | L_B4,
L_R4 | L_G4 | L_B4,
L_R2 | L_G4 | L_B1,
L_R1 | L_G1 | L_B1
};

const uint16_t squares[3] PROGMEM = {
ALL_R, ALL_G, ALL_B
};

/// modes

uint16_t rand_mask() {
return (1 << (xrand() % 12));
}

void noise_fast() {
uint16_t len = 300 + (xrand() % 300);
for (uint16_t t = 0; t < len; t++) {
set_lights(lights ^ rand_mask());
_delay_ms(60);
}
}

void fade_down() {
while (lights != 0) {
set_lights(lights & (~rand_mask()));
_delay_ms(1);
}
}

void fade_up() {
while (lights != ALL_LIGHTS) {
set_lights(lights | rand_mask());
_delay_ms(1);
}
}

void updown_fast() {
uint16_t len = 20 + (xrand() % 20);
for (uint16_t t = 0; t < len; t++) {
fade_up();
fade_down();
}
}

void rgb() {
uint16_t len = 150 + (xrand() % 100);
for (uint16_t t = 0; t < len; t++) {
for (byte i=0; i<3; i++) {
set_lights(pgm_read_dword(&squares[i]));
_delay_ms(120);
}
}
}

void tri_rand() {
uint16_t len = 300 + (xrand() % 700);
for (uint16_t t = 0; t < len; t++) {
set_lights(pgm_read_dword(&(tris[xrand() % 8])));
_delay_ms(60);
}
}

/* causes reset?
void tri_strobe() {
uint16_t len = 100 + (xrand() % 300);
for (uint16_t t = 0; t < len; t++) {
set_lights(pgm_read_dword(&(tris[xrand() % 8])));
_delay_ms(30);
set_lights(0);
delay_ms(xrand() % 200);
}
}
*/

/*
void test() {
for (byte i=0; i<12; i++) {
set_lights(1 << i);
delay_ms(1000);
}
set_lights(0);
delay_ms(5000);
}*/

int main() {

sreg_init();
//ui_init();

set_lights(0);

for (;;) {
rgb();
updown_fast();
rgb();
noise_fast();
rgb();
tri_rand();
}

}




20100817

Mill PCBs using Adobe Illustrator

I elected to design a couple circuit boards using a vector graphics editor rather than Eagle cad. This allows for smooth organic traces and arbitrary graphics, but can make fabricating the boards difficult. I would recommend Eagle cad or some other program that can output gerber files if you are designing a board that you might some day want to mass produce. These instructions and scripts pertain specifically to the "Modela 3D plotter" devices. These instructions are absurd and more of a satire of actual PCB milling.

Quick preview
0 - sketch it up
1 - rasterize
2 - screw around in Gimp
3 - convert to mill file using python
4 - adjust and mill board
5 - export to SVG & use python to turn SVG into drill file
7 - manually adjust and drill board


Software links
cad.py (for generating mill code, from here)
circle.py (for extracting circles form .svg and converting them to modela drill file)
modela-move.py (for manually positioning the mill)
modela-send.py (for sending a .rml to the mill with buffering)
realign.py (for applying affine transformations to .rml files)
stats.py (for getting .rml plotting bounds for sanity check)
- files not guaranteed for correctness, may generate commands that break mill, be careful
- realign hates negative numbers
- note to self : hosting on dropbox, move later
- requires python serial libraries and BeautifulSoup packages to run

0 - Draw the board. I set up a 0.25" grid which is good for 0.1" pitch components. Use circles only for component pads, and put a circle at the center of each pad. This makes it possible to strip out the circle positions with a script to generate a drill file. I connect pads with smooth splines and add custom artwork. Routing and positioning is all done by hand.

1 - Export your file and process through "cad.py" script from fab-lab to generate code for your milling machines. In fact, "cad.py" crashed when I tried to process SVG directly. Instead, rasterize the SVG at 600 DPI and process it as a .PNG. A few things to watch out for : Adobe Illustrator uses a default 72 DPI, while Inkscape uses 90 dpi. That is, units in the exported SVG file will be in 1/72nds of an inch from Ilustrator, and 1/90ths of an inch from Inkscape. Hence, opening a SVG at a DPI other than what it was created at may cause problems.


2 - I never thought I'd be using The Gimp for circuit board design. Open the 600DPI rasterized file. First, make the background is opaque, and invert the file such that traces are white and the background is black. Then apply gaussian blur followed by threshold to round out the traces, and manually corrected close traces with the paintbrush. Gaussian blus+threshold can also be used to shrink or grow the size of board features if you are having trouble with traces being too thin or too close together, but watch out for accidentally merging traces. This is absolutely absurd, but it works, and cad.py liked .PNG more than .SVG.


3 - We wrote a collection of utility scripts for the Modela milling device. These include

realign.py for apply arbitrary affine transformations to a mill file (works on standard in/out, redirect files to/from these IO streams to read/write from files). This is useful for moving the file co-ordinates to just the right spot in mill co-ordinates. This is also useful for manually aligning drill files or two sided circuit boards, since they seem to be a bit off sometimes. It can't handle negative coordinates at the moment.

The file stats.py simply prints out the number of plotting commands (redirect files to standard in), followed by the minimum and maximum x and y coordinates of the milling file. This is good for a sanity check to make sure your file is in the right location. It can't handle negative coordinates at the moment.

The file modela-move.py accepts x,y,z coordinates and moves the mill to that position.

The file models-send.py accepts a .rml file piped from standard in and sends it to the milling machine. This script is necessary to avoid overflowing the command buffer on the mill.

4 - Use realign.py to move the output of cad.py to the correct position for milling. Use stats.py to double check that your board is where you think it is. Calibrate and position the mill. You probably want to make sure the x,y,z speeds are set slow. I have been using the slowest speed of "1" because I broke way to many bits going faster. Read up on the Modela mill or ask the mill owner to train you in its operation. TODO : collect some useful links here ?

5 - Prepare the drill file. To do this, redirect a SVG of the board to the "circles.py" script. This script will extract the centers of all circles, remove duplicate circles, and create a semi-sane set of drilling commands. However, it does not use exactly the same coordinate transforms as cad.py, hence drill files are off anywhere from 5 to 40 mils ( the machine uses 'mil' as the basic unit, which is 1/1000" ). Whatever transform you applied with realign.py to the board file, do this also to the drill file.

6 - Manually adjust your pen down height to be 50 mils above the board. Run a test run to see how far off the drill file is, and use realign to move it to the correct position. I really wish I had a better procedure here. When the first hole looks aligned, set pen down to -80 mils and drill. Make sure there is something underneath the board so you don't dril through the bottom of your milling bed.

This actually works. I milled nine boards the the past couple days. Designing circuit boards in drawing programs, and using gaussian blur and paintbrush aren't generally part of the workflow for circuit board production. You can also just print off the board and use the toner transfer method, then drill by hand.

The results look nice, though 0.1" pitch is as small as it can go for through-hole work. SMT probably has a higher resolution since you don't have to worry about the holes.

p.s. : I dislike how google sends the blog post out to the RSS feed when its first created, such that subsequent grammar corrections are not reflected in people who read this blog via RSS reader. I guess this just means I should proof-read better.


20100529

Do it Yourself : Trip Visor

Thanks to a dumpster diving friend I had come into possesion of a pair of welding goggles, as well as some white translucent plexiglass. So, the old hallucination goggles project was adapted for this new, awesome, rugged, form factor.

Step 1 : electronics :
I chose to use an Arduino Pro-mini, two RGB LEDs for the goggles, and a 4 character multiplexed 7 segment display.

Step 2 : draw a circuit board. I like to use a generic drawing program so I can put graphics in the copper pattern. Some PCB drawing software will also allow this, although not all PCB fabrication services will do custom graphics. I skipped out on the current limiting resistors for the blue and green channels, since the supply voltage is actually lower than the LED driving voltage. I still needed them for the red though. This kind of design is very general, as you just need to get some LEDs to blink in a controlled manner. The circuit looks like this :



Next, transfer pattern, etch, drill, clean. It is easier to wire this up on a breadboard and then transfer it to a radioshack protoboard, to save on the hassle of making your own board. Here is a tutorial that I loosely followed, and here is a previous post where I practiced the technique, and below is the finished result. I made the traces from the Arduino to the LED display a too narrow, and unless you're careful this design requires clean up after etching.


I was wrong to try to drive this circuit from coin cell batteries. These batteries do not put out enough current to drive the LEDs. I worked around this by adding a 2xAAA battery pack to the interior of the goggles. If you copy my design, bear this in mind and adjust accordingly.


My friend laser cut white plexiglass to replace the tinted glass of the welding goggles. This is a square cut that could also be accomplished with a saw. These goggles have a slot for a piece of plexiglass on the inside, and another piece on the outside, with 7mm clearance in-between, so it is straightforward to sandwich the LEDs between two sheets of plexiglass to create diffused light. Position the LEDs approximately in the center of the visual field in each eye, so that when you look at them through a pane of the white plexiglass, they line up as if they were one diffuse source. I used standard connectors for indicator lights and power buttons in PC cases to connect the LEDs, and a rocker switch from an old Ikea lamp, to finish off the connections.


This is more durable than past designs, since it doesn't have a separate part for the driving hardware and the goggles, connected by a failure prone cable. Reminds me of this. I can actually toss this one around without breaking it.



20091107

Circuit Etching Test

Using some variant of the instructions found here, I was able to etch a small 1"x1" test board.


Current problems : surprisingly few. [1] OpenOffice, which I used to draw the design, does not scale correctly when printing. Much searching on the internet did not resolve this problem, and ultimately I guessed as to the correct scale at which to draw the design. Suggestions for a better free drawing program would be welcome. [2] There was a 1mm misalignment between the two board sides. This makes through hole mounting.. tricky to impossible ? I will have to try harder next time. [3] I do not have a drill press, and Home Depot does not sell bits small enough to drill out PCB holes. I will simply use only surface mount designs in the future, to avoid this problem. [4] I do not know how to reliably get good close-up shots with my cheap digital camera.

Significant deviations/simplifications/shortcuts from the internet instructions : [1] I did not prepare the board with acetone beforehand, I scrubbed it a bit with steel wool. [2] I did not have to soak the board particularly long to remove the paper. I simply left the board in warm water for a few seconds then slowly peeled off the transfer paper in one piece. This created a nearly perfect mask. [3] I did not have to heat or agitate the etching solution, I just ignored it for twenty minutes. [4] I removed the mask with a q-tip and acetone, no abrasion.

Update : I tried some surface mount style soldering practice on the board

Since drilling holes is a major nuisance, I decided to try soldering an IC directly on the surface. I cut about 1/2 the leads off and bent them inward. I then tinned both the pads on the board and the leads. Connecting the chip was then as simple as briefly touching the joint to melt the two pools of solder together. The chip ( a hex inverter ) still works despite using no anti-static precautions, no heat sink while soldering, and hooking it up to twice the operating voltage backwards. Surface mount soldering of 0.1" pitch components turns out to be fairly easy, so I see no reason not to use surface mount design in the future. Soldering of smaller surface mount components appears to take a bit of cleverness.


20090902

Do It Yourself : How to Build Hallucinogenic Goggles

This post will describe how to construct a pair of goggles which can be used to induce geometric visual hallucinations (1 2 3) via strobe light patterns. This tutorial should be accessible to anyone familiar with Arduino, and I do not cover details of the electronics design. These goggles can be constructed for 25 to 50 dollars, depending on how good you are at scavenging parts.

WARNING : this and similar projects have been known to induce seizures in susceptible individuals.


Device Summary

This device consists of three major components : a physical interface to provide the visual stimulation, electronics to control the physical interface, and code which governs the behavior of the interface. The physical interface consists of ping pong balls in swimming goggles with LEDs inside. The electronics are an Arduino pro-mini, and a few additional interface parts. The code is Arduino SDK C style driver code.

Component 1 : Physical Interface
Update : This later post suggests there might be an easier, faster, and more durable way to construct the goggles. The design posted here works fine, but is tricky and time consuming to make, and also fragile.

parts :
  • 4 to 10 Ping pong balls
  • 2 RGB LEDs, frosted clear casing (this is important, sand down the outside if not frosted)
  • 2 4x1 male headers, .1" spacing
  • 2 4x1 female headers, .1" spacing
  • 1 8x1 female header
  • 1 Dolfino medium sized silicone adult swim goggles ( had to buy in a 3 pack )
  • 2-3 ft of elastic ribbon
  • 3-4 ft of ribbon cable, only 8 channels required. Other cables with 8 channels also work.
Description :

Ping-pong balls, cut as if by a plane penetrating approximately 15% of the ball diameter, and rejoined with with smaller section inverted to form a cup like structure. RGB LEDs are affixed via solder to male headers which penetrate the corner of the ping pong balls (near the joint of the two sections). Light is emitted from the LEDs, reflects off the back of the larger section of sphere, and creates uniform illumination in the smaller cup. Two ping pong balls are nestled in a modified pair of swimming goggles. A ribbon cable connector is affixed with female headers which interface between the male headers on the spheres, and the male header output from the electronics. Note that logos or text printed on the ping pong balls can usually be removed with acetone ( nail polish remover ).

Tools :
  • one minute epoxy
  • superglue
  • soldering iron
  • solder
  • sharp razor
  • scissors
  • medium to fine sandpaper
  • wire cutters
  • tweezers
  • pin
  • toothpick, etc. for mixing and applying epoxy
Instructions :

Construct (2x) ping pong ball shells which are mirror images of eachother:


  1. Imagine the section cut by a ray displaced 34-40 degrees from vertical and rotated around the z axis. Alternatively imagine the section of a circle cut by an arc of 70-80 degrees. This partition defines the sizes of the large and smaller sections which form the spherical diffuser. You will not be able to cut both sections from the same ball, since material is lost in cutting, and a 1-2 mm edge is required for overlap to bond the sections together. Additionally, neither side should have a company logo on it, since this will ruin light diffusion. Ping pong balls have a ridge where the two halves are joined in manufacture, avoid cutting through this ridge since it will create an uneven joint that will prevent the balls from being re-assembled. I don't have exact measurements, but on my model the diameter of the circle at the interface of the two sections is 1.365"
  2. Prepare the larger section first, as described above. With a razor, cut a crude circular hole in the ping pong ball, perhaps circumscribing the logo if one is present. Slowly and carefully expand this hold by cutting around its circumference with a pair of fine scissors. Stop approximately 2mm from the final desired hole. At this time lightly sand the hemisphere on a flat piece of medium to fine sandpaper to create a fine, flat interface.
  3. From a new ping pong ball, prepare the smaller section. Cut the ball crudely in half using a razor, then carefully trim one half down to the intended size of the smaller section, plus 3mm.
  4. The smaller section should rest in the larger cup, and be large enough not to fall inside. Do not glue the sections together yet.
  5. Using a pin, create evenly 0.1" spaced holes for the male header in the larger section as shown. You may want to practice on a spare bit of plastic first. Insert the short end of the male header through these holes, and super-glue the header in place. Trim the LED leads so that the LED rests as shown, and bend down the last 2mm of leads to align with the inner header pins. If you do not have frosted housing for the LEDs, lightly sand the exterior of the LED with fine sandpaper. Clear housing creates light that is too focused for uniform diffusion in the eyepiece. Tin both the LED leads and the header pins in advance. Solder the LED onto the header from the inside; do not to melt the plastic. Super-glue the smaller piece into the large piece to make a finished eyepiece. Once the super-glue thoroughly hardens, you may want to finish the joint in the plastic with additional careful trimming and fine sanding ( don't sand through the joint )
  6. The final pair of eyepieces should be mirror images of each other, which is just a matter of correctly positioning the LED leads :

Construct ribbon cable connector:

EDIT : this is a terrible, tedious, way to build a cable. The correct way involves some sort of headers that are actually designed to clamp into ribbon cable, or using these little header connectors that use pins which clamp onto the wire (pins sold separately ?). I will post a writeup if I build a pair using better technique.


I found that it was important to have a separate cable that would disconnect from the goggles under force. This prevents the inevitable accidents from destroying the tediously constructed eyepieces, and modularity makes the whole thing easier to repair. This step is open to improvisation. Here is what I did :
  1. Tear a band of 8 lines from a section of ribbon cable. The cable should be as long as you would like the strap from the electronics to the goggles to be. I think 3-4' is fairly good.
  2. Cut the ribbon cable diagonally such that the spacing between the lines matched the 0.1" spacing of the 8 pin female connector
  3. Strip 2mm bare wire of each line
  4. Solder the line to the 8 pin female connector. Tinning the contacts in advance helps.
  5. Apply 1 minute epoxy to the contact, to provide both insulate and structural stability. Make sure there are no shorts between lines before you do this.
  • EDIT : Hot glue works better here, for a number of reasons. Hot glue remains flexible once cool, which allows for smooth transfer of strain on the cable without breaking the contact. Epoxy hardens, which results in an inflexible interface which slowly cuts and degrades the cable. Breaking of the cable, as well as squishing of the ping-pong balls, seem to be the two most common failure modes of this design. If anyone knows of any commercial connectors that would be better for this design, let me know.
  • Tear the line in two for ~1.5', creating a split from 8 lines to two ribbons of 4 lines. Prepare 4-pin female headers similarly to the 8 pin female header, in a symmetric fashion as pictured below. I used a clip that came with the swimming goggles' strap to stabilize the point where the cable splits in two.
  • The assemblage of this connector cable with the eyepieces should have the indicated pinout at the 8 pin female header :

  • Modify swimming goggles and complete physical interface assembly :

    1. Locate suitable swimming goggles. This is harder than it sounds. The only goggles I found suitable were the mid-sized silicone pair in a three pack of Dolfino goggles. The goggles must be of a correct size to snugly fit the eyepieces, and be able to deform to the circular shape of the eyepieces. The goggle must also be able to hold together with the lenses removed. Many goggles are bridged by an attachment to the lenses, rendering them unsuitable. Ideally, you would also be able to affix a strap to the goggles even with the lenses removed. Due to the limited availability of suitable goggles, this step may require improvisation.
    2. Remove the lenses. In the pair I used, the lenses were held in with a weak silicone glue. It was difficult to remove the lenses without damaging the goggles. Superglue proved effective at repairing large accidental tears in the silicone goggles
    3. Attempt to insert the eyepieces. If necessary, create an opening in the silicone to feed the male headers though. I used either a razor, or a hole-punch, depending on the thickness of the silicone. Insert the eyepieces.
    4. Create a head-strap. I used elastic ribbon, threaded through the hole used for the header pins, held in place by plastic loops, and super-glued back on to itself. One end was folded and kept free to adjust tension.
    5. Attach ribbon cable headers to the eyepieces, check that you have oriented the ribbon cable pinouts correctly.
    6. If the eyepieces are loose, optionally super-glue them in place to the goggles. Note that this will make repairs and maintenance more difficult.


    Component 2 : Driving Electronics

    Parts :
    • 1 Arduino pro-mini ( and FTDI breakout for programming ) (other options 1 2 3 4)
    • 1 6x1 right angle male header
    • 1 8x1 right angle male header
    • 2 12x1 straight male headers
    • 6 Resistors for the 6 LED channels as determined by your board voltage and LED datasheet (voltage, current) specifications. Use this handy LED resitor calculator. For 3v boards, a resistor may be un-necessary for the (green, blue) channels.
    • hookup wire
    • 1.5"x2.5" radioshack protoboard
    • Battery Pack
    • Power Switch
    • optional : LED displays, pushbuttons for a hardware user interface. I used a 16 segment display for some of my models, and a couple designs have pushbuttons to cycle through the various strobe light patches.


    Description

    There are probably a million and one ways to make 6 LEDs blink quickly in a controlled fasion. You can drive your LED goggles however you wish. I used an Arduino because the programming interface is easy to use. I also hope to figure out the serial interface to the arduino so I might write a control sketch in processing, for real time tweaking of the waveform patterns. My construction consisted of an arduino board, with the 6 pulse-width-modulation ( PWM ) output pins attached to the LED goggles. I also attached a 16 segment display and some push buttons to the design, but you can experiment with whatever features you wish.

    Tools : Soldering iron, Solder, Soldering accessories

    Assembly of an example control board :
    1. Since the arduino chip rests on raised headers, and the 16-segment LED display has ~1.5mm clearance, we can hide some of the circuitry underneath these components. Since this is a 3 volt board, I only needed 56ohm resistors for the red channels. Your LEDs and board may have different constraints. Also solder on the 6x1 right angle male header to the Arduino pro-mini serial FTDI interface ( I think thats what those 6 pins are called anyway ).
    2. We then solder in place the arduino chip and LED diplay. The LED display is set up for multiplexing, so the corresponding segments of each digit are connected, and the display is driven by alternately drawing both digits, controlled by switching on and off the common cathodes. Since I was short on pins, several display pins also double as input pins for the switches. Every so often, the sketch switches the display pins into read mode and polls the state of the buttons.
    3. I used a lot of tedious surface-mount style wires on the back to keep the design clean. It took some practice for me to get used to this type of soldering. Attaching the battery pack and power switch is not shown.


    Assemble All components :

    This is open ended, Experiment !. Prototype your design on a larger Arduino and breadboard. Tweak the driver code to your preferences. Make a more permanent device using your favorite prototyping technique ( Or design and order a custom PCB ! Please tell me if you do, I'd probably buy a couple! ).







    Component 3 : Code

    I've put some files up on Sourceforge

    Arduino sketch

    ( and here, another example adapted for the AtTiny13a)