Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Halloween Special – Haunted Post Box

By Ganesh Selvaraj

 

Well as the Halloween is coming close I thought why not show you how to make an interactive electronic Halloween prop. All we need is a PIR sensor, an Arduino/ ATMega8 board and couple of other electronic components to make this Haunted Post box.
Components Required
      1.      Arduino/ ATmega8 / ATmega16 board
      2.      1 x PIR Sensor
       3.      1 x Servo Motor (Medium Torque) with servo horn
      4.      1 x BC547 (or any other equivalent) Transistor
      5.      2 x Resistors 330 ohms
      6.      1 x LED
       7.      4 x AA Battery Holder
       8.      4 x AA Batteries
       9.      A  Plastic/ Carton box
      10. Nuts, bolts, spacers, etc.
      11.  Solid Wires
      12.  Plastic Rulers
      13.  Female Jumper wires

 

Tools Required
      1.      Soldering machine, De-Soldering wick, Flux, Soldering wire
      2.      PCB drilling machine/ Hand Drill
      3.      Screwdriver, Cutter, Wire stripper
      4.      Insulation tape
      5.      Digital Multimeter

 

What The Prop Does?
Basically a scary element pops out of the post box as soon as the PIR sensor senses a human nearby the door step. It stays out for a while and again goes back into the post-box and stays there till the next victim comes close. The scary element is of your choice. It can be a plastic skull or a monster mask or a toy hand or anything which scares people when they see it suddenly. Be creative! And use your own imagination.

 

Circuit Explanation
The most important part of the circuit is the PIR (Passive Infra-Red) sensor. These sensors basically measure the Infrared light radiated by an object present in its field. All living creatures (and objects) with a temperature above absolute zero (which is 0 Kelvin or -273oC) emit heat energy in form of radiation. The PIR sensors are tuned in such a way that they detect only the radiation emitted by human beings.
To know more about how it works go to this link: http://www.engineersgarage.com/insight/how-motion-pir-sensor-works
Now this sensor would be used to detect our targets coming near to our door steps and trigger the scaring mechanism.

 

Amplifier Circuit
Since the output coming from a PIR sensor is quite weak, we use a transistor to amplify the output signal. You can either solder the circuit onto a small PCB or directly solder the pins of the components according to the circuit diagram. When I say to connect the output of PIR sensor to the microcontroller pin, it means you need to connect the output of this amplifier.
Circuit Diagram of BC547 Transistor Amplifier
Fig. 1: Circuit Diagram of BC547 Transistor Amplifier

 Working Mechanism

Mechanism
Since the scary element needs to pop out of the box and go back into it, which is a linear motion, we can’t simply use just a DC geared motor or a servo motor. We will need a crank type mechanism to convert the circular motion of the motor into a linear motion for the scary element to work.

Image showing mechanism of Haunted Post Box

Fig. 2: Image showing mechanism of Haunted Post Box

 

 

Image showing mechanism of Haunted Post Box

Fig. 3: Image showing mechanism of Haunted Post Box

 

Image showing mechanism of Haunted Post Box

Fig. 4: Image showing mechanism of Haunted Post Box

 

Image showing mechanism of Haunted Post Box

Fig. 5: Image showing mechanism of Haunted Post Box

The length ‘L’ and radius ‘R’ should be chosen carefully based on the height of the scary element you are using.
The maximum height the element’s bottom can reach is H= (L + R + i) and
The minimum height is H= (L – R + i)

 

Points to Remember:
-> The height of the element should be less than ‘2xR’ or else it will not completely fit into to the post box in minimum position.

 

-> The length ‘L’ should be slightly more than the diameter (2xR) of the wheel.

 Explanation and Working

Diagrammatic Explanation
 Image showing Mechanical Design of Haunted Post Box
Fig. 6: Image showing Mechanical Design of Haunted Post Box

 

Working

 

The post box would be very normal when there is no one around it. Initially the servo axle is at 0O, but when a person comes in front of the PIR sensor, the servo rotates to 180O and the following happens.
Image showing working of Haunted Post Box
Fig. 7: Image showing working of Haunted Post Box
And after a period of time say five seconds, the element goes back into the box and the lid gets shut automatically due to gravity, making the haunted post-box look like a normal one again (by this time the victim would have ran away and so we need to hide the surprise from next target).

Image showing working of Haunted Post Box

Fig. 8: Image showing working of Haunted Post Box

 

Code Explanation
The code is pretty simple and straight forward. I have attached the code for most commonly used development boards (ATmega8 dev. Board & ATmega16 dev. board) .You can easily modify the code to work with arduino also.
        ·         Initialize the timers for non inverted Pulse Width Modulation and fast PWM mode.
        ·         Set the time period = 20ms (frequency = 50Hz)
        ·         Configure PD5 of PORTD as output (PB1 in ATmega8). This is where the Servo motor is connected.
       ·         Configure the first pin PA1 of PORTA as input (PC0 in ATmega8/ digital pin 14 in arduino) and set it to logic high state. This is where the output of PIR signal is connected to (through an amplifier circuit)
       ·         Enter an infinite loop.
       ·         If PA1 goes low, change the servo angle to 180O , wait for few seconds and change the angle back to 0O

Making of Box and Mechanism

Making of the box and mechanism
I’m using an old CD and a couple of plastic rulers to make the crank mechanism.
First we attach the servo horn to the CD by making some holes on the CD and using couple of solid wires. Use the necessary tools.
Image showing holes drilled on a CD to attach Servo horn
Fig. 9: Image showing holes drilled on a CD to attach Servo horn
 
Image showing servo attached to CD with solid wires
Fig. 10: Image showing servo attached to CD with solid wires
 
Image of tools used for making haunted post box
Fig. 11: Image of tools used for making haunted post box
Then we take two pieces of plastic ruler and make holes in them so that we can attach them.
Image showing holes drilled on plastic rulers
Fig. 12: Image showing holes drilled on plastic rulers
Use few bolts and lot of nuts to make the joints. If the holes are too big for the screws, use some plastic or PCB pieces to fix them.

 

Image showing mechanical assembly with CD and Rulers

Fig. 13: Image showing mechanical assembly with CD and Rulers

 

Image showing holes drilled on PCBs

Fig. 14: Image showing holes drilled on PCBs

 

Image showing nut and bolts attached to PCBs

Fig. 15: Image showing nut and bolts attached to PCBs

 

Image showing Rulers attached using PCB Nut-Bolt assembly

Fig. 16: Image showing Rulers attached using PCB Nut-Bolt assembly

Dump the program into the controller, connect the setup as per the circuit diagram and attach the wheel (CD in my case) to the servo. Now test the mechanism and see if it runs works smoothly.
Note: For testing you can connect a tactile switch to the input pin of the controller (and other end of switch to ground) instead of PIR sensor. This is because PIR sensor will continuously sense you so you cannot sit near and test the circuit.

 

 

 
Once you have tested the mechanism next you need to find a suitable box (cardboard or plastic) to put it in. Remember to cut the slot inside the box as shown in the drawings.

 

Final Touches
Well as the title says, the prop is supposed to look like a post-box remember? Post boxes look different in different place and so it’s up to you to find out how they look in your region and make the prop look similar to that.

 

 

Project Source Code

###

C Program for Atmega 8 /*
 * prank.c
 *
 * ATMega8
 *  Author: GANESH SELVARAJ
 */ 


#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>


void Waiting(int j) // simple delay function
{
uint8_t i;
for(i=0;i<j;i++)
_delay_ms(200);
}
int main(void)
{
//Configure TIMER1
TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); //NON Inverted PWM
TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM)

ICR1=4999; //fPWM=50Hz (Period = 20ms Standard).

DDRB|=(1<<PB1); //PWM Pins as Out
OCR1A=150;

DDRC=0b11111110;
PORTC=0b00000001;
while(1)
{
if((PINC & 0b00000001)==0)
{
OCR1A=600;
Waiting(20);
OCR1A=150;
}

Waiting(1);
}
}
**********************************************************************************************

C Program for Atmega 16/*
* prank.c
*
* Created: 10/4/2013 7:34:21 PM
* Author: GANESH SELVARAJ
*/


#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>


void Waiting(int j) // simple delay function
{
uint8_t i;
for(i=0;i<j;i++)
_delay_ms(200);
}
int main(void)
{
//Configure TIMER1
TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); //NON Inverted PWM
TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM)

ICR1=4999; //fPWM=50Hz (Period = 20ms Standard).

DDRD|=(1<<PD5); //PWM Pins as Out
OCR1A=150;

DDRA=0b11111101;
PORTA=0b00000010;
while(1)
{
if((PINA & 0b00000010)==0)
{
OCR1A=600;
Waiting(20);
OCR1A=150;
}

Waiting(1);
}
}
 

###

 


Circuit Diagrams

Circuit-Diagram-Arduino-Servo-Motor-Based-Haunted-Post-Box


Filed Under: Electronic Projects
Tagged With: Post Box
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What is a low power design?
  • Renesas partners with Tata to accelerate progress in advanced electronics
  • STMicroelectronics’ new touchscreen controller for smartphones enables longer runtime
  • Samsung unveils ISOCELL image sensor with industry’s smallest 0.56μm pixel
  • Renesas and Cyberon to deliver integrated voice-user interface solutions

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Help identifying drop in ssignal
  • Atrduino IDE ompilation Error
  • Cadence Layout (LVS error in bulk connections)
  • FPGA LVDS with separate clock
  • Limits of duty cycle for ICM7555 IC?

RSS Electro-Tech-Online.com Discussions

  • Lighting a .010 green fiber optic with led
  • Bridge purpose in connecting the two functional circuit
  • ICM7555 IC duty cycle limit at high frequency?
  • How to quickly estimate lead acid battery capacity ?
  • intro to PI
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering