Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Mega 2560 Controlled Ghostbuster Trap Prop with MP3 Player and Haptic Feedback

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560 Controlled Ghostbuster Trap Prop with MP3 Player and Haptic Feedback

Circuit Documentation

Summary

The circuit is designed to simulate a ghost trapped in a Ghostbuster trap trying to escape, with a sequence of events triggered by an RF remote. The sequence includes audio playback, vibration effects, LED flickering and stabilization, bargraph display animations, servo movements, and a relay-controlled pump motor. The circuit is powered by a 7V battery and uses an Arduino Mega 2560 as the main controller, interfacing with various components to create the desired effects.

Component List

Arduino Mega 2560

Adafruit Bi-Color 24-Bar Bargraph w/ I2C Backpack

LED: Two Pin (red)

MKE-M11 UART Control MP3 Player Module

Set battery (7v)

LilyPad RGB LED

Servo

Vibration Motor

SparkFun Haptic Motor Driver - DRV2605L

DC Motor

Relay module 5v-30v

Mini bomba de Agua (Mini Water Pump)

Resistor (200 Ohms)

IR Receiver

Step down Buck converter

Bluetooth Module

Wiring Details

Arduino Mega 2560

Adafruit Bi-Color 24-Bar Bargraph w/ I2C Backpack

LED: Two Pin (red)

MKE-M11 UART Control MP3 Player Module

Set battery (7v)

LilyPad RGB LED

Servo

Vibration Motor

SparkFun Haptic Motor Driver - DRV2605L

DC Motor

Relay module 5v-30v

Mini bomba de Agua (Mini Water Pump)

Resistor (200 Ohms)

IR Receiver

Step down Buck converter

Bluetooth Module

Documented Code

/*
 * Ghostbuster Trap Prop Simulation
 * This code simulates a ghost trapped in a Ghostbuster trap trying to escape
 * and power failure and then stabilization at the end.
 * The sequence is triggered by an RF remote and includes the following:
 * - MP3 player tracks
 * - Vibration with haptic driver and DC motors
 * - Flickering LEDs, that then one turns solid and the other blinks at 1 per second
 * - Bargraph display
 * - Servo movements
 * - Relay-controlled pump motor
 */

#include <SoftWire.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>
#include <Servo.h>
#include <DFPlayer_Mini_Mp3.h>

// Pin definitions
SoftWire I2cbus1(44,45);
SoftWire I2cbus2(46,47);
#define VIBRATION_MOTOR_PIN 5
#define DC_MOTOR_PIN 10
#define LED1_PIN 11
#define LED2_PIN 12
#define RELAY_PIN 13
#define SERVO1_PIN 6
#define SERVO2_PIN 7
#define RF_REMOTE_PIN 2

// Components
Adafruit_24bargraph bargraph = Adafruit_24bargraph();
Servo servo1;
Servo servo2;

void setup() {
  // Initialize components
  I2cbus1.begin();
  I2cbus2.begin();
  pinMode(VIBRATION_MOTOR_PIN, OUTPUT);
  pinMode(DC_MOTOR_PIN, OUTPUT);
  pinMode(LED1_PIN, OUTPUT);
  pinMode(LED2_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(RF_REMOTE_PIN, INPUT);
  servo1.attach(SERVO1_PIN);
  servo2.attach(SERVO2_PIN);
  bargraph.begin(0x70);
  mp3_set_serial(Serial1);
  mp3_set_volume(20);
}

void loop() {
  if (digitalRead(RF_REMOTE_PIN) == HIGH)