Friday, July 1, 2022

Spider Victim with Random Twitching Movement

I wanted to show off a twitching victim I made for a friend's spider themed haunt. Here's a video of the prop in action.



The mechanism is based on an automatic car door lock motor like this:


It's available on Amazon for about $6 and runs on 12v DC. Here are a couple close up pictures of the mechanics. 




The PVC and motor were then covered with plastic bags for bulk and then a couple layers of plastic treated with a heat gun to give the right corpsed/spun web appearance. 




This electronics for this project are an extension of a lighting simulator I made previously. For this project, the frequency of the random twitches are controlled by the potentiometer. The arduino sends 5 volt signals to the mosfet which in turn controls the 12 volt motor. 


To keep things small and cheap, I built the circuit based around an ATTINY85. These processors are great because they are very cheap (usually <$2) and programmable using the Arduino IDE. Here's a picture of the board. 



Alternatively this could be built with an arduino uno and mosfet as a simple first arduino project.


Here's the schematic for the circuit:



And here's the code: [code updated 8/29/22 to account for millis() rollover] 



//  Jekyll-Labs Twitchy Att
iny85
//  Built for Randflash board v1.1
// 
int fet = 0;
int pulses = 1;
int pot = A1;
unsigned long start = 0;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(fet, OUTPUT);
  randomSeed(A0);
}

// the loop function runs over and over again forever
void loop() {
  int potsens = analogRead(pot);
  if (potsens < 120) potsens = 0;
  unsigned long delaybonus = map(potsens,0,1023,0,600000);

  if ((millis() - start)>(3000 + delaybonus)){
    start = millis();
    pulses = random(3)+1;
    for (int i = 0; i < pulses; i++) {
      digitalWrite(fet, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(150);                       // wait for a second
      digitalWrite(fet, LOW);    // turn the LED off by making the voltage LOW
      delay(600);                       // wait for a second
    }
  }
  else {
    digitalWrite(fet,LOW);
  }
  delay(10);
}

1 comment:

  1. I’d like to purchase a few of these if you have any left!?

    ReplyDelete