Halloween Animated Knights

by inclined-orbit in Circuits > Arduino

1943 Views, 7 Favorites, 0 Comments

Halloween Animated Knights

IMG_1694-cropped.jpg

About a week or so after Halloween, I happened to be in Home Depot and back in a far corner bin were several Halloween items very heavily discounted. They were just trying to get rid of them as fast as they could. There were two life-sized animated knights that I got for a steal. I decided to hack these to do more than just stand there with a moving jaw. I envisioned two knights that swing their swords to block the path to the house, talk to each other telling jokes and eventually raising their swords to let the Trick-or-Treaters pass. I can see Arduinos, pneumatics, WAV players…. Let the fun begin!

The Concept

I have several other animated Halloween props:

  1. A pneumatic scissor prop that is hidden behind some trees that flies out a life-sized spooky pumpkin-headed ghost with sound and lighted eyes about 8 feet and puts quite a scare on the kids.
  2. A Witch that is hidden in a window well that I fill with fog that pneumatically pops up, speaks with a moving jaw and glowing eyes.
  3. A large dragon that sits on top a balcony overlooking the entrance of the house. It makes noise, emits smoke and (simulated) fire from its jaws while rotating its head and flapping it's wings.
  4. A Frankenstein monster that grunts, sways back and forth and waves it’s arms.
  5. A pair of Skeletons that play a jazz duo swaying back and forth playing a trumpet and Sax

I already made a "remote master controller" that I keep in the garage that detects the people approaching by PIR sensors and drives the animations by controlling solenoids for the pneumatic cylinders in the props. I also keep my noisy compressor in the garage. So, it was easy to add another micro controller for the knight props and add another PIR sensor for this prop. I also have an enable switch so that if I wanted to disable the prop I can do this with a local toggle switch. The knights will stand on either side of the house entrance. A PIR sensor will detect when someone approaches, they swing their swords across the path, tells the kids to "HALT "and each knight tells them a joke in sync. Once the joke is complete, they lift their swords to allow them to pass. Each knight has a pneumatic piston to move the arms and swords, an internal micro controller to drive the audio files, drive the jaw movement and light up their eyes.

For this instructable, I will primarily focus on the knights. The schematic I'm showing is for all my animated props. I've included links to these other props above.

The First Prototype Video

single knight

This is only one of the knights. I fixed the audio so it says both sides of the joke but you get the idea. I will make up the second knight as a mirror image of this one. I still have some tweaking to do, fix the jaw movement, and adjust the arms so they cross over the walkway, but it's close!

Start of the Hack

IMG_1574-cropped.jpg
IMG 1575

Here is the original prop I bought at Home depot. I actually bought two. The video attached is what it did before I got to it. I then took the whole thing apart. I removed the capes and shoulder padding. I removed the electronics box, shoulder framing the head, arms all the way down to the metal frame.

I took the electronics box apart and took out the speaker. Now I have the start of my hack.

Master Controller Parts

Schematic.png

General Parts - Master Controller

  • Sainsmart 8-Relay board (1)
  • Arduino Nano Every (5)
  • Solenoid Switch (4)
  • Solenoid Master Valve (5)
  • 1/4" pneumatic hose AR
  • Particle Photon (1)

RS485 Board

  • RS485 Module (6)
  • 5-pin header socket (2)
  • 5x7 proto board (1)

Switch Board

  • Toggle switch SPST (6)
  • Push button - momentary (1)
  • Resistor (5)
  • Resistor (1)
  • Resistor (1)
  • LED (7)

Power Distribution Board

  • Fuse Holder (12)
  • Terminal Block (2-tab) (6)
  • Terminal Block (3-tab) (6)
  • 5 Header connector AR

Master Controller - Knight Control

Master_Knights1.jpg

The master controller is remotely located in my garage and the knight props are located by the steps leading up to the front door. The master controller is based on an Arduino Nano Every. I picked this small microcontroller for its size, plus for this use I didn’t need much in the way of I/O. The primary purpose of the Nano is to receive an external Passive Infrared (PIR) sensor signal when someone approaches (I have a step later that describes this). The code then tells the remote knights to start their animation cycle and also enables a pneumatic solenoid to drive the cylinders located in each knight for the mechanical arm animation. I have an electrical cable from the Master Controller that supplies the control signals, electrical power to the knights and also pneumatic hoses to drive the pneumatic cylinders. I got some of that web mesh to cover it all.

The controller has four inputs. There is an Enable input, which is connected to a switch and used to enable or disable the prop locally. Another input is Knight Start. This is a signal from a Particle Proton. A Particle Proton is a Wi-Fi/web-based micro controller that allows me to control all of the animations from anywhere through my smart phone. I’ll discuss this a bit later. Another input is a Passive Infrared (PIR) sensor (PIR D). The PIR sensor detects when someone comes close to the knights. The last input is END. This is an input from the knights and signals when the knight is finished with telling the joke and its animations and is ready to swing the swords out of the way. Since each “joke” is of varying length, I decided to use an END signal instead of a generic delay. That way as soon as the joke is done, regardless of length, the swords swing open to let the kids pass.

The Nano is programmed to first check if the prop is enabled (the local switch), if not it returns to the start loop and will continue looping until I enable it. If enabled, it then checks to see if it is being remotely commanded to start (Knight Start). If so, it initiates the animation cycle, if not it continues and then checks to see if the PIR sensor (PIR D) detected someone. If not, it returns to the loop and continues until something happens. I'll go through this in the code walk-through. The Nano has two outputs, one triggers a relay to enable two solenoids connected to a compressor. Each solenoid is connected to its respective knight and drives a pneumatic cylinder that rotates the knight’s swords to block the path. The other output is a signal that is transmitted to each knight to tell its internal micro controller to start its animation cycle.

I have lots of schematics, might be hard to go back and forth - but don't worry, I have the entire set later on for download, so bear with me.

Communicating With the Knights

Master_Knights2.jpg

Because of the distance, I used an RS-485 transceiver to drive these signals from the Master Controller in the garage to each knight and is also used for the other input from the knights (END). I should also mention that along with the digital communications, I include remote 5VDC power to each knight through the cable. That way there is only one cable to each knight that I can hide (and also prevent little feet from tripping).

Enable Switches and Reset

Master_Knights3.jpg

These are the enable switches used to enable and disable each prop. There is also a reset push-button which will reset each knight’s microcontroller in case they get out of sync with each other. I’ll explain this later in the code walk-through.

Power Distribution

Master_Knights4.jpg
Master_Knights5.jpg

I have a pretty extensive power distribution with a 10A, 5VDC supply and also include fuses in case I have a short in one of the remote sensors or props.

You can see I show the Photon which receives remote command through the BLYNK app on my iPhone and Tablet. This allows me to manually start the props. This is WAY simple so I did not have to attempt any iPhone coding or GUI - this app has it all and has a simple GUI. I might also say it's free, for small projects and private use.

I had a few issues with communicating from the Photon to the Arduinos since the Photon has 3.3 V logic and the Arduino is 5 V logic. I added an inexpensive 3.3 to 5 VDC level converters to the Arduino (easier than fussing with pull-ups).

PIR Sensor

PIR-figure.png

I use a simple PIR sensor (HC-SR501). This is a very cheap sensor that is widely used. Lots of on-line information on how to use this and how to use with an Arduino. The field of view is very wide. One could adjust the sensitivities but I needed something that would have a very narrow field of view so that it would only trigger when someone passes directly in path of it. You can experiment with the sensitivity so that it works as you like. The output timing is how long the output pulse lasts. I kept it pretty short, long enough for my micro controller and code loop to detect an event. It is a pretty long length of wire, but it seems to work OK.

So I came up with a sensor assembly that I can mass produce and use for all my Halloween props.

Sensor Parts

Sensor Assembly:

  • PIR sensor (HC-SR501)
  • 6" black 2" PVC pipe
  • 3-D Print PIR Cap
  • 3-D Print PIR mount
  • 3-D Print stand (legs, wedge, clamp)
  • Hex bolt, washers and wing nut
  • Connector for cable to mater controller (AR)

PIR Sensor Assembly

PIR_Cap.jpg

The assembled cap is placed on the end of a 6” length of 2” black PVC pipe so that the PIR has a very narrow field of view. The end of the cap also has a hole in the back for the +5VDC, GND and PIR Detect cable. I made up my own connector where one end plugs into the PIR 3-pin header and the other end is a JST-SM type 3-pin connector (no reason, I just had a few of those hanging around).

Finished Sensor

PIR_Mount.jpg
PIR_Sensor.jpg

I also 3D printed a clamp and legs so I can set the sensor in the best location. I used wing nuts to quickly adjust the legs and clamp as needed.

The sensor is positioned in such a way that when the trick or treaters approach it kicks off the animations just at the right time automatically. The PIR Sensor is connected through a long-shielded cable to the master controller, which I hide in my garage along with my air compressor.

Knights

knight_controller.jpg

The next steps describe what is installed inside the knights. The Halloween Knight Prop is based on an Arduino MEGA 2650. The Arduino MEGA 2650 is a larger microcontroller that has many I/O pins. The knight controller is substantially more complex and has many additional inputs/outputs. Out of all my props, this one is the most challenging.

The Arduino is programmed to make the Knight speak and move its jaw. I used an Adafruit Audio FX Sound Board 16 MB. This card can hold 8 WAV files. Each wave file is only one side of the joke. One half of the conversation is stored in the sound board. An identical board is in the other knight. The audio track is initiated in both knights at the same time, but timed so that it appears they are having a conversation. (More on this later)

The (R) output of the FX board is connected to a Velleman audio amp VMA408 and then to a speaker. I didn't see the need for stereo.

Knight Parts

Knight Controller Parts

  • Arduino MEGA
  • Adafruit Audio FX Sound Board 16 MB

  • Velleman audio amp VMA408

  • KA2284 Audio Meter

  • 2N3904 Transistor (2)

  • 270 ohm resistor (2)

Driving the Jaw Based on the WAV File

Meter.jpg
knight_controller-jaw_drive.jpg

The other discrete channel output of the Adafruit Sound Board (L) is connected to an KA2284 Audio Meter. I soldered wire to each of the KA2284 LED high-side pins of D2, D3 and D4 and connected to A0, A1 and A2 of the Arduino.

The knight skull jaw is driven by a motor and a spring to return it to closed. Jaw control requires more current than the Arduino digital out, so I used a 2N3904 transistor as a driver. Use 270 ohm base resistor, connect emitter to ground and the Jaw between a separate 5 VDC supply and the collector.

Knight Eyes

knight_controller-eyes.jpg

I could probably drive the skull eye LED’s directly from the Arduino but I had room and replicated the drive circuit for the Eyes as well. The Skull LEDs for the eyes are driven by a 2N3904 transistor as a driver for the Arduino Digital pin 49. I used a 270 ohm base resistor, Connect emitter to ground and the LED between a the 5 VDC supply and the collector.

I placed a 150 ohm resistor in serial with the LED’s since I’m driving with my 5 VDC supply. OK, I’ll admit, I thought the original circuit had resistors in line (there was a bunch of tape and goop over them), but I burned out the LED’s and had to replace them. Dang – out 5 cents. For my second knight, I'll add resistors in serial - maybe that will give them different looking eyes?

Enable and Power Distribution

knight_controller-pwr.jpg

Digital Pin 2 of the Arduino is connected to an enable switch, pulled to ground when closed. This is used to enable or disable the prop locally if I have to do some troubleshooting, instead of running back and forth to the Master Controller.

Arduino Pin 3 is the input pulse from the master controller to start the animation.

Speaker

knight_controller-amp.jpg

The FX board has an output that goes low when the audio file is playing (ACT pin). The Arduino monitors this and as soon as ACT goes inactive that signals that the voice tract is complete. The Arduino code generates a signal, propEnd (labeled as END in the schematic) is sent to the RS-485 transceiver and sent to the Master Controller. The Master Controller then enables the air solenoid to drive the pneumatic piston to move the swords back to allow passage to the front door.

There is an external reset from the Master Controller sent to the to the MEGA (Reset) over the RS-485 transceiver to reset each knight in case the joke count becomes out of sync. Later I will do a code walk through, but each knight Arduino counts each animation event and increments the joke count so we can cycle through all the jokes. If we get a glitch, that count will be out of sync and nothing will work right so the reset will start that count back to one.

Pneumatics Basics

pneumatic_101.png

Before I get into the details, I'll give you a quick overview of the use of Pneumatic cylinders. Cylinders are controlled by a solenoid valve. The solenoid valve consists of the manifold and the solenoid. Looking at the diagram, the compressed air is connected to the manifold. The manifold is a mechanism that receives continuous compressed air in and directs it to a selected output port (A or B). It also has exhaust ports (R or S). The magnetic solenoid attached to the manifold moves an internal mechanism that switches between the ports. There are many types of solenoids with different voltage levels from a few volts DC to 240 VAC. In my case I selected 12 VCD control. When no voltage is present, the air flows through the A port and the piston is retracted. When the voltage is applied, air is now switched to the B port and the piston extends. Simple, but that piston will slam back and forth (ripping your project apart) so this is where those exhaust ports come into play. When solenoid is off (position 1), Port P (in) is connected to Port A (out), Port B to exhaust S. Likewise, when solenoid is on (position 2), Port P is connected to Port B, Port A to exhaust R. Instead of leaving the exhaust ports open, you can connect a flow control valve to each. The valve is adjustable so that you can limit the air flow, thus slowing down the piston response. By experimenting you can adjust each and get a smooth movement and not tear your prop apart. The Solenoid costs about $13 and the flow control valves are a few dollars so they are cheap.

Pneumatic-Cylinders.gif
Pneumatic-Cylinders-1.gif
flow_control.jpg

Here is a cool graphic that shows how these cylinders operate. As you can see, when you drive air into one side it causes the cylinder to move and the other end has to exhaust the air. If you let that air flow free, the cylinder will slam open. By limiting how fast the air escapes, you can slow the motion of the cylinder. Get an adjustable one and experiment a bit to get the movement you want..

Mechanisms

Knight_Mechanism1.jpg
Knight_Mechanism2.jpg

Before I get into all that code stuff, I need to go over the mechanics of the knights.

I used most of the original knight frame but had to heavily modify the upper portion to mount the pneumatic cylinder to rotate the sword. I kept the base frame (green in the drawing ) but rigged up a 120 degree PVC threaded joint to fit on the original frame with a galvanized floor flange. I then cut a ¼ inch plywood platform to mount the pneumatic piston, rotating arm and remount the head and attached all that to the flange. That blue thing just below that is the speaker. I 3D printed a bunch of clamps that will fit around the original frame and used a few to clamp the 3D printed speaker case to the frame. I’ll talk later about where I mounted all the electronics.

Pneumatic Arm Mechanism

Knight_Mechanism3.jpg

I 3-D printed a plug that fits into a PVC T joint that also holds an aluminum bar that is then attached to the end of the pneumatic cylinder. When the pneumatic cylinder is extended, it pushed the bar that then causes the PVC T to rotate. Note that this picture shows the rotated position where the sword is blocking the path. When the piston is fully extended, the sword is in the start position and the end position to allow the kiddies to pass. The PVC T is attached to PVC pipe that allows the assembly to rotate the arm (PVC pipe). I also printed some bearings to hold the PVC pipe and allow it to rotate. I placed the “bearings” close to the PVC T so that holds it in place.

I will mirror this for the other knight so that they move together both blocking the path.

PS: the swords are plastic and if some kid tries to run under as its moving it wont hurt them, the swords actually slid into a socket so they will pop out easily. I make sure the PIR sensor is far enough forward that it starts the sword movement before they reach the knights. But some kid will come up with some way...

Arm Prototype

IMG_1470.jpg
IMG 1471

Here is my first prototype of the arm movement. You can see the cylinder pushing the rod which rotates the arm mechanism.

Attaching Arms to PVC Pipe

Knight_Mechanism4.jpg

The knights hands came with a plastic insert that connected to the original non-moving frame. I removed those from the hands and 3D printed new ones that could be inserted back into the hands but accept a PVC pipe.

The PVC pipe inserts into the hole, and I 3D printed screw holes to make sure the PVC pipe won’t rotate. I have not experimented yet if PVC pipe glue will work with PLA printing material so it was easy to just design it in. Screws also make it easier to disassemble (I still have to store this thing after Halloween – orders from the management).

This whole assembly fits right into the hands and I used those cheap screws that held the original plug. I just inserted, drilled a small pilot hole and Done.

This knight prop has a single molded hands assembly holding a sword hilt. The hands are about at a 90-degree arm angle. This looks great if you can imagine holding a sword in front of you. If you wanted to rotate the sword to one side to block someone’s path one would have to rotate your shoulders, twist your hands and wrists. I didn’t want to figure out how to chop the hands apart and try to MacGyver all that out, so I tried another idea.

Non-Rotating Arm

Knight_Mechanism5.jpg

I’ll try to explain what I came up with. The purple cylinders represent the molded hand position and the white pipe coming out of it is the wrist. One side is fixed to the rotating PVC pipe. The other I attached a foam tube to the wrist. Attached to the Pneumatic mounting board (YELLOW), I 3D printed two parts; one is a swing arm and another is a cylinder with a mount end. The far end of the swing arm is attached to the pneumatic board loosely (closest to the neck). At the far end it has a raised tab that I attach a another part that is basically a cylinder that can fit into the other end of foam tube and is screwed onto the end of the swing arm. So, when the fixed arm rotates, the foam tube pulls the swing arm allowing for rotation. I added a spring to the arm so it will return to it's original position when the fixed arm rotates back to start. I have a few more details next.

Swing Arm Mechanism

Knight_Mechanism6.jpg
Knight_Mechanism7.jpg

When the fixed PVC pipe is rotated by the pneumatic cylinder it pulls on the foam tube attached to the other wrist.

The swing arm will allow the foam tube inserted into the cylindrical tab on the swing arm to rotate and move with the fixed wrist. When the event is done, and the fixed wrist rotates back the foam tube pushes back, and the swing rotates back to the original position. I'll try to add a few videos of this.

Swing Arm Mechanism With Foam Arm

Knight_Mechanism8.jpg

In the image, the sword fixed arm rotates to the left, away from he swing arm. THe foam bends and the swing arm allows it to follow the bending wrist. Not exactly anatomically correct, but I ain't got the Disney yah know...

3-D Print Files

I've drawn the parts using AutoCad 2000, which is a very old version, but I converted all the parts also to an STL file format for 3-D Printing.

Speaker Mount

Knight_Speaker1.jpg
Knight_Speaker2.jpg

I needed a way to mount the speaker so I removed the speaker from the original prop and 3D printed a case and using some 3D printed clamps attached it to the original frame. The enclosure has a hole to allow the speaker wires to exit and I placed connectors at the end so that I have an easy way to disconnect from the electronics board.

Electronics Mount

knight_controller-board.jpg

This is a 1/4" plywood board I use to mount all the electronics. I 3-D printed some stand-off mounts for the Aurduino, AdaFruit FX, Audion Level Meter, the Audio Amp and the custom Power Distribution Board. I also have a frame for the local enable switch and some cable and pneumatic hose clamps.

I made some 3-D clams to I can clamp this board to the knight tubular frame. It is mounted facing the rear of the knight, and behind the cape.

The Master Controller Code Walk-Through

Master-1.png

OK - Back to the Garage and the Master Controller coding.

The Arduino Nano code starts off defining the digital pins followed by defined variables. Not only do I define the variables I preset them to initial values so animation doesn’t start once the loop begins.

The next section sets up and defines the digital pins as inputs or outputs and whether they need pull-up.

Define Pins

Master-2.png

Here I define the pins and inputs or outputs.

Loop() Function

Master-3.png

The first thing I do is digitally read the enablePin, sensePin and manualStart inputs and place those values into the variables enableOn, sensed and animate. The first thing I check is if the prop is enabled (enableOn == HIGH). If not, continue to loop until it’s enabled. If enabled, the next check is if the sensePin is enabled (stored in the variable sensed). This external signal is from the PIR sensor to detect if someone approaches the prop. If a person is detected it calls the armMove() function which starts both the knights animation. If it is not detected, we lastly check if there is a manual start coming from the Proton via BLYK, if so we again initiate armMove() function. Before I get into the resetProp() function lets walk through the armMove() function.

ArmMove() Function

Master-4.png

The armMove() function first turns on the on board LED on the Arduino Nano to let me know when the animation sequence has started (OK, I like Das Blinkenlights).

Once I turned on the Arduino on-board LED, I enable the output (startProp) that is transmitted to the remote knight, through the RS485 transceiver. This signal tells the knight to start its animations (audio file, Jaw movement and glowing eyes). Right after that I set the output to enable the Relay board to close (relayPin, LOW) which enables the solenoid which initiates the knight pneumatic cylinder and the sword swings into place blocking the path. The next step is a fixed delay constant (delay) that is pre-set to allow the sword movement to complete.

We then move into the while loop that waits for the return signal from the knight that it has finished all it’s animation and jokes and is ready to be reset.

OK, back to the code. The last step is resetProp() function.

ResetProp() Function

Master-5.png

This last function activates the relay and drives the pneumatic solenoid to return the swords to its original position and turns off the Arduino Nano LED. It returns and loops waiting for the next event. Simple right?

The Knight Code Walk-Through

knight-1.png

Now moving out to the knight code.... This one has a bit going on, so I'll give it my best shot.

This is the code that runs on the Arduino MEGA located inside the knight prop. The Arduino MEGA code first section defines the analog and digital pins followed by defined variables.

Not only do I define the variables I preset them to initial values so animation doesn’t start once the loop begins. I’ll describe some of these later. The next section sets up and defines the digital pins as inputs or outputs and whether they need pull-up.

Defines the Pins

knight-2.png

This section defines all the pins and sets some needing pull-ups. There will be a test later.

Loop() Function

knight-3.png

The first thing I do is digitally read the enable, start and ACT inputs and place those values into the variables. The first thing I check is if the prop is enabled (enableOn == 1). If not, continue to loop until it’s enabled. If enabled, the next check is if the startPin is enabled (stored in the variable animate). This external signal is from the Wi-Fi connected Photon to manually start the animation.

Loop() Function Else If

knight-4.png

Using an else-if we check if the animation start is initiated, if not the loop starts over, rechecks the pins and starts again. If the animation signal is enabled, we start. The first step in the animation is to enable the knight eye LED’s (LOW) and then calls the halt() function.

Halt() Function

knight-5.png

The first thing in the halt function is to transmit the signal to the FX audio card to start the audio file to say “Halt! We have a joke for you!”. Now this depends on which knight this is. Both knights have a WAV file of the exact duration but one says “Halt!” and the other says “We have a joke for you!” making it seem like the knights are conversing. See my instruction later on how to make the WAV files.

Once the pulse has been sent, this function calls another function called tellJoke().

TellJoke() Function

knight-6.png

The tellJoke() function starts with a short delay to allow the FX board to start the WAV file playback and assures the ACT signal is active. It enters a while loop as long at the playing variable (which holds the value of ACT). If ACT is active, the function calls another function called jabber() and continually loops until ACT goes low. Before I go on, I’ll explain the jabber function.

Jabber() Function

knight-7.png

The jabber() function basically makes the jaw move along with the FX audio board WAV file. I have a small board that I’m using as an audio meter. It has a voltage input, and has 5 LED’s that light up based on the voltage input level. I soldered wires to LED D2, D3 and D4 and attached to the Arduino analog pins A0, A1 and A2. For this program I am only looking at A0. If the value is more than an analog count of 200 (analog voltage level) the jaw motor is driven high. As soon as it drops below 200, the jaws close. You’ll need to tweak these values to get the right effect since it's based on the WAV file spectrum. Too low and the jaw stays open, too high the jaw barely moves. Someday I might look more at this and see if using the other analogs pins and an algorithm to give the jaw even better movement. You will also note the delay. This delay will allow the jaw signal to remain high just long enough to allow to motor to actually physically move. You have to be careful with this one too. Make it too long and the jaw will stay open, too short you could miss too much of the audio stream. This function continually loops back to the tellJoke() function, checks that the ACT is still active and returns to keep moving the Jaw. It works good enough, but again I might look at this to see if I can improve it.

So, once function tellJoke() detects that ACT is inactive (done with the WAV file), the code returns to the halt() function, but since that’s the last line, the halt function returns all they way back to the loop().

Now you might be totally confused by now. At the end of this instructable I have the entire Arduino code so it might be easier to have that in hand as you follow along, because it jumps around a bit.

Return to Loop() Function

knight-8.png

Starting off back in the loop() function, after the halt function which we just completed, I inserted a fixed delay (sword) to allow the knights swords movement to complete, now blocking passage. The first step is to check the joke count. If it’s 1, tell joke1. We then call joke1() function.

Joke1() Function

knight-9.png

The first step in the joke1() function is to transmit the signal to the FX audio card to start the specific audio file for Joke 1. In this case we initiate the FX board to play the jokeWave1 WAV file. Since both knights have parallel code running in sync, each file will play at the same time and the result will look like they are having a conversation. I then initiate the tellJoke() function which checks the ACT monitor, reads the audio meter and makes the jaw move as we described earlier. Once the joke is done the joke count is incremented. The next time it goes through the code, it will play joke 2 since the count was incremented, then joke 3, etc. The other joke functions are the same other than they initiate a different WAV file from the FX board. I'll have 7 different jokes - reserving the 8th FX Board input for the Halt voice tract.

Program End

knight-11.png

Once the joke is finished, returning to the loop() function, we turn off the knights eyes and then send a signal back to the master controller telling it that the animation is done. At this point, the code returns back to beginning and waits for the signal to start again.

Once the Master controller receives the end of animation from the knight, the master controller then activates the relay and solenoid to return the sword to its original position and the entire process waits for the next event.

CODE Files

Knight-Nano.ino is the master controller code

Joke_Tell.ino is the code in the knight

For those new to Arduino code, its a text file that can be read with any text editor. (I like Notepad ++)

Making the Wave Files

I used Audacity (https://wiki.audacityteam.org/wiki/Audacity_Wiki_Home_Page; https://www.audacityteam.org/) to create my WAV files. This is a pretty powerful (and free) app for audio creation. There are lots of on-line instructions to record and make sound effects. Below is basically how I created the knight’s jokes.

Recording the Joke Track

Wav_file-1.png
Wav_file-4.png

I recorded the entire track for both knights. In this example I recorded “Halt! Who Goes there!”. This first thing I did was select an area of the recording that had no speaking (I usually start the recording and let it play for a few seconds and then speak). I went under the EFFECT pulldown and select NOISE REDUCTION. With the non-speaking section selected of the audio track, you can select GET NOISE PROFILE. This captures the background noise. Then select the entire audio tract (ctrl-A), select NOISE REDUCTION again and select OK. This will remove most of the ambient background noise. You can trim the beginning and end of the tract if needed for the audio tract. You will learn to leave about a ½-1 sec at the end of the track once we add reverb (it stretches the audio out). I'll get to effects a bit later.

Duplicate and Remove Background Noise

Wav_file-2.png
Wav_file-3.png

Once it’s cleaned up and ready, I then select the track and under EDIT I select DUPLICATE. This made an exact duplicate track.

I then used my cursor and highlighted the first track but the second half of the recording which is the “Who Goes there!” and selected SILENCE AUDIO SELECTION so that the first audio line (track) is just “Halt” and I used SILENCE AUDIO SELECTION over the Halt in the second audio track. I can now save each as a different WAV file, both of the same length, but when they are played simultaneously from each knight the first knight says “Halt!” and then the second knight says “Who Goes There!”. Now I need to do some audio effects to get the voices to sound spooky.

Add Audio Effects

Wav_file-4.png

I first selected the entirety of one of the tracks, selected REVERB under the EFFECT pull down and I selected ~50% in damping. Select OK. This adds a reverb to the tract. Next I wanted to change pitch. Select the entire track again and select CHANGE PITCH under the EFFECT pull-down. I used -20 Percent Change. Select OK.

Now your voice will have a reverb and a lower pitch and should sound pretty scary. The last thing I did was select the track and select AMPLIFY under the EFFECT pull down and adjust how you want. My amplifier was rather limited so I needed the WAV almost clipping to get the right volume level out. Need to experiment to get what sounds the best.

If you do the effects to the entire track, then duplicate track and cutting trick explained earlier, both knights will sound exactly the same. Nahhh. You can make them different by changing the pitch a bit with your own voice as you tell the entire joke add effects, duplicate tracks and cut. It will have a slightly different sound. Another way is to duplicate the tracks, cut each knights lines and then add different effects to each to make them sound like two different voices. Try this out (make notes!!) and come up with whatever you want. I enclosed an example of just adjusting my voice and adding effects but as an entire tract. Once cut, imagine one knight speaking with jaws moving and the other knight saying the other part. Pretty cool huh?

Note: I used a mono tract since I only have one speaker and it saves some file space. The FX board has 16 MB of space which is a lot, but if you get carried away you might go over.

Schematics and Other Drawings

This is the entire schematic in PDF. It also includes the other props also.

Links to My Other Halloween Props

As I start publishing the other props I'll add the links here.