MIM Module version 1.07a                    22 Apr 1999
=======================================================
APRS Engineering LLC    Email wb4apr@amsat.org
115 Old Farm CT
Glen Burnie, MD 21060.

NOTE: Firmware for MIM module v1.07a and MIC Encoder
v1.04 are combined into one microcontroller.  Additional
hardware to interface the MIM to one's microphone is
required for MIC Encoder operation depending on features
desired.  THe minimum is just 1 diode and 2 resistors...

New features in MIM module v1.07a and MIC Encoder v1.04:
(1) Selection of ANY NMEA sentence for transmission (and
      wildcards for multiple sentences.  $GPRMC preferred).
(2) Special "RAW mode" message formats for position
      reporting intervals less than 3 seconds.
(3) Message intervals selectable down to 1 second.

I.  Description.  The MIM module is an APRS, packet radio
telemetry unit.  When attached to a suitable transmitter,
the unit sends GPS position reports, telemetry data, a beacon
text message and CW ID at user-selectable time intervals.
It can use digipeater paths with as many as eight hops.  The
unit accepts GPS data in NMEA 0183 format for position
reporting and can telemeter five A/D inputs (8-bit
resolution) as well as eight bits of digital input. 
Through the use of configuration software "MIC107.EXE,"
the user is able to customize call signs and other
parameters.  An on-board EEPROM stores configuration
information indefinitely and "MIC107.EXE" can be run as
often as needed to change settings.  An on-board voltage
regulator accepts power from an unregulated 6.5-40 VDC
source (or it may be run from a regulated 5 VDC source). 
The regulated voltage is also available for other
applications, as less than 15 mA is required for the MIM
module but the regulator can supply 100 mA at +5 VDC. 
The MIM module measures 1" by 1.7" and uses surface mount
technology (except for the microcontroller which is in a
socket for easy firmware upgrades).  All user connections
use solder pads on the top of the board for easy access.

======================================================
Table 1.  Device Pinout
Pad Name       Function
=======        ========
V+             Unregulated supply (6.5-40 VDC)
GND            Ground for power and A/D and Digital
                  reference
+5             +5 VDC regulator output (or +% VDC input)
A0-A4          Analog inputs 0-4
D0-D7          Digital inputs 0-7
RXD            RS232 received data
TXD            RS232 transmitted data
HOLD OFF       RXA hold off pin
PTT            Push-To-Talk OUTPUT (open-collector NPN)
TXA            Transmit Audio
MIC GND        Ground for TXA
======================================================

II.  Technical Specification.

     Two power options are available.  Unregulated DC
voltage (6.5-40 VDC) may be supplied to V+ with GND
being the ground pin.  An on-board voltage regulator
provides a clean +5 VDC power supply to all components
on the MIM module and may be accessed through the pin
labeled "+5" for use in other portions of the user's
circuit.  The MIM module uses approximately 15 mA,
leaving 85 mA at +5 VDC available for other
applications.  Components that produce noise on the
power line should be buffered in some fashion. 
Alternately, the user may supply +5 VDC to the module
through the +5 pin.  The single ground pin, GND, is
common to all portions of the MIM circuit except the
transmit audio TXA which has its own ground MIC GND. 
This includes RS232 communications, power, and analog
and digital inputs.  The pad labeled MIC GND can be
connected to the board's ground GND by solder jumpering
pad J2.  It should remain isolated where possible, however
to avoid ground loop noise problems.

     The MIM module has 5 analog telemetry inputs, labeled
A0 through A4 which are digitized to 0 to 255 over a range
of 0 to 5 volts.  The analog channels are sampled just
prior to transmission and the A/D converter is powered
down when not in use to save power.  Source impedance for
any device connected to the A/D pins should be below 10 K
to avoid crosstalk.  Unused channels should be tied to GND
to reduce power consumption and eliminate crosstalk.

     The MIM also has eight TTL digital input telemetry
bits are provided labeled D0 through D7.  These bits have
internal pull ups and are read as logic 1 unless pulled
low.  The analog and digital inputs lines may be disabled
using "MIC107.EXE".

     The MIM RADIO transmitter interface uses connections
labeled TXA, MIC GND, PTT, and HOLD OFF.  Prior to
transmitting, HOLD OFF is sampled.  If logic low (<0.8 VDC)
is sensed, transmission will be held off.  This is
important for collision avoidance on the channel.  Once
the communications channel is clear, the Push-To-Talk
signal PTT is activated via an NPN open collector
circuit to key the transmitter and the AX.25 tones are
sent out Transmit Audio TXA.  The radio's microphone ground
should be connected to MIC GND.  When transmission is complete,
PTT is deactivated.  The single-turn potentiometer near
jumper J2 controls the signal level on TXA.  Clockwise
rotation gives maximum amplitude (there is no stop, so
if the deadband is encountered, simply turn the potentiometer
another 1/2 turn).

     Alternately, the MIM may be jumpered (J1) for Handy-Talky
(HT) operation where the TXA pin provides both PTT transmitter
keying and the audio signal, superimposed.  NOTE: When used in
HT mode with J1 jumpered, the PTT line cannot rise above 5
volts and the sense of the PTT is inverted, since the NPN
transistor is bypassed.  To correct this, the sense of PTT can
be inverted in the configuration MIC107.EXE software.
It may be safer to just not use the jumper and just add your
own 2.2 to 3.9 K PTT resistor external to the board to operate
in HT mode.  I simply combine TXA through a 100K and PTT via a
3.3k and it works fine.

    The MIM is configured with the user's callsign and other
parameters via the configuration software MIC107.EXE and the
serial port labeled TXD and RXD.  On-board transistors invert
the signal and provide over-voltage protection of the MIM 
module from the higher RS232 voltage levels received via RXD.  
The 5 volt signal sent out the TXD is satisfactory for RS232
communications over the short distances typically used
for configuring the module.  Similarly, the RXD connection is
only used to receive data from a GPS receiver whose NMEA output
is also 0 and 5 volts.  The RXD data is also used by the 
MIC107.EXE program to read back the configuration stored in
the MIM EEPROM.  This readback is not essential, however.

NOTICE!  Some PC serial ports may be not work reliably
with only these 0-5v signals.  The PC to MIM data will
always work, meaning you can still program it in the
blind...  but sometimes the PC software may not
recognize the data from the MIM.  In this case, you may need 
to bias the TXD slightly positive or negative.  First try
a 5K pullup resistor to 5v (or 12k if 12V).  If this positive
bias does not work, you can try adding a negative offset by
inserting a 1.5 volt battery in series with the TXD data line 
from the MIM as follows:
                            + 1.5v  -
        MIM TXD *------------BATTERY-----------* PC RXD

You may even try both.  But again, data from the MIM TXD to
the PC RXD is only for readback of the configuration and is
not used or checked in normal operation.  Even if it does
not work reliably, the MIM can still be programmed in the
blind.

III.  System Operation.  Upon power-up, the MIM module
verifies that its EEPROM contains a valid configuration. 
If not, a packet is transmitted stating "CONFIG FAILED"
to alert the operator of its failed status (every 15
seconds).  The remedy for this is to first cycle the
power to ensure that the failure was not simply due to a
poor power-up condition and, if the system still fails,
to run the configuration software "MIC107.EXE".  This
software allows the module to be configured as either a
MIM module (default) or a MIC encoder with the MODE MIC
or MODE MIM commands.  The default settings are:

   --  Call sign "NOCALL-0"
   --  MIM module operation
   --  PTT active low
   --  Transmission delay = 213 milliseconds
   --  Base transmission period = 1 second
   --  GPS position reporting interval = 60 seconds (if
         GPS attached)
   --  A/D and digital telemetry interval = 60 seconds
   --  Beacon Text OFF
   --  CW ID OFF

   In MIM mode there are four AX.25 telemetry packet types 
that the MIM can send 
   -- A/D and digital telemetry data
   -- GPS position report 
   -- STATUS beacon text 
   -- CW ID (20 WPM)
  
All packet types are individually disabled or enabled 
at a user defined rate by the configuration software 
"MIC107.EXE".

   Upon power-up the MIM module enters telemetry mode,
sending packets at the set intervals stored in the 
configuration EEPROM.  The basic time period (in seconds) 
is set by the command "per <n>" where "n" is in the range 
1 to  254 seconds.  Each of the four packet types (data, 
position, beacon text, and CW ID)  is sent at an interval 
which is a multiple of this base time period.

For example, with a base time period of 15 seconds
(command "per 15"), the telemetry data message can be
set to occur every 15 seconds using the command "tele
1", the position reporting period can be set to 5
minutes using the command "pos 20", the beacon text
every 1 hour with the command "b 240", and the CW ID
every 10 minutes with "cw 40".  Setting an interval to
zero turns that feature off (e.g., "cw 0" turns off the
CW ID feature).

   The format of the position reports depends upon the
NMEA sentence chosen.  The default is $GPRMC and it is 
specifically reformatted into a shorter APRS format for
transmission.  Use GPRMC where possible, since it is  
thus more channel effecient.  Selecting any other NMEA
sentence will cause the MIM to just pass it through and
transmit it in raw form.
  
    If you set the reporting rate to two seconds or less
and select GPRMC or GPGGA, then a special packet format 
is used inorder to ensure that no data is lost.  This is
required since the GPS receiver outputs its NMEA sentences 
at 4800 baud but the MIM only transmits at 1200 baud. 
This special format appends the telemetry data to the
end of the position report, regardless of the telemetry
interval (if telemetry is enabled), so as to allow for
the most rapid message transmissions.  Additionally,
regardless of whether one or two seconds is chosen as
the position reporting interval, the MIM module sends
position reports immediately upon receipt of the desired
NMEA sentence.  For example, if you choose a position
reporting interval of two seconds and select the GPRMC
message, position reports will be sent as often as your
GPS sends GPRMC messages out -- even once per second if
that is the rate.  This is called the RAW mode.

   If no GPS fixes are received via RXD, no position
reports are sent, regardless of the position reporting
interval set with the "pos" command (except for RAW
mode).  If valid GPS data is received, it is sent when
the next position message interval occurs and has the
text "/GPS FIX" appended to show that it is current.  If
at some later time GPS data is no longer available, the
MIM will report the last fix and append the text "/LAST
FIX" to indicate an old position.  If valid GPS fixes
once again become available, they will be so indicated
by the text "/GPS FIX".  The time stamp on the GPS fix
tells when it was valid.  If configurable, GPS
communications must be set for 4800 N81 operation.  If
your GPS cannot transmit using this configuration, the
MIM module will not be able to receive GPS reports.  The
configuration  4800 N81 is the NMEA 0183 standard.


IV.  System Setup. Two basic electrical configurations
are discussed: (1) wiring for software configuration
using "MIC107.EXE" and (2) wiring for telemetry use.

Basic wiring for the MIM module when running
configuration software "MIC107.EXE" is as follows:
===================================================
-- EITHER 6.5-40 VDC to pad V+ OR 5 VDC to pad +5.
-- Ground to pad GND.
-- RS232 serial communications to MIM module
         pads TXD, RXD, and GND.
  (Note: The designation TXD and RXD -- are relative
to the MIM module and connect to the opposite label
on your PC serial port.  Thus, connect the MIM's TXD 
pad to the PC's RXD pin -- DB-9 pin 2 or DB-25 pin 3.  
Similarly, connect the MIM's RXD pad to the PC's TXD 
pin -- DB-9 pin 3 or DB-25 pin 2.  Also connect the 
MIM's GND to the ground pin of the serial connection 
-- DB-9 pin 5 or DB-25 pin 7).

In addition, if one wishes to see the AX.25 output of
the MIM module (to verify configuration), the TXA and
MIC GND pads may be connected directly to a TNC input
(through a 0.1 microF blocking capacitor if  TXA is also
connected to a transmitter).  Then using another PC
connected to this TNC, you can observe the on-air
performance of the MIM/Mic.

Basic wiring for telemetry use is as follows:
================================================
-- EITHER 6.5-40 VDC to pad V+ OR 5 VDC to pad +5.
-- Ground to pad GND.
-- GPS data (if used) to MIM module pads RXD and GND
   TXD is not used by a GPS.  But a LED via a 1k
   resistor can be connected here to indicate when the
   GPS is locked on.  In this case, the TDX line 
   flickers.
-- Connect 0-5V analog signals to pads A0 through A4.
-- Connect 0-5V logic signals to pads D0 through D7.
-- Connect radio PTT to MIM module pad PTT
-- Connect TXA on radio to MIM module pad TXA.
-- "Hold off", if implemented, to MIM module pad HOLD
OFF.  Figure 1 illustrates a suitable hold off circuit. 
RXA is the received audio.  The transistor is a 2N3904
or similar.  Other component values are:  R1=100 ,
C1=10microF, R2=100K , and C2=0.68microF.

V.  "MIC107.EXE" Configuration Software.  The program
"MIC107.EXE" allows the user to customize  the MIM
device using conventional TNC commands and store the
configuration information in an on-board EEPROM.  This
EEPROM has an erase/write life in excess of 1,000,000
operations.  A three-wire communications system is
employed as noted in the prior section.

    The software communicates with the MIM module using
either COM1 or COM2 (4800 baud, N81, since that is also
the standard used for GPS communications).  The program
is executed from the DOS prompt with the command "mic107
[1|2]", where either 1 or 2 is used depending upon the
serial port connected.  If no argument is given, the
program checks both COM ports (first COM1, then COM2)
for an active MIM module.  Upon running "MIC107.EXE",
the software first queries the MIM module to find its
current configuration.  If the MIM module is not
attached or is powered down, a default screen will
appear and the message "Comm Link FAILURE" is displayed
in the upper right corner of the screen..  

If a powered-up MIM module is found, its current 
configuration is displayed.  Additionally, 
if the MIM module was transmitting when the configuration 
software was started, it will cease transmitting until 
the unit is reset (by software or hardware).

If the MIM was not powered-up when you started MIC107,
then simply attach the communications cable, power
the module up, and either execute the "com" command
which will search for the active device.  If the COM
port is known (e.g. COM1), issue the command "com 1". 
Or, if the correct COM port is already selected, the
"disp" command will read and display the current
configuration.  The message "Comm Link OK" is shown once
communications are established.  At this point, the user
may wish to change one or more of the parameters and
download the new configuration to the MIM module using
the command "perm" (short for PERMANENT).  The
configuration, once stored, remains valid until changed
by the user.

   Parameter changes which have not yet been downloaded
to the MIM module are shown in blinking or grayed text
(select this option with the "blink" command).  If
communications fail while performing a "perm" command,
the parameters will no longer flash on the screen, but
neither can one be sure that they were successfully
received and stored by the MIM.  Try executing the
"perm" command again to re-establish communications and
store parameters.  It is a good idea to execute the
"disp" command after sending new parameters to ensure
they were correctly downloaded.

   Figure 2 shows the primary run-time screen of
"MIC107.EXE".  Only the capital letters beginning each
command may be used and the program accepts both upper
and lower case characters.

   When operating in MIM mode, any NMEA sentence may be
selected and will be sent "as received" from the GPS
receiver.  As noted before, the $GPRMC is sent in a 
condensed APRS format for a shorter packet.  Any other 
NMEA sentence will be transmitted in itw much more 
verbose raw format.  For example, to select the GPGLL 
sentence, issue the command "str GPGLL".  If no argument 
is given, the default GPRMC is selected.  Wildcard 
characters (?) may also be used to select among several 
sentences.  For example, "str GP???" (or simply "str GP"
, since the
string is padded with "?" characters) will cause the MIM
module to send ALL NMEA strings.  There is, of course, a
practical limitation to this feature.  Since the GPS
receiver sends its strings at 4800 baud but the MIM
transmits AX.25 packets at 1200 baud, overrun will occur
and the actual sentences which get transmitted cannot be
determined exactly.  This feature is primarily intended
for future migration to 9600 baud packet radio which
would allow all sentences to be transmitted reliably.

VI.  Example Configuration Session.  Suppose we wish to
configure the MIM module using COM1 as follows:
   --   Call sign "N3XLM-1".
   --   Via "WIDE, WB4APR-11, N3MIM-5, WIDE".
   --   PTT active low (default)
   --   Display character "A" (ASCII value)
   --   Default transmission delay.
   --   Telemetry sent every 60 seconds (= 01:00 mm:ss).
   --   GPS position report sent every 02:30 mm:ss.
   --   GPS string to use: "GPRMC" (default)
   --   Beacon Text sent every 05:00 mm:ss.
   --   Beacon Text:  "Wx Balloon, 9/30/96, N3XLM"
   --   CW ID sent every 20:00 mm:ss.
   --   CW ID Text:  "DE N3XLM"

Solution:
   Since the greatest common factor in the four
transmission periods is 30 seconds (i.e., all four time
periods are multiples of 30 seconds), we will set the
base transmission period to 30 seconds.  Note that the
10 minute interval of the CWID will not permit a base
transmission period of less than 20*60/254 = 4.72   5
seconds since CWID can be at most 254 times the base
transmission period.

(1)    Run "MIC107.EXE" from the DOS prompt (C:>) with
the command:   "mic107 1 <cr>".  The symbol <cr> means a
carriage return (or enter key) and the quotes ("") are
not typed.

(2)    From the "cmd:" prompt, enter the following
commands:
   cmd: "myc n3xlm-1 <cr>"
   cmd: "via wide, wb4apr-11, n3mim-5, wide <cr>"
   cmd: "ptt 0 <cr>"
   cmd: "mys A <cr>"
   cmd: "txd <cr>"
   cmd: "per 30 <cr>"
   cmd: "tele 2 <cr>"
   cmd: "pos 5 <cr>"
   cmd: "str GPRMC <cr>"
   cmd: "b 10 <cr>"
   cmd: "bt Wx Balloon, 9/30/96, N3XLM <cr>"
   cmd: "cw 40 <cr>"
   cmd: "cwi DE N3XLM <cr>"
   cmd: "perm <cr>"
   cmd: "disp <cr>"
   cmd: "reset <cr>"
   cmd: "q <cr>"

   Note that the CW ID text is not case-sensitive but
will be converted to upper-case for display.  Beacon
text can be upper or lower case, as desired, and will be
transmitted as such.  The software reset is not
necessary if the unit is going to be powered down and up
before use.  The first timeout period for each enabled
message type (and hence, the first transmission) occurs
one second after reset (software or hardware).  The
telemetry message looks as follows:
   T#000,aaa,aaa,aaa,aaa,aaa,dddddddd, MIM v1.06

The three digits following the "T#" are the message
sequence number (000-255).  This number increments to
255 and then rolls over to 000 and continues.  The five
groups denoted "aaa" are the five analog data channels
displayed in the range 000-255 (ASCII BCD).  Channel A0
is the first group and A4 the last.  Similarly, the
symbol "dddddddd" represents the eight bits of digital
data, with D7 sent first.

   As an example of the analog data sent back, if A/D
channel 1 read 3 VDC (of a maximum 5 VDC), the
transmitted value would be (3/5)*255 = 153.

   The message stream would look as follows (with the
time of arrival after reset shown):

TIME 00:00 mm:ss
   N3XLM/1>APRS, WIDE, WB4APR-11, N3MIM-5, WIDE:
   @072914h3858.88N/07629.17WA270/031/GPS FIX
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#000,127,031,056,198,227,11010111, MIM v1.06
   N3XLM/1>APRS, WIDE, WB4APR-11, N3MIM-5, WIDE:
   Wx Balloon, 9/30/96, N3XLM
TIME 01:00 mm:ss
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#001,129,031,045,108,226,11010111, MIM v1.06
TIME 02:00 mm:ss
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#002,133,032,044,105,227,00010111, MIM v1.06
TIME 02:30 mm:ss
   N3XLM/1>APRS, WIDE, WB4APR-11, N3MIM-5, WIDE:
   @073144h3858.88N/07630.83WA270/031/GPS FIX
TIME 03:00 mm:ss
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#003,132,032,041,106,226,00110101, MIM v1.06
TIME 04:00 mm:ss
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#004,132,032,041,106,226,00110101, MIM v1.06
TIME 05:00 mm:ss
   N3XLM/1>APRS, WIDE, WB4APR-11, N3MIM-5, WIDE:
   @073414h3858.88N/07632.49WA270/031/GPS FIX
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#005,133,031,040,108,222,00110111, MIM v1.06
   N3XLM/1>APRS, WIDE, WB4APR-11, N3MIM-5, WIDE:
   Wx Balloon, 9/30/96, N3XLM
TIME 06:00 mm:ss
   N3XLM/1>APRTLM, WIDE, WB4APR-11, N3MIM-5, WIDE:
   T#006,133,031,040,108,222,00110111, MIM v1.06

If a GPS unit had not been attached, the GPS messages
would not have been sent.  The characters in the GPS
message have the following meaning (looking at the 02:30
mm:ss transmission).  The characters "073144h" are the
time stamp (hhmmss) in GMT.  "3858.88N" is the latitude
(ddmm.mm N/S) and "07630.83W" is longitude (dddmm.mm
E/W).  The display character is the "A" and the course
and speed are given by "270/031" (degrees/knots). 
Finally, the fact that this is a current GPS fix is
indicated by the words "GPS FIX".  Had this been an old
fix, the text "LAST FIX" would have been sent.

VII.  Message Formats.  Depending on the position
reporting interval chosen and the NMEA sentence
selected, the position report may have various formats.

RAW mode (Position reporting interval 2 seconds, MIM
mode selected, GPRMC or GPGGA sentence):

GPGGA sentence:

   213714Z3916.26N07644.20W,NUL,VTG,36M,T#071,002,094,
       ... 226,035,112,11111110
   <time>Z<latitude><longitude>,NUL,VTG,
   <altitude, meters>M,<telemetry message>
or

   NO GPS FIX,T#071,002,094,226,035,112,11111110
     (if GPS indicates no fix)

   The fields "NUL,VTG" are place holders for later
implementations when the GPVTG sentence will be parsed
for speed and course.

GPRMC sentence:

   213713Z3916.26N07644.20W,000,360,T#017,002,094,226,
       ... 035,112,11111110
   <time>Z<latitude><longitude>,<speed, kts>,
   <course, true>,<telemetry message>
or
   NO GPS FIX,T#017,002,094,226,035,112,11111110

Note that for RAW mode, these combined position and
telemetry messages are only sent if a GPS receiver is
attached and sending NMEA data (even if no fix has yet
been obtained).  If a powered GPS receiver is not
attached while in RAW mode, the regular telemetry,
beacon, and CW ID transmissions will occur at their
scheduled intervals.

NORMAL mode (Position reporting interval>2 seconds OR a
message other than GPRMC or GPGGA is selected):

GPRMC sentence (interval>2 seconds):
   @073414h3858.88N/07632.49WA270/031/GPS FIX
   @<time>h<latitude>/<longitude>
    <display character><course>/<speed>
or
   @073414h3858.88N/07632.49WA270/031/LAST FIX

Other sentence (e.g., GPGLL):
   $GPGLL,3916.265,N,07644.206,W,142040,A/GPS FIX
or
   $GPGLL,3916.265,N,07644.206,W,142040,A/LAST FIX

   Note that the sentence is sent "as received" from the
GPS receiver, but without the asterisk (*) and check-sum
which normally appear at the end.  Instead, the text
"/GPS FIX" or "/LAST FIX" is appended to indicate the
currency of the information.

VIII.  Context-Sensitive Help.  Help for "MIC107.EXE"
commands is obtained by using the command "h <cmd>"
where <cmd> is the command identifier (the capital
letters for that command).  The program will respond
with a help screen corresponding to the command in
question.  For example, to inquire about the "perm"
command, type "h perm <cr>".
