Halloween Prop Controller?

Hey Everyone,

I might be a bit out of my realm ( I'm an iOS programmer ) and a Halloween enthusiast. I was watching how to control props, someone used a RaspberryPi to activate a relay module into a cut up footpad and voila, it worked.

It just wasn't practical, so I started thinking: Can I buy a 1-Channel ( 5 or 12v?) Relay Module Switch, Hooked into a Arduino Nano, which this then plugs into the relay and the prop with this -> https://www.amazon.com/gp/product/B0D8LGBWX5/ref=ox_sc_act_title_1?smid=ABTEPSXTTA5JK&psc=1.

Would that actually work? I would ideally run a webserver on the nano, which activated the module switches by a web request. Would also be able to hook in a sensor(s)?

Can this be a solution?

Well, first, you can't run a webserver on an Nano, so there's that.
But why do you think the Pi application isn't practical? It's probably the easiest platform to do this on.

Just the cost of it. Youd then have to buy the waterproof cases etc. I want hoping for something very small. I didnt know you cannot run a web server on the nano.

  • You could use an ESP32 with some external hardware.

This is EXACTLY it! I will start researching along with this what I should buy!

  • First off, we have no idea what your skill sets are.

  • You need to spend design time to come up with all the things that the project is to do.

  • Relays come as modules and bare bones.

  • To go from the 3v3 ESP32 to 5v logic, BJTs or logic level MOSFETs are required.

  • Watch these:

The smallest and simplest would be an esp01. It can run a web server and has a I/O pin to drive a relay module. In fact I have seen relay modules for an esp01. I have never used one so can't say how good they are.

I'm currently working on a custom PCB Halloween prop controller. While not web-based, it's Arduino Nano ESP32 using IOT Clout (so I can create a dashboard for my phone to control all my props):

  • Two 5V level-shifted WS2812B outputs, allowing me to control the color/brightness/on/off states of various LEDs
  • A relay switch that interfaces with an AC power strip (to turn an AC mist-generator on/off)
  • Two motor drivers to control a linear actuator (for an animate prop), and to control/adjust a fan for a fog-chiller
  • Two outputs that hacks into a fog-machine wireless remote control (so I can turn the fog on/off)

It's my first "serious" project doing something "useful" with an Arduino, other than just basic tinkering.

Wow! Do you have a thread of your build?

I am mostly new at arduino, I’ve worked with esp module in the past but it’s been at least 6 years.

Ideally I’d like to control all of my props, I was thinking an esp for each prop

I’ll look through some tutorials.

I think for stage one woudl be to tinker with one to get some basics, see if work etc then design the layout.

Either adapt this to work with the step pad or follow this directly to use HCSR-04 Ultrasonic sensor (step pads you have to actually step on and they're finicky - for reference just go to any Spirit Hallowe'en and see that they're finicky on the floor models).

Tip from a 10-year Hallowe'en Arduino Enthusiast: your original idea sounds epic. Unfortunately, it's 35 days 'til the big night and you don't have time for that. Start on that November 1 for next year (after you raid Spirit Hallowe'en for all the deals).

The sketch and instructions that follow should be easy enough to get you up and running. This single prop controller will work for anything you'd power with that relay module with a few tweaks you should be able to figure out. For AC loads just imagine the relay taking the place of the mechanical switch, because after all, that's what a relay is - an electrically operated switch. Sorry if I'm telling you stuff that's very basic to you but I hope to save you time.

Of course, copy this sketch and never change it. Make copies and change those.

/*****************************************************************************
 ******************* HALLOWE'EN SONIC FOGGER 2024 EDITION ********************
 *****************************************************************************

  --general info and summary--
THIS USES AN ARDUINO AND ULTRASONIC SENSOR OR THREE TO ACTIVATE THE SWITCH
ON A PREHEATED SPIRIT HALLOWE'EN LOW LYING FOG MACHINE BY BYPASSING THE SWITCH
AND SWITCHING IT INSTEAD WITH A RELAY MODULE.

THIS WILL WORK THE SAME FOR ANY OF THEIR FOGGERS THAT COME WITH A MANUAL
SWITCH, WHICH THEY ALL HAVE FOR AT LEAST THE TEN YEARS I'VE BEEN A 
HALLOWE'EN NUT. WILL ALSO WORK WITH ANY 5V ARDUINO BOARD THAT SUPPORTS THE 
NEWPING LIBRARY (ALL AVR BOARDS PLUS MOST OF THE OTHERS).



  ------------------build details---------------------

<<< EQUIPMENT >>>

  [hardware]
ARDUINO NANO EVERY x 1
WHADDA 5V RELAY MODULE x 1
HCSR-04 Ultrasonic sensor modules 1-3x
SPIRIT HALLOWE'EN 01423078 400W LOW LYING FOG MACHINE (COFFIN SKELETON)
GENERIC SMART PHONE BATTERY BACKUP OUTPUT 5V/2.4A MAX, 5200mAh/19.2Wh
CORD TO CONNECT BATTERY BACKUP TO ARDUINO NANO EVERY.
FEMALE-TO-FEMALE DUPONT JUMPER WIRES min 7, max 15

  [software]
Arduino IDE v2.3.2
NewPing Arduino library v1.9.7 (available in IDE under Sketch > Include Library > Manage Libraries > NewPing )
     or here: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home as of the time of this writing.



<<< UPLOAD THIS CODE TO YOUR ARDUINO >>>
   BEING SURE TO SELECT THE CORRECT BOARD AND 
   COM PORT UNDER Tools > Board and Tools > Port in the Arduino IDE.



<<< ASSEMBLE THE CIRCUIT: >>>
 The switch that comes with Spirit Hallowe'en fog machines has 3 wires:
 mine had white, black and green. I cut them all off the switch and
 stripped back 1/4" on the white and green. We will use a 5V relay
 module (I used a Whadda brand model WPM406 5V relay module).
 The HCSR-04 ultrasonic sensor senses something within 400 cm (about 13').
 Change as needed below.

 I did not use the black wire but it is cut off the switch and just taped
 to the switch housing plastic.

 The switch will measure something like 8VAC when the heater isn't warm enough
 across the two stripped wires. Once the heater is warm, you will be 
 able to hear the built in internal relay of the fog machine click to
 activate the stock switch. This is the action we are bypassing with the
 Arduino and relay module. If you measure the voltage now, you will see
 about 120VAC (North America).

 WIRE fog machine Normally Open (NO) switch as follows:
 switch green to relay C (common)
 switch white to relay NO (Normally Open)

 WIRE HCSR-04 sensors (use one, two or three, spaced out to cover some 
 periphery as you like):
 the sensors themselves are all powered by Arduino analog pins
 driven HIGH during void setup(). Choose any of A0, A1 or A2.
 Typically this is ill-advised as a way to power devices; however,
 since the Nano Every can tolerate up to 20mA current per I/O pin
 and each sensor needs only 15mA @ 5V to function, it's fine.

 WIRE all the grounds of all the sensors to Arduino GND.

 WIRE Sensor Trigger/Echo pin combos:
 D6, D7 and D8, D9 and D10, D11. 
 
 WIRE Arduino to relay module connections:  
 Connect Arduino D5 to relay S (Signal)
 Connect Arduino GND to relay module -
 Connect Arduino +5V pin to relay module +

 Power Arduino with USB smart phone battery backup
 power bank.

Tested and working as expected.
By Hallowed31
Five-second timer revision courtesy of Arduino Forum member kolaha
2024-09-09
*/

#include <NewPing.h>

const int sonarNum = 3;          // Number of HC-SR04 sensors
const int maxDistance = 400;     // Max distance to ping for (cm). Adjust this number as needed up to 400
const int sensor1PowerPin = A0;  // we will use the analog pins to power the sensors
const int sensor2PowerPin = A1;
const int sensor3PowerPin = A2;
// use one to three sensors to cover desired range of detection, sketch won't care which
NewPing sonar[sonarNum] = {
  // Each sensor's trigger pin, echo pin, and max distance to ping for.
  NewPing(6, 7, maxDistance),  // each of these can be manually adjusted if needed different distances
  NewPing(8, 9, maxDistance),
  NewPing(10, 11, maxDistance)
};
const int fogPin = 5;
const int led = LED_BUILTIN;
const unsigned long pingTimer = 50;
unsigned long lastPingInterval = 0;

unsigned long lastFogCountdown = 0;
unsigned long fogOnInterval = 5000;  // 5 seconds, adjust if you like

byte state;
int ledState;
int fogPinState;

void setup() {
  pinMode(fogPin, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode(sensor1PowerPin, OUTPUT);
  pinMode(sensor2PowerPin, OUTPUT);
  pinMode(sensor3PowerPin, OUTPUT);
  digitalWrite(sensor1PowerPin, HIGH);
  digitalWrite(sensor2PowerPin, HIGH);
  digitalWrite(sensor3PowerPin, HIGH);
  fogPinState = LOW;
  ledState = LOW;
  Serial.begin(115200);
  // some blank lines because I like them
  for (int j = 0; j < 15; j++) {
    Serial.println("");
  }
  Serial.println(F("halloweenSonicFoggerV2024ed\n"));
  state = 0;
  Serial.println("off");
}

void loop() {
  unsigned long pingInterval = millis();
  if (pingInterval - lastPingInterval >= pingTimer) {
    lastPingInterval = pingInterval;
    for (uint8_t i = 0; i < sonarNum; i++) {
      if ((sonar[0].ping_cm() == 0) && (sonar[1].ping_cm() == 0) && (sonar[2].ping_cm() == 0)) {
        state = 0;

      } else if ((sonar[0].ping_cm() >= 10) || (sonar[1].ping_cm() >= 10) || (sonar[2].ping_cm() >= 10)) {
        state = 1;
      }
    }
  }
  switch (state) {
    case 0:
      fogPinState = LOW;
      ledState = LOW;
      noFog();
      break;
    case 1:
      fogPinState = HIGH;
      ledState = HIGH;
      deployFog();
      break;
    default:
      fogPinState = LOW;
      ledState = LOW;
      noFog();
      break;
  }
}

void deployFog() {
  Serial.println("\non");
  unsigned long thisFogTimer = millis();
  while (millis() - thisFogTimer <= fogOnInterval) {
    digitalWrite(fogPin, fogPinState);
    digitalWrite(led, ledState);
  }
  Serial.println("\noff");
  state = 0;
}

void noFog() {
  digitalWrite(fogPin, fogPinState);
  digitalWrite(led, ledState);
}

For those about to Haunt, I salute you :saluting_face:

2 Likes

I don't have any write-up, but here's a summary: an Arduino Nano ESP32 (built-in WiFi) and an easy Arduino Clout IOT project with a simple/customizable dashboard (for access/control through my phone). The Nano sits in the yard, powered with a 12V PSU, connected to my home WiFi, with all the props attached through my custom PCB/shield.

The code is pretty basic:

  • LEDs are controlled by the dashboard Colored Light widget and uses the FastLED library
  • Solenoid and fan are PWM controlled
  • Other items are a simple on/off trigger

The dashboard is pretty simple (and self-explanatory) to control each prop. I could also easily add buttons that would trigger a "scene," if I needed.

My PCB has the following:

  • A single 12V power input, that powers both the Nano and all attached props (that might be a questionable decision, but so-far so-good)
  • Connection terminals and 5V level-shifter for two WS2812 LED outputs
  • Two DRV8871 motor drivers (and supporting components) to control the direction/speed of a linear solenoid and fan
  • A couple other output triggers (which I guess could also be re-purposed as input triggers as well)

1 Like

Where did you get that board made? Going by the date it's a pretty fast turnaround.

It’s a board I designed and had made by JLCPCB. Had it delivered at my doorstep <1 week after I uploaded to their site.

1 Like

I dont mind if its not for this season, I just need a project :slight_smile:

Can anyone help with my shopping cart list? My goal is to have this esp connect to an animated prop via foot pedal 3.5mm jack. I want to use an app ( I can make that ) to hit a web request & || use bluetooth ( both? ) to set it off. This is a POC but if possible id like to hook a battery pack to it and have a weather proof enclosure created.

Ardunio esp32 ( do i want headers? )

Will these work for foot pedals? https://www.amazon.com/gp/product/B0D8LGBWX5/ref=ox_sc_act_title_2?smid=ABTEPSXTTA5JK&psc=1

Channel relay do I need 5 or 12v?

Battery?

Any specific solder? I have the soldering gun.

Thank you in advance.

I'm presuming your prop AC? Does it have any control-inputs, or is it merely on/off (or does it have multiple states that need to be controlled)?

What exactly is your foot pedal, is it just a simple on/off button/contact?

Are you powering your battery with the Arduino? I've never worked with relays, but I would presume (?) that you'd want them to be powered the same--or are you using separate power for each component.

I would think it's easier with an Uno R4 Wifi than an ESP32.

For one, the ESP32 isn't nearly as easy to work with, at least it hasn't been for me. That was the ESP32 Dev Kit with protoboard.

I'm not saying I don't like it, just that as someone used to working with Arduino as in Uno R3 and other AVR boards, the ESP32 wasn't as user friendly.

Plus, Uno R4 Wifi is 5V logic, ready to go with 5V relay module marketed to Arduino community.

You can use a shield and tons of modules designed around the Uno footprint and capability, plus tons on online support. I found the ESP32 less so in that regard as well.

Also library support for Uno is I think much more extensive than ESP32 or at least you have to look around (Servo for example).

1 Like

Was that your experience with the Arduino Nano ESP32, or some other ESP32? In my (very limited) experience, I haven't really noticed any difference or issues....yet. The few Arduino libraries I've needed, have worked on the Arduino Nano ESP32.

Good point about the 5V logic vs the 3.5 on the Arduino Nano ESP32. On my custom PCB, I added 5V level shifters for the WS2812 LEDs...I presume I wouldn't have needed those if the PWM was 5V? I've become accustomed to using level-shifters on my other LEDs projects (non Arduino), so I didn't really give it much thought.

1 Like

These? https://a.co/d/3okR9ZP1

For my first prototype this could work, my main concern was cost. The esp32 you can have 3 -5 for that price.

Any thoughts on the other items? Is that all I would need? Do I need resistors?