Introduction: Teensy Monster V1.0 // DIY MIDI Controller

About: fuzzywobble.com

Welcome to the Teensy Monster Instructable!

This Instructable will help you assemble your Teensy Monster, understand how to program it, and provide many tips for building a great DIY controller.

teensymonster.cc

Buy your Teensy Monster here.

https://github.com/FuzzyWobble/TeensyMonster

Step 1: Parts

Included in your Teensy Monster DIY kit.

01 __ Teensy Monster PCB
02 __ 3x Male headers
03 __ 1x 2x4 female header
04 __ 15x Ribbon connectors, male
05 __ 14x Ribbon connectors, female
06 __ Ribbon cable
07 __ 6x 700 ohm resistors
08 __ 2x 1.5 kohm resistors
10 __ Teensy 2++
11 __ IC socket
12 __ Analog multiplexer IC
13 __ 2x female headers

**Parts will not appear exactly as shown in image**

Step 2: Soldering Like a Pro

Without doubt, the most important step of this Instructable.

I have a soldering technique that anyone can follow to become an expert almost immediately.

Most importantly, use a flux pen. Never solder without a flux pen.

Add a generous amount of flux to the solder location.

Stick a blob of solder to the tip of the hot iron.

Quickly press that blob of solder against the solder location. Listen for a 'sizzle' type sound.

Use paper towel to wipe up the remaining flux.

Step 3: Assemble Your Teensy Monster

Things you will need:

Follow the directions carefully and ensure you do not solder anything in the wrong spot or backwards. You DO NOT want to be desoldering anything -- it is a terribly frustrating procedure.

Each step has corresponding images. See the image gallery to help guide you through the steps.

STEP 1

Solder the 14 female ribbon connectors to the Teensy Monster. Ensure that the connectors are facing the right way (slit outwards).

STEP 2

Solder the six, 700ohm resistors. The orientation of the resistors does not matter (there is no front or back). It is best to bend the resistors at 90 degrees BEFORE inserting them into the PCB holes. Use your flush cutters to remove the extra wire on the underside.

STEP 3

Solder the two, 1.5kohm resistors.

STEP 4

Grab three, 5-pin male headers. One at a time, solder these headers to the PCB. You may have trouble holding the pins in place while trying to solder. Best thing to do is hold one end of the headers with your finger and solder one connection to secure the headers perpendicular to the board. Obviously do not solder the same header pins that you are holding or you will burn yourself.

STEP 5

Solder the female headers to the PCB. Again, use the trick from step 4 to ensure that these are soldered upright and perpendicular to the board. It is important that these headers are aligned correctly otherwise your Teensy will not snap into place.

STEP 6

Solder the IC socket into place. Ensure it is oriented as shown on the PCB -- with the notch facing towards the Teensy.

STEP 7

You have already soldered over 200 connections so you should be good at this by now. I have saved the most important soldering for last -- the Teensy. Break a male header strip into two 20-pin sections (it may already be broken for you). Also break off two 4-pin sections. When soldering these pins to the Teensy ensure you don't overheat the board or you could fry it. Your soldering should be swift and clean.

Do NOT forget to wipe all the excess flux off of the Teensy when you are done. It must be 100% dry!

STEP 8

Plug your Teensy and multiplexer into the board. Make sure your multiplexer is facing the right way. You're done the assembly. Bravo!

Step 4: Let's Go Component Shopping!

I have spent endless hours searching for the best and most reasonably priced components from around the world. I ordered many different components to test out and compare, most of them were rubbish and were not used in project. Here is the list of the best stuff I found. The ones with * are my favorites. Without doubt, there are many great components out there not included on this list. Check out my list of top electronics stores.

Pushbuttons

(Many of these pushbuttons are available in different sizes and color - check the sites for more options. With pushbuttons, you usually get what you pay for.)

Faders

(If these are out of stock, they may also be available at digikey.com or newark.com. Note, these faders are very cheap and have a lot of friction/resistance. I am still on the lookout for a better fader. You may want a 'frictionless' fader. DJ Deals sells them for cheap, and they are simple enough to use with the DIY controllers.)

Slide knob

  • Many options available at Newark.

Potentiometers

Potentiometer Knobs

(Knurled knobs can only be attached to knurled shafts. Knobs with set screws will require a hex key to couple with the potentiometer. 6.4mm knobs coupled with 6mm shafts fit slightly non-concentric - this can be fixed with some scotch tape. 6.35mm potentiometers do exist although I was unable to find an economical option.)

Encoders

(Search 'PEC11-' on Newark to get a long list of nice and affordable encoders. I used PEC11-4115F-S0018 and PEC11-4215F-S0024 in my build. I tested many encoders and found the Bourns ones to be best. They have both D, and knurled shaft options available. For my jog-wheels, I am using more expensive optical encoders.)

PCB

Wires & Connectors

Header Pins

  • Male @ All Electronics, Sparkfun, Futurlec, Adafruit, SureElectronics
  • Female @ Sparkfun, SureElectronics, Futurlec

(Sure electronics is by far the cheapest!)

LEDs

(Every site has plenty of different LED options. Keep in mind this controller framework is not really designed to control more than a few LEDs. Now that is not to say you can't use many LEDs in this project, you just can't control them, ie, turn them on and off when you please.)

Hardware
All hardware (nuts, bolts, standoffs) can be found at McMaster (USA). McMaster is the best!

Other
Soldering iron, wire cutters/strippers.

There are many other components you may want to include in your interface such as LCDs, touchscreens, trackballs, pressure pads, proximity sensors, etc. SparkFun and Adafruit are the best resources for these kinds of components. Although the controllers I showcased in this Instructable are somewhat conventional, I encourage you to get crazy. DIY gives you the power to do anything you can imagine - just wait till you see the next controller I am going to build!

Read the datasheets carefully before buying components.

Discount/surplus stores like Futurlec & All Electronics have excellent prices, but also carry some components which are totally bogus - be extra careful before buying from these stores.

Note that all these components are PANEL MOUNT. There is an important distinction between surface mount and panel mount components. Surface mount components fasten directly to the printed circuit board (PCB) while panel mount components fasten to the top panel and connect to the PCB via wire and solder connections. It is usually not possible to use surface mount components unless you fabricate custom PCBs and have expert soldering skills. Using panel mount components makes this project accessible to anyone.

If you are from Europe or Asia this list may not be totally relevant or useful. Sorry.

Step 5: Teensy Monster Pinout

Here are the types of connections available on the Teensy Monster.

  • digital input __ used for pushbuttons/switched/toggles
  • digital input interrupt __ used for encoders
  • digital output PWM __ used for LEDs with variable brightness
  • analog input multiplexer __ used for potentiometers/sensors
  • analog input teensy __ used for potentiometers/sensors
  • power (+) __ used by potentiometers/sensors
  • ground (-) __ used by everything

Very important diagram. Print it out. You will be referencing it often.

Step 6: Test Circuit (Part a - Hardware)

The best way for you to understand how to use Teensy Monster is to build a quick test circuit. First we will start with the hardware.

Things you will need:

  • Soldering iron with thin tip
  • Thin solder
  • Multimeter
  • Flux pen
  • 6x, ribbon cable, 8-wire
  • 6x, ribbon connectors, female
  • 2x, encoders
  • 2x, LEDs
  • 2x, potentiometers
  • 2x, pushbuttons
  • 2x, 4-pin male headers

If you don't have two potentiometers/pushbuttons/LEDs/encoders no worries -- just ignore the steps that involve those components.

Component Connections

  • Pushbuttons/toggles/switches require one digital input and one ground.
  • Encoders require two digital inputs and one ground.
  • Potentiometers require one analog input, one power, and one ground.
  • LEDs require one digital output and one ground.


STEP 1 __ ATTACH RIBBON CONNECTORS


Attach a female ribbon connector to the end of the six 8-wire ribbon cables (easier said than done). Unless you have super strength, this will require a rigid block. Wedge the female ribbon connector between the block and a hard surface. Push down until you hear a 'click'. Inspect the connector. Likely one side has locked into place. Push on the other side until you hear another 'click' and both sides will be locked into place.

** Ensure you have inserted the cable from the correct end (see image). **

** Ensure white/grey is on the correct side (see image). **

** Minimize the gap (see image). **

Be cautious of the length you cut your ribbon cable. You will likely want to reuse this in your controller -- it is important the cables are long enough.

STEP 2 __ CONNECT ENCODERS

Using your wire strippers, strip four ends of one of the six ribbon cables. Solder the ends to the two encoders (see image).

**Start with the white/grey cable.**

STEP 3 __ CONNECT PUSHBUTTONS

Using your wire strippers, strip two ends of one of the six ribbon cables. Solder the ends to the two pushbuttons (see image). It doesn't matter which pushbutton connector you solder to.

**Start with the white/grey cable.**

STEP 4 __ CONNECT LEDs

Using your wire strippers, strip two ends of one of the six ribbon cables. Solder the ends to the two LEDs (see image). Ensure your solder to the longer LED connector (leg).

**Start with the white/grey cable.**

STEP 5 __ CONNECT POTENTIOMETERS

Using your wire strippers, strip two ends of one of the six ribbon cables. Solder the ends to the two potentiometers (see image). Ensure your solder to the correct connector. All potentiometers are different but this is usually the middle (2) connector -- check the datasheet for your potentiometer.

**Start with the white/grey cable.**


STEP 6 __ COMPONENTS DONE

All components should now be connected to a ribbon cable (see image).

STEP 7 __ POWER AND GROUND

You should have two remaining ribbon cables. One is used for ground, the other for power. Ground is required on all components. Power is only required on potentiometers. (see images)

STEP 8 __ TEST CONTINUITY

I seem to be using 'conductivity' and 'continuity' interchangeably here. Ahh whatever, you get it!

If for whatever reason you do not have continuity, this suggests your female ribbon header was not pressed with enough strength to enable a connection. Push on it again. Test until continuity is achieved.


STEP 9 __ CONNECT TO TEENSY MONSTER

Plug your headers into the appropriate slots on the Teensy Monster (see image).

That's it. You're done!

~~~

Before finishing the test circuit we must first become familiar with the software and code used by the Teensy Monster.

Step 7: Set Up Teensyduino (Arduino + Teensy)

Teensyduino is an addon for Arduino that enables Teensy to be used in the Arduino programming environment -- very handy!

Download Arduino: http://arduino.cc/en/main/software

** IMPORTANT -- certain versions of Teensyduino are only compatible with certain versions of Arduino. On the Teensyduino download page this is specified. As of April 2014, "Teensyduino 1.18 supports only Arduino version 1.0.5". **

Download Teensyduino: https://www.pjrc.com/teensy/td_download.html

Follow the install instructions on this page (be sure to install all the libraries!).

Download Teensy Loader: https://www.pjrc.com/teensy/loader.html

Lets do a quick test to ensure Teensyduino is installed correctly.

STEP 1

Plug your assembled Teensy Monster into the USB port on your computer. After plugged in an orange light on the Teensy should be flashing on and off every second. This is called the 'blink' sketch -- Teensy comes loaded with it.

STEP 2

Open the version of Arduino you just downloaded. Go to File->Examples->Teensy->Tutorial1->Blink (see image).

STEP 3

Edit the blink sketch. You will need to change the 'ledPin' to 6, and the 'delay' to 100. (see image).

STEP 4

Go to Tools->Board->Teensy++ 2.0 (see image).

STEP 5

Click the upload button (right arrow) to upload the new code to the Teensy Monster. Since this is the first sketch you uploaded, Arduino will ask you to click the reset button on the Teensy. Click it (see image). After clicked, the sketch should immediately upload and the LED should now be blinking much faster.

Step 8: The Code

https://github.com/FuzzyWobble/TeensyMonster

**Note that the code still has a few minor bugs as of Sept 16, 2014. I am working on getting those fixed. Please check back for the updated code at a later time if you are reading this message.**

Inside the 'TestCircuit' folder you will find four folders: Encoder, TeensyMonster_v1, TeensyMonster_v1_TestCircuit_Basic, TeensyMonster_v1_TestCircuit_Shift.

Open 'TeensyMonster_v1.ino' in Arduino.

Check if File->Examples->Encoder exists. If it does not, copy the Encoder folder to you Arduino libraries folder (different locations for Mac and PC).

Teensy Monster does not require you to write much code. But you are required to configure your Teensy Monster. This is done by simply editing the code found within:

// ---------------------------------------------------------------------------
// EDIT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

edit this code

// END EDIT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ---------------------------------------------------------------------------

All the instructions can be found within the comments of the code, but I will give you a quick example. Say I hooked up a pushbutton to pin 27, an encoder to pin 0 and 1, and a potentiometer to teensy analog pin A0. I will have to tell the Teensy Monster that I want these pins to be enabled. I do this by editing the code accordingly -- usually replacing a 0 with a 1 on the corresponding pin (see image).

The best thing to do is carefully read through the comments in the EDIT code section -- they explain all the details of Teensy Monster configuration.

Step 9: Test Circuit (Part B - Software)

Open 'TeensyMonster_v1_TestCircuit_Basic.ino' in Arduino.

Scan through the EDIT code and you will see the following

  • Pushbutton pins 28 and 29 have been enabled
  • Pushbutton mode for pin 29 has been set to 4 (toggle mode)
  • LEDs on pins 14 and 15 have been enabled
  • Encoders have been enabled on on pins 0/1 and 2/3
  • Analog Mix pins 0 and 1 have been enabled

As you can expect, the code has been configured to work with your test circuit. This assumes you are using pushbuttons, LEDs, potentiometers, and encoders. If you are not using any of these it is IMPORTANT you set the pins back to their default values. Enabling pins which are not connected to components will cause unexpected output.

If you followed my directions closely and always started with the grey/white cable then the pin numbers should be correct. If you mixed up the ordering, reconfigure the code to match your pin numbers.

Once everything is configured, upload 'TeensyMonster_v1_TestCircuit_Basic.ino' to the Teensy Monster.

Open the Serial Monitor (see image).

You should see the configuration below (see image):


___DEBUG ENABLED___

~~~~~~~~~~~~~~ CHECKING CONFLICTS ~~~~~~~~~~~~~~
~~~~~~~~~~~~~~ PIN CONFIG ~~~~~~~~~~~~~~
Pushbutton on pin [28] is enabled with pushbutton mode [1]
Pushbutton on pin [29] is enabled with pushbutton mode [4]
LED on pin [14] is enabled
LED on pin [15] is enabled
Encoder on pins [0,1] is enabled
Encoder on pins [2,3] is enabled
Analog in on multiplexer pin [0] is enabled
Analog in on multiplexer pin [1] is enabled
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROGRAM WILL START LOOPING IN THREE SECONDS...

If you are seeing output in the Serial Monitor but you are not interacting with a component, then something is wrong. This is a common issue. It could be caused by one of the following.

  • Enabled a component on the wrong pin -- check your pin configuration.
  • Hooked up a potentiometer or encoder incorrectly -- check your component datasheet.
  • Analog jitter issues -- increase the 'analogThreshold' variable.

If you see no output or wacky output on the Serial Monitor, this could be caused by one of two things. Frist, check your Serial Port (see image). If you are on the wrong Serial Port you will not see any output -- find the correct port. Second, check your baud rate and ensure it is 9600 (see image).

**WARNING -- I must inform you of one bug that has long disrupted Teensyduino (hopefully it will be fixed soon). For no reason at all, your Teensy may no longer appear is the Serial Port. It will just vanish. When you attempt to upload code Arduino will repeatedly ask you to hit the reset button, although hitting the reset button will do nothing. If you are noticing this wacky behavior, you must close Arduino and open it up again. If the problem persists, you sometimes have to restart your computer (usually on Apple). It is a very annoying bug.**

**SECOND WARNING -- In rare cases, the Teensy will stop showing up in the Serial Port no matter what you try. It happened to me a couple of times, and it is a bit annoying to fix. Solution here.

If everything is working as expected you should see the following:

  • Pushbutton 1 sends toggle message 'click on/off'. Also toggles LED on/off at 100% brightness.
  • Pushbutton 2 sends 'click on' message while held and 'click off' message on release. LED is on at 25% brightness while held.
  • Encoders output 'forward' or 'reverse' message depending on which way they are turned.
  • Potentiometers output value between 0 and 127.

Upload 'TeensyMonster_v1_TestCircuit_Shift.ino' to the Teensy Monster.

We have made one critical change to this code. We have added a shift button.

//SHIFT_______________________________________________
//shift buttons offer dual functionality to your pushbuttons and encoders
//if using a shift button enter the pin number here, else put 0
int shiftPin = 28;

Hold your shift button and interact with the other encoders and other pushbutton. You will notice the pushbutton has enabled dual functionality for these components. This means, when the shift button is held they output different messages, and thus can have dual functionality. Carefully designed shift buttons can drastically reduce the number of components needed on your interface -- resulting in a more elegantly designed control surface.

Step 10: Mapping

STEP 1 __ DISABLE DEBUG MODE

So far, we have only ran the code in 'debug mode'. Debug mode outputs messages to our Serial Monitor to help us configure the code. When we are ready to map the Teensy Monster to our software of choice, we must turn off 'debug mode'. Edit the following code so debug is set to 0:

//DEBUG_______________________________________________
//enable if you want to test your output in the serial monitor
boolean enableDebug = 0;
// 1 for enable, 0 for disable. **Remember to disable debug when running MIDI**.

STEP 2 __ UNCOMMENT MIDI MESSAGES

Next, scroll to the bottom of the code and you will find a number of commented lines with the command 'usbMIDI'. Each of these lines will also include '//!!!'.

if(val==1){
//usbMIDI.sendNoteOn(pin,127,channelNumber); //!!!
}else{
//usbMIDI.sendNoteOff(pin,127,channelNumber); //!!!
}

These lines are very important -- they send the MIDI messages.We have to uncomment them!

Note that the encoder MIDI message has three modes (Note, Ableton, and Other). You must pick the ONE that best suits your software and uncomment it. This may involve some trial and error. I have tested 'Note' mode in Traktor with success. Tomash G (fellow controller enthusiast) uses 'Other' mode in Traktor, and of course, uses 'Ableton' mode with Ableton.

STEP 3 __ SWITCH TEENSY TO MIDI MODE

From the Arduino software, go to Tools->USB Type->MIDI (see image).

STEP 4 __ UPLOAD

Now upload your code to the Teensy Monster. Open your software. You should see 'Teensy' appear as a MIDI controller. Start your mapping!

** IMPORTANT -- If you want to return to debug mode you must reverse these steps **

  • Set Arduino to serial mode
  • Comment all usbMIDI lines
  • Turn debug mode back on

Step 11: Building Your Controller

I uploaded a large collection of images here with hopes they help you with your controller design and build.

Truth is, every controller is different so I cannot give you specific instructions. I do, however, have a few tips.

Components

The fewer components the better. Anyone can make a cluttered interface. Make it minimalist. Make it personal. You are likely going to be the only one using your custom controller, so don't be afraid to make the interaction somewhat convoluted.

Use shift buttons/toggles to double, or even triple the number of output messages a single encoder/pushbutton can send. My latest controller (see images) has three shift buttons, two of which are toggles. Although you can only count 19 pushbuttons on my interface, there are actually 48!

Get creative! There are dozens of unique components/sensors out there that could make your interface one-of-a-kind -- unlike anything available on the market.

Top Panel

I am a big fan of the three layer acrylic approach (see image). I carefully design the panels in Adobe Illustrator and have them manufactured using a laser cutter. You can outsource laser cutting domestically to Ponoko -- they are great! Blunders in laser cutting can become very expensive. Best thing to do is order your components, then measure them with calipers to ensure your cutouts are the correct dimensions. Datasheets also have dimensions of the components, but are sometimes difficult to read. Printing out your Illustrator designs to get a sense of the spacing is recommended (see image).


Enclosure

Enclosures are tough. I have made a few with wood (see images). Threaded inserts are your friend. CNC machines like a ShopBot will enable you to create professional looking enclosures. Best place to find CNC equipment is at your local universities engineering department.

You can also laser cut boxes. Try the Box Maker.

Component Connections

Solder connections between your ribbon cable and components MUST BE STRONG. Carefully solder these connections, and if they are not perfect, remove the wire and start again.

Chain ground and power connections to avoid sending a ground/power back to the Teensy Monster for every component (see image). This will reduce the number of wires inside your enclosure.

Ribbon cables must be kept at an optimum distance from the Teensy Monster. I like to make them just long enough so I can stand up the top panel at 90 degrees, next to the base (see image).

Reference

My original DIY controller Instructable, https://www.instructables.com/id/A-Framework-For-Making-Affordable-Stylish-Modula/, may be very helpful!