Tsunami WAV Trigger - Serial Control Tutorials with sample code/diagrams

I am searching hard for any more comprehensive guides and tutorials for controlling Tsunami WAV Trigger with an Arduino via serial communications. I have a small lab set up with an Arduino Uno, a Tsunami, and a level shifter in between them. Some buttons give commands to the Arduino as to what I want it to do with the Tsunami, and I have a TRRS 3.5mm Jack Breakout board connected between the stereo pins for port 1 and my amp. So I have what I think to be plenty of hardware.

I have loaded the latest firmware, sample audio tracks, and the recommend libraries. So I would think that loading up the only sample code I can track down (the official sample written by Jamie Robertson and published 11/22/2016) would at least give me meaningful text on the serial panel. Alas, it does not. Clearly I am short on my wiring hookups and possibly some code changes (such as serial speed or something).

So I am looking around for anyone who has implemented a working project of any sort using Arduino to communicate with Tsunami via serial, who might be willing to share a wiring diagram and at least enough code to make GET_SYS_INFO work.

Any helpers out there?

E

Please provide a schematic or wiring diagram of how you have things hooked up.

GET_SYS_INFO requires communications in both directions. Have you tried just starting tracks, which only requires transmitting from the Arduino to the Tsunami? If that doesn’t work, then GET_SYS_INFO certainly won’t.

Troubleshooting serial communications without an oscilloscope is difficult. There are so many things that can be wrong - hardware connections, incorrect serial baud-rate, wrong serial port on the Arduino. It’s hard to help without more info about exactly what you’re doing both with the hardware and the software.

Well, I was asking for input concerning any other successful projects that had documentation that I could use as a tutorial to guide my own project. But if we wish to dive into the guts of what I am doing, I would be glad to share and garner any assistance possible. (And I have no problem sharing my project if I ever get it completed and functional as a tutorial to other Tsunami beginners.)

For starters, my software code is straight up the “Tsunami Serial Control Example” sketch written by Jamie Robertson and published 11/22/2016. As far as I can tell, I have Metro/Tsunami/AltSoftSerial libraries installed appropriately. The only tweaks I have made would be to try various values for “Serial.begin();” in an effort to make serial monitor output legible, and I have sprinkled in a few “Serial.println();” statements to track code location on the monitor (if I ever get that legible). I am using the Arduino IDE version 1.8.12.

I have downloaded the Tsunami test WAV files and loaded onto a proven microSD card that I have made work with manual triggers.

My full circuit diagram is here (although right now I am only concerned with trying to send/receive with the Tsunami and not worrying about audio output):

Perhaps someone else will jump in with what you were hoping for. In the meantime… when I zoom your wiring diagram, it seems that the low resolution doesn’t allow me to see the connections.

At the risk of telling you stuff you already know, I suggest you start with the simplest thing first. Do you know the Tsunami is functional? Can you trigger a sound with a trigger input per the hookup guide? Does the LED exhibit the correct behavior when you power up and when you play a track?

If you know the Tsunami is working, then I’d start by just sending one serial command to play one track. Even if you don’t have audio hooked up, you should see the LED come on for the duration of the track. This only requires that you have the Arduino TX connected to the Tsunami RX (and ground of course) and does not rely on any response from Tsunami. If that doesn’t work, then I wouldn’t bother with trying any command that requires a response from Tsunami until that does work.

Obviously, if you have access to an oscilloscope, confirming that you actually are sending data on the Arduino TX would be the first thing to check.

Dang. Sorry. The doc is huge and the upload process in the editor shrank it. I uploaded it to https://ibb.co/NxQPwkP.

For now I am ignoring 99% of my diagram. the important parts are this:

Arduino GND to ground

Arduino VIN to +5V

Arduino Serial RX to Level Shifter HV3

Arduino Pin 9 to Level Shifter HV4 (use of Pin 9 for TX is to support AltSoftSerial, as per instructions)

Level Shifter GND to ground

Tsunami Serial Pin RX to Level Shifter LV4

Tsunami Serial Pin TX to Level Shifter LV3

Tsunami Serial Pin GND to Level Shifter GND

Tsunami VIN to +5V

Tsunami GND to ground

The Tsunami and the microSD card have both been tested together. I hooked up my back end amp and speaker system and manually shorted Trigger 1 to GND, and Trigger 2 to GND, and was able to play 0001.WAV and 0002.WAV. I had a good tsunami.ini file which I built with the Editing tool, updated firmware, and had recently switched out microSD cards to resolve an earlier issue based on another tech help post here. So unless I fried the Tsunami when I changed my table top lab, it should be fine and proven.

What I am trying to do is just get started. Send a command to Tsunami and ask Tsunami to just tell me back something about itself. If I can do that, I have a baseline from which to build and can then begin to attack playing WAV files. For all I know, it is actually happening but the info that the sample sketch is throwing up to the serial monitor is unreadable. It’s a lot like the typical question marks and special characters that are present when one does not have the speed settings right.

Did you change the serial port define in the library header file (Tsunami.h) to use AltSoftSerial, instead of Serial1 which is it’s default?

When I look up AltSoftSerial pin usage for the Uno it indicates RX is Pin 8, whereas according to your wiring diagram, you’re using Pin 0.

Yes I did:

==================================================================

// The following defines are used to control which serial class is

// used. Uncomment only the one you wish to use. If all of them are

// commented out, the library will use Hardware Serial

// #define TSUNAMI_USE_SERIAL1

//#define TSUNAMI_USE_SERIAL2

//#define TSUNAMI_USE_SERIAL3

#define TSUNAMI_USE_ALTSOFTSERIAL

// ==================================================================

I will move my wire to port 8 and update the diagram. And re-test and report back. Thank you!

I moved my RX wire to Pin 8. The updated diagram is here: https://ibb.co/Nx8d32f

I parked an extra line into the sample code. It’s the Serial.println below. It allows me to see that the code is looping and trying to talk to Tsunami repeatedly.

===================================================

int i;

// Call update on the Tsunami to keep the track playing status current.

Serial.println(“Call update”);

tsunami.update();

// Check if the sequencer timer has elapsed and perform the appropriate

// state action if so. States 3 and 5 wait for tracks to stop playing and

// are therefore not in the metro event. They are instead polled after the

// metro check.

if (gSeqMetro.check() == 1) {

switch (gSeqState) {

etc…etc…

===================================================

And the result is that Serial Monitor is displaying this: https://ibb.co/StBW1pd

About once every 10-15 seconds I get that “Waiting for Track 2 to finish… Track 2 done” message. It bounces back and forth between reporting on track 2 and a track 4. And on occasion I also get back “WAV Trigger response not availableCall update”. Looking at the sample code I can walk through the cycle testing and following how the three results report back.

But the important thing (to me) is that the first thing I notice is that early on I should see a line in the Serial monitor reporting "Number of tracks = ". I don’t. Things never start out right. I am led to believe that the other reports to the monitor are the result of random noise on a faulty comm link.

Nobody has any other ideas?

So just for giggles, using the lab layout I have diagrammed I am simply attempting to send the following commands:

tsunami.start();

delay(10);

tsunami.setReporting(true);

delay(100);

gNumTracks = tsunami.getNumTracks();

delay(100);

Serial.println("Number of tracks = " + gNumTracks);

and get back a value to the serial monitor. Instead all I get on the monitor is:

Number of tracks =

In other words, nothing comes back into the buffer assigned by gNumTracks.

Why not???

I suggested above that you concentrate on just trying to send commands to the Tsunami that don’t require responses. As I mentioned, if you send a trackPlayPoly() command and specify a track that you know exists, then you should both hear the track as well as see the LED come on for the duration of the track. Have you tried this?

Also, I’ve never used that level shifter, but it sure looks like you need to hook up reference voltages for each side using the LV and HV pins. I don’t see any connection to these on your wiring diagram.

FYI, you don’t really need to level shift the Tsunami TX output back to the Uno RX, as 3.3V will still read as “high”.

Update: I accidentally fried my Tsunami and had to order a replacement. I have it in hand now and am starting over, beginning with the basic manual trigger demo. This should validate my Tsunami, my micro SD card, my WAV files, my audio out connection, and my power.

Once validated, I will do the next baby step of simply using the serial port to play - VIA TX ONLY - the same files off the same micro SD card via the same Tsunami to the same audio setup…and then report back.

(FYI - that level shifter is the Sparkfun BOB-12009.)

Ok. Back to a stable starting point.

My replacement Tsunami is playing working just fine according by following the example for manually triggering sample WAV published here at SparkFun (Hookup Guide): https://learn.sparkfun.com/tutorials/ts … -guide/all.

So all is well. Working Tsunami, working micro SD card, correct power hookup. Correct audio out to amp and speakers. I even flipping from the sample track 16 to one of my own, which works great too.

I connected back to the Arduino Uno as before, connecting only GND and Uno pin 9 (TX) to Tsunami Serial RX via the SparkFun level shifter. No Uno pin 8 (RX) connection.

To make sure, I repeated the manual trigger again and, again, all works well. So I am comfortable that I am not introducing any connectivity error when adding the Uno to the lab.

I made a simple sketch. My declare section:

#include <Metro.h> // Include the Metro library header

#include <Tsunami.h> // Include the Tsunami library header

#include <AltSoftSerial.h> // Optional for using AltSoftSerial

Tsunami tsunami; // Our Tsunami object

char incomingChar;

My Setup section

Serial.begin(9600);

tsunami.start();

delay(10);

tsunami.stopAllTracks();

tsunami.samplerateOffset(0, 0);

My void section:

if (Serial.available() > 0) {

incomingChar = Serial.read();

switch (incomingChar) {

case ‘1’:

Serial.println(“I received: 1, attempting to play track 0001”);

tsunami.trackPlayPoly(1, 0, true); // Start Track 1

tsunami.update();

delay(2000); // Wait 2 secs

break;

default:

break;

(SORRY, I HAD TO POST MY CODE THAT WAY BECAUSE I WAS GETTING a 404 FORBIDDEN HTML ERROR)

Anyway…So when I send the char ‘1’ from the serial monitor the code should branch and send the command to play the first sample WAV file.

Instead…silence. Nothing happens.

I am wondering if my tsunami.ini file is correct for serial trigger, where the only thing I did was change the “Hardware Interface” from ‘Contact Closure’ to ‘Active’. I left the “Type” at ‘Edge’:

#TRIG 01, 192, 0, 0, 1, ,

#TRIG 02, 192, 0, 0, 1, ,

#TRIG 03, 192, 0, 0, 1, ,

#TRIG 04, 192, 0, 0, 1, ,

#TRIG 05, 192, 0, 0, 1, ,

#TRIG 06, 192, 0, 0, 1, ,

#TRIG 07, 192, 0, 0, 1, ,

#TRIG 08, 192, 0, 0, 1, ,

#TRIG 09, 192, 0, 0, 1, ,

#TRIG 10, 192, 0, 0, 1, ,

#TRIG 11, 192, 0, 0, 1, ,

#TRIG 12, 192, 0, 0, 1, ,

#TRIG 13, 192, 0, 0, 1, ,

#TRIG 14, 192, 0, 0, 1, ,

#TRIG 15, 192, 0, 0, 1, ,

#TRIG 16, 192, 0, 0, 1, ,


This file was generated by the Tsunami Configurator v0.30

It’s required only if you wish to over-ride the default settings.

You may add your own comments below this line →

“I connected back to the Arduino Uno as before, connecting only GND and Uno pin 9 (TX) to Tsunami Serial RX via the SparkFun level shifter. No Uno pin 8 (RX) connection.”<<

You didn’t mention… Did you review the level shifter hookup guide and connect the HV and LV reference pins?

SparkFun BOB-12009 Level Shifter is hooked up as follows:

Uno Pin 8 → HV4==LV4 ← Tsunami Serial TX0

Uno Pin 9 → HV3==LV3 ← Tsunami Serial RXI

Uno GND → GND==GND ← Tsunami Serial GND

Tsunami 5V PWR and GND are coming from Meanwell 5V power supply

Uno 5V PWR and GND are coming from same Meanwell 5V power supply

You still haven’t answered my question about the level shifter reference voltages. Did you connect 5V to the HV pin and 3.3V to the LV pin, as per the hookup guide:

“The pins labeled HV, LV, and two GND’s provide high and low voltage references to the board. Supplying a steady, regulated voltage to both of these inputs is required.”