Death Star Christmas Tree Topper​

So i came across this Death Star Christmas Tree Topper i would like to do but im having a little trouble getting it coded and wired up. Im hopping someone might be able to help me finish it off or at least get me past this point.

So this is the instructables link

Basically i’m not sure what pins connect to what on the Arduino Uno board. for the Switches, Laser, Motion Sensor. So i made some adjustments to what i think will work but i can’t seem to get the code to upload to check it. Its telling me it there’s no such #include <FatReader.h> file

Any help with this would be great. I have attached everything im using plus old and adjusted stuff.

This is his layout. I had trouble figuring out what pins he used so i made some changes.

This is the original layout

This is my updated layout im using

Here is my adjusted Code

/**
 * deathStarPlayer  Plays the music and sounds for the Death Star
 *
 * @author  Kevin Craine
 */

// General stuff
const int DEBUG = 0;
// Count for delay between sounds
const unsigned int AUTO_TIME_DELAY = 8000;        // Delay between sound plays when in auto play mode
const unsigned long MOTION_TIME_DELAY = 1800000;  // Delay between sound plays when in motion control mode
static unsigned long timeTrack = 0;     // Keeps track of overall time to see if we need to trigger an event
// Mode selecting and tracking
int modeSwitchPin = 10;                 // Switch that will cycle between the different modes
int modeSelected = 0;                   // Default is 0 = motion sensor enabled, 1 = auto play (no input), 2 = off
int modeSwitchState;                    // Keeps track of the state of the switch, so we only get one hit when pressed
int pinValue;                           // Holds the pins value
int pinValue2;                          // Holds the pins value again (check for bounce)
// Motion Sensor
int pirPin = 15;                        // Pin that will get HIGH/LOW values from motion sensor

// Stuff for Wave Shield
#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"
// Some variables to hold info for the Wave Shield
SdReader card;
FatVolume vol;
FatReader root;
FatReader file;
WaveHC wave;
// Sound files that we will use
const int NUM_OF_FILES = 3;  //Number of WAV Files
char *wavFiles[] = {"IMPERIAL.WAV", "FIRING.WAV", "DEATHSTR.WAV"};


// Stuff for Weapon Firing
const int COUNT_GREEN_SETS = 4;           // Count of the number of green sets in the circle
int greenCirclePins[COUNT_GREEN_SETS];    // Array for perimeter leds
int greenCenterPin =  11;                 // Green Center LED to digital pin 11
// Counts for Weapon Firing
const int TIME_TO_START_WEAPON = 9350;    // Number of milliseconds before we initiate the LEDs
const int TIME_TO_WEAPON_FULL = 12560;    // Number of milliseconds before full weapon firing
const int TIME_TO_WEAPON_STOP = 14210;    // Number of milliseconds weapon shutdown
// Button for firing
int firingSwitchPin = 12;                 // Switch for overriding current function and start firing sequence
int firingSwitchState;                    // Keeps track of the state of the switch, so we only get one hit when pressed


/**
 * setupWave  Initialize Wave Shield
 */
void setupWave() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  
  if (!card.init()) {
    if (DEBUG) putstring_nl("Card init failed.");
    while(1);
  }
  card.partialBlockRead(true);

  uint8_t part;
  for (part = 0; part < 5; part++) {
    if (vol.init(card, part)) break;
  }
  if (part == 5) {
    if (DEBUG) putstring_nl("No valid FAT partition.");
    while(1);
  }
  
  if (!root.openRoot(vol)) {
    if (DEBUG) putstring_nl("Unable to open root directory.");
    while(1);
  }
}

/**
 * setupWeapon  Initialize Weapon
 */
void setupWeapon() {
  greenCirclePins[0] =  6;    // Green Set 1 LEDs to digital pin 6
  greenCirclePins[1] =  7;    // Green Set 1 LEDs to digital pin 7
  greenCirclePins[2] =  8;    // Green Set 1 LEDs to digital pin 8
  greenCirclePins[3] =  9;    // Green Set 1 LEDs to digital pin 9
  // initialize the digital pin as an output:
  for(int x = 0; x < COUNT_GREEN_SETS; x++) {
    pinMode(greenCirclePins[x], OUTPUT);
  }
  pinMode(greenCenterPin, OUTPUT);
  pinMode(firingSwitchPin, INPUT);
}

/**
 * checkMode  Checks to see if we are switching modes
 */
void checkMode() {
  pinValue = digitalRead(modeSwitchPin);
  delay(10);  // Bounce check
  pinValue2 = digitalRead(modeSwitchPin);
  if (pinValue == pinValue2 && pinValue != modeSwitchState && pinValue) {
    modeSelected = (modeSelected + 1) % 3;
    if (DEBUG) {
      putstring("Mode Selected: ");
      Serial.print(modeSelected);
      putstring_nl(".");
    }
    // This will visualize the mode selected for user.
    for (int x = 0; x <= modeSelected; x++) {
      weaponToggle(HIGH);
      delay(300);
      weaponToggle(LOW);
      delay(200);
    }
  }
  modeSwitchState = pinValue;
}

I attached the full original code my full adjusted code and the .h files im using.

Photos of my layout

Original_Code.ino (7.87 KB)

FatReader.h.h (7.76 KB)

SdReader.h.h (5.19 KB)

WaveHC.h.h (3.32 KB)

WaveUtil.h.h (527 Bytes)

DeathStar_Arduino.ino (7.87 KB)

Its telling me it there’s no such #include <FatReader.h> file

That means you haven’t installed the FatReader libiary.

So this is the instructables link

ARRRRRRRRRRRT!
Crap warning - Crap warning - Crap warning

NEVER use instructables unless you know more that the moron that wrote it!

Death Star Christmas Tree Topper

:o

.

had trouble figuring out what pins he used so i made some changes.

Sadly you copied all the mistakes. Like :-

Wiring two LEDs in parallel.

Short circuiting the 5V and ground.

Overloading the current output for an Arduino pin by several times over its absolute maximum.

Not having capacitors on a voltage regulator.

Useless so called protection resistors on the inputs and mistakenly having different values for them.

That circuit gives crap a bad name.

Yeah i can go in and change Resistors and I got a actual Voltage regulator that drops to 3.3v and there should be enough pins that i could setup pins 2-9 as the green LEDs so i dont have to use any of them in parallel. little changes i can make myself.

My biggest problem is that I am not that good at coding. I'm slowly figuring it out. I would image if it all worked before that it should work again. there just needs to be some minor adjustments. would anyone be able to help one this?

So i have made some changes to both the code and circuit. I was able to get the Library to be seen but the system is still not working.

Would someone be willing to take a look at this and give me a hand please. I’m willing to pay for time if someone could get this to work.

Both the first half of the code(since it won’t all fit) and layout are shown. I have attached the full code and image as well.

/**
 * deathStarPlayer  Plays the music and sounds for the Death Star
 *
 * @author  Kevin Craine
 */
// this constant won't change:
//pirPin = 0;  // Anolog Pin 0 that will get HIGH/LOW values from motion sensor
//ledPin = 2;      // Green LED Circle Around Center Laser/LED
//ledPin = 3;      // Green LED Circle Around Center Laser/LED
//ledPin = 4;      // Green LED Circle Around Center Laser/LED
//ledPin = 5;      // Green LED Circle Around Center Laser/LED
//ledPin = 6;      // Green LED Circle Around Center Laser/LED
//ledPin = 7;      // Green LED Circle Around Center Laser/LED 
//ledPin = 8;      // Green LED Circle Around Center Laser/LED
//ledPin = 9;      // Green LED Circle Around Center Laser/LED
//ledPin = 10;      // Green Center Laser/LED
//buttonPin = 11;    // Switch that will cycle between the different modes
//ButtonPin = 12;    // Switch for overriding current function and start firing sequence  

// General stuff
const int DEBUG = 0;
// Count for delay between sounds
const unsigned int AUTO_TIME_DELAY = 8000;        // Delay between sound plays when in auto play mode
const unsigned long MOTION_TIME_DELAY = 1800000;  // Delay between sound plays when in motion control mode
static unsigned long timeTrack = 0;     // Keeps track of overall time to see if we need to trigger an event
// Mode selecting and tracking
int modeSwitchPin = 10;                 // Switch that will cycle between the different modes
int modeSelected = 0;                   // Default is 0 = motion sensor enabled, 1 = auto play (no input), 2 = off
int modeSwitchState;                    // Keeps track of the state of the switch, so we only get one hit when pressed
int pinValue;                           // Holds the pins value
int pinValue2;                          // Holds the pins value again (check for bounce)
// Motion Sensor
int pirPin = 0;                        // Pin that will get HIGH/LOW values from motion sensor

// Stuff for Wave Shield
#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"
// Some variables to hold info for the Wave Shield
SdReader card;
FatVolume vol;
FatReader root;
FatReader file;
WaveHC wave;
// Sound files that we will use
const int NUM_OF_FILES = 3;  //Number of WAV Files
char *wavFiles[] = {"IMPERIAL.WAV", "FIRING.WAV", "DEATHSTR.WAV"};


// Stuff for Weapon Firing
const int COUNT_GREEN_SETS = 4;           // Count of the number of green sets in the circle
int greenCirclePins[COUNT_GREEN_SETS];    // Array for perimeter leds
int greenCenterPin =  11;                 // Green Center LED to digital pin 11
// Counts for Weapon Firing
const int TIME_TO_START_WEAPON = 9350;    // Number of milliseconds before we initiate the LEDs
const int TIME_TO_WEAPON_FULL = 12560;    // Number of milliseconds before full weapon firing
const int TIME_TO_WEAPON_STOP = 14210;    // Number of milliseconds weapon shutdown
// Button for firing
int firingSwitchPin = 12;                 // Switch for overriding current function and start firing sequence
int firingSwitchState;                    // Keeps track of the state of the switch, so we only get one hit when pressed


/**
 * setupWave  Initialize Wave Shield
 */
void setupWave() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  
  if (!card.init()) {
    if (DEBUG) putstring_nl("Card init failed.");
    while(1);
  }
  card.partialBlockRead(true);

  uint8_t part;
  for (part = 0; part < 5; part++) {
    if (vol.init(card, part)) break;
  }
  if (part == 5) {
    if (DEBUG) putstring_nl("No valid FAT partition.");
    while(1);
  }
  
  if (!root.openRoot(vol)) {
    if (DEBUG) putstring_nl("Unable to open root directory.");
    while(1);
  }
}

/**
 * setupWeapon  Initialize Weapon
 */
void setupWeapon() {
  greenCirclePins[0] =  2;    // Green Set 1 LEDs to digital pin 2
  greenCirclePins[1] =  3;    // Green Set 1 LEDs to digital pin 3
  greenCirclePins[2] =  4;    // Green Set 1 LEDs to digital pin 4
  greenCirclePins[3] =  5;    // Green Set 1 LEDs to digital pin 5
  greenCirclePins[0] =  6;    // Green Set 1 LEDs to digital pin 6
  greenCirclePins[1] =  7;    // Green Set 1 LEDs to digital pin 7
  greenCirclePins[2] =  8;    // Green Set 1 LEDs to digital pin 8
  greenCirclePins[3] =  9;    // Green Set 1 LEDs to digital pin 9
  // initialize the digital pin as an output:
  for(int x = 0; x < COUNT_GREEN_SETS; x++) {
    pinMode(greenCirclePins[x], OUTPUT);
  }
  pinMode(greenCenterPin, OUTPUT);
  pinMode(firingSwitchPin, INPUT);
}

DeathStar_Arduino.ino (9.03 KB)