Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
circuito.io team
Published © GPL3+

Motion-Triggered Confetti Cannon

Confetti everywhere! Who doesn't love confetti? (um...everyone?) Place the cannon in a strategic place and surprise your friends passing by!

IntermediateShowcase (no instructions)5 hours5,706

Things used in this project

Hardware components

SparkFun Voltage Regulator - 5V
×1
SparkFun Jumper Wires Standard 7" M/M - 30 AWG (30 Pack)
×1
SparkFun Wall Adapter Power Supply - 12VDC 600mA
×1
Adafruit PIR (motion) sensor
×1
SparkFun Servo - Generic Metal Gear (Micro Size)
×1
SparkFun Capacitor Ceramic 0.1uF
×1
SparkFun Heatsink TO-220
×1
SparkFun Electrolytic Capacitor - 1uF/25V (in kit)
×1
Arduino UNO
Arduino UNO
×1
SparkFun Breadboard - Full-Size (Bare)
×1
SparkFun USB Cable A to B - 6 Foot
×1
SparkFun Jumper Wires - Connected 6" (M/F, 20 pack)
×1

Software apps and online services

circuito.io
Click on the link to go to the pre-defined parts selection for this project on circuito.io
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Before 3D printing the cannon, make sure that your spring will fit inside. You may need to make adjustments according to the equipment you have or purchased for the project.

Story

Read more

Custom parts and enclosures

confetti canon cad

Before 3D printing the cannon, make sure that your spring will fit inside. You may need to make adjustments according to the equipment you have or purchased for the project.
There are three parts you'll need to 3D print for the Confetti Cannon.
You may need to make adjustments so that the parts fit together properly.

launcher_ZRlKaYizMg.stl

spring_base_VkizTpgBEY.stl

Schematics

confetti canon schematics

Code

confetti canon code

Arduino
Connect the Arduino board to your computer and upload the code your received in the reply from circuito.io.
Once everything is running properly, replace the voide setup and void loop functions in the firmware tab of the original code, with the code below.
If you need any help, you are always welcome to contact us >> hello@circuito.io.
/* This code sets up the essentials for your circuit to work. It runs first every time your circuit is powered with electricity. */
void setup() {
    // Setup Serial which is useful for debugging
    // Use the Serial Monitor to view printed messages
    Serial.begin(9600);
    Serial.println("start");
    
    servo.attach(SERVO_PIN);
    servo.write(servoRestPosition);
    delay(100);
    servo.detach();
}

/* This code is the main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop. */
void loop() {
    
    
    
    
    if (pir.read())
    {
        // The servo will rotate to target position and back to resting position with an interval of 500 milliseconds (0.5 seconds) 
        servo.attach(SERVO_PIN);         // 1. attach the servo to correct pin to control it.
        servo.write(servoTargetPosition);  // 2. turns servo to target position. Modify target position by modifying the 'ServoTargetPosition' definition above.
        delay(500);                              // 3. waits 500 milliseconds (0.5 sec). change the value in the brackets (500) for a longer or shorter delay in milliseconds.
        servo.write(servoRestPosition);    // 4. turns servo back to rest position. Modify initial position by modifying the 'ServoRestPosition' definition above.
        delay(500);                              // 5. waits 500 milliseconds (0.5 sec). change the value in the brackets (500) for a longer or shorter delay in milliseconds.
        servo.detach();                    // 6. release the servo to conserve power. When detached the servo will NOT hold it's position under stress.
    }
    
}Binary file (no preview)

Credits

circuito.io team

circuito.io team

29 projects • 601 followers
Circuito.io is an online platform that generates wiring and code for Arduino projects. Want to know more? Visit http://circuito.io

Comments