Arduino (Teensy) USB MIDI foot controller for Katana amps

Started by SteveO, February 04, 2019, 01:10:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SteveO

I made an Arduino (Teesny 3.2) USB MIDI foot controller for Katana amps. I've been using it with my Katana 100 12 but it should work with other Katana amps.  I'm posting this here in hopes that it might save someone else some time if they want to build something similar.

Here's a link to the project with sketch and wiring: https://github.com/SteveObert/KatanaUSB_Midi_controller

The reason I built this is because I don't like some things about the GA-FC. For example, not begin able to see what amp channel is selected when the effects button is active and having to press the effects button after selecting an amp channel. I found that annoying but I'm sure most people get used to it. I spent a lot of time researching how to build this. I didn't know much about Arduinos or Teensys when I started and this is my first project with either of those.




Switch 0 is the upper left corner, switches 1, 2, and 3 are across the bottom and switch 4 is the upper right one. Tap switch 0 once and the other four buttons will select channels 1 -4. Tap switch 0 twice and the other buttons select channels 5 – 8. Tap switch 0 three times or select a channel and the four buttons act like the booster/mod, delay/fx, reverb, and loop buttons on the GA-FC foot controller. After selecting a channel, the buttons 1 -4 will automatically switch to control the effects state unlike the GA-FC where you have to press the effects button.

NOTE: There have been a lot of updates to the way the buttons work, see the rest of this thread for more information. There are two versions on the Github page the original described above and a more advanced version where the LCD and LEDs are updated from Katana MIDI messages.

UPDATE current features:



  • Menu for saving user preferences.


  • Tap tempo: global or patch


  • Selectable mode for 3 foot switches, toggle either one or both FX/MOD, Delay 1/FX, and Reverb/Delay 2.

  • Three switches to toggle effects on/off and select channels 1 -8.

  • One dual purpose switch for both tap tempo and toggle Loop on/off.

  • One switch for selecting bank 1, 2, or panel.

  • LCD displays FX status, amp name, tempo, loop status, bank/fx mode, and channel number.

  • Select Green, Yellow, or Red effect functions from the three lower foot switches.

  • Midi IN - control Katana patch and FX from an external MIDI controller.  Some CC and PC messages from the MIDI in port can be received and translated to sysex and forwarded to the Katana. If you're looking for a more complete external MIDI to Katana you could buy the MIDX-20.

  • An expression pedal can be connected to an external MIDI controller to control 1 effect only. This is experimental and requires some coding on your part.

  • Expression pedal jack input directly connected to controller and external MIDI clock IN is being worked on but not yet complete, no ETA.


Bill of materials (you probably want to find lower prices but this stuff worked for me): https://github.com/SteveObert/KatanaUSB_Midi_controller/blob/master/Bill%20of%20Materials/BOM.csv


I hope somebody finds this useful or interesting.

Thanks to the discussions on this forum and the links below:
https://www.vguitarforums.com/smf/index.php?topic=19707.0
https://github.com/MrHaroldA/MS3
https://www.vguitarforums.com/smf/index.php?topic=19782.0
https://github.com/snhirsch/katana-midi-bridge/blob/master/doc/katana_sysex.txt


Inside picture with messy wiring and extra holes from a previous project:





* Note the Raspberry Pi in the top picture background is not part of the project.

gumtown

Awesome work !
Funny I should read this just now, as right now I am having a struggle with exactly the same type of project, getting the USB host shield to work.
I have given up for the day realising an 5 volt Arduino Nano does not work with the 3.3v host board.
I finally figured out that it works only when my laptop is undocked and the USB supply voltage drops.
So a note to anyone deciding on what type of Arduino/MCU to use, 5 volt I/O pins don't work with the USB host board.

My design is to have 8 channel buttons a panel button and effects/mode button, and 10 neopixel leds (multi colour).
So that the pedal works much like the GAFC,
mode 1: direct access to 8 channels + panel. (red leds)
mode2: press the effect button and switch the effects individually MOD, FX, BSTR, TAP, EQ, REV, DD1, DD2, LOOP (green leds)
mode3: press both effects/panel and switch between the 3 effect types (red, green, yellow leds) for BSTR, MOD, FX, DD1, REV/DD2.

I will share the code once I get things working..
now got to dig out a spare Teensy 3.2 somewhere in my drawers.

BTW: I have the same RPi case I was using to try build a Zynthian synth project.
Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

SteveO

Your project sounds awesome. I was going to use 6 switches and 6 OLEDs but decided that I wanted to get everything mounted up and I was dreading finding away to mount those OLEDs that looked nice. So, I just went with an enclosure I already had and what I could fit in it.

Quote from: gumtown on February 04, 2019, 02:34:05 PM
I have given up for the day realising an 5 volt Arduino Nano does not work with the 3.3v host board.

I had my nano working with the USB Host shield. Something else must be going on. Edit: I "cut the trace inside VBUS jumper" as mentioned in the second paragraph under the Power Options part of this page: https://www.circuitsathome.com/usb-host-shield-hardware-manual/ shown here: https://www.pjrc.com/teensy/td_libs_USBHostShield.html

Can't wait to see yours when it's ready.

gumtown

I have built a replication of your project, but 2 source files are missing, MS3,h and Queue.h.
I have modified the originals to how I think they should go, but still don't get any USB joy.
The lcd displays "KAtana Not Responding",
the Teensy I/O led blinks at a regular rate with no USB connection, and changes it's polling rate when the Katana is plugged in.

So I'm wondering if there is any magic stuff in the 2 missing files.
Or my USB Host shield is buggered.
Although on the Serial Monitor, I do get "Ready" and then  continuous scrolling of
"Waiting..."
and
"Katana NOT READY!"

Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

vit3k

Did you do anything special to connect teensy to full size usb host shield? I've tried this some time ago and it didn't work for me... Shield is working fine with arduino mega. Did you use wires for connection or create pcb?

gumtown

I am using the "Duinofun" mini USB Host Shield.
from eBay



paired up to a Teensy LC



I2C 20 x 4 lcd from eBay, mine has the alternate chip set which means the I2C address is 0x3F rather than 0x27

Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

gumtown

Quote from:  philjynx on February 05, 2019, 04:19:19 AM
If the left hand max_rst is correct, so is the right, their traces go to the same pin on the chip.
Did you see my remark about logic level shifter? Let's 3v and 5v logic levels 'talk' to each other.

The USB Host image posted is a random one off the net, only 6 pins are used,
MOSI, MOSO, SS, CLK, VCC, GND.

Rather than the extra components of a level shifter (don't have one either),
I have just swapped out the 5 volt Arduino Nano for a 3.3 volt Teensy LC which I removed/reused from a previous experiment.
Teensy's are handy for midi projects, they support serial and 4 midi ports independently over USB,
so any midi software see's the Teensy as 4 midi devices.
Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

SteveO

Quote from: gumtown on February 04, 2019, 11:15:30 PM
I have built a replication of your project, but 2 source files are missing, MS3,h and Queue.h.
I have modified the originals to how I think they should go, but still don't get any USB joy.
The lcd displays "KAtana Not Responding",
the Teensy I/O led blinks at a regular rate with no USB connection, and changes it's polling rate when the Katana is plugged in.

So I'm wondering if there is any magic stuff in the 2 missing files.
Or my USB Host shield is buggered.
Although on the Serial Monitor, I do get "Ready" and then  continuous scrolling of
"Waiting..."
and
"Katana NOT READY!"

I'll post the MS3.h and queue.h files I'm using later today.  In the mean time there are two things I'd try. First is to compile with the Teensy options set to DEBUG or "fast" and MIDI + serial (that works on Teensy 3.2). The second is to use the USB host 2.0 library example sketch called board_qc (or something like that) to test the USB host board. I had to comment out a line in that example because my board failed the "die revision" check.




SteveO

Quote from: vit3k on February 05, 2019, 02:57:15 AM
Did you do anything special to connect teensy to full size usb host shield? I've tried this some time ago and it didn't work for me... Shield is working fine with arduino mega. Did you use wires for connection or create pcb?

I used the Mini USB Host shield with the Teensy 3.2. When I tested the shield with my nano I did I "cut the trace inside VBUS jumper" as mentioned in the second paragraph under the Power Options part of this page: https://www.circuitsathome.com/usb-host-shield-hardware-manual/ shown here: https://www.pjrc.com/teensy/td_libs_USBHostShield.html. then I moved to the Teesny and just hardwired everything with the teensy after breadboard testing.

SteveO

Quote from: gumtown on February 04, 2019, 11:15:30 PM
I have built a replication of your project, but 2 source files are missing, MS3,h and Queue.h.

Gumtown, I added the MS3.h and Queue.h files that are working for me to my GitHub page: https://github.com/SteveObert/KatanaUSB_Midi_controller

I don't know if this is necessary for the Teensy but I now remember that when I tested my Mini USB Host shield with a nano I "cut the trace inside VBUS jumper" as mentioned in the second paragraph under the Power Options part of this page: https://www.circuitsathome.com/usb-host-shield-hardware-manual/ shown here: https://www.pjrc.com/teensy/td_libs_USBHostShield.html. I googled these pictures: https://geekhack.org/index.php?PHPSESSID=jnim6u2dcno62u8vpbm8sl9ias67hb3o&action=dlattach;topic=80421.0;attach=130856;image and https://geekhack.org/index.php?PHPSESSID=jnim6u2dcno62u8vpbm8sl9ias67hb3o&action=dlattach;topic=80421.0;attach=130858;image

sixeight

Great project. I like the enclosure. Where did you find it? Or is it a 3d printed enclosure?

SteveO

Quote from: sixeight on February 05, 2019, 09:36:18 AM
Great project. I like the enclosure. Where did you find it? Or is it a 3d printed enclosure?

The enclosure: https://www.ebay.com/itm/Aluminum-DIY-Project-Box-Enclosure-Case-PCB-Amplifier-Electronic-200-105-55mm/142615103868?hash=item213485c97c:g:KncAAOSw5VtaJmbs:sc:USPSPriorityMailPaddedFlatRateEnvelope!83714!US!-1:rk:1:pf:0

Here's the LCD bezel: https://www.tindie.com/products/WIDGENEERING/20x4-lcd-bezel-with-clear-backplate/

I wish had access to a 3D printer, but the aluminum case worked out really well for the LCD and 5 switches. I'd like to find a case just like it but about 1.5" longer for one more button.

vit3k

So do I understand correctly that it worked on breadboard? If yes I suppose I have broken mini shield...

SteveO

Quote from: vit3k on February 05, 2019, 10:06:14 AM
So do I understand correctly that it worked on breadboard? If yes I suppose I have broken mini shield...

Yes, it works on a breadboard. Try the USB host board test sketch: https://github.com/SteveObert/KatanaUSB_Midi_controller/tree/master/USBminiBoard_qc. At one point, if it makes it that far, you'll need to click send or enter on the serial monitor window.

HAMERMAN409

A few questions:

Is your controller getting it's power from the Katana or is there a separate power supply that isn't shown?

If I were to build this for a Katana 50 would I be limited to 4 presets since that's all the top panel supports? (If that is the case I wonder how practical from a latency and audio glitch perspective it would be to create more presets by storing parameters within the pedal and then dumping all parameters with each button press?)

How are you using the MIDI IN and OUT on your box? To control other effects, editor connection, etc.

SteveO

Quote from: HAMERMAN409 on February 05, 2019, 11:11:03 AM
A few questions:

Is your controller getting it's power from the Katana or is there a separate power supply that isn't shown?

I'm powering it with step down buck power supply, 9v in and 5v to the teensy/LCD: https://www.ebay.com/itm/LM2596S-DC-DC-3A-Buck-Adjustable-Step-down-Power-Supply-Converter-Module-Arduino/382552225398?hash=item5911e3b676:rk:2:pf:0

Quote from: HAMERMAN409 on February 05, 2019, 11:11:03 AM
If I were to build this for a Katana 50 would I be limited to 4 presets since that's all the top panel supports? (If that is the case I wonder how practical from a latency and audio glitch perspective it would be to create more presets by storing parameters within the pedal and then dumping all parameters with each button press?)
I would say that yes, you'd be limited to 4 presets because the teensy does not store anything, it acts like the buttons on a GA-FC. I think it'd work just fine with a Katana 50 but I don't have one of those to test. The latency, to me, is comparable to the GA-FC but I'm the only one who tested one and I biased. I'd say this is very much beta but I'm satisfied with it.

Quote from: HAMERMAN409 on February 05, 2019, 11:11:03 AM
How are you using the MIDI IN and OUT on your box? To control other effects, editor connection, etc.
I have MIDI IN through the DIN connector setup right now like this:  Morningstar MC6 MKII MIDI controller -> serial MIDI IN of the Teensy pedal to USB Host MIDI out -> Katana amp. From the Morningstar I can send the following to the Katana:  program changes 1 - 8 for the 8 presets and CC's setup to toggle the boost/mod, delay/fx, reverb, and Loop like the switches (like GA-FC). If that makes sense. I'm hoping to either plug an expression pedal into the Morningstar and send it through the Teensy to the Katana or add an expression pedal input to the Teensy foot controller later. Right now I see the expression pedal messages from the Morningstar arriving on the Teensy foot controller but I haven't been able to translate it to the right sysex messages to forward to the Katana.

I don't have MIDI OUT configured through the DIN connectors, but I did test it early on because if this hadn't worked out I was just going to build a regular Teensy style MIDI controller.

gumtown

YeeHaaa !!

After repeated USB test fails,
I needed to wire INT to pin 9,
had my MOSI and MISO back to front
and have to wire +5V to the VBus pin of the Host USB to use a USB memory pen drive for testing.

Seems to work now  :)

Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

SteveO

Quote from: gumtown on February 05, 2019, 08:22:05 PM

Seems to work now  :)


Stoked you got it working. Can't wait to see it with some proper code.

sixeight

Quote from:  philjynx on February 06, 2019, 03:34:45 AM

I use a 3d printer increasingly but I wouldn't even consider printing foot switch enclosures with one. Granted 3d prints are stronger in compression than tension but the top panel  would have to be ludicrously thick to take the stress of accidental heavy pressure on the foot switches. There's also the time it takes to print, attached pic of a part I designed and printed yesterday at medium quality (time is proportional to quality) what you see is 32mm OD. That took 11 hours to print.


A Raspberry pi case takes about 9 hours but I don't make a habit of standing on my pies, I would expect to get filling all over the floor.

I have just started printing the VController mini enclosure. I print it on draft quality. It saves time and makes it stronger. Time to print is just under 12 hours. The enclosure has a thickness of 3 mm. I used the same thickness on the RPi enclosure.  It should be strong enough.

sixeight

Quote from:  philjynx on February 06, 2019, 04:52:34 AM
Wrong thread to ask really, is that something you're going to stand on? And what material?

For this enclosure I use PLA, which isn't the strongest material, but I do hope it is strong enough.

I guess I will just have to try it. I will know more by tomorrow.


gumtown

Here is mods to the code (so far)
The pedal can now read any changes made on the Katana panel in real time.
On patch change the effect states are read into the controller and the status set for the effects.
The amp type is read for each channel with the 5 panel types, and any other are just labelled "Sneaky".
If the Katana USB is online, then the display flashes "Katana Offline".

Yet todo,
have the amp channel read in and displayed from the Katana.
long press on the function switch selects the Panel Chanel.
long press on the 3 FX buttons cycles through the Red/Green/Yellow effect variations.

SteveO let me know how this works for you and your controller, and any recommendations/changes.

Arduino library and code attached below.

oh no is that the time  :o


EDIT: just noticed if the Katana gets powered off, the controller needs to reestablish setEditorMode();
another todo:

EDIT 2: just noticed it doesn't work if Arduino IDE is not running, might need to re-compile without the Serial option enabled.
I'm going to bed......

Later EDIT: removing old redundant code posts as newer refined code gets pasted further along the topic.
Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

SteveO

Quote from: gumtown on February 09, 2019, 03:08:16 AM

EDIT: just noticed if the Katana gets powered off, the controller needs to reestablish setEditorMode();
another todo:

EDIT 2: just noticed it doesn't work if Arduino IDE is not running, might need to re-compile without the Serial option enabled.
I'm going to bed......

Nice work! I like what you've done.

To get your code to work for me I had to add back in the setEdit() I had in the original sketch  <-- there's probably a better way to do that because it's just a hack

// If USB connection is lost set the katana back in BTS edit mode
void setEdit(void) {
  unsigned long test = 0;
  byte dataTest = 0;
  Serial.println();
  Serial.println(F("Waiting..."));
  Serial.println();
  MS3.begin();
   delay(100);
MS3.setEditorMode();
  switch (MS3.update(test, dataTest)) {
    case MS3_READY:
      Serial.println(F("############ Now I'm ready!"));
      Serial.println();
      MS3.setEditorMode();
      MS3.read(PC, 0x02);
      break;
  }
}


I also noticed a switch polling problem (?) - probably because the Teensy is busy reading or waiting for the incoming Katana data. (?) If you press one switch and then quickly switch another only the first one is recognized. If you press two FX switches together at the same time they both work properly. This is the same behavior I saw when I tried to use parseData(parameter, data) a few days ago but didn't spend any time trying to figure out how to fix.

I see what you mean about powering off the Katana, I don't know how to fix that in the new code. It was OK to power it off in the original code.

EDIT: Jeeze, I had to edit this post about 1000 times... things were getting weird when I powered the Katana off... I think the ridiculous hack above is what it made it work for me.

EDIT: # 1001... With the above hack it appears the FX switches aren't working reliably. I give up for the evening.

gumtown

Working much better now, I found the cause of the sticky behaviour, the String message2,
for some reason can't be used as it must have been used in one of the Arduino libraries.

So I have relabelled all message strings to message_1, message_2.....
 
Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

SteveO

Quote from: gumtown on February 10, 2019, 08:04:19 PM
Working much better now, I found the cause of the sticky behaviour, the String message2,
for some reason can't be used as it must have been used in one of the Arduino libraries.

So I have relabelled all message strings to message_1, message_2.....


Cool, nice work. I don't know how you figured that one out.  I found a way to speed things up, especially the foot switch responsiveness - you can press FX buttons one after another more quickly now. Just search for "wire" in the attached code to see what I updated.

Edit: I still haven't figured out how to automatically set the Katana back in edit mode after powering it off.

SteveO

Quote from: sixeight on February 05, 2019, 09:36:18 AM
Great project. I like the enclosure. Where did you find it? Or is it a 3d printed enclosure?

Here's an interior picture with messy wiring and extra holes from a previous project (the wiring will be much less messy eventually).