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

Thread: Super New to Teensy, Project Questions

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    3

    Super New to Teensy, Project Questions

    Hi! I have been looking for a board to make a midi controller for awhile now, and I think I should go for the Teensy ++ 2.0. But I have a few questions
    1. How many controls can be connected without having to add chips?
    2. Is it very difficult to program the board for midi controls?

    My plan is to have 9 buttons and 5 knobs. At some point I'd like to add an accelerometer, but that isn't super important.

    I guess i should also point out that I was looking at Livid Instruments' Brain Jr., but switch because of the cost. The nice thing I notice about that board is all the pots are labeled there on the board (Button, LED, Analog). But looking at the Teensy and not having ever built anything, I have no idea what would go where.

    Thanks for the help!
    Last edited by Dj Cryonic; 08-18-2013 at 09:21 PM. Reason: typing error

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,980
    There are 46 I/O pins. 36 are easily available on the edges and 10 more in the interior.

    Usually a button uses 1 digital input. So your 9 buttons will consume 9 of 46 the pins.

    A "knob" might be an analog pot or a rotary encoder. Analog pots need 1 analog input pin. There are 8 of those pins, so you could connect 8 pots without any extra chips.

    Rotary encoders need 2 digital inputs. Performance is better when at least 1 of the inputs is an interrupt pin, and best when 2 are interrupts. For knobs turned by humans (relatively slow... not a motor moving at high speeds), usually 1 interrupt pin is plenty. There are 8 interrupt pins, so you could connect 8 rotary encoders with good performance, or 4 with best performance. If you're careful not to delay in your code, you might even be able to use more than 8 on the non-interrupt pins. With 37 pins left over after the buttons, you could in theory connect 18 rotary encoders.

    Teensy 3.0 has interrupt capability on all digital pins. Teensy3 also has many more analog inputs. For only 5 "knobs", any board is probably ok... but if you wanted to connect a large number without extra chips, Teensy 3.0 might be the best choice.

  3. #3
    Junior Member
    Join Date
    Aug 2013
    Posts
    3
    Awesome, super informative!

    I guess that leaves me with just one more question (hopefully): Is there some form of documentation that I could find that would show me what each port on the board is, so I can see what I would plug in where?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,980
    Quote Originally Posted by Dj Cryonic View Post
    Is there some form of documentation that I could find that would show me what each port on the board is, so I can see what I would plug in where?
    Do you have the pinout reference card that came with the Teensy?

    If not, the info is here, with PDF files if you want to print a fresh copy. Having a printed copy can be really handy while you're actually connecting the wires on a breadboard, or creating a PCB layout with that software running full-screen.

    http://www.pjrc.com/teensy/pinout.html

  5. #5
    Junior Member
    Join Date
    Aug 2013
    Posts
    3
    I've read this, but the problem is that I don't really understand it all. I don't see what anything would be plugged in, especially having all the things in at once that you suggested.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,980
    Quote Originally Posted by Dj Cryonic View Post
    I've read this, but the problem is that I don't really understand it all.
    Thanks ok. Everyone has to start somewhere. Here's what I'd recommend to get started.

    In Arduino, open an example using File > Examples > Teensy > USB_MIDI > Buttons. Use Tools > Boards to make sure you've got the correct Teensy selected. Also use Tools > USB Type to select MIDI. The default is Serial, so you must do this to make Teensy become a MIDI device.

    Then click "Upload" (the 2nd icon on Arduino's toolbar). That will upload this Buttons example to your Teensy. If this is the first time you're uploading to the board, it may ask you to press the pushbutton to initiate reboot the board. Usually it can do this automatically, but sometimes not the very first time.

    Look at that pinout card. It has 2 sides. You want the Arduino side, where the pins are numbered from 0 to 45.

    This example causes pins 0 to 11 to respond to button presses. Each button connects between a pin and ground. You can test with just a wire or paperclip. Touch it first to ground (in case you have any electrostatic charge built up... it's safeset to touch ground first), then touch it to any of those first 12 pins (numbered 0 to 11). When the wire touches both ground and a pin, your Teensy is send a MIDI note on message. When you remove the wire, it will send MIDI note off.

    So run some MIDI software on your computer. Once you've uploaded the program, your MIDI software should show Teensy in the list of available MIDI devices. Select it and do whatever your software needs to make it respond to note on/off codes. If you're new to that MIDI software, it might be best to connect a known-good MIDI keyboard or other instrument and make sure you've got the software working so it does something when a keyboard sends.

    Then with software running on your PC which responds to incoming MIDI notes, try touching the wire (or paperclip) between ground and those pins. You should see the software respond, the same as it does for a regular MIDI keyboard.

    The next step would be using actual pushbuttons instead of the paperclip.

    Of course, much more is possible. But before you get into more advanced stuff like pots or rotary encoders, at least go through this process with the Buttons example. You'll gain a lot of useful experience along the way, which will pave the way to branch out to trying other stuff.

Tags for this Thread

Posting Permissions

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