Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Ghostbusters Trap Simulation with Arduino Mega and Adafruit Modules

Image of Ghostbusters Trap Simulation with Arduino Mega and Adafruit Modules

Circuit Documentation

Summary

The circuit is designed to simulate a ghost trap from the movie Ghostbusters. It features a variety of components including servos, LEDs, a bargraph, a haptic motor, a DC motor, and a water pump to create an effect of a ghost being trapped and the trap experiencing an electrical failure. The sequence can be activated by a Bluetooth input or an encoder knob switch. The encoder knob also controls the volume. The circuit is controlled by an Arduino Mega ADK microcontroller.

Component List

  • Adafruit 16-Channel 12-bit PWM Servo Driver - I2C: Used to drive multiple PWM servos.
  • Adafruit DRV2605L: A haptic controller for vibration motors.
  • Vibration Motor: Provides haptic feedback.
  • Servo: Actuators for moving parts of the trap.
  • Adafruit PowerBoost 1000C: A power supply module for battery charging and 5V regulation.
  • Mosfet: Used to switch higher current loads with a microcontroller.
  • 5v mini water pump: Simulates the effect of the ghost being trapped.
  • Lamp Red: Provides visual indication.
  • Adafruit Bi-Color 24-Bar Bargraph w/ I2C Backpack: Displays visual information.
  • LED: Two Pin (red): Simple indicator LED.
  • Resistor: Used for current limiting and pull-up/down resistors.
  • Rotary Encoder: Provides user input for control and volume adjustment.
  • DC Motor: Used to simulate mechanical movements.
  • Diode: Prevents back EMF from the DC motor.
  • NPN Transistor (EBC): Used as a switch for controlling various components.
  • Speaker: Outputs audio signals.
  • Adafruit Music Maker Shield with Amp: Handles audio playback and amplification.
  • Adafruit Bluefruit LE UART Friend: Provides Bluetooth connectivity.
  • 2Pin Push Switch: A simple push button switch.
  • 1 Watt LED Cool White w/ Heatsink: High-power LEDs for bright visual effects.
  • Arduino Mega ADK (Rev3): The main microcontroller board that controls the circuit.
  • 2000mAh Battery: Provides power to the circuit.
  • Terminal Block: Used for making easy connections to the board.
  • Toggle Switch SPST: A single-pole single-throw switch for power control.
  • AMS1117 3.3: A voltage regulator for providing 3.3V.

Wiring Details

Adafruit 16-Channel 12-bit PWM Servo Driver - I2C

  • 5.0V and VCC connected to 5V power supply.
  • SDA and SCL connected to I2C bus (Arduino Mega ADK).
  • OE not connected.
  • GND connected to ground.
  • PWM0 to PWM15 connected to servos and other PWM devices.

Adafruit DRV2605L

  • VIN connected to 5V power supply.
  • GND connected to ground.
  • SCL and SDA connected to I2C bus (Arduino Mega ADK).
  • IN/TRIG connected to digital pin D31 (Arduino Mega ADK).
  • OUT+ and OUT- connected to Vibration Motor.

Vibration Motor

  • POS connected to OUT+ on Adafruit DRV2605L.
  • NEG connected to OUT- on Adafruit DRV2605L.

Servo

  • GND connected to ground.
  • VCC connected to 5V power supply.
  • PWM connected to PWM output from Adafruit 16-Channel PWM Servo Driver.

Adafruit PowerBoost 1000C

  • GND connected to ground.
  • 5.0V connected to 5V power supply.
  • VBUS and VLIPO connected to 2000mAh Battery.
  • ENABLE connected to Toggle Switch SPST.

Mosfet

  • Gate connected to digital pin D28 (Arduino Mega ADK).
  • Drain connected to 5v mini water pump and NPN Transistor (EBC).
  • Source connected to ground.

5v mini water pump

  • positive pin connected to Mosfet.
  • negative pin connected to ground.

Lamp Red

  • + connected to digital pin D27 (Arduino Mega ADK).
  • - connected to ground through a resistor.

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

  • VDD connected to 5V power supply.
  • GND connected to ground.
  • SDA and SCL connected to I2C bus (Arduino Mega ADK).

LED: Two Pin (red)

  • cathode connected to ground through a resistor.
  • anode connected to digital pin D26 (Arduino Mega ADK).

Resistor

  • Connected in series with LEDs and other components for current limiting.

Rotary Encoder

  • clk and dt connected to digital pins A0 and A1 (Arduino Mega ADK).
  • sw connected to digital pin A2 (Arduino Mega ADK).
  • gnd connected to ground.
  • + connected to 5V power supply.

DC Motor

  • One pin connected to NPN Transistor (EBC) collector.
  • Other pin connected to ground through a diode.

Diode

  • cathode connected to DC Motor.
  • anode connected to NPN Transistor (EBC) collector.

NPN Transistor (EBC)

  • emitter connected to ground.
  • base connected to digital pins D22, D23, D25 (Arduino Mega ADK) through resistors.
  • collector connected to various components like DC Motor, Diode, and LEDs.

Speaker

  • + and - connected to Adafruit Music Maker Shield with Amp.

Adafruit Music Maker Shield with Amp

  • Connected to Arduino Mega ADK through ICSP and digital pins for control and data transfer.

Adafruit Bluefruit LE UART Friend

  • MODE, CTS, TXO, RXI, VIN, RTS, GND, DFU connected to corresponding pins on Arduino Mega ADK for Bluetooth communication.

2Pin Push Switch

  • Input + connected to digital pin A15 (Arduino Mega ADK).
  • Output + connected to ground.

1 Watt LED Cool White w/ Heatsink

  • Positive connected to 5V power supply.
  • Negative connected to ground through NPN Transistor (EBC) and resistors.

Arduino Mega ADK (Rev3)

  • Various digital and analog pins connected to components as described above.
  • 5V and GND used to power components and provide ground reference.
  • VIN connected to 5V power supply.

2000mAh Battery

  • VCC connected to Adafruit PowerBoost 1000C.
  • GND connected to ground.

Terminal Block

  • Used for organizing connections to various components.

Toggle Switch SPST

  • L1 connected to Adafruit PowerBoost 1000C ENABLE.
  • COM connected to ground.

AMS1117 3.3

  • VIN connected to 5V power supply.
  • OUT connected to 3.3V components.
  • GND connected to ground.

Documented Code

/*
 * Ghostbusters Trap Simulation
 * This code simulates a ghost trap from the movie Ghostbusters.
 * It controls servos, LEDs, a bargraph, a haptic motor, a DC motor,
 * and a water pump to create an effect of a ghost being trapped
 * and the trap experiencing an electrical failure.
 * The sequence can be activated by a Bluetooth input or the encoder knob switch.
 * The encoder knob also controls the volume.
 */

#include <Adafruit_PWMServoDriver.h>
#include <Adafruit_VS1053.h>
#include <Adafruit_LEDBackpack.h>
#include <Wire.h>
#include <Servo.h>
#include <SoftwareSerial.h>

#define LED_D26 26
#define LED_D27 27
#define LED_D22 22
#define LED_D23 23
#define LED_D25 25
#define SWITCH_PIN 31
#define HAPTIC_PIN 20
#define DC_MOTOR_PIN 29
#define PUMP_PIN 28
#define ENCODER_SW_PIN 48
#define ENCODER_CLK_PIN 49
#define ENCODER_DT_PIN 46
#define BLUETOOTH_RX 18
#define BLUETOOTH_TX 19

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer();
Adafruit_24bargraph bargraph = Adafruit_24bargraph();
Servo leftServo;
Servo rightServo;
SoftwareSerial bluetooth(BLUETOOTH_TX, BLUETOOTH_RX);

volatile int lastEncoded = 0;
volatile long encoderValue = 0;
long lastencoderValue = 0;
int lastMSB = 0;
int lastLSB = 0;