Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Jorvon Moss
Published © LGPL

Magpie Sci Goggles

Ever want a new fun Sci-Fi wear for you costume or cosplay well I hope you enjoy this.

IntermediateFull instructions provided3 days1,603
Magpie Sci Goggles

Things used in this project

Hardware components

-Goggles
×1
3d printer
Any 3D printer could do
×1
E6000, Transparent glue
×1
Adafruit trinket
×1
Power Booster
×1
Lithium Ion Battery
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Servo Motor, Premium Male/Male Jumper Wires
Servo Motor, Premium Male/Male Jumper Wires

Story

Read more

Custom parts and enclosures

Servo Holders

Theses are glued to the goggles to hold the servos

Right_Left_eye

These are parts for the Iris eye

Lens Base

These are what you print 1st to attach to the goggles

Iris Leaf

these are the Leaves used for the Iris. I recommend printing multiple cause they are Fragile

Eyebrow Pully

the Pully parts to the goggles

Circuit cup

The cups you use the put the circuit inside

Aesthetic

The colorful parts to add some flavor to your goggles

Schematics

schematic

little thing I put together to show how I hot wired the goggles

Code

Random Code

C/C++
Same Code from Adafruit Legend of Zelda Guardian
// Trinket Servo Monster sketch
// Hardware: Adafruit Trinket (3V or 5V), micro servo, LED + resistor
// Libraries: uses Adafruit_TiCoServo library to manage servo pulses,
// even though NeoPixels are NOT being used here.

#if !defined(__AVR_ATtiny85__)
 #error "This code is for ATtiny boards"
#endif
#include <Adafruit_TiCoServo.h>
#include <avr/power.h>

// Servo parameters.  Pin MUST be 1 or 4 on a Trinket.  Servo position
// is specified in raw timer/counter ticks (1 tick = 0.128 milliseconds).
// Servo pulse timing is typically 1-2 ms, but can vary slightly among
// servos, so you may need to tweak these limits to match your reality.
#define SERVO_PIN  4 // Pins 1 or 4 are supported on Trinket
#define SERVO_MIN  4 // ~1 ms pulse
#define SERVO_MAX 26 // ~2 ms pulse

#define LED_PIN    0 // "Eye" LED is connected here

Adafruit_TiCoServo servo;

void setup(void) {
#if (F_CPU == 16000000L)
  // 16 MHz Trinket requires setting prescale for correct timing.
  // This MUST be done BEFORE servo.attach()!
  clock_prescale_set(clock_div_1);
#endif
  servo.attach(SERVO_PIN);
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH);
}

uint32_t lastLookTime = 0; // Time of last head-turn

void loop(void) {

  unsigned long t = millis(); // Current time

  // If more than 1/2 second has passed since last head turn...
  if((t - lastLookTime) > 500) {
    if(random(10) == 0) { // There's a 1-in-10 chance...
      // ...of randomly moving the head in a new direction:
      servo.write(random(SERVO_MIN, SERVO_MAX));
      lastLookTime = t;   // Save the head-turn time for future reference
    }
  }

  // Unrelated to head-turn check,
  if(random(10) == 0) { // there's a 1-in-10 chance...
    // ...of an "eye blink":
    digitalWrite(LED_PIN, LOW);  // The LED turns OFF
    delay(random(50, 250));      // for just a short random moment
    digitalWrite(LED_PIN, HIGH); // then back ON
  }

  delay(100); // Repeat loop() about 10 times/second
}

Credits

Jorvon Moss
9 projects • 251 followers
Hi Odd Jayy Here I'm a tinker, who is design to make gadgets and robots, support me http://ko-fi.com/odd_jayy http://patreon.com/Odd_Jayy

Comments