Design Do Discover
I loved participating in Design Do Discover 2017! The people and facilities are fantastic and I really enjoyed taking a project idea from start to finish (-ed enough) in the 2-day whirlwind workshop. I just want to document here our process of making a zoetrope, which I went in thinking I would like to make. One of the best parts of D3 was experiencing the epiphany that in the process of trying to make something you come to understand something so much better than if it were just explained or shown to you. The thing I came to understand was how persistence of vision works.I knew what that was but I came to see how it's a necessary part of seeing an animation.
Zoetrope project by Conway Brackett and Lorna LaRiviere |
Starting With An Idea
I started with a group of teachers and we broke off into two groups, one exploring making a traditional zoetrope, made of a spinning cylinder with slits to view the animation frames, and I worked with participant Nancy Bates to explore making a zoetrope in which the animation frames are viewed on a spinning disk, as inspired by this video. Problem is I didn't watch the video carefully enough to realize the importance of the strobe. We set out putting the circle of animation frames on the end of a stick, then looking through a square hole at it while we spun it. It was just a blur.Not Working
Something was wrong and we didn't know what. Then I tried on a whim to film it with my phone and suddenly it looked like something! Not perfect, but definitely not a blur of nothing.
We realized that the phone had a framerate and was only recording a portion of the images as they sped past (we looked it up-30 FPS for an iPhone 6). So to make a zoetrope we needed a way to break up what the eye sees so it would only see each frame when it was at the right place.
The Epiphany Moment
Our epiphany moment had arrived. Separate frames of an intended animation will not look like an animation unless something breaks up the constant stream of visual input to the eye. The camera does that because it has a finite number of frames it captures each second. The traditional zoetrope in a cylinder does that by only allowing you to see the images through the perfectly spaced slits. So we had to figure out what could break up our spinning images. I thought of a little door that opened and closed over the hole, but that would not be able to go nearly fast enough.
Prototype Revision
We set about finding lights bright enough we could control as a strobe. We found an Arduino with an Adafruit 40-NeoPixel Shield, and programmed it to flash white. We used the following code:
#include <adafruit_gfx .h="">
#include <adafruit_neomatrix .h="">
#include <adafruit_neopixel .h="">
#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(5, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_RIGHT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
void setup() {
matrix.begin();
matrix.setBrightness(40);
}
void loop() {
matrix.fillScreen(matrix.Color(255,255 , 255));
matrix.show();
delay(25);
matrix.fillScreen(0);
matrix.show();
delay(25);
}
Then we had to get the circle to spin on a motor. I had another project where I used stepper motors to make music. I combined that code with the neopixel code.
The stepper was actually scavenged from an old printer |
It Works!
We hooked it all up in a box and with some fidgeting we were able to get certain points where the strobe aligned well enough with the animation frames to appear to animate to the naked eye. It was exciting to see!
Here is a video of the animation.
And the final code.
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif
#define NEO_PIN 6
#define DIR_PIN 2
#define STEP_PIN 3
#define POT_PIN_A A0
#define POT_PIN_B A1
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(5, 8, NEO_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_RIGHT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
double speed;
void setup() {
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
pinMode(POT_PIN_A, INPUT);
pinMode(POT_PIN_B, INPUT);
matrix.begin();
matrix.setBrightness(80);
Serial.begin(9600);
}
void loop() {
float setStep = analogRead(POT_PIN_A);
float setDegrees = analogRead(POT_PIN_B);
// setStep = constrain(setStep, 0,1023);
setStep /= 4000;
// setStep = .05;
setDegrees = map(setDegrees, 0, 1023, 0, 180);
// setDegrees = 36;
Serial.print("step: ");
Serial.println(setStep);
Serial.print("degrees: ");
Serial.println(setDegrees);
rotateDeg(setDegrees, setStep);
matrix.fillScreen(matrix.Color(255, 255 , 255));
matrix.show();
delay(setStep*100);
matrix.fillScreen(0);
matrix.show();
delay(setStep*100);
}
void rotateDeg(float deg, float speed) {
//rotate a specific number of degrees (negitive for reverse movement)
//speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
int dir = (deg > 0) ? HIGH : LOW;
digitalWrite(DIR_PIN, dir);
int steps = abs(deg) * (1 / 0.225);
float usDelay = (1 / speed) * 70;
for (int i = 0; i < steps; i++) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(usDelay);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(usDelay);
}
}
Future Work
I think it still needs some work because at many positions of the potentiometers the motor isn't able to move because it's being interrupted by the strobe delay. I need to rework the code, but I'm also thinking of combining the LightLogo and LogoTurtle projects to do this project.
What To Do With It
Ultimately what I will be doing with it is having students code TurtleArt or Turtle Blocks designs, save images of them as they progress, and copy them into a template they can print out and put in the Strobing Zoetrope when it works better.
No comments :
Post a Comment