Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Kevin Sidwar
Published © MIT

Flame Throwing IoT Pumpkin

Dominate Halloween by having this Internet of Things pumpkin on your front porch throwing flames at the press of a button.

IntermediateFull instructions provided2 hours2,233
Flame Throwing IoT Pumpkin

Things used in this project

Hardware components

Photon
Particle Photon
×1
Servos (Tower Pro MG996R)
×1
Travel Size Hairspray
×1
Pumpkin
×1
18 Gauge Craft Wire
×1

Software apps and online services

Particle Cloud

Hand tools and fabrication machines

Dremel

Story

Read more

Custom parts and enclosures

Lid Hole Template

Print the template and cut along the outer rectangle. Wrap it around the hairspray lid and tape in place. Cut out black box and drill holes where marked.

Schematics

Button Schematic

The bare bones version of the button

Code

pumpkin_node.ino

Arduino
This is the code that runs on the Photon controlling the pumpkin.
// Configuration Variables 
int sprayDurationInMilliseconds = 400; 
int servoOffPosition = 40; 
int servoOnPosition = 1; 
Servo sprayActuator; 
 
void bringTheHeat(){ 
   sprayActuator.write(servoOnPosition); 
   delay(sprayDurationInMilliseconds); 
   sprayActuator.write(servoOffPosition); 
} 
 
void subscriptionHandler(const char *event, const char *data) 
{ 
   // If you wanted you could specify a duration to the flame by 
   // passing a value in the data parameter and changing the  
   // bringTheHeat() function to accept it. 
   bringTheHeat(); 
} 
 
void setup() { 
   // The servo is attached to D3 on the Photon 
   sprayActuator.attach(D3); 
   // Initialize it to our known start position 
   sprayActuator.write(servoOffPosition); 
   // Subscribe to the button events. MY_DEVICES is used as a  
   // security wall so other random Particle devices can't  
   // trigger the pumpkin. 
   Particle.subscribe("bring_the_heat", subscriptionHandler, MY_DEVICES); 
} 
 
void loop() { 
// Don't need anything here. I told you it was simple!
} 

button_node.ino

Arduino
This is the code that runs the Photon-controlled button.
int LED = D7; 
int BUTTON = D2; 
void callCloudService(void); 
void setup() { 
   pinMode(LED, OUTPUT); 
   pinMode(BUTTON, INPUT); 
   // Go into a low power mode until the button is pressed 
   System.sleep(BUTTON, RISING); 
} 
void loop() { 
   // Make a cloud service call 
   callCloudService(); 
   // Go back to sleep 
   System.sleep(BUTTON, RISING); 
} 
void callCloudService(){ 
   // Send the event to the pumpkin
   while(!Particle.publish("bring_the_heat", PRIVATE)); 
   // Needed so the event can be published before sleep 
   for (uint32_t ms=millis(); millis()-ms < 4000; Particle.process()); 
} 

Credits

Kevin Sidwar

Kevin Sidwar

11 projects • 24 followers
Software Guy with an EE Degree. Obsessed with teaching people about the Internet of Things.

Comments