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.
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.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.POS
connected to OUT+
on Adafruit DRV2605L.NEG
connected to OUT-
on Adafruit DRV2605L.GND
connected to ground.VCC
connected to 5V power supply.PWM
connected to PWM output from Adafruit 16-Channel PWM Servo Driver.GND
connected to ground.5.0V
connected to 5V power supply.VBUS
and VLIPO
connected to 2000mAh Battery.ENABLE
connected to Toggle Switch SPST.Gate
connected to digital pin D28 (Arduino Mega ADK).Drain
connected to 5v mini water pump and NPN Transistor (EBC).Source
connected to ground.positive pin
connected to Mosfet.negative pin
connected to ground.+
connected to digital pin D27 (Arduino Mega ADK).-
connected to ground through a resistor.VDD
connected to 5V power supply.GND
connected to ground.SDA
and SCL
connected to I2C bus (Arduino Mega ADK).cathode
connected to ground through a resistor.anode
connected to digital pin D26 (Arduino Mega ADK).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.cathode
connected to DC Motor.anode
connected to NPN Transistor (EBC) collector.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.+
and -
connected to Adafruit Music Maker Shield with Amp.MODE
, CTS
, TXO
, RXI
, VIN
, RTS
, GND
, DFU
connected to corresponding pins on Arduino Mega ADK for Bluetooth communication.Input +
connected to digital pin A15 (Arduino Mega ADK).Output +
connected to ground.Positive
connected to 5V power supply.Negative
connected to ground through NPN Transistor (EBC) and resistors.5V
and GND
used to power components and provide ground reference.VIN
connected to 5V power supply.VCC
connected to Adafruit PowerBoost 1000C.GND
connected to ground.L1
connected to Adafruit PowerBoost 1000C ENABLE
.COM
connected to ground.VIN
connected to 5V power supply.OUT
connected to 3.3V components.GND
connected to ground./*
* 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;