Project tutorial
Cylon Pumpkin

Cylon Pumpkin © GPL3+

A Cylon Pumpkin with Arduino Nano.

  • 245 views
  • 0 comments
  • 1 respect

Components and supplies

Apps and online services

About this project

Hi everyone! I created this Halloween Cylon for this year's Halloween. I found a cool idea on https://www.evilmadscientist.com/2006/make-a-cylon-jack-o-lantern/. So it is by no means my own idea.

I did, however, make my version using an Arduino Nano V3. This article explaines how to do just that.

P.S. I am writing this article after I created the pumpkin itself so I don't have every step detailed with a photo, so bear with me. :)

1) First I made a prototype

No pictures, see the schematic for this. It uses 10 5mm red LEDs with each an 330 ohm resistor. Each LED is is connected to a digitalPin.

2) Solder the LED to a piece of cardboard

I used a piece of cardboard and poke holes in it for each LED and resistor.

the front

3) Carve the pumpkin

Design

I found a design online (https://www.wikihow.com/images/sampledocs/b/Cylon-Pumpkin-Stencil.pdf), but I wasn't too fond of it so I draw one (not to shabby if I do say so myself).

4) Place the parts in the pumpkin

I used a piece of styrofoam to keep the leds in place by placing the leds between the styrofoam and the side of the pumpkin. I placed the other parts inside a ziplock bag and placed this inside the pumpkin

5) The finished pumpkin

I am quite happy with the end result.

Code

Cylon VisorC/C++
Upload to your Arduino Nano V3 using Arduino IDE
int startPin = 2;
int activePin = 2;  //center of the active lights
int speed = 100;    //speed in ms, lower is faster
int direction = 1;  //visor direction
int width = 3;      //width of the active lights
int length = 10;    //amount of leds

int testPin = 6;

// the setup function runs once when you press reset or power the board
void setup()
{
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);

  Serial.begin(115200);
}

void toggleOther(int activePin)
{

  for (int i = startPin; i < length + startPin; i++)
  {
    if (i != activePin)
    {
      digitalWrite(i, LOW);
    }
  }
}

void drawVisor(int activePin, int direction)
{

  for (int i = 0; i < width; i++)
  {
    if (direction == 1 && activePin < length + startPin || direction == -1 && activePin >= 0)
    {
      int pin = activePin + i * direction;
      digitalWrite(pin, HIGH);
      Serial.println(pin);
    }
  }
}

// the loop function runs over and over again forever
void loop()
{
  if (direction == 1 && activePin <= length + 1 || direction == -1 && activePin >= startPin)
  {
    toggleOther(activePin);
    drawVisor(activePin, direction);   
    delay(speed);

    activePin = activePin + direction;
  }

  //toggle direction
  if (activePin == length + 2 || activePin == 1)
  {
    direction = direction * -1;   
  }
}

Schematics

Schematic
Schematic qx12kixceg

Comments

Similar projects you might like

UltrasonicEyes

Project tutorial by Unexpected Maker

  • 16,820 views
  • 52 comments
  • 123 respects

Smart Halloween Pumpkin Lamp

Project tutorial by Luigi Francesco Cerfeda

  • 2,212 views
  • 0 comments
  • 9 respects

Arduino Simple Simon Says

Project tutorial by Metonymy

  • 4,988 views
  • 2 comments
  • 8 respects

Arduino Pumpkin

Project tutorial by Team FD

  • 2,382 views
  • 0 comments
  • 9 respects

Animated Pumpkin

Project showcase by Matthew Irwin

  • 2,067 views
  • 4 comments
  • 8 respects

Crossroad Traffic Lights (FSM)

Project showcase by Daniel Turner and Carlos Silva

  • 1,308 views
  • 1 comment
  • 6 respects
Add projectSign up / Login