Comments: WAV Trigger Hookup Guide V11

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • How do I trigger a sound with a sensor? The hookup guide is not clear about this.

  • I struggle for way too long to change the pin on altSoftSerial to other than pin 9. I finally got it to work by using softwareSerial library as follows.

    #include <SoftwareSerial.h>
    #include <wavTrigger.h>
    
    SoftwareSerial wavSerial(6,5);  //pin 5 is used to TX to wave trigger pin 6 is not used
    
    void setup() {
      wavSerial.begin(57600);
    }
    
    void loop() {
      uint8_t txbuf[8];
      int trk = 1; //plays track 1
      int code = 1; //plays polyphonic (see wavTrigger.h library for codes)
    
      txbuf[0] = 0xf0;
      txbuf[1] = 0xaa;
      txbuf[2] = 0x08;
      txbuf[3] = CMD_TRACK_CONTROL;
      txbuf[4] = (uint8_t)code;
      txbuf[5] = (uint8_t)trk;
      txbuf[6] = (uint8_t)(trk >> 8);
      txbuf[7] = 0x55;
      wavSerial.write(txbuf, 8);
    
      delay(2000);
    
    }
    

  • -------------------- Tech Support Tips/Troubleshooting/Common Issues --------------------

    WTSerial.clear()

    If you are having issues compiling the Arduino example code and you see something like this:

    C:\Users\...\Documents\Arduino\libraries\wavTrigger\wavTrigger.cpp: In member function 'void wavTrigger::response(uint8_t)':
    C:\Users\...\Documents\Arduino\libraries\wavTrigger\wavTrigger.cpp:51:14: error: 'class AltSoftSerial' has no member named 'clear'
         WTSerial.clear();
                  ^
    Error compiling.
    

    Robertsonics is aware of this issue if you look at the comments under "Arduino Serial Control Tutorial => [ http://robertsonics.com/2015/04/25/arduino-serial-control-tutorial/ ]. This might be due to a recent commit on "Jul 7" for a two-way serial communication. There is also an issue posted in the GitHub repository [ https://github.com/robertsonics/WAV-Trigger-Arduino-Serial-Library/issues/8 ]. You can try using the Apr 26, 2015 commit [ https://github.com/robertsonics/WAV-Trigger-Arduino-Serial-Library/tree/db8cf771971844480fbd13a9a43efc60c972d22c ] or try commenting out line 51 in the wavTrigger.cpp file where it says:

        WTSerial.clear();
    

    AltSoftSerial pins for Atmega32U4 Development Boards

    If you are using the WAV trigger and not the Arduino Uno, make sure that you are connecting to the correct defined pins for the AltSoftSerial library. Try looking at the AltSoftSerial Library page for the defined pins on your Arduino [ https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html ].

    AltSoftSerial pins for SparkFun Pro Micro

    If you are using one of the SparkFun Pro Micros, AltSoftSerial's default pin (pin 13) for the Rx is not broken out. What you could do is go to the header file (AltSoftSerial_Boards.h), change what timer is being used, and pins defined between lines 95-105. You would need to uncomment line 97- 99 and then comment out lines 103-105:

    #elif defined(ARDUINO_AVR_YUN) || defined(ARDUINO_AVR_LEONARDO) || defined(__AVR_ATmega32U4__)
    
    //#define ALTSS_USE_TIMER1
    //#define INPUT_CAPTURE_PIN     4  // receive
    //#define OUTPUT_COMPARE_A_PIN  9 // transmit
    //#define OUTPUT_COMPARE_B_PIN  10 // unusable PWM
    //#define OUTPUT_COMPARE_C_PIN  11 // unusable PWM
    
    #define ALTSS_USE_TIMER3
    #define INPUT_CAPTURE_PIN       13 // receive
    #define OUTPUT_COMPARE_A_PIN        5 // transmit
    

    to:

    #elif defined(ARDUINO_AVR_YUN) || defined(ARDUINO_AVR_LEONARDO) || defined(__AVR_ATmega32U4__)
    
    #define ALTSS_USE_TIMER1
    #define INPUT_CAPTURE_PIN       4  // receive
    #define OUTPUT_COMPARE_A_PIN    9 // transmit
    //#define OUTPUT_COMPARE_B_PIN  10 // unusable PWM
    //#define OUTPUT_COMPARE_C_PIN  11 // unusable PWM
    
    //#define ALTSS_USE_TIMER3
    // #define INPUT_CAPTURE_PIN        13 // receive
    //#define OUTPUT_COMPARE_A_PIN      5 // transmit
    

    Make sure that you rewire the pins to pin 4 for Rx and pin 9 for Tx on the Pro Micro. It was documented by "CircuitSerialKiller" in the Arduino.cc forums here => [ https://forum.arduino.cc/index.php?topic=339587.0 ].

    Delay

    I noticed that there was a slight delay of about 3 seconds before the Pro Micro was able to send a command correctly to the WAV trigger. This might have something to do with the Atmega32U4's timers. After uploading the WTriggerResponse.ino to the Pro Micro, the code waits for you to send a character to the microcontroller. You probably won't see the text "Hit any key to start" after upload because the Pro Micro might change COM ports on certain versions of the Arduino IDE. I sent the character "k" through the Arduino serial monitor and received a response saying that the Pro Micro was "Starting!"

    The Pro Micro will provide a few options to control the WAV trigger. After sending the letter "p", you will need to wait a few seconds of before being able to play an audio track associated with the number. After waiting about 3 seconds, I was able to play the audio track associated with trigger pin 1 by sending "0001" to the WAV Trigger.

    Playback Issues

    If you have issues during playback, make sure that the WAV files are formatted as "16-bit, stereo, 44.1kHz" tracks without any meta data [ as explained in Robertsonics' troubleshooting guide http://robertsonics.com/wav-trigger-online-user-guide/#chapter12 ]. Using a program called Audacity can set the bit rate and strip any meta data on the audio track.

    If you continue to have problems, make sure that your microSD card is compatible. Certain microSD cards are not compatible and can create a "metal," distorted sound. Using a different microSD card can fix the issue.


If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!