Icom Mic-O-Matic

From Wiki
Jump to: navigation, search

Status

  • 2010/02/15 - Schematics largely done
  • 2010/01/01 - Processor selected, will almost certainly be a Parallax Propeller
  • 2009/12/25 - Lew has done the audio path portion of the schematic (need to prototype)
  • 2009/12/01 - Able to emulate a HM-98 microphone to the IC-207H
  • 2009/12/04 - Able to decode microphone data

Overview

Note: Mic-O-Matic may be renamed to THRICE, or The Ham Radio Interface Controller Electronics.

The Mic-O-Matic project was started as the result of a desire to control three completely different brand radios with a single microphone. The Icom IC-208H has been a long time radio in my Subaru Impreza RS2.5. After developing an interest in 900Mhz, I bought a Kenwood TK-981, a very nice 15 watt mobile. The lack of a remote head kit for the '981 presented a problem since I was losing about half my transmit power through the 17' of coax to get to the antenna. I acquired a Kenwood TK-931HD with a remote kit, which is a 30 watt radio. With 39" inches of coax, I'm delivering a substantial amount more power to the antenna (for an interesting comparison see the Larsen Antennas page). The Kenwoods have what I affectionately refer to as a "weaponized microphone". It's big, it's heavy, and you can hurt people with it. The Icom HM-133 microphone is much nicer, lighter, and more convenient.

After playing with 900Mhz a while (about 2 weeks), I thought it would be nice to add a 220Mhz radio to the car. The two choices of radios that are affordable, current, and off-the-shelf are the Alinco DR-235T MkIII and the Jetstream JT220M. I initially bought the JT220M, as it's a 50 watt radio and basically a clone of the DR-235T. After using it for a week and finding it lacking, it was shelved and a DR-235T was installed.

Naturally, the HM-133 should also be able to control the DR-235T. So we've got an Icom, a Kenwood, and an Alinco that all have different interfaces, and need their own impedance matching and control methods. The first step was to see if anyone else had already invented this wheel, so some quality time with Google was spent. I didn't find anyone who had done this yet, but I did find a handful of people that were very interested in controlling an IC-207H or IC-208H with a PC. Over Thanksgiving weekend of 2009, I settled down in front of the PC and reverse engineered the HM-98 protocol. I then built up a board with a PIC18F2620 processor, an RS-232 driver, and the circuitry to control the radio data line. I wrote a few hundred lines of C code, and can now fully control the radio as if a mic were attached.

The details of the protocol, with notes and logic analyzer screen shots, are at Icom HM-98/HM-133 Internals. Feel free to make use of this information however you like. The schematic for the board is below, at the end of this page. Note that the schematic is not the final Mic-O-Matic controller, but what was used to test the interface. It's sufficient for control of a IC-207H or IC-208H with a PC, but no more. The software will soon be checked into subversion and made available as soon as I add a few more debugging features and run some additional tests.

Being able to control the IC-207H wasn't actually a real goal of this project. Since the HM-98/HM-133 controls this radio directly, I only need to pass all the signals through. However, since people were interested in controlling the radios, I thought that would be a better starting place, and allow me to prove my theories about how things worked. What the Mic-O-Matic needs is to be able to decode the keys from the HM-133 to synthesize PTT, UP, DN and a few other functions.

The HM-98 and HM-133 microphones don't actually send DTMF. They send key codes to the radio, which in turn generates the DTMF tones. The microphones for the TK-931 and the DR-235T generate the tones on the microphone and gate them on to the mic audio line (the TK-981 uses it's own bizarre protocol. See the Kenwood KMC-28A page). One cog in the Propeller controller will be used to synthesize DTMF tones, which will be mixed into the audio stream.

Microphones

Icom

The Icom HM-98 and Icom HM-133 microphones are functionally identical. Currently the Mic-O-Matic controller can generate microphone key codes to control a radio, and can decode keys from either microphones. For this project, we don't actually need to be able to encode keys, since when the mic is connected to the Icom IC-208H, it will basically be a straight through connection. We may want monitor for key presses to select which radio the microphone is connected to, but that may create problems.

Alinco

The microphone for the Alinco DR-235T MkIII appears to be fairly straight forward, although DTMF synthesis is done on the mic, rather than in the radio (like the Icom_IC-208H and Kenwood_TK-981). I would like to be able to use the PIC to synthesize the DTMF tones, but since one of the two available CCP/PWM channels is used for decoding the HM-98/HM-133 data stream, this may not be feasible. It would probably make more sense to use an off-the-shelf encoder.
Although not yet reverse-engineered, it appears that the micro-controller on the Alinco mic is using a UART port. This implies that it's probably sending standard async data down. It may be possible to control the radio in other ways, and that's something will have to be looked into.

Kenwood

The Kenwood KMC-28A (schematic Icon-pdf.gif (54 KB)) is just plain WEIRD. It uses a pair of CD4017 decade counters, and actually appears to be measuring the current on one of the CD4017's to decide if the part is drawing current or not. After I acquire one of these mics, I'll do some testing.
I have since reverse engineered how this works, and am now in the stage of considering how best to emulate it. Unfortunately, it requires reacting fairly quickly (within a few microseconds) of the falling edge of the DM line, and may require a dedicated processor (something like a PIC12F629) to manage it.

Operation

The HM-133's FN2 button is used to select which radio the microphone is connected to. Pressing FN2+1 selects radio 1, FN2+2, radio 2, etc. Three external push-buttons may also be used to select the assigned radio.

When the microphone is assigned to a particular radio, the Mic-O-Matic (or THRICE) re-maps the microphones buttons to functions appropriate for that radio.

For the IC-208H, the control codes are passed straight through, since the HM-133 is native to the IC-208H. Pressing FN2+FN2 passes the FN2 key to the radio (the IC-208H FN1 and FN2 key programming is handled in the radio). DTMF processing is handled within the radio.

When mapped to the DR-235T, the UP and DOWN buttons are remapped to drive I/O pins that are connected to the UP and DOWN inputs, as is PTT (the IC-208H sends a command to place the radio into transmit mode, and sends another command when PTT is released). Keys which don't have equivalent functions on the DR-235T are ignored. When the microphone is not in DTMF mode, keys that are applicable to the DR-235T are remapped and sent down (A=V/M, B=CALL, C=SET, D=DIAL, *=MONI, 0=H/L, #=BAND). When in DTMF mode, the DTMF digit is synthesized on the Mic-O-Matic into the audio stream.

The TK-931HD is the most primitive. PTT is remapped to an output. DTMF is handled by the Mic-O-Matic. When the microphone in DTMF mode (the DTMF LED on the HM-133 is lit) and PTT is pressed, the Mic-O-Matic will synthesize a DTMF tone into the audio stream. When not in DTMF mode, all microphone keys are ignored.

The TK-981 is also supported, although lowest on the list. It's also the weirdest. PTT is a straight forward input. Keypad scanning is handled over a single open-collector line. The radio drives the line to a high state, then switches the like to an input and samples it to determine if the microphone is holding it low or not. See the KMC-28A page for details.

The microphone is buffered by an op-amp to present the correct impedance to the microphone element. The output of the op-amp drives three op-amps, each of which is connected to each radio. This means that the audio to each radio is always "hot". As the radios use PTT to control transmit, this shouldn't be an issue. The DTMF from the Propeller is also buffered through an op-amp and mixed with the microphone audio op-amp.

I/O Requirements

Function Type Port Notes
Programming In P31 RX
Programming Out P30 TX
EEPROM In/Out P29 SDA
EEPROM Out P28 SCL
Serial Port In Pxx Console RX
Serial Port Out Pxx Console TX
Ignition In Pxx Ignition switch sense
Ext Select In Pxx Radio #1
Ext Select In Pxx Radio #2
Ext Select In Pxx Radio #3
Quick Mute In Pxx Mutes non-selected radios
Audio Mute Out Pxx Mutes radio #1 receive audio
Audio Mute Out Pxx Mutes radio #2 receive audio
Audio Mute Out Pxx Mutes radio #3 receive audio
DTMF Out Out Pxx Synthesized by a cog
HM-133 In Pxx MICIN
IC-208H Out Pxx MICDAT
IC-208H In Pxx Power presence detect
DR-235T Out Pxx PTT
DR-235T Out Pxx MR
DR-235T Out Pxx UP
DR-235T Out Pxx DOWN
DR-235T In Pxx Power presence detect
DR-235T Out Pxx Ignition sense input on radio
TK-981 In/Out Pxx DM
TK-9x1 Out Pxx PTT
TK-9x1 Out Pxx Power switch signal
TK-9x1 Out Pxx Hook signal
TK-9x1 In Pxx Remote control RX
TK-9x1 Out Pxx Remote control TX
TK-9x1 In Pxx Power presence detect
LED Out Pxx General indicator

Total pins: 32

Cog Utilization

  • Application/Console (SPIN)
  • Overview
This is the top-level process that handles key presses coming from the HM-133, determining which radio the keypress gets routed to, remapping of the keys, etc. Other functions include watching for the external radio select buttons, quick-mute button, power management, DTMF synthesis, etc. It is also responsible for initial system configuration. This cog runs continuously.
  • Methods
    • (none yet)
  • HM-133 (PASM)
  • Overview
This cog listens for traffic from the HM-133. When a key is seen, it puts it in the queue and notifies the dispatch cog. It also parses the control fields of the key, which are PTT, 1st, DTMF, and FUNC. These states are made available through a method interface. This cog runs continuously.
  • Methods
    • Clear queue
    • Get character from queue
    • Peek character in queue
    • Get PTT state
    • Get DTMF state
  • IC-208H (PASM)
  • Overview
Sends a passed key to the IC-208H. No other support is needed for the radio, since PTT, DTMF generation and function keys are all handled within the radio itself. This cog is started when the IC-208H is selected, stopped when deselected.
  • Methods
    • Send key
    • Return busy status
  • DR-235T (SPIN)
  • Overview
The DR-235T does not synthesize DTMF tones in the radio like the IC-208H and TK-981 do. This is handled by the EMS-57 microphone. A switch on the mic determines if a DTMF tone will be generated when a key is pressed (and PTT is down), or if a keycode will be sent to the radio. Keycodes 1-9 start the entry of a frequency, assuming the first key is a '2' (for 220Mhz radios. For the DR-135T it's '1', and for the DR-435T it's '4'). Keys A, B, C, D, *, 0 and # cause the radio to change power, dialer memory, etc. The interface to the radio is standard serial, 9600/8/N/1. See the EMS-57 page for details. This cog could be started when the DR-235T is selected, and stopped when deselected.
  • Methods
    • Set UP key state
    • Set DOWN key state
    • Set PTT state
    • Send DTMF digit
    • Send keycode
  • TK-931 (SPIN)
  • Overview
The TK-931 is fairly primitive as far as control via the microphone goes. Basic functions are set and release PTT, and send DTMF digit. There is also a method to set the power state of the radio so an auto power-off feature can be implemented by Mic-O-Matic. Remote commands are sent as standard serial, 9600/8/N/2. The TK-931 protocol is under NDA and cannot be detailed in a public document. This cog could be started when the TK-931 is selected, and stopped when deselected.
  • Methods
    • Set power state
    • Set PTT state
    • Send DTMF digit
    • Send remote command
  • TK-981 (SPIN)
  • Overview
The TK-981 methods allow setting the power state of the radio (to implement an auto power-off feature), setting the PTT state, and sending a keypad character. The radio handles DTMF synthesis internally, so the DTMF cog is not used. The effect a keypad character depends on whether PTT is pressed or not. Remote commands are sent as standard serial, 9600/8/N/2. The TK-981 protocol is under NDA and cannot be detailed in a public document. This cog could be started when the TK-981 is selected, and stopped when deselected.
  • Methods
    • Set power state
    • Set PTT state
    • Send keypad character
    • Send remote command

Processor Candidates

Initially I was waffling between using a PIC and an ARM processor. I have tool chains for both, but while I hate PICs, they're cheap, easy to program, and come in DIP packages, which is handy for prototyping. The ARMs are appealing for the larger amount of memory, better compilers, and not being a PIC, but it seemed like massive overkill. The Cortex M0's had a lot of appeal also, but lack a DAC channel. A DAC can be implemented with PWM, but a real DAC has some advantages.

Then I had the happy accident of running across this post, a CP/M emulator in a matchbox. I ordered one, and while waiting for it to arrive, started reading all the Parallax Propeller documentation. This got me hooked on using it for the Mic-O-Matic.

Below is list of processors I had considered with some (very) brief reasoning:

  • Parallax Propeller - Most likely candidate due to DTMF synthesis ability
  • PIC18Fxxxx - Already have PIC code written, but none have a DAC channel for DTMF
  • LPC2142 - Experience, tool chain, but overkill
  • LPC2132 - LPC2142 without USB, 64K flash, may be overkill
  • LPC1754 - Cortex M3 core, but does it have enough timers? (product page) (cheapest)
  • EFMG230F32 - Cortex M3 core, but has 16-bit timers (may not be a problem)
  • EFMG200F16 - Cortex M3 core, but only has 2 16-bit timers
  • Cortex M0 - Any parts have a DAC channel?

Notes

  • Should there be external switches to select the radio, in addition to the FN2+(1|2|3) selector?
  • Should the audio amplifier be integrated, and if so, should there be a 'Quick Mute' function to mute the non-selected radios?
  • Should it include the auto-off function for controlling the TK-931/TK-981 ignition leads, and faking out the DR-235T?
  • Possible amplifier candidates:
  • Articles on padding speaker inputs down to line-level inputs

Documents, Schematics, Etc