Motion detect Dalek

Uses a GCDuino (Gold Coast Techspace developed Arduino) with ultrasonic detection and directly plays a WAV file to PWM audio output

Similar projects worth following
Uses a GCDuino (uses Uno board selection in Arduino IDE). Uses a ping sensor HC-SR04 and triggers from 40cm - 120cm range.
GCDuino reads an SD card WAV file and outputs sound on pin 9 as PWM signal.
Have tried to simplify and lower cost of the project as much as possible and use what I had on hand.
Modified GCDuino to run on 3.3volts so no level shifter required for SD card - I used SD card adapter as a micro SD card reader.
This project is based on many similar Arduino-SD-Wav projects.
See for the final result

This project was shown at our local on the Gold Coast Australia
A great crowd draw .Suprised quite a few people walking past!

Still got to add schematic

  • 1 × GCDuino Similar to Uno
  • 1 × HC-SR04 Ultrasonic range sensor - less than $2 on ebay
  • 1 × LM2596 buck converter Convert 7-30volts in to 5volts for circuit - less than $2 on ebay
  • 1 × 3W class D amplifier PAM8403 mini board Amplify the Dalek voice! - less than $2 on ebay
  • 1 × Micro SD card adapter

View all 8 components

  • 1
    Step 1

    Breadboarding the setup

  • 2
    Step 2

    Uploading the program - this is the final version that plays all sounds then restarts

    Library files are from here

    Note WAV files are 8bit and should be less than 20K/sec samples - I used Audacity Portable

    This is modified code originally from APC mag in Australia - the article goes into great detail 

    Thanks Darren Yates

    // ---------------------------------------------------------------------------------
    // DO NOT USE CLASS-10 CARDS on this project - they're too fast to operate using SPI
    // ---------------------------------------------------------------------------------

    #include <SD.h>
    #include <TMRpcm.h>
    TMRpcm tmrpcm;

    File root;
    File entry;

    // ---------------------------------------------------------------------------------
    // set chipSelect to '10' if using the $2 SD card module or '4' if using the
    // Ethernet shield's microSD card instead.
    const int chipSelect = 10;
    // ---------------------------------------------------------------------------------

    const int oldCard = SPI_HALF_SPEED;
    const int newCard = SPI_QUARTER_SPEED;

    // ---------------------------------------------------------------------------------
    // set cardType to 'oldCard' if using an old SD card (more than a few years old) or
    // to 'newCard' if using a newly-purchase Class-4 card.
    int cardType = oldCard;
    // ---------------------------------------------------------------------------------

    int wasPlaying = 0;
    int inSwitch = 7;
    int finished = 0;
    int start = 0;
    int pauseOn = 0;
    int trigPin = 4;
    int echoPin = 5;

    void setup() {
    pinMode(trigPin, OUTPUT); //for HC-SR04
    pinMode(echoPin, INPUT); //for HC-SR04
    Serial.print("\nInitializing SD card...");
    pinMode(chipSelect, OUTPUT);
    if (!SD.begin(chipSelect,cardType)) {

    tmrpcm.speakerPin = 9; //Pin9 for audio output

    pinMode(inSwitch,INPUT_PULLUP); //Audio Test switch
    // digitalWrite(inSwitch,HIGH);

    root ="/");

    void loop(void) {
    long duration, distance; //
    digitalWrite(trigPin, LOW); // HC-SR04 setup
    digitalWrite(trigPin, HIGH);
    digitalWrite(trigPin, LOW);
    duration = pulseIn(echoPin, HIGH); //Get ping time
    boolean btnState = digitalRead(inSwitch); //Check Audio Test switch
    if(btnState == LOW){ //manual trigger on pin 7 - bring low
    if ((duration < 8000) && (duration > 3000)) { // Trigger set for 40cm - 120cm
    delay(5000); //Delay between each sound file
    delay(1000); //Check ping sensor every second

    void playNext() { //play next track function
    entry = root.openNextFile();
    if (entry) {
    wasPlaying = 1;
    } else {
    if (wasPlaying == 1) {
    wasPlaying = 0;
    entry = root.openNextFile();

View all instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates