Building a flashlight

For our first Fabrication class, we had to build our own flashlights.

I’ve been inspired to play with prisms and mirrors since I watched this video of Alberto Biasi’s exploration of prisms.

So I set out to make a simple flashlight that could use a prism to shoot rainbow light. I wasn’t sure whether the LED was going to shoot a beam of light strong enough to emit a beam of rainbow light like in the video, so I decided to encapsulate my LED in a mirrored tube that I had found around the shop.

flashlight_sketch

 

As I tested the light with the prism, I learned that you needed the light to reflect off a surface to see the rainbow that the prism created. It wouldn’t just “shoot out” a beam of rainbow light. So I decided to just build the flashlight for now, and see if I could figure out the prism later. In the meantime, I programmed my LED to cycle through the rainbow colors. Here’s the code below:


#include <Adafruit_NeoPixel.h>

#define PIN 6
#define NUM_LEDS 1

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
strip.begin();
strip.show();
strip.setBrightness(255);
}

void loop() {
//strip.setPixelColor(0, strip.Color(255, 255, 255));
rainbowCycle(20);
strip.show();
}

void rainbowCycle(int SpeedDelay) {
byte *c;
uint16_t i, j;

for (j = 0; j < 256 * 5; j++) {
for (i = 0; i < NUM_LEDS; i++) {
c = Wheel(((i * 256 / NUM_LEDS) + j) & 255);
setPixel(i, *c, *(c + 1), *(c + 2));
}
showStrip();
delay(SpeedDelay);
}
}

byte * Wheel(byte WheelPos) {
static byte c[3];

if(WheelPos < 85) {
c[0] = WheelPos * 3;
c[1] = 255 – WheelPos * 3;
c[2] = 0;
} else if (WheelPos < 170) {
WheelPos -= 85;
c[0]=255 – WheelPos * 3;
c[1]=0;
c[2]=WheelPos * 3;
} else {
WheelPos -= 170;
c[0]=0;
c[1]=WheelPos * 3;
c[2]=255 – WheelPos * 3;
}
return c;
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
strip.setPixelColor(Pixel, strip.Color(red, green, blue));
}

void showStrip() {
strip.show();
}

With my light working, I had to figure out what materials I wanted to use to build a case for my flashlight. I repurposed some wood that I found in the recycling bin and began to build a case for it. I then used cardboard to close my flashlight. I realized that I could not reach the battery switch if the case was fully closed, so I decided to leave the back open so one could reach the batteries and possibly replace them.

building_a_case

finished1

finished2

finished3

 

I’m glad we got to work on this assignment, as it already illuminated several things that I know will be important to keep in mind in the future.

  • I’ll need to know what materials I am using ahead of time and have those materials ready.
  • I’ll need to measure things beforehand so that I have enough material at time of build.
  • I will need to blueprint what I’m building so that I will have an understanding of how things will fit together.
  • I will need to figure out how the inside of any fabrication will be organized, if I end up using electronics. Currently, my battery and arduino sit inside my finished product, and there really isn’t a way to change the battery or reprogram the arduino unless I take my flashlight apart.