Simple remote numeric keypad with ATmega88

Numeric keypad for radio control
Numeric keypad for radio control

Introduction

For my 40m DC receiver I wanted to have a 4×3 keypad to control the receiver. of course a large number of buttons could be added to the receiver directly. This would make the receiver front panel much larger, however. My intention was to keep the receiver quit small so I could easily take it with me. Therefor I decided to add a remote keypad much like the Lowe HF-255 series of receivers.

The remote keypad, K-225, uses a two-wire serial link to communicate with the receiver. Key depressions are converted into an asynchronous PPM (pulse position modulation) data stream… each key is uniquely represented by a 5-bit word which is send whilst the key is held down. Power for the keypad unit is also sent down the two wires and data is transmitted by current modulation of this supply.
….
Each key code is transmitted as a series of six current pulses. With the five time intervals between the pulses changed according to the data. The time between pulses may be either 3.15ms, representing a ONE, or 2.1ms, representing a ZERO. These time are in the ratio 3:2, with the pulse width being about one sixth of the ZERO time ie 350us. The 5-bit key code consists of a ONE followed by the 4-bit key code shown in the table below”

Key Data code
D3 D2 D1 D0
No key pressed No data pulses
0 0 1 0 0
1 1 0 1 1
2 0 1 1 1
3 0 0 1 1
4 1 0 1 0
5 0 1 1 0
6 0 0 1 0
7 1 0 0 1
8 0 1 0 1
9 0 0 0 1
Cancel (*) 1 0 0 0
Enter ( #) 0 0 0 0

Not shown in the table above is he ONE start bit that is preceding every data code. Thus to send the key code ‘6’, the bit pattern is 1-0-0-1-0.

Keypad transmitter circuit

The original circuitry of the K-225 uses the Plessey SL490DP IR transmitter IC. Plessey semiconductors has been sold of a long time ago and the SL490 has been end-of-sale for an even longer time. Luckily enough the IC can easily replaced by a low-end microcontroller.

The ATmega88A is an overkill for this application, both in flash size and in the number of pins needed. It was leftover from a previous projects and was the first one I came across in my microprocessor drawer…

PD5-7 are used to connect the column lines 1 to 3 on the keypad. PC0-3 are used to connect to the 4 rows. PB4-6 and the RST! pin are connected to 2×3 way male pin-header that can be used the program the microcontroller in circuit. The circuit around Q2 and Q1 is copied straight from the K-225 circuit. There is something I don’t like about this. When IC2 is not yet up-and-running, Q1 will be fully turned on via R2. The maximum start-up delay that can be configured in IC2 is circa 64ms, so it is not really a big deal. Therefor, for historical reasons, I’ve decided to leave this in place.

Keypad connection (front vs. back)
Keypad connection (front vs. back)

Construction

The keypad is build in a HBT4 enclosure from Multicomp / Farnell. A hole was made in the top of the box through which the keypad fits snugly. On top of the PCB is a female pin header that connect to the keypad. The bottom of the PCB is equipped with two 10 mm hexagonal metal standoffs. These rest on the backside of the keypad and keeps the PCB balanced. On the inside of the lid a piece of foam is glued. This keeps the PCB and keypad sandwich in place. The cable with the 3.5mm jack is connected to the PCB using a right angle male pin header.

Construction of numeric keypad
Inside view of the keypad and the enclosure.

Keypad interface circuit

The receive circuit below, comes straight from the HF-225 manual.

Keypad interface circuit - first attempt
Keypad interface circuit with NE555 as schmitt-trigger with large hysteresis

Below is the output from the keypad as recorded from the TxD pin (can you see which key has been pressed?). At the end of the cycle, I’ve found a nasty surprise, however. Because of the slow charging of C1 after the last bit, Q1 slowly gets out of conduction. At this very moment, Q1 is biased to amplify any noise signal present on Q1. This might be ambient noise or microcontroller switching noise. This cases rapid signal bouncing, ouch!

There are different solution to this. This is an excellent opportunity for me to use the good-ol’ 555 time IC once again. It has a hysteresis of 1/3 Vcc. If it is powered from 9V, this means there will be a 3V hysteresis, which should be sufficient. It has a open collector output, as well. This can be hooked up to the 5V or 3V3 logic supply without level translators.

Keypad interface circuit - fianl circuit
Keypad interface circuit with NE555 as schmitt-trigger with large hysteresis

I added R5 and D2 for the test so that a new 2nd supply was not necessary. The new TxD output is captured below. You can see the output is now very clean.

Downloads

  • Atmega88P source code (please send me an e-mail, if you would like a copy of the code).

5 comments to Simple remote numeric keypad with ATmega88

  • David Williams

    Hi,

    I would like to build a keypad for my recently acquired HF225. I was delighted to find your page with what you have built.

    I don’t need the source code as I would not know how to compile it. However would you be prepared to send me the hex file so I can program my ATmega88A device, please?

    Many thanks,
    David

    • admin

      Hi David,
      of course, you can have the hex file! Unfortunately, I don’t have a HF-225 to test it against. So even though I tried my best to mimic the results of the Plessey chips I cannot yet guarantee this…
      Nevertheless I am more than to provide the hex file.
      Kind regards,
      cor

  • David Williams

    Hello Cor,

    Thank you for your reply. Please can you send me the hex file at the email below & I will see how it goes. May take me a little time as I don’t have (yet) an ATmega88.

    Many thanks,
    David

  • Vlad

    Hello, I would like to ask David if the mentioned connection with the HF-225 receiver works for him.
    Thank you, Vlad

    • admin

      Hi Vlad,
      sorry for the late reply it has been a very busy Q4. I’ve asked David for some feedback. I’ll let you know, if I hear anything!

      Kind regards,
      cor / pa3cor

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>