"Breaker breaker , any takers? This is the the one and only Delchi hunting for bear on I-95 South , keeping that double nickel and keeping the sunny side up & the greasy side down! We gone!" 1
I was looking for some new gaming frontiers when I came across truck simulators! All the skill & thrill of a big rig from your PC. As with all simulators there are button boxes and realistic cockpits to buy, but one thing I didn't see was a CB radio mic! They expect us to use desktop mics, headsets or some other hoo-haw instead of the ol jabberjaw microphone! A little deeper digging showed that you can buy adapters, but they ranged from $180 to $300! ( Granted the $300 one is an awesome button box and has a lot of realistic controls along with the mCB mic.)
Well the first thing I did was say "Belgium" to that, and pulled Rolling Thunder across the room to my workbench and got to work. This was going to be a project that would work with Truck simulators, sub simulators and more! Grab that soldering iron, the wire clippers and that drill over there! It's time to start making!
1. CB radio jargon was around long before IRC , and was its own language designed to obfuscate communication and have a grand ol time. "Handles" were common, and yes CB radio handles are where the hacking community got the term handles for hacker aliases!
Translation? Why not ?
- "Breaker breaker , any takers?"
- In cb radio ( less formal than ham radio ) it was common to ask permission before talking on an open channel. Calling for a "break" was like requesting permission to chime in , and was normally answered with "Go ahead breaker"
- "This is the the one and only Delchi"
- Handles were a point of pride and very often unique, but when they did collide they politely adjusted to be like "The New Orleans Joker " vs "The Chicago Joker" and so on.
- "hunting for bear on I-95 South"
- Truckers took great lengths to avoid being caught by the police in speed traps. "Smokey Bear" referred to the Smokey The Bear hat most often worn by police patrolling the interstates. If you were hunting for bear that meant you were on the lookout for police, and sometimes were asking for a "Smokey report" if anyone had seen any police. You usually followed this with the interstate you were on and the direction you were traveling and sometimes the mile marker you had passed most recently.
- "keeping that double nickel"
- This referred to the speed limit of 55 miles per hour that was enforced back then. Sadly there is no clever phrase for the 65 mph speed limit.
- "keeping the sunny side up & the greasy side down!"
- Multiple meanings here, but for the most part this meant keeping your truck upright ( sunny side was the cabin, greasy side was the road ). It was like wishing someone safe travels and no accidents.
- "We gone!"
- When a conversation ended people would signal this with a number of phrases like "we gone" , or "On the side". Sometimes it also included the "10-code" messages such as "10-10 Till I see you again"
- Truck Simulator
- Button Box
- 10- Code & other jargon
So then at the workbench with graph paper and pencil in hand ( or Lucidchart if you will ) let's determine what we need to make this CB mic project roll down the road :
- Utilizing a CB Microphone
- Be able to attach the microphone to the computer
- Be able to use the button on the microphone to activate the PTT ( Push to talk ) feature on the computer / in game
- Make it look realistic!
- Make it as clean as possible ( minimum number of wires / software / configuration )
So after thinking it over for a bit I came up with the parts needed to make this happen :
- CB Microphone
- CB mic with 4 Pin male plug
- Microphone adapter - CB 4 pin to 1/8" MIC IN
- CB 4 pin female plug
- 1/8" MIC IN in cable with bare wire on one end
- PTT signal adapter
- Adafruit QT Py RP2040 ( Part # 4900 )
- Adafruit USB type A to type C cable - 6" ( Part # : 4472 )
- Adafruit Half Size Breadboard ( Part # 4539 )
- Project Box :
- USB Hub
- USB Soundcard
So now we have to go exploring as to how we will connect these microphones to the computer. First off we know that most computers come with a built in sound system ( we used to call it a sound card when they didn't come with them ). There is a AUX input and a MIC input. Seems simple enough, right? So now all we need to know is the pinout for the 4 pin connector. Quick! To the internet!
So we now know that pin 1 is ground, pin 2 is the microphone element, and pin 3 is the PTT button.
Take care to note that pin 2 is connected to the microphone element, which means this is best suited to go into the MIC IN on the computer and not the AUX IN port. AUX IN is designed for connecting to AUX OUT on another device. For more info google up "Mic level and line level".
So with a handy soldering iron and some wire , we will make the following connections :
- Microphone plug
- Two wires from pin 1
- Wire #1 : to negative on the 1/8" MIC IN plug
- Wire #2 : to be attached to the QT Py GND pin
- One wire from pin 2 to the positive on the 1/8" MIC IN plug
- One wire from pin 3 to be attached to the QT Py A0 pin
- Two wires from pin 1
Don't connect any wires to the QT Py just yet. It still needs to be set up.
The next challenge is getting the PTT signal to the computer. As it stands the PTT switch on the microphone not only closes the circuit on pin 2, enabling the microphone, but it also closes the circuit on pin 3 to let the radio know the microphone is in use and to start transmitting.
This means that we need pin 3 and pin 1 connected as a switch to know when the microphone is in use & send a signal to the computer that emulates pressing the hot key on your keyboard to let the game know that the microphone is in use. For this we will be using the Adafruit Adafruit QT Py RP2040.
The first step in doing this is to acquire the QT Py 2040, then solder the header pins on it, then attach it to the breadboard.
After doing that bit of fun, head on over to the most excellent tutorial on how to install circuitpython on the board at https://learn.adafruit.com/adafruit-qt-py-2040/circuitpython.
Once you have that completed, use your editor of choice ( I chose the MU editor ) and drop the following code into the QT Py :
import board import keypad import usb_hid from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode pins = [board.A0] buttons = keypad.Keys(pins, value_when_pressed=False) keyboard = Keyboard(usb_hid.devices) event = keypad.Event() print("listening") while True: while buttons.events: buttons.events.get_into(event) if event.pressed: keyboard.press(Keycode.SHIFT,Keycode.F2) print("PRESSED") else: keyboard.release(Keycode.SHIFT,Keycode.F2)
Make sure to replace the keystroke you need to send to the game in the code. In the example above I used because it's an out of the way key combo, but I had to set that as the PTT key in the game as well.
Change the value to what you like in these two lines :
Nothing could be easier, thanks to the breadboard! Take a good look at the QT Py board and you will see the pins related to GND and A0.
In the following photo A0 is on the left, and GND is on the right. Follow the wiring diagram above and if you feel the need, use a hot melt glue gun ( like I did ) to secure the wires on the breadboard. It's not cheating, I promise!
With all the wires connected you should see the messages generated by the PRINT statements in the MU editor when you press the button on the CB microphone.
A few pointers if it doesn't work :
- Check your soldering joints on the header pins ( I made a mistake here )
- Check the connections at the breadboard ( That's why I hot glued them! )
- Check your soldering connections at the 4 pin plug ( I made a mistake here )
OK so now is about the time where something goes wrong, right? We have working code, working gear , what could go wrong? Well talking with some people I found that I had overlooked a few things :
- What if I already have a microphone in the MIC IN jack?
- The volume controls on Windows are evil for MIC IN
- I don't want two cords coming out of the project box, just one! I have enough wires already!
- How do I easily reprogram the QT Py if I need to?
These are all good points, and after doing some thinking I came to an interesting solution.
Instead of going directly to the MIC IN on the computer, and running two cables to the PC ( USB and MIC IN ) I changed the design to use a small unpowered hub, a small USB sound card, and one extra USB cable. This solves all of the problems at once!
A quick redesign lead me to this prototype :
( Apologies to you folks in Canada ;) )
So next we put the whole shooting match in a box. This is where you , the gentle reader , have to make some decisions on how you want your project to look. For me I chose to use a large box because I had an extra microphone that I managed to get working by getting a swap-meet microphone adapter for powered Motorola mics. This was not a plug & play solution and was a bit of a challenge. This will be explained in another project.
So I found a rather large box, measured and marked it with a grease pencil, drilled some holes for mounting the plugs, and added a gasket for the USB cable that leads to the computer. A little hot melt glue and some trial & error later I had a mounted project!