Tuesday, June 12, 2012

Using a PTT desk mic on a PC

So in this post, I'm going to talk about a cool project that I finished a few weeks ago.  I like to use EchoLink (http://www.echolink.org/) to chat with people all over the world.  One of the uses for EchoLink, and the only thing that I use it for, is to connect to a repeater that you are too far away to hit using RF alone.  This software connects you to that repeater, and broadcasts what you say into your PC mic as if you were using a radio.  That being said, I like to feel like I am talking into a real rig, instead of talking on Skype or some other VoIP application when I am using EchoLink, especially since it is only accessible by other licensed Hams.  To that end, I had an old mic laying around, so I decided to connect it to the computer.  There were several obstacles that needed to be surmounted, the first being that the mic used an 8-pin connector for Kenwood HF radios, and the second being that you needed the press the PTT (Push-To-Talk) button in order for your audio to be sent out of the mic's audio pins.  The final issue was that the EchoLink software needs to be "keyed" as well by pushing down the space bar on your PC.  Here is how I solved these issues:

To convert from 8-pin to something that the PC could accept, I wired up the audio pins from an 8-pin male connector (the mic has a female, although it seems as though the names should be reversed) to an 1/8" female audio jack.  I mounted both in a small project box to make the assemblage a little easier to use.  This took care of getting the audio into the PC, but I still had to hit the space bar to "key" EchoLink, and at the same time hit the PTT button on the mic to connect the mic element to the audio pins inside the mic.  This was annoying to say the least.  Enter the Teensy USB Development Board:



This board connects to the PC and is recognized as one of several devices, a keyboard, a flash device, a MIDI device, etc.  The main one that I am concerned with was the ability to emulate a USB keyboard.  I soldered a connection from the PTT pins in the mic jack to one of the digital pins on the Teensy board, and another one to the ground pin.  This allows me to detect when the PTT button is depressed on the mic.  I then took this detection, and triggered a key press event to key EchoLink!  Now I can use EchoLink just like a normal radio, via the desk mic, without keyboard input.  Just for fun, I added a red LED to know when the mic PTT key is depressed (to hopefully avoid "hot-mic" issues).

My Parts List:

  • 1 x Teensy USB Board ( http://www.pjrc.com/teensy/)
  • 1 x Project Box
  • 1 x 8-pin male mic connector
  • 1 x 1/8" (3.5mm) audio connector
  • 1 x Red LED
  • 1 x 220-Ohm resistor


Time to Completion:

  • About four hours including figuring out the code for the "sketch" on the Teensy board.


Here is the simple schematic:



Here are a few pics:



Here is the code that I used on the Teensy board (which uses the Arduino IDE environment):


#include <Bounce.h>


Bounce button0 = Bounce(0, 10);


void setup() {
  pinMode(0, INPUT_PULLUP);
   pinMode(12, OUTPUT);
}


void loop() {
  // Update all the buttons.  There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.
  button0.update();


if (button0.fallingEdge()) {
   // press and release CTRL
   Keyboard.set_key1(KEYPAD_PLUS);
   Keyboard.send_now();
   Keyboard.set_key1(0);
   Keyboard.send_now();
   analogWrite(12, 200);
  }


 if (button0.risingEdge()) {
   // press and release CTRL
   Keyboard.set_key1(KEYPAD_PLUS);
   Keyboard.send_now();
   Keyboard.set_key1(0);
   Keyboard.send_now();
   analogWrite(12, 0);
  }
}

Well, that's all for this post, I hope that you have enjoyed it, I certainly enjoyed making it!

73,

Richard, KK4JDO

6 comments:

  1. really neat project,you should sell thm on ebay ready to go.

    regards brian gm7jds

    ReplyDelete
  2. Hi there,

    Thanks for checking out my blog! I decided to take your advice, although I am trying it on QRZ first.

    http://forums.qrz.com/showthread.php?370479-PTT-mic-and-CW-key-interface-for-Echolink-(or-other-PC-based-uses)

    Thanks and 73,

    Richard, KK4JDO

    ReplyDelete
  3. Firstly as an echolink user I have never had a problem using the space bar to transmit. Nor heard anybody else complain about it. Firstly you could had brought most cheap and still have the bare functionality of this device at a fraction of the cost. You could use analog components for a few $ and have a better design. With the most basic licence in the UK, you would have enough knowledge (or out of laziness) to do a more efficient design without digital circuitry. But lets look at the fact that you are content with using the teensy; well I think that if your going to make it at least use the DAC features, and transmit/receive between the handset to echolink. Maybe add a cheap LCD. If your planning to produce this, I wouldn't be the first person to design a singing / dancing wireless handheld. Your solution is analogous to using a 52 seat coach in a rural area with a maximum of any five passengers at anytime. Its inefficient.
    One last rant why didn't you put an on off switch which would run a combination of keys to the startup shortcut, and then kill when set to false using a one time run bat file? Anyway I own that concept, along with a bluetooth or zigbee or form of mobile mic to run echolink. Seriously you only needed some logic gates and a few connectors. If the space button is pressed the computer only needs to receive dec32 or in binary (could have used a dip) 00100000, hex 20 SP (space).
    It doesn't matter, you could have done it digitally far cheaper. This chip could function as a real repeater and you set it up to send the space character.... what a joke. Even 1khz would be a fast enough clock cycle to have no lag. I'd say even lower. But if you did it properly the old school way then you wouldn't have any latency except your computer. Christ you have given me the the perfect idea. Thanks for showing me a rubbish design that is going to be reformed. It's just a case of putting a MCU unit in a mic and blowing them away, you fellow ham have failed.

    M6CPZ

    ReplyDelete
  4. Hey Merlin,

    Thanks for your helpful and wonderfully friendly comments on my blog! Way to show everyone how Hams act!

    Very best 73!

    Richard, KK4JDO

    ReplyDelete
  5. Hi, Richard!

    Merlin seems to be a real genius, don't he? Very humble and gentle as all the geniuses by the way.

    I was about to say "just delete this shit", but you're right. A post like this must stay to show others how a person could help and support, but instead opts to act like a piece of crap.

    Very sad indeed. Just like one being proud of building a fishing boat out of some plywood and his combination of effort and self-taught attitude, and then comes a just-released-from-college naval engineer to start telling the guy that the boat was crappy and amateur, and that his newly-obtained knowledge allied to the "last technology" is far better.

    Instead of mocking and criticizing others, which seems to be Merlin's best skill, you dug into what you knew and had and made it! Be proud!
    The kids never understood, in history, that simple things also work (sometimes better). They never will.
    We were kids once. We did it.

    Patience, my friend! And congratulations for the project and the altive answer!

    All my best 73's!

    Guilherme, PY2ING

    ReplyDelete
    Replies
    1. Hi Guilherme!

      Thank you! I did debate deleting the comment, but thought that the community would be better served by leaving it. He did seem very knowledgeable and had he been more pleasant we could all have benefited, but to some the pleasure is not in helping others, but in tearing them down. Or maybe he was just having a bad day and chose a bad way to vent. As the saying goes, it takes all kinds to make a world. Again, thanks for stopping by the blog and hope to work you on the air sometime!

      73,

      Richard, KK4JDO

      Delete