Katana MKII 50W - 'Katana Solutions USB Foot Controller' - In Progress

Started by StevenMartin, February 11, 2020, 04:17:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

StevenMartin

Lots of googling later and I'm still not getting much further.

So plugging my phone into the shield passes the board_qc test, and shows the device ID and etc, but plugging any other USB device in hangs at waiting for USB device.

Any thoughts there?

Bauerbyter

Hm, are you sure you have an MK2 ? I checked your wiring and recreated it here, everything works fine . Its hard to help when i dont see whats going on.

StevenMartin

Def a MKII yeah. I think maybe the USB host board is busted. Do you know of any other ways to test it?


StevenMartin

As some of the MVPs out there may know (because a few have replied on my other thread), I've been trying to make an Arduino based foot-controller. I'm very new to the coding side as this is my first venture.

I've finally managed to get my hardware working perfectly, by testing it with Bauerbyter's code (great work!). But I'd like to be able to get my own code working and learn how to understand this myself.

In my own code, I've been able to set up 5 buttons for effects and 4 buttons for channel switching, track and change the effect/channel states in my code and set LEDs to reflect the states. Where I'm falling VERY short is understanding how to actually construct and send communications with the Katana.

I know about the legendary MS3 library, and that there's no point re-inventing the wheel when MrHaroldA has put in so much effort already, but when I look over the library code, or other peoples examples that use the modified versions, my coding knowledge isn't good enough to understand how it works and how to use it properly. In essence, I'm in the deep end and haven't got my armbands yet!

Does anyone know of one of the following:

- A tutorial guide on how the MS3 library works and how to use it effectively.
- Any useful learning resources on where I can find the information required to be able to understand the type of code that's used in the MS3 library.

Failing this, if anybody has an itching urge to create such a tutorial that would be an amazing resource for a lot of us newcomers to the arena.

Or even, if anyone would be so kind as to explain how I can construct and send a single SysEx message to the Katana over USB that would be very helpful too. Let's say I wanted to create the simplest code possible.... where a loop runs and every 5 seconds it shouts to toggle the Reverb on and off again. What's the easiest way to write that?

I understand that we have the Header, Read or Write, Param Address, Value, Checksum and Footer... but not sure how to then send that sucka to the amp over USB (with or without the MS3 library's help.)

Anyone bored enough in quarantine to provide some resources, please?

Thanks all!!

Steve

StevenMartin

Bauerbyter you legend, I bought a new host shield that piggie backed right onto the Mega. I've tested with your code and it worked perfectly!

So I can confirm that my hardware is no longer busted :D

Now just to learn and figure out how to get my own coding up to scratch.

Bauerbyter

Nice to hear! To change the commands and the buttons, you dont have to do much:
For Example
ChannelButton control1 = ChannelButton(29, 0, PARA_PC, PARA_PC, 1, 5);
From left to right. Channelbutton is the Type of Button .. and yes as you guess in this case this is for switching channels.
byte pin => pin of your button
byte ledPosition => if you are using ws2812.. it is the number of the led in the chain
unsigned long sendParameter. Parameter from sysex.h=> Adress to send
unsigned long readParameter.Parameter from sysex.h=> Adress to receive
byte firstValue => in this case first value is the channel your are switching 1
byte secondValue => here the second value is the the channel that you are switing if Bank A/B is set.


Bauerbyter

Katana MK1 or 2?
Do you know how to import the MS3 Lib?

Code is NOT tested.
#include <Arduino.h>
#include "MS3.h"

const unsigned long reverb = 0x60000610; //Adress of Reverb in MK1!
MS3 katana;

void setup() {
  Serial.begin(9600);
  setupKatana();
}

void loop() {
  katana.write(CC18, 1, 1); //Turn Reverb on
  delay(5000); //wait for 5 seconds
  katana.write(CC18, 0, 1);//Turn Reverb off
  delay(5000); //wait for 5 seconds
  //write(adress,value,length) so we send the adress
  //, the value ( 1 is on, 0 is off ) and the length of the value (here 1)
}
void setupKatana() //See if Katana is there
{
  if (!katana.begin())
  {
    Serial.println(F("*** USB / Katana init error! ***"));
    while (true)
      ;
  }
  connectKatana();
}

void connectKatana() //Connect to it and set it to edit mode.
{
  unsigned long parameter = 0;
  byte data = 0;
  byte editMode = 0;
  while (editMode == 0)
  {
    switch (katana.update(parameter, data))
    {
      case MS3_NOT_READY:
        clearAllLeds();
        setLed(Led{10, LED_WARNING});
        Serial.println(F("Katana OFFLINE !"));
        Serial.println();
        delay(100);
        break;
      case MS3_READY:
        clearAllLeds();
        katana.setEditorMode();
        getKatanaStatus();
        katana.read(PARA_PC, 0x02);
        editMode = 1;
        Serial.println(F("Ready!"));

        break;
    }
    delay(100);
  }
}


StevenMartin

Quote from:  Bauerbyter on April 30, 2020, 07:44:18 AM
Katana MK1 or 2?
Do you know how to import the MS3 Lib?

Katana 50W MKII. And no could you let me know how to import the MS3 Lib? I have it in the Arduino Libraries folder.

When you get a chance would you be able to test that code to check it works? I'm getting some errors and I think it's referring to other parts of the code that isn't there. I removed the set and clear LEDs part and the "getKatanaStatus();" is throwing the error as there isn't a function for that in the code you posted for me.

Really appreciate the help. I think once I can filter out the bare minimum essentials of what required to connect and set one effect and maybe read one effect, I can get the full board up and running!

StevenMartin

Update: I have the LCD and LEDs working. And we're actually controlling the amp this time!


First thing's first... as I've said before, I've never coded before, and never built any electronics before. This is my first project and I'm frantically trying to learn C++ and Arduino to get this all working. I'm sure if any real programmer looked at my code they would vomit. It's clunky and primitive and likely way over-inflated. You know that thing where a programmer can express something complex and fully-functional in about 2 or 3 lines of beautifully simply code? I can't do that yet. I'm working through the book "Programming_Principles_and_Practice_Using C++" by Bjarne Stroustrup.

Anyway... the update!

At the moment the foot controller (real footswitches to come soon!), is very 'dumb'. Everything has to be set to 'zero' on the amp and the controller at the start and then the foot controller is blindly setting effect and amp changes to give us our fancy light show.

The next step is to work out how to get it to 'read' from the amp so that 1) it can 'sync' FROM the amp on start-up, and 2) we can change amp channel and reflect any effects that are on/off onto the controller. So say Ch1a everything is off... but switch to Ch2a and everything is on. At the moment the controller won't 'update' FROM the amp.

I understand the Sysex to send is F0 41 00 00 00 00 33 11 60 00 05 40 00 00 00 01 5A F7 to check reverb status or just katana.read(parameter, data) with 11 being the read bytes, 60000540 being the RVB address and then 00000001 being 4 bytes saying how many bytes are requested. Then obviously the checksum and footer.

That said, I've not tried adding any reads into the code just yet.

But we're getting somewhere at least!

I'm using VSCODE and Platformio to write/apply this code.

Please excuse how clunky and gut-wrenching my code may be to read (I need to go through and add comments before I forget how it works), but if anyone has any pointers... or more importantly any C++/Arduino subjects they think I need to read/learn about to make this better I'm all ears and eager to get googling. So far it's taken me 500+ lines of code to get here and I'm sure it could be done in about 1/4 of that if I had the wizarding skills of you chaps!





StevenMartin

More progress!

Current features:

-The board now syncs from the amp on initial connection (and on re-connection if it drops out during use)

-Changing effects via the amp is now reflected on the foot controller

-Changing channels via the amp is now reflected on the foot controller

-Changing effects on the foot controller is reflected on the amp

-Changing channels on the foot controller is reflected on the amp

-LCD shows all current effects and current channel

-Pressing the channel button of a channel that is already active saves the current effects to that channel.

Video to come later!

Next to work on:

-Add a dedicated write button instead.
-Swap write feature to the write button
-Show amp and variation on LCD (Next to channel)
-Add toggling amp and variations

Bauerbyter

its nice to see your progress! pretty good what you accomplished!

StevenMartin

Bauerbyter, yours has been my main inspiration man, and being able to look at how you've made yours and your code has been absolutely invaluable so thanks for making it all available. 

Bauerbyter

hehe, thanks :-) But I was just stealing a lot of work from the others here. Keep us updated :-)

Bauerbyter

Sorry again to late to the party, BUT I saw you already got this working, lets keep it in your main post.

gumtown

Here is the display I used for my Teensy Katana USB foot controller, I2C 4x20 lcd.
I made custom character 'glyphs' for the R/G/Y effect status indications.

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

StevenMartin

Another update!

-We now show current amp and amp variation on the foot controller (Showing as 'Lead' or 'Lead V' etc). Changing these via the amp is also reflected on the foot controller.
-Pressing an active channel button on the foot controller now cycles through the 5 amps and 5 variations.
-We have a dedicated 'write' button that saves to the active channel.
-Long pressing the 'write' button toggles between 'Player Mode' (where you switch channels and toggle on/off effects) and 'Edit Effects Mode'. In 'Edit Effects Mode', pressing an effect button cycles between Green, Red, Yellow. Then we can short press 'write' to save, and long-press 'write' again to return to 'Player Mode'.

Later I plan to add a series of menu push buttons below the LCD (select, return, up, down maybe) and then we can blow open 'Edit Mode' and get all the juicyness that Boss Tone Studio allows. Maybe if I use rotary encoders with momentary switches built-in we can get Gain Volume Bass Mid Treble up and running too!

Something I haven't added yet (because I'm out of tiny little buttons for the breadboard, so we'll wait for the real footswitches), is the tap tempo function.

Gumtown. I bet the code for yours is so super sleek and sexy. I haven't even seen it and I'm jealous. If you saw my code I bet you'd think it a miracle that mine even works! :D

Your LCD is awesome. Very well laid out. I'm trying to cram as much info onto a 16x2 as I can.

I did have
Channel | Amp (/V)
Current FX (+ ON or - OFF)

So an example would be

|CH1A     BROWN V|
|B- M+ F- D- R+  |

i.e Reverb and Mod are ON, rest are OFF (of course all shown as LEDs too).

But since adding the G/R/Y function I've swapped it (similarly to you actually) to an inverted GRY. Looks funny though.

So now it's more:

|CH2B     BROWN |
|B- M- Fg Dg Rr  |  (with '-' still being OFF)

Which is fine if you understand it, but to the uninitiated, that wouldn't be very intuitive. Seems the way to go though! I need to restyle my inverted characters like yours. My lower case ones look pants!

StevenMartin



Excuse the blown-out LED exposure...  There are 4 green LEDs for the channels, and 5 red LEDs for the effects. Later will be RGB LEDs (NeoPixels).

StevenMartin

I have a friend who is a photoshop whizz, who is working on a new potential design for me, but I roughed this design out myself in Photoshop to show an idea of what I'm hoping to work towards. Oh yeah, and we need to add Exp functionality later too! Because I love me a Wah and a nice little volume swell ;)

For the final build I'm hoping to maybe get this custom printed on a vinyl wrap, and then make the shell out of aluminium or steel:


Bauerbyter

Amazing! Do it. Or maybe you have a friend with a CNC.  Is your code on github or somewhere? If you want I can have a look and maybe give you some little hints.

sixeight

QuoteLater I plan to add a series of menu push buttons below the LCD (select, return, up, down maybe) and then we can blow open 'Edit Mode' and get all the juicyness that Boss Tone Studio allows. Maybe if I use rotary encoders with momentary switches built-in we can get Gain Volume Bass Mid Treble up and running too

It is beginning to look more and more like a VController / VC-mini project. Looking great.

StevenMartin

Thanks guys! Lots of time and headaches, especially as I'm a complete dud with C++ and Arduinos... but somehow I'm being able to make it do what I want it to, and I'm starting to like it.

The first time I saw the VController in action Sixeight (My mistake there! This project is going to my head), my mind melted and it quickly fell out of my open mouth  :o If I can get even close to that level of functionality I'd be amazed. The trouble is, I know so little about C++ that I don't really understand anyone else's (much better) code, in order to 'borrow' their ideas. So I'm kind of flying solo and just hitting stuff with hammers until they work.

I don't know how to use Github Bauer, maybe I can look into it soon. Before I did that though, I would HAVE to clean up and comment through my overblown and needlessly under-thought out code though. If you read it, you'd vomit and sh*t your pants simultaneously.

Bauerbyter

Dont think so, man from someone who never programmed C/C++ before this is absolute amazing!

StevenMartin

Rough video coming in a few to prove I'm not totally insane.

StevenMartin

Okay here we go:

The amp looks to be updating quite fast but my LCD is lagging behind on channel changes. I think this is because I have an LCD timeout, so that things show on the LCD for a few seconds then go back to the 'default' display. I think I need to reshuffle the code so the display for the channel changes don't get caught in the timeout. It wasn't doing this before so I'm sure it's just a reshuffle needed to make it look as snappy as it actually is.

4 Green LEDs/buttons are channels CH1a, CH1b, CH2a, CH2b. These buttons swap channels, and pressing an already active channel toggle amps/variations.

5 Red LEDs/buttons are effects (Boost, Modulation, FX, Delay, Reverb). Pressing these in Player Mode toggles effects On/Off.

Far-right button is 'write' that writes to the current channel, and long-pressing 'write' goes to edit mode where we can change G/R/Y for each effect, then long press again to return to Player Mode.


The video is very dark because the LEDs were blowing out. When I get the NeoPixels we can turn the brightness down and maybe save my retinas in the process. And towards the ends when I switched all the effect colours, I forgot to write them which is why they went back as they were when I changed channels and came back  ::)

Video: Go for 1080p full screen to see better.