CB Mic to PC ... part one

 At first I tried to come up with a reasonable adapter that was designed for this purpose. That lead me to the Google search that lead me to smart PTT. 

( Vocab : PTT == Push To Talk ) 

Smartppt makes a device that adapts the Motorola microphones with RJ45 connectors to the PC. It's meant to work with their software that is a large scale dispatch system. 

https://support.smartptt.com/hc/en-us/articles/201693771-Microphone-Connector

Lucky for me I had just such a mic on hand : 


The mic in question : Motorola HMN3008A


There are a few problems with this unit and our use case : 

  • Cost ( $120 )
  • No documentation useful for reverse engineering
  • No documentation for use outside of expected software 
  • Hard to find / get ahold of

Eventually I did get one in hand, and it was basically a white box with a female RJ45 on one side, and a USB & 1/8" male audio plug on the other. 

Initial experimentation with this box showed that

  • The USB was recognized by windows as a UART USB to SERIAL adapter. 
  • The 1/8" audio plug did pass microphone audio , and if you plugged it in to a MIC in it worked well, but the PTT feature did not work. 
<INSERT A LOT OF RESEARCH HERE> 

It turns out that the USB part of the box uses a Prolific chip to do USB to SERIAL. This was discovered when I applied DEVICE MANAGER to the task of finding the white box. 

Small note about Prolific - they have a sense of humour. For example when they found that their chips were being illegally produced and sold under cost they adapted their legitimate chips to communicate with the driver so that fake chips would not work with the official driver, and you were told as much. Likewise with the chip in the white box the driver told us that the chip was EOL and not supported anymore. 

( Vocab : EOL == End Of Life ) 

So in the end ( after some research ) I rolled back the Prolific driver to version 3.3 and the white box was recognized and worked with windows, and appeared as COM10. 

The only problem was that there was no data flowing down the line via the assigned COM port when the white box was plugged in. I tried using various serial communication software , but none of them showed any indication of data from the white box.

Enter Older freeware to the rescue!

From a suggestion from a Reddit user, it was suspected that the white box was sending a CTS signal and that my newer fancy pants terminal software was not indicating that part of the protocol. 

( Vocab : CTS == Clear To Send )

I grabbed an old terminal program called CoolTerm that registered serial connection protocol status with graphic indicators. 




So it turns out that when you press the mic switch the white box sends a serial CTS signal down the wire, which the software that SmartPTT sells will recognize. 

This is great, but it does not bode well for use with modern gaming software. 

So what we have to do to make this work : 
  • Open COM10
  • Listen for CTS
  • Send keyboard shortcut key to PC
  • In game, map shortcut key to PTT key for the game
So let's go to Python! 
----------------

import serial
import pyautogui

# Init Variables
previous_cts = False

# Stops pyautogui from exiting if it detects mouse in corner of screen
pyautogui.FAILSAFE = False  

# init serial port. 
ser = serial.Serial()
ser.port = "COM10"    # change to com port you are using
ser.baudrate = 1152000

# Open the serial port, fail if it can't be opened.
# Make sure it's the right one ( device manager -> ports ) 
# And it's not in use by any other programs ( testing )
try:
    ser.open()
except Exception as e:
    print("Error: " + str(e))
    exit()



try:
while True:
current_cts = ser.cts
if current_cts != previous_cts:
if ser.cts:
print("CTS is on")
pyautogui.keyDown("q") # Change as needed for PTT keyboard key
else:
print("CTS is Off")
pyautogui.keyUp("q")   # Change as needed - same key as above
previous_cts = current_cts

# Pressing ^c will stop the program and close the connection to the COM port.
except KeyboardInterrupt:
    ser.close()
    print("Serial port closed.")

---------------

So now ... we plug the 1/8" male plug into MIC IN , configure the above Python program for the desired hot key , configure the gaming software for the chosen hot key & microphone input and ....

HUZZAH! It works! 

Key the mic, Python script sends the hotkey, game gets it , and you are one step closer to being a real simulated trucker! 

Can this me improved? You bet it can! Taking what we have learned here I plan on improving this : 

  • Better price point
  • Use only one cable
  • Ability to use other microphones ( some classic use 4 pin not RJ 45 ) 
  • Better PTT service

Stay tuned for part two! 


Comments

Popular posts from this blog

Flipper Zero and TouchTunes ... the great mystery

Home Stretch!!

Prototype! Breaker Breaker any takers ?