Friday, January 18, 2013

Teensy + XBee: Simple Native USB Wireless MIDI Controller

Overview
I want to make wireless controllers.

To this end, I have a few conditions:
  • I want the wireless link to be easy to deal with
  • I want the wireless link to appear as a native MIDI USB device
  • I want the wireless link to be sturdy
  • I want the wireless link to be made up of off-the-shelf components that can be sourced in Australia

Here is a simple solution and proof of concept that  fulfills these conditions. The idea is that a USB 'dongle' is connected to the computer. Let's call this the base receiver. A second device reads data from a pot. Let's call this the node transmitter.

Wireless communication is handled by a par of XBee modules. This project is designed to run using XBee modules straight out of the packet - i.e. no configuration is necessary.

As it has been stated, this project is more of a proof-of-concept to show how easy and simply it is to set up something like this. Keep in mind that (1) many sensors etc can be attached to the node transmitter (2) more than one node transmitter can be used and (3) speeds can be increased via configuring the XBee modules.





Hardware
2 x Teensy 2.0 boards
2 x Xbee 1mW chip antenna modules
2 x Xbee explorer regulated boards
2 x mini breadboards or similar
1 x 10kΩ B-type pot or similar
1 x mini usb cable
1 x  4AA battery holder
4 x AA batteries
Assorted breadboard jumper leads




Base Receiver Setup

  • Place the Teensy 2.0 board on the breadboard
  • Place an XBee module onto an Xbee explorer regulated board
  • Connect 0V ground on the Teensy 2.0 board to 0V ground on the XBee explorer regulated board
  • Connect 5V VCC on the Teensy 2.0 board to 5V VCC on the XBee explorer regulated board
  • Connect digital pin 7 on the Teensy 2.0 board to the DOUT pin on the XBee explorer regulated board
  • Upload the XBee Base code to the Teensy board using the Arduino IDE and the Teensyduino add on. 



 Node Transmitter Setup 

  • Place the Teensy 2.0 board on the breadboard
  • Place the potentiometer on the breadboard
  • Place an XBee module onto an Xbee explorer regulated board
  • Connect 0V ground on the Teensy 2.0 board to 0V ground on the XBee explorer regulated board
  • Connect 5V VCC on the Teensy 2.0 board to 5V VCC on the XBee explorer regulated board
  • Connect digital pin 8 on the Teensy 2.0 board to the DIN pin on the XBee explorer regulated board
  • Connect 0V ground on the Teensy 2.0 board to an outside leg of the potentiometer
  • Connect 5V VCC on the Teensy 2.0 board to the other outside leg of the potentiometer
  • Connect 0V ground on the Teensy 2.0 board to the black terminal of the battery connector
  • Connect 5V VCC on the Teensy 2.0 board to the red terminal of the battery connector
  • Connect analog input pin 0 on the Teensy 2.0 board to the middle leg of the potentiometer
  • Upload the XBee Node code to the Teensy board using the Arduino IDE and the Teensyduino add on. 



Usage
As presented here, potentiometer data will be sent using MIDI channel 1 and controller 1. This data should appear on the Teensy USB MIDI device, which can interface directly with Ableton Live etc.




2 comments:

Anonymous said...

Very cool; I'm afraid I'm always a few months behind what you are doing.


I built a two pot plus RGB LED device similar to your one pot USB teensy build described way back and had a question -- I'm only seeing MIDI values in the range 48-127, which means that the analogRead values from my pots don't go below about 700.


Have you seen this before?

Unknown said...

Thanks for sharing such a nice post on Wireless Sensor Networks. I read your post. I watched your video on your project is good xbee tutorial understand XBee.