How to make a skull shoot lasers out of its eyes with a Particle Argon

How to make a skull shoot lasers out of its eye sockets
Check out the video tutorial here!

Today we’re going to use the particle argon to make a quick and easy halloween decoration. We will use the particle ide and create a simple circuit that takes an input(a button) and produces an output(flashes two lights).

Since it’s Halloween we are going to mount this circuit to a foam skull. I will be using laser diodes for the lights, though you can use the code on standard LEDs if you don’t have any lasers available.

Technical Skills Covered in this tutorial:

  • How to code/wire Push button input
  • How to blink an LED or laser

Materials:

Technical Components:

  • Particle Argon
  • Wifi antenna
  • Breadboard
  • Male to male wires x 9
  • Male to female wires x 4
  • Laser Diodes that accept 3v3 x 2
  • Push Button
  • Battery pack

Non Technical Components

  • Foam skull
  • Fake blood

Steps:

Get your Argon ready to for set up

  1. Connect your device to power. You can use either USB power or connect it to a battery pack.
  2. Connect the wifi antenna so your device can connect to the internet

Wire up your light sources

  1. In the lower section of your breadboard, away from your Argon, insert your Laser diode.
  2. Use a different wire to connect the black/blue wire to the ground wire.
  3. Put a resistor next to the red wire.
  4. Connect a wire to the resistor and put the other end of the wire next to the D6 pin of your Argon.
  5. Repeat this process with your second laser and the D5 pin.

Program the lights to turn on when the code is flashed

  1. Download Particle Workbench
  2. Create a new app
  3. Above the setup function create two const ints that are equal to the pins where you wired your lights.
1. const int leftLaser = D6;
2. const int rightLaser = D5;
  1. Inside the setup function declare your lasers as outputs
1. pinMode(leftLaser, OUTPUT);
2. pinMode(rightLaser, OUTPUT);
  1. In the loop function write your lasers to high then have a delay for two seconds then write to low then delay again for two seconds
 digitalWrite(leftLaser, HIGH);
  digitalWrite(rightLaser, HIGH);
  delay(2000);
  digitalWrite(leftLaser, LOW);
  digitalWrite(rightLaser, LOW);
  delay(2000);

Wire up your push button

  1. Attach the button below the Argon, in the center of your breadboard so two pins are on one side of the breadboard and two pins are on the other side.
  2. Run a wire from one of your pins to the A5 pin of your argon.
  3. Run a wire from the positive section of your breadboard to another pin on your button.
  4. Lastly, run a resistor from one pin of your button to the negative port in your breadboard.

Program the push button to turn the lights on and off when pressed

  1. At the top of the file name your Button and say what pin it’s at.

const int redButton = A5;

  1. Create an int called buttonState that will store the value of the button’s state (whether it’s being pressed or not)

    int buttonState;

  2. Next go to the setup function and declare the button to be an input.

    pinMode (redButton, INPUT);

  3. In the loop section, set buttonState equal to the status of redButton so it knows if that button is pressed.

` buttonState = digitalRead(redButton);`
  1. Then write an if statement that dictates different behavior for a pressed and unpressed button.
1. If the input is high that means the button has been pressed and we want our lights to blink.
if(buttonState == HIGH){
      digitalWrite(leftLaser, HIGH);
      digitalWrite(rightLaser, HIGH);
      delay(2000);
      digitalWrite(leftLaser, LOW);
      digitalWrite(rightLaser, LOW);
       }
  1. If the input is low that means the button is not being pressed and we want the lights to stay off.
 else{
    digitalWrite(leftLaser, LOW);
    digitalWrite(rightLaser, LOW);
  }
  1. Compile the code and flash it to your Argon.
3 Likes