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

Ghostbusters Trap Simulation with Arduino Mega and Adafruit Modules

View and Edit Project In Cirkit DesignerImage 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

Wiring Details

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

Adafruit DRV2605L

Vibration Motor

Servo

Adafruit PowerBoost 1000C

Mosfet

5v mini water pump

Lamp Red

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

LED: Two Pin (red)

Resistor

Rotary Encoder

DC Motor

Diode

NPN Transistor (EBC)

Speaker

Adafruit Music Maker Shield with Amp

Adafruit Bluefruit LE UART Friend

2Pin Push Switch

1 Watt LED Cool White w/ Heatsink

Arduino Mega ADK (Rev3)

2000mAh Battery

Terminal Block

Toggle Switch SPST

AMS1117 3.3

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;