Controlling a microphone keypad on ham radio.

hobergenix

New Member
I would like to use a Picaxe to control a keypad on an IC-2200H radio. Basically
I want to add remote control to the radio thru the microphone Keypad. I ran across
all the specs here http://tinymicros.com/wiki/Icom_HM-98/HM-133_Internals

The microphone has 26 buttons that are arranged in a 9 X 4 matrix that control the
radio.

I am wondering if I can just use the picaxe and interface it directly to the keypad matrix
in the microphone to mimic the pressing of each button by useing 13 io pins of a picaxe.

The microphone dose send out a data stream from the cpu in it to the radio but it is not
a standard rs-232 asci format.

Mike
 

AllyCat

Senior Member
Hi Mike,

You say you want to "control" the keypad, but the keypad is a control device, do you mean you want the PICaxe to "emulate" (or replace) the keypad, i.e. you intend to dismantle the microphone, disconnect the keypad and replace it with a PICaxe? If so, what is telling the PICaxe which commands are to be sent (emulated)?

To emulate the keypad it appears that the PICaxe would need to monitor 9 pins and when any one is "strobed" apply a nibble of four hi/low bits onto 4 output pins. This would certainly need to be done within the 1.3 ms which is described as the polling interval. That is probably at the limit (or beyond) what a PICaxe can do, even at an elevated clock frequency (32/64MHz). However, the PICaxe code might be able to "predict" the strobing because it is probably fairly regular. Also, there are some references in that data to an 8 volt supply rail, you would need to ensure that the keypad interface is 5 volts or less.

If you actually want to intercept the microphone interface cable, then that protocol seems to be described in the link. It refers to bit periods (two transistions of the voltage level) of about 500us which, at the very best, the PICaxe could only "record" that data to its memory (or transmit from memory). It appears that the data burst persists for about 20ms (40 bits) and then there is (about) a 20ms gap. That is very probably insufficient time to "process" the data in the memory.

Both of those scenarios appear to be absolutely at the PICaxe limits (or beyond) so there would probably be no resources to do whatever "background" task is responsible for the intended "control" function.

Can you clarify exactly what is the "control" function/sequence?

Cheers, Alan.
 

hobergenix

New Member
Emulate

Hi Mike,

You say you want to "control" the keypad, but the keypad is a control device, do you mean you want the PICaxe to "emulate" (or replace) the keypad, i.e. you intend to dismantle the microphone, disconnect the keypad and replace it with a PICaxe? If so, what is telling the PICaxe which commands are to be sent (emulated)?

To emulate the keypad it appears that the PICaxe would need to monitor 9 pins and when any one is "strobed" apply a nibble of four hi/low bits onto 4 output pins. This would certainly need to be done within the 1.3 ms which is described as the polling interval. That is probably at the limit (or beyond) what a PICaxe can do, even at an elevated clock frequency (32/64MHz). However, the PICaxe code might be able to "predict" the strobing because it is probably fairly regular. Also, there are some references in that data to an 8 volt supply rail, you would need to ensure that the keypad interface is 5 volts or less.

If you actually want to intercept the microphone interface cable, then that protocol seems to be described in the link. It refers to bit periods (two transistions of the voltage level) of about 500us which, at the very best, the PICaxe could only "record" that data to its memory (or transmit from memory). It appears that the data burst persists for about 20ms (40 bits) and then there is (about) a 20ms gap. That is very probably insufficient time to "process" the data in the memory.

Both of those scenarios appear to be absolutely at the PICaxe limits (or beyond) so there would probably be no resources to do whatever "background" task is responsible for the intended "control" function.

Can you clarify exactly what is the "control" function/sequence?

Cheers, Alan.
I do not want to read the keypad but let the picaxe press the buttons remotly. I am just expiermenting.
As an example. Thru the internet or other communications I want to enter in a new fequency, mode, or
call up a memory channel, or press the transmit key, ect. The microphone has all they keys on it to control
all of the radio function on the fly.

For now I just want to expierment and have the picaxe enter in a number of programed key strokes for me.
I believe the 8V comming into the microphone gets regulated down to 5V for the CPU in the microphone.

The data from the microphone gets sent to the radio on a seperate line.

For me I am a novice at the Picaxe. Trying to emulate that data stream going from the microphone
to the radio is way over my head. My hat is off to the person that wrote all that information in the
link on that Wiki.

Mike
 

hippy

Technical Support
Staff member
The best solution IMO would be to emulate the serial signal the microphone puts out; that doesn't require any modification of the microphone itself, is just a single I/O pin interface to deal with, is no more than generating a non-Sony IR code, but the timing required is on the fast side for a PICAXE. I think it should be possible with a 20X2 at 64MHz.

Whilst it will be a challenge to get working, it is primarily a software issue so you don't have to build any hardware to start with. You would need an oscilloscope or logic analyser to check the output and get the timing right.
 

MartinM57

Moderator
The Wiki is certainly worth reading :)

"I am wondering if I can just use the picaxe and interface it directly to the keypad matrix
in the microphone to mimic the pressing of each button by useing 13 io pins of a picaxe.
I think that will be hard and involve deconstructing the keyboard, working out how it's matrix works, connection messy wiring to it etc

The obvious thing is to emulate the data stream, but it's not a simple one (see the Wiki) and even the electrical characteristics are a bit odd
"The microphone communicates to the radio over an open-collector bus. The bus idles at a high voltage of approximately 2.45V, and is pulled low to 1.95V by the open-collector driver on the microphone. The radio itself has a comparator with a threshold voltage of about 2.2V. This would seem to result it an exceedingly low noise threshold, but it does work")
and will need some circuitry outside the PICAXE to obtain

Do-able, but a pretty advanced project IMHO
 

techElder

Well-known member
And none of the electronic solutions take into account the regulatory issues of having a remote controlled radio. Better check that out, too, if you're interested in creating legal-to-use hardware.
 

westaust55

Moderator
If a hardware based option appeals then you could consider using some 4066 analog switch chips. Each 4066 has 4 switches so maybe 7 chips with a switch across each keypad switch. But then you need around 26 PicAxe outputs or some other chips such as
- 4 off 74HC138's (and about 6 PICAXE outputs) or
- 4 cascaded 74HC595 shift registers which can control all 26 keypad options with just 3 outputs.
 
Last edited:

hippy

Technical Support
Staff member
If a hardware based option appeals then you could consider using some 4066 analog switch chips. Each 4066 has 4 switches so maybe 9 chips with a switch across each keypad switch. But then you need around 36 PicAxe outputs or some other chips such as 4 off 74HC138's (and about 6outputs) or 4 cascaded 74HC595 shift registers which can control all 26 keypad options with just 3 outputs.
An alternative, to minimise I/O pin use, would be to have four analogue switches, one per column, and another nine, one per row, all 'joined in the centre' so you have to close one of each to create a key press.

That's still 13 connections having to be made to the keypad within the microphone, but only 13 control signals rather than 36 and fewer 4066's.

In both cases the number of I/O signals or 4066 could be reduced if only some of the keys were to be controlled.
 

AllyCat

Senior Member
Hi Mike,

Thru the internet or other communications I want to enter in a new fequency, mode, or
call up a memory channel, or press the transmit key, ect.
You are going to have to work out very clearly HOW you intend to do that. The PICaxe only really has a serial ("RS232") interface and even that means you'll be developing "multi-tasking" software.

Trying to emulate that data stream going from the microphone to the radio is way over my head. My hat is off to the person that wrote all that information in the link on that Wiki.
To me that Wiki looked like a model of clarity (of course I may be missing something) and IMHO that method should be far easier and better to implement using a single wire (speed is the main issue and hippy seems to think it's possible) rather than 13 connections needed to emulate the keyboard as you suggested. There are numerous "hardware" issues in connecting PICaxe pins directly to the keyboard connections (particularly if you intend to keep the original keyboard active as well) and you will definitely need an oscilloscope (and the necessary investigative skills).

As others have said above, the best solution (for you) appears to be to use "bilateral analogue switches" (consider them as tiny relays) to directly emulate the keyboard buttons. Try to find one keyboard row which doesn't need to be used and then you should be able to use 3 x 4016 (or 4066) DIL packages which each contain 4 switches. Or you could select the column with a 4052 (which has 2 x 4-way switches but I can't see how you'd use the second usefully), save two PICaxe pins and maybe get away with a PICaxe 14M2.

Note that these CMOS devices are available in various "flavours". The original "4000" series work to 15 volts but are slow (probably not an issue when used here) and have fairly high "closed switch" resistance (hundreds of ohms). The later HC and HCT versions (HCT have different digital levels which shouldn't be an issue here) work up to 5 volts and should have lower resistance with the 4066 better than the 4016 (you will still need to check what the embedded micro scanning the keyboard will tolerate).

Cheers, Alan.

EDIT: Change two 4016s to 4053s (3 x 2-inputs) and you can connect all 9 rows with ease and save a few more PICaxe pins. But actually, you only need 8 rows because you can overlay row Q0 onto Q2 or Q8.

EDIT2: I think you can do it with just two 16-pin chips, a 4052 and 4051 (1 x 8 way switch), overlaying row Q8 onto Q0.
 
Last edited:

AllyCat

Senior Member
Hi,

I've been "refining" the design (see edits above) and I think you can emulate the keyboard with just two 16-pin chips (4051 + 4052) and only 6 pins on the PICaxe (3 for row address, 2 for column and 1 to enable).

Cheers, Alan.
 

hobergenix

New Member
Comments and one question

Hi,

I've been "refining" the design (see edits above) and I think you can emulate the keyboard with just two 16-pin chips (4051 + 4052) and only 6 pins on the PICaxe (3 for row address, 2 for column and 1 to enable).

Cheers, Alan.
Thanks Alan and everybody else for all the help and suggestions.

For what its worth the microphone can be bought on ebay for about 15.00 and up. So my plan was
to buy one to hack up. First thought was to just use relays but that would take about 26. Second plan
was to use Cmos switches.

I thought maybe I could use a picaxe to monitor one of the four rows comming into the keypad and
when I saw the one I needed then to put a high signal on the corresponding column that was needed.
I was not sure if The picaxe would be fast enough to do this or if it would work.

I am realativly new to expiermenting with the picaxe. I am just learning to do simple things like turn a
pin on and off or read a pin, add a keypad or display ect.

I agree that the simplest thing would be to just send the bit stream out but for now that is way beyond
what I know how to do at this point or as some have said that maybe the picaxe might not be fast enough
to generate it.

I have one question. Can I connect the picaxe up directly to the inputs and outputs on the cpu in the
microphone. They both appear to operate at 5V. Would I need some sort of resistor in the lines for protection
of the pic or microphone cpu? I believe that the inputs to the microphone cpu have internal pull up or down resistors
internaly.

Mike
 

AllyCat

Senior Member
Hi Mike,

If you're going to leave the original keypad connected (which might help test and debugging) then definitely put some resistors between it and the PICaxe pins. It would probably be wise to use some anyway (I've no idea of the value but maybe 1k would avoid dangerous current flows).

What is currently unknown (which is why you need a 'scope) is what series resistance value will the embedded micro accept, and what is the time delay between the micro "strobing" a row and expecting to find the pulse on the appropriate column line (which normally would be almost instantaneous). I doubt if you'd get the delay through a PICaxe much below 1 ms, but the Wiki says that the total polling cycle is only 1.3ms.

Note that the (4-bit) embedded micro is generating 9 output "strobe" lines (called rows here) and reads a 4-bit wide nibble (called columns here) which is not the way that the Wiki table is laid out. So the PICaxe would need to "monitor" 9 input lines* and control 4 output lines.

Cheers, Alan.

*EDIT: The micro only generates 4 "address", lines so you might be able to pick these up on the decoder chip to save PICaxe pins (and maybe a tiny amount of propogation delay through the decoder).
 
Last edited:

hobergenix

New Member
One question Alan

Hi Mike,

If you're going to leave the original keypad connected (which might help test and debugging) then definitely put some resistors between it and the PICaxe pins. It would probably be wise to use some anyway (I've no idea of the value but maybe 1k would avoid dangerous current flows).

What is currently unknown (which is why you need a 'scope) is what series resistance value will the embedded micro accept, and what is the time delay between the micro "strobing" a row and expecting to find the pulse on the appropriate column line (which normally would be almost instantaneous). I doubt if you'd get the delay through a PICaxe much below 1 ms, but the Wiki says that the total polling cycle is only 1.3ms.

Note that the (4-bit) embedded micro is generating 9 output "strobe" lines (called rows here) and reads a 4-bit wide nibble (called columns here) which is not the way that the Wiki table is laid out. So the PICaxe would need to "monitor" 9 input lines* and control 4 output lines.

Cheers, Alan.

*EDIT: The micro only generates 4 "address", lines so you might be able to pick these up on the decoder chip to save PICaxe pins (and maybe a tiny amount of propogation delay through the decoder).

In the schematic located at the bottom of http://tinymicros.com/wiki/Icom_HM-98/HM-133_Internals#Documents.2C_Etc
It seems to show two different models in the schematic page 7 of the HM-133 mic. Am I reading this right. The schematic
on the left strobes the colums and reads the rows. And the schematic on the right strobes the rows and reads the colums.
Am I correct on this.

I guess I will just have to order one on ebay and see what model they ship.

Thanks for all the help !

Mike
 

MPep

Senior Member
Schematic for the HM-133V microphone is attached.

I don't have one to test, but you could try supplying +8V and use SERIN at standard baud rates and see what happens. Maybe something sensible can be read. ;)
 

Attachments

AllyCat

Senior Member
Hi Mike,

Your link is an "IE Cannot Display Page" for me, but the .PDF posted by MPep looks consistent with the Wiki data.

You probably need the hardware to see what connections can actually be intercepted, SMD components are not easy and sometimes whole ICs can be buried under blobs of black "compound" directly on the PCB. The "ideal" connections to do what you want purely with a PICaxe, seem to be access to R18 - R21 (Row address out) and R22 - R25 (keyboard data input).

But so much depends on the system timing, do you have any access to an oscilloscope? If you don't then it might be possible to use the PICaxe as a "data logger" but it will be much more difficult. BTW, with any strobed keyboard, bear in mind what might (or does) happen if two buttons are pushed at the same time (the need for diodes D3 - D12 rather worries me)!

Cheers, Alan.
 

MPep

Senior Member
Your link is an "IE Cannot Display Page" for me
I kept coming up with that too, so I found a schematic. Uncertain of the micro, if you can read that and the xtal frequency, look up the datasheet, and a range of baud rates may well become apparent.
I would keep trying various baud rates with SERIN (maybe HSERIN) until some sort of semblance to valid data becomes apparent. Got nothing to lose by trying, and a darn sight more to learn on the way.
 
Top