Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: kush hammer eq midi controller

  1. #1
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    13

    kush hammer eq midi controller

    Here's my teensy 3.2 based midi controller, with a pdf description, and the sketch. The sketch is zipped, as there are numerous .ino files because I spread the sketch out across multiple tabs. Hope you find it at least interesting.

    Paul Hesketh
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	kush eq controller.jpg 
Views:	42 
Size:	49.1 KB 
ID:	14157  
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Quote Originally Posted by Paul Hesketh View Post
    Here's my teensy 3.2 based midi controller, with a pdf description, and the sketch. The sketch is zipped, as there are numerous .ino files because I spread the sketch out across multiple tabs. Hope you find it at least interesting.

    Paul Hesketh
    Thanks for this. I'm a complete newbie (well, I briefly used an Arduino 10 years ago at uni) and pondering putting together a controller for a SSL type EQ plugins.

    The way you've packaged together your thinking like this is really handy. Cheers.

  3. #3
    nice project and great presentation. thanks for posting the info.

  4. #4
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Paul - Really dumb question from the n00b (I'll try not to ask too many).

    I've installed the Arduino tools (1.8.5) and then the Teensy add ons (1.4.2). When I verify, I get compilation errors around each of the following: Adafruit_MCP23017.h. ILI9341_due_config.h. ILI9341_due.h.

    Do I have to manually find and download these resources from the web and if so, where do I put them?

    Thought I'd try to carefully understand and compile your code, before stripping out the things I don't need- I might end up needing 1 MCP23017, but not three.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,829
    Was Teensy selected in IDE for Board?

    Nothing DUE should be used or needed. TeensyDuino comes with an optimized ILI9341_t3.h driver that should be used.

    More details needed if there are issues after that . . . verbose console output from IDE, a small sketch that shows the problem and software/hardware involved.

  6. #6
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    13

    libraries

    Quote Originally Posted by astrocreep View Post
    Paul - Really dumb question from the n00b (I'll try not to ask too many).

    I've installed the Arduino tools (1.8.5) and then the Teensy add ons (1.4.2). When I verify, I get compilation errors around each of the following: Adafruit_MCP23017.h. ILI9341_due_config.h. ILI9341_due.h.

    Do I have to manually find and download these resources from the web and if so, where do I put them?

    Thought I'd try to carefully understand and compile your code, before stripping out the things I don't need- I might end up needing 1 MCP23017, but not three.
    Aye, need to download them, but they're fairly well known and documented libraries - they're all available on github, I put links at the end of the pdf to the relevant pages. Can download them as zip files, no need to unpack them, just add zip file in library manager. They have good examples, too. The MCP23017 is very useful, and easy to use, but do take a look at the datasheet - if you want to use say a lot of LEDs, need to be a bit careful of the maximum current the chip can source or sink. The main reason I used 3 of them was so that I could spread out the LEDs, and so I could add a ps/2 keyboard. By using the 8 pin parallel output of a keyboard encoder board to 8 inputs on a MCP23017, I could read each pin in turn then bitwrite to make the ps/2 scancode byte. I was running out of pins on the teensy For the three address pins, all grounded is address 0, and all VCC is address 7, so 8 addresses are available. Don't forget that the reset needs VCC, and the two I2C lines both need 4.7K resistors to VCC, though.


    As for the coding, the mcp.digitalRead /Write is easy enough to get your head round, and the reading of button switches/writing of the LEDs is essentially a state machine - read data, if its on, turn it off, if its off, turn it on, send data. The incremental encoders just count up and down, with a change in count sending MIDI data and updating the screen. The thing that's really useful in the encoder library is the encoder.Write(value), so that the starting value of an encoder count variable can be changed at any time - this makes it pretty straightforward to enable MIDI in to update it too. The LCD is really graph paper, drawing rectangles, arcs and text - the MarekBuriak due library has some excellent documentation of the functions available, and is really very impressive indeed. The eeprom is essentially 32k of static memory, and can read/write each byte by individual address, so I thought it was ideal for saving of presets - I made each preset 64 bytes long, so can just multiply the preset number by 64 to get the start address to read/write the preset. I used arrays for the presets with a fixed format, so that the byte order from the start of the preset updates the same variables. I think the muddiest part of my coding is probably in the preset naming - this is the first thing I've done where I've used string/char variables and arrays, and I found it a little tricky, tied myself up in knots a few times, especially for trying to read characters from 3 potential sources - buttons, encoder and keyboard. Greedy....

    I tried to document the sketch as much as I could, and hopefully used names for variables/voids that weren't too cryptic to follow - this is the first project I've put online, so feel free to ask away I put the functions on tabs in the sketch, to hopefully try and make it easier to break down. There are a lot of variables for the MIDI functions, but most of these can be broken down into sets fairly easily. 3 sets of controllers for left,stereo, right. Each of these sets has 9 controllers each, 3 cut/boosts, 3 frequency ranges, and 3 in/out states. After that, there is 1 overall output gain, 1 power and 1 bypass state. These all need more than 1 variable, to allow for comparisons of old values/states to new values/states, so the number of variables needed racks up pretty quick Makes it look far more complex than what it is, though, which is really just simple ideas repeated.

    I'm fairly new to all this, too, but its been an entertaining learning curve.

    Paul.

    Paul.

  7. #7
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Thanks again Paul! I had a look over the pdf again at lunchtime today and noticed the locations of the libraries so I'll give them ago. Thanks for clarifying where they go!

    I figure it is those sort of background issues, how to compile, libraries to include etc that would totally trip me up. It's great to be able to try that a few times, work towards the code I need and see if I lose the drive to finish it before I buy myself a Teensy!

    I think everyhing I need is a small subset of what you've done, I'm not even looking at requiring LEDs at the moment, nevermind screens or presets. I'll definitely buy you a beer when it's finished, hopefully I'll not need that much extra pointers now.

    T

    EDIT - That gets me further, I'll see if I can make sense of the current problems myself before bothering anyone else. There was a spurious multiline comment in the keyboard_input file which I had to fix. The other issues are around Midi not being declared right and something with ILI9341_due.h
    Last edited by astrocreep; 07-23-2018 at 07:10 PM.

  8. #8
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Nope, still can't see what is going wrong. I've gone back to the original zip file so I don't think it's anything I've changed in the original sketch, but I still get the errors below:
    errorMessages.txt

    Technically neither the midi or ILI9 stuff is required for my build, but I thought I'd get to the bottom of compiling this successfully before I start to tinker round the edges.

    Cheers.

  9. #9
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    13

    library issue

    Hmm, that's an awful lot of errors from the libraries - all those "not declared in this scope" makes me suspect a library error. I'd suggest commenting out the #includes for the libraries giving the problems, and then include them again from the sketch tab - could possibly be a location reference, with the compiler not finding the library. Otherwise, I can only guess that the ili9341 library I used is not compatible with your setup as it is, so maybe take a look at the settings in the ILI9341_due_config.h file. I use arduino 1.66, as I've had some difficulties before with some libraries not working with some builds, which can be very frustrating. The main reason I used this library over any other ili library was the very clear documentation for text alignment and its arc function, that I used for the gauges.

    So, I did a very quick and dirty edit of the sketch to use the ILI9341t_3 library instead, just stripping out all the arcs, fonts and text formatting - some of the library commands are different, so a little bit fiddly, but this library does at least drive the display, and is optimised for the teensy, so should work with any build. I'll post a copy if you like, just so you get something that'll hopefully compile, but it's incomplete proof of concept thing and I haven't prettified it - so, most of the graphics aren't there and for example, the text will overwrite itself, that kind of thing. However, if there are any component parts of this project that you'd like explained more, just let me know and I'll knock up a more simplified sketch to cover them - I guess this project does jump about quite a bit. Most of the ideas are simple enough, but would breakdown sketches such as eg

    #include <Encoder.h>

    Encoder encoder_1(3,2);//encoder_1 is just naming, 3 and 2 are the pin numbers on the teensy that the rotary encoder is attached

    long op1=0;
    long np1=0;//some variables used to count the encoder, for old position and new position so you can look for a change in position


    void loop()

    {

    np1=encoder_1.read();

    if (np1!=op1)//has the encoder moved
    {
    //do stuff - I use this a lot to send MIDI - so, usbMIDI.sendControlChange (3,np1,16); sends controller 3, value np1, channel 16
    }

    op1=np1;//make a note of encoder position

    }

    be useful?

    The MIDI errors look like the library isn't right, either - my #include was the contributed library from the arduino installation, so can't see any reason why that shouldn't work. I only added this library to have a 5 pin MIDI port on the tx/rx in addition to usb, so its not really required at all - the usbMIDI just works class compliant if the tools/usb type is set to MIDI. Hardware midi should be fairly straightforwards, just needs

    before setup:

    #include <MIDI.h>

    then in setup:

    Serial.begin(31250);//set to MIDI baud rate

    MIDI.begin(16);//MIDI channel 16

    in loop:

    MIDI.read();

    I'm not too advanced with all this, but happy to help if I can.

  10. #10
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Thanks again Paul. Given that it's things that I'm not using that appear to be the issues, I'll just miss them out and build something simple up and slot in what I need.

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,300
    Why are you using ILI9341_due.h when you're compiling for Teensy 3.5? That looks like the code for Arduino Due.

    Normally you'd use ILI9341_t3, which is the one optimized for Teensy.

  12. #12
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,829
    Quote Originally Posted by PaulStoffregen View Post
    Why are you using ILI9341_due.h when you're compiling for Teensy 3.5? That looks like the code for Arduino Due.

    Normally you'd use ILI9341_t3, which is the one optimized for Teensy.
    That's what I said in post #5 - then in post #7 it seems he doesn't yet have a Teensy?

  13. #13
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Quote Originally Posted by PaulStoffregen View Post
    Why are you using ILI9341_due.h when you're compiling for Teensy 3.5? That looks like the code for Arduino Due.

    Normally you'd use ILI9341_t3, which is the one optimized for Teensy.
    Thanks Paul, I thought I'd grabbed the correct copy of the library, but perhaps not.

  14. #14
    Junior Member
    Join Date
    Jul 2018
    Location
    Edinburgh
    Posts
    8
    Quote Originally Posted by defragster View Post
    That's what I said in post #5 - then in post #7 it seems he doesn't yet have a Teensy?
    Teensy 3.5 has now arrived, I was just trying to get my head around libraries and compilation etc before purchasing to ensure I wasn't going to be wasting my time and money.

  15. #15
    Junior Member
    Join Date
    May 2017
    Location
    Edinburgh
    Posts
    13

    ILI9341 library

    Hello there - I guess that's down to me. As I mentioned in post above, the main reason I used the due library was for the additional text formatting, and the simple to use fill arc functions - there are no arcs in the 9341_t3 library, or the adafruit gfx that I could see. I'm just learning as I'm playing around and exploring, and I'm more than happy to acknowledge that there are more elegant and efficient ways of doing things - I just found that the library documentation for the due library was very easy to follow, and it compiled and worked well on my teensy 3.2. This is my first functional project with any complexity, and to be honest, I was pleased to get it to work as intended

    Constructive criticism will always be appreciated, though, and I'll certainly take a look at the t3 library a little more closely for my next project, with a teensy 3.5.

    Paul.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •