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

14 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
    Replies
    1. Hi, are you still selling these PTT/PC interfaces? Thanks -- Jeff

      Delete
  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
    Replies
    1. first of all MERLIN just because you think you can do it better does not mean you can start being a keyboard warrior and tell him in the rust way possible how it should be done. The way he did it is the way he wanted to do it there is always going to be different ways to do the same thing. You don't have to have a I'm better than you attitude.

      Anyways thanks for the informational blog Richard KK4JDO hopefully someday ill see you on the air!!

      Kyri KG5WXZ

      Delete
  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
  6. Came here thinking that 'someone must have done this' and was very pleased to find that I would be able to use your technique very quickly with components I have lying around - including a Teensy. Just need to get myself a fist mike and physical connectors. Cheers, Mark.

    ReplyDelete
  7. Came here thinking that 'someone must have done this' and was very pleased to find that I would be able to use your technique very quickly with components I have lying around - including a Teensy. Just need to get myself a fist mike and physical connectors. Cheers, Mark.

    ReplyDelete
  8. hi, names Steve, was wondering if you would consider, am a stroke survivor, my left side ie pretty much useless, have a kenwood mc-60 mic- 4 pin connector, would love to use on my pc, might you consider building me one of these for me?, if so, your price?

    Steve Simmons KD4KTV, Cheers, ssimm1958@gmail.com

    ReplyDelete
  9. Hi, I really like this idea! But I am wondering if it would be possible to have the Mic go into the Teensy instead of the PC? This way everything is being handled by the Teensy and audio from the Mic would go through the Teensy and out the USB into the PC? Would i need to add a pre amp circuit to make the Mic audible? Something based on an LM386? How would this change the code or the schematic? Any feedback would be appreciated! Thank you!

    ReplyDelete
  10. Like you, I wanted a hand mic for use with Echolink and with the remotehams.com software. After reviewing your post and a couple others, I took your inspiration and made two interfaces that took in a cheap baofeng 2-pin external mic. The audio part is easy like you say. The first was of my interfaces used the guts from an old mouse, connecting the PTT switch to the middle-mouse-button since the current Echolink software allows a middle-mouse-button push to trigger the TX. Unfortunately, the remotehams.com software didnt have that option, so the second interface used a FT232 serial board that is about the same as your teensy project board. I wired the PTT switch to one of the serial signal pins that both Echolink and remotehams recognized, and the rest is history! Thanks for the inspiration!

    ReplyDelete
  11. Richard, KK4JDO

    Ok I'm getting somewhere but some of this is going over my head. I have to desktop mics one is a Kenwood KMC-9C with an 8 pin RJ45 male plug and the other a Motorola HMN3000A 6 pin with a male RJ45 plug. I want to use them on a PC with Zello and I'm just not finding much help on the internet so any help would be. If you would be interested in making me an adapter that would work Id prepay for them and the shipping cause what I have found is way over priced. The only function I want is the mic and ptt don't care about the monitor feature.

    Thanks Rick AKA Dispatcher

    ReplyDelete