• You can now help support WorldwideDX when you shop on Amazon at no additional cost to you! Simply follow this Shop on Amazon link first and a portion of any purchase is sent to WorldwideDX to help with site costs.

Introducing the CBduino

SLR_65

Active Member
Dec 27, 2014
104
16
28
Hi Guys,

I've been having fun experimenting with my Galaxy DX-979.

I wanted to increase the frequency coverage, but I wasn't happy with the usual switches that modify the settings fed to the PLL. Mostly because I don't care for the frequencies being out of order and having to refer to a chart. I do have a matching external frequency counter, but it's still inconvenient having the frequencies scattered about.

I decided to see if there was something I could do easily to make it more convenient.

I enjoy doing small electronics projects and I've been playing with the Arduino series of microcontrollers. They're cheap, easy to program and readily available. All one really needs to do is turn power on or off to seven wires to control the PLL frequency, and turning things on and off is duck soup for an Arduino, so I decided to see if I could combine the two. I also decided to include a four line, twenty character LCD display. They are also cheap, readily available and easy to hookup and program for, and I thought it would be nice to be able to display some information, especially if one doesn't have a frequency counter.

I used an Arduino Uno as it seemed the best match for the project. I would've liked to use an Arduino Micro Pro, but the sketch is a bit large for it (that version of Arduino builds some overhead in as it can function as a USB keyboard or mouse and you can't keep it from building that overhead in) and it doesn't contain a full 8 bit port I can address quickly and easily. As I experiment I'll revisit using it, but for now I just wanted to play quickly and easily and the Uno was more than capable.

I used a four line, twenty character display as they're the only ones I purchase since they are roughly the same price as a two line, sixteen character and it seems you always need to display more than you have the capacity to.

I debated on what to use for a channel selector. The obvious choice is to use the radio's channel selector, but interfacing to and programming for it will take a little effort and again, I was simply in a hurry to play so I looked for something easier. I thought about a simple five button keypad (up, down, left, right and enter). It would be easy to move up or down a channel at a time and you could make the left and right arrows move up or down ten channels to move through them quickly very easily. The only real issue was that when you shut the radio off and turn it back on it's always going to start at whatever you hard code the starting channel to be. Not a big deal, but I just didn't like it. I finally decided that a 10K potentiometer would fit the bill. When a potentiometer is hooked up to one of the Arduino's analog inputs it will divide the 5v being supplied to it into 1,023 steps so it's very easy to simply divide 1,023 by the number of frequencies and then just say if the analog read value is between x and x generate frequency x and display it's associated text to the LCD. The bonus is that when you turn the radio off and back on you will still be on the same frequency that you last left it at. A 10K single turn pot puts the frequencies pretty close together, but it's not bad. I have a three turn pot on order though. Though expensive, they also make continuous turning pots that would allow one to cycle through all the frequencies and then start over again at the lowest frequency without having to turn back the other way when the highest frequency was reached. In my limited experiments thus far though, the single turn pot has been fine.

I didn't want to hack up my radio, why I dunno, I got it used and cheap and it's not that expensive to start with, but it's just my preference to take the least invasive approach. Everything needed is contained in the wiring harness coming from the channel selector to the main board, but again I didn't want to hack up my radio. After a little research I found the connector is a JST (Japan Solderless Terminal) PH series, 2.0mm spacing, single inline 10 pin. Unfortunately I couldn't find a source for these pre-made Stateside. I could find the terminals and housings but you need an expensive crimping tool to use them. I found some pigtails on eBay that come with the female end terminals already crimped on and in a housing. The male end is a pc solder mount, but it's easy enough to solder the other end of the leads on to it (I used liquid electrical tape to paint the exposed solder tabs). The only real issue was that the vendor was in Hong Kong and it took almost a MONTH for them to arrive! The board end of the wiring harness is under the channel selector pcb, so it's not readily accessible so I simply left it hooked up to the board and plugged the male of the cable I made into it.

The Arduino runs on 5v and the PLL on 8, so I installed a level shifter on the PLL lines (a cheap device also readily available on eBay). 10K pull down resistors were also installed between the PLL lines and ground to pull the lines to a stable normally low state.

Here's a picture of my Arduino development board. The LCD is in the upper left, the 10K pot in the top right and the Arduino Uno is in the lower right. The device in the lower left is an Arduino Micro Pro that's unused in this application.

http://www.worldwidedx.com/data/photos/l/3/3301-1422584366-ca835d6e727b2979365ef1e675c4975b.jpg

Here's a pic of the level shifter.

http://www.worldwidedx.com/data/photos/l/3/3302-1422584382-d3aa1d893f76336c0915df226054b5af.jpg

Here's a picture of the LCD display and the external frequency counter confirming the frequency. Note it displays what band you are in (in this case the lower freeband), the channel relative to CB channel #1 and the frequency.

http://www.worldwidedx.com/data/photos/l/3/3303-1422584389-3b7c467452505affb47d76bb6b0a28cd.jpg

Here's a picture of it on CB channel 1 - note the band display has changed.

http://www.worldwidedx.com/data/photos/l/3/3304-1422584396-6b099e089545bfe78c2f8ea1c588ed40.jpg

There are also channels between some standard CB channels, these channels were originally used for remote control toys and other such devices. Here's a pic showing one of those channels being tuned in - note the "a" for additional displayed before the channel number.

http://www.worldwidedx.com/data/photos/l/3/3305-1422584402-dab856ab92224dad3fc0afd628fd6ddc.jpg

Here's a picture showing the change from CB to the upper freeband at 27.4155, note again the band designation change.

http://www.worldwidedx.com/data/photos/l/3/3306-1422584411-3baa6c1e6c302b95c30e5b2c3079c8e4.jpg

This pic is just showing the top frequency. This radio is actually capable of frequencies into the 10 meter ham band, but I consciously programmed it to not go beyond 27.995.

http://www.worldwidedx.com/data/photos/l/3/3307-1422584417-cac83a6b3c84307e3e526873b1e2bb7e.jpg

This radio, and others such as the Galaxy 929, have a slightly different crystal in them at X3 so they don't go as low as other radios such as the Galaxy 959, but they go higher. Since any frequency above 27.995 is unusuable, and actually one probably should keep a few channels below to avoid any possible chance of causing interference on the neighboring ham band, the frequency spread of the 959 may be preferable. I have a crystal from a 959 on the way and will test it and report back once it arrives. The crystal change will require some tweaking to the Arduino sketch but it won't take much effort and will probably allow the CBduino to be used with the more popular 959 radios (I say probably because I don't have one to experiment with).

The project is a mess right now, just a rats nest of long wires and the such. I'll work on shortening them up. I'm hoping the Arduino can be left in the radio case, if so then one would just need to run 7 wires out of the case, four for the LCD display and three for the potentiometer. A decent quality network cable would probably be an readily available 8 conductor cable to use for this. The LCD and pot would fit in a fairly small external case.

In the future I would like:

*) To get this working with the physically much smaller Arduino Micro Pro.
*) To interface to the channel selector. I'm thinking three sets of 40 channels would work out well. The Arduinos have eeprom memory that is rated at 100,000 read write cycles, so I'm thinking a set change flag could be written to the eeprom. This would create continuous tuning with no physical channel set switches needed. We could read the channel setting and reorder the channels so they are sequential.
*) Interface to a three digit LED for channel display for radios without a frequency display.
*) I may revisit the keypad idea also, I'm thinking interesting things could be done with a 12 or 16 key keypad. Possibly a search function? Maybe monitor the speaker voltage - turn up the squelch so the speak is silent, then increment the channel and check the speaker for sound, if sound stop, if no sound then increment the channel and check the speaker again, etc.? Favorite channels could also be assigned to keys. Receive modifications, RFX amplifier on/off, etc. could also all be assigned to keys.

All in all, this could be a fun project for a while yet!

For now, I'm quite happy - the initial incarnation is working well and so far everything has been plug and play.

I'll update as I play further...any questions or comments are most welcome.

I'll post the Arduino sketch shortly after I have a little more time to bug test.

Take care,

Steve
 
  • Like
Reactions: space cowboy

It's a comprehensive and well done project but there is a reason these mods have been superseded by dds vfos, this type of mod won't make the radio tune between channels.http://www.adafruit.com/products/2045
here is a vfo for your arduino for 8 dollars that doesn't need any pll traces cut or level shifters, just pull out the crystal and hook it in. i doubt it would be any more expensive than your current approach.
and if you just remove a crystal the radio is left stock for when you want to sell it, nobody is any the wiser.
 
Nice work. I did something similar with an Arduino to replace the custom chip (IC803) in a SBE Console V. The radio has other problems, but it tunes again!

Keep going, can't wait to see what you come up with next.
 
Thanks guys! :) So far it has been a fun project!

It looks like an Arduino Mini Pro would be a good choice here and it's cheaper than an Uno and has the same amount of memory as well as enough i/o pins to accomplish what we want, however it needs a special serial cable to program and that brings the cost back to about what an Uno costs, but it's much smaller which would be nice for fitting it in the radio...I have one on the way!

I'll do a better write up along with a wiring diagram, parts list and sketch (Arduino speak for the program code) soon - got a wedding this weekend so we're kinda busy.

Fodendaf - thanks for the product link, I'll have a look! I wasn't too worried about the frequencies being in 10kc steps as I think a majority of the radios operating in these bands are converted CBs that are also using the 10kc steps. I haven't dug into this radio too far, but I imagine the clarifier could be unlocked and possibly made to shift 5kc or so, so the space between steps could probably be accessed. I also considered that the crystal that is responsible for the 10kc steps could also be changed to give 5kc steps. I just haven't given it much thought yet as I see it more as an improvement to explore later as the development gets more mature.

On one hand, I'd like to utilize the channel selector and keep everything in the radio for a nice clean look, but on the other hand, with the addition of a small external box we could probably add some significant improvements...I guess we may have to work on several flavors! :)

Thanks for the input - keep it coming, input drives development!
 
ta]ba02 - arduinos are addictive, aren't they?

I'll post a sketch tomorrow after I sober up from the reception tonight so you can play.

I'm thinking a SWR, Power meter, as well as an antenna analyzer would be doable?

I'm also headed towards my ham license, so a Hambdunion and maybe beacon software may be in the future?
 
I'll do a more Arduino newbie orientated write up soon. I'll also comment the code a bit soon too, but for now...if you're experienced with Arduinos you'll know what to do with the attached sketch! ;-)

I tried to put the code into the body of a message but it said the message was too big. I tried to upload the ino file but it didn't like that either, sooo, I printed the sketch to a pdf file - just cut and paste the sketch from it to the Arduino IDE.

Have fun - feel free to provide feedback, improve the code, whatever...I have no ego when it comes to these things and I'm not that great of a c programmer, so I 'm sure there's some way to do this code better, it's just the way I found...and IT WORKS! If you do it better then please do share with us all!

If you find bugs please let me know.

If you want it to do something different, please ask - if I have time I'll probably have no issue creating a version that does what you want.

I'm in early development stages, so this isn't optimized at all, it's simply not a finished project, so don't expect one, but if you want to play please join in, else wait a bit and we should get to a more polished mod going pretty soon.

Take care, have fun!

Steve
 

Attachments

  • CBduino V1_0.pdf
    20.2 KB · Views: 97
//************
//*Functions *
//************
void check_what_channel() {
pot_val=analogRead(pot_pin);
//
float potvar= 0;
float spacing_size=8.59;
lowe = 0;
upp = 1000;
potvar = lowe;
float pot_temp = 0;
while (potvar <= upp) {
potvar = potvar + spacing size;
channel = channel + 1;
channel_num = channel_num +1;
if (potvar >= potval){
if (channel < 1)
band = lower_freeband;
else if (channel < 41)
band = citizens_band;
else if (channel < 99)
band = upper_freeband;
return;}
}
 
I'm having trouble getting this to compile, though it's probably because I'm hungover from the wedding reception last night ;-) .

lowe = 0;
upp = 1000;

Throw up errors as their type isn't declared, they should be?:

int lowe = 0;
int upp = 1000;

and

potvar = potvar + spacing size;

Throws up an error, it should be?:

potvar = potvar + spacing_size;

and

if (potvar >= potval){

Is throwing up an error because potval hasn't been declared, I haven't sorted it yet.

Briefly looking at the code in my diminished state today, it's much smaller, but is it accounting for the additional channels between channels such as 3-4, 7-8, 11-12, 15-16 and 19-2o that I've labeled as a3, a7, a11, a15 and a19? Is it accounting for the out of sequence arrangement of channel 23, 24, and 25?

Though channels below 1 and from 26 up are sequential, from 1 to 25 we need to deal with skips and arrangement issues.

In the future it may be easier to simply upload the whole sketch rather than snippets - I think the pdf method worked, do you have a pdf print driver? If not pm me a direct email and I can send you one.

It would be very nice to reduce the size of the code - leaves room to do other interesting things! Perhaps we need to test if it's below 1 or above 25, if so use this type of compact code, if not then sort it the long way?
 
my bad, i know, it's not finished but i hoped you could tidy it up. i dont have the arduino lcd and wire.h libraries installed so i couldnt compile it, i just rushed it together in case you wanted to add bands easily. so now you know about while and if/else loops. and i've never programmed for an arduino before either.
dont use pdf's ascii text files are best for programming, i can't seem to read the small text in the arduino ide no matter what i set the font size at. i suggest that you make a free account at sizeablesend.com and upload any project files you think would be useful to it.
 
I agree pdfs aren't optimal, but it was a matter of finding something in a hurry with an extension we could upload here and it's a text searchable pdf so just selecting all and cutting and pasting to the Arduino ide works fine.

I've done if/else statements (I've even been known to use switches!), but in this case I was deferring to ease of reading...which doesn't always equate to small and compact code and I'm eventually going to want small and compact as there isn't much room in the Arduino. (i.e. I figured out what I wanted to do for one channel in a manner that was clear to me and then I just cut and pasted it for the rest of the channels...and yeah, I don't like my use of the label "channels" as it doesn't really relate to the actual channel defined later, I'll relabel that eventually....this was just for my playing, but then I thought others may want to play too).

These are fun little boards though...they're cheap, readily available and the programming language is easy enough that even tyros can usually cobble something together that works...evidenced by the fact I did! 8-D
 
Taking a look at the digital replacement option for the crystals...

First I'm wondering if there is a pressing need to be able to do less than 10kc resolution? Most radios operating in the 26 and 27 mhz bands are converted CBs aren't they? (I'm sure there are ham setups operating in this band, but I imagine most are CBs with PLL address line switches, LesComm or Farmer Dave mods) And as such they continue the 10kc channel spacing up into the freebands, don't they?

I'm just wondering if a finer resolution is worth chasing after...any and all input would be welcomed.

I don't think using this would make the project any cheaper as you still need the Arduino and I think you still need the level shifter as the specs say this is a 3 volt peak to peak device and the radio runs on 8 volts, so it only adds to the cost of the project, though it may add flexibility.

I don't think using this would make the programming any easier or smaller as it's not a simple matter to set it up for a particular frequency - it's not just increment or decrement the divisor. I think treating it as a crystal and setting it up once for a particular frequency and then subdividing it via the PLL as normal would be easier. With a couple frequency shifts the radio could do a very wide bandwidth. The next issue with that though is that once you added that wide bandwidth then the radio would need some tweaking to be able to operate wide band also, wouldn't it?

This sounds like a very nice option for converting these units to the ham bands though as that frequently requires crystals with odd frequencies that are expensive.

As far as molesting the board as little as possible, this item would require desoldering the crystal and soldering this in, my current mod can be done with no board modifications at all, you just modify the wiring harness - and I'm using a harness extension, so I don't even cut the stock wiring harness. I can simply unplug my mod and I'm back bone stock.

I think it's an interesting option, and I've got one on the way, but I don't think I'm going to hold up development and wait for it to get here.

I'm open to input though, am I missing something that makes this approach the more favorable one?
 
I do not know the minimum step size on that board I linked you to so I do not know then if it would be suitable as a pll replacement.
The programming may not be easier but with the proper use of loops it need not be tedious to maintain or repetitive to write.
There is example code provided however so you need not reinvent the wheel.
But replacing the crystal has more utility among radio conversions as many radios are difficult to convert in any other way due to the efforts of the FCC. There have been many requests for mods for the uniden 980 but they have been slow in coming. I understand they use a different frequency for the tx as for the rx and since that link i gave you has three outputs it might be no problem if you were willing to port your project to one of the arduino nano boards.
Before I saw your code I had never considered an arduino for this purpose as I thought to display text on the lcd it was necessary to build arrays to turn each pixel on and off, and then build an array for each letter or number, then go look at i/o expanders to drive seven segment displays in the cb and switches on the front panel and such.
To understand developing a replacement microcontroller it is helpful to examine points of failure or restriction in a cb. For instance the wafer switches in the front panel are subject to failure and they are unavailable new, so the switch doing the same job in your project must be easily available.
President made a line of excellent multimode radios that had dc present on the mic plug along with channel change microprocessor pins which would brick the radio if the 3 were shorted.
On another forum I read how a man had thrown a yaesu ft757 in a bin because of microcontroller failure.
That is why you should be open to new ideas, though I will not tell you your business.
If the code is not spaghetti there is less demand for memory and so there can be multiple unused functionalities within which will increase interest in your code and more contributions to it.
There have been many radios converted to homebase on the internet already, some do it to add large meters and amplifiers inside the case. Many have added dds vfos but most have not released their code.
So if you want you can grab some lofty ideals and go overboard, make a homebase case with numberpad, meters, vfo dial based on a small alternator( featured on hackaday) and have analog microcontroller inputs to every knob on the front panel, because that's how many hf radios do it, you can tune to birdie frequencies and hear the noise they make as they signal. you could buy up these fried radios and fit them in your case and sell them on as boutique items.
You could build separation kits for any radio, just remove the front panel, cut 40-50 wires, wire the front and back panel into an arduino each and signal all that analog data over a few serial wires.
There are lots of things you could do and make money doing and selling what you love. I don't have the patience for that but I will try to chip in every now and again.
 
Please don't take offense, none was intended, I was just thinking out loud.

The synthesizer board you linked to is interesting, and I have one on the way, but for what I'm doing right now I don't think it's really necessary. I have a Temp One I've recently repaired and have been using to monitor these frequencies, and it appears that most traffic is on 10kc steps. It's kind of interesting, in my limited monitoring it seems the upper freeband is more geared towards DX and the lower seems like more local traffic from the southern states. The upper band seems more SSB orientated and there's both AM and SSB on the lower. I may be wrong, it's just been limited monitoring. One other interesting observation, back in the day it seemed the lower sideband was preferred, but these days it seems the upper is preferred?

I have a good handle on how the PLL is operating and it really is as simple as turning seven lines on and off to generate the frequencies I want with my particular radio. I don't have a good handle on how oscillators work and how to interface them to a microcontroller though.

When I was young the CB craze was in full swing and my older brother got into freeband dx, and consequently so did I. He bought good equipment, a full Yaesu FT-101E station. With that available I got interested in what lied beyond freeband and I got my ham ticket at 13. I had fun with it for a couple years, but at 16 I started working and had less time for it, then college, the service, marriage, kids, etc. so I didn't really get back to it. I've piddled with electronics off and on since - small projects like putting convergence ICs in old rear projection big screens, building a MegaSquirt fuel injection controller, etc., but those were more kits than anything and one doesn't really need to know the how and why, just follow directions, so I'm really pretty rusty with electronics so I'm a little out of my league for now with the synthesizer. Doesn't mean it's not a good idea, doesn't mean I won't go there eventually, just means for now I can do what I want to do by just creating the proper PLL divisor (reading the tutorial for the synthesizer, in one part it says "As you can see, the annoying part here is figuring out the best choice for PLL multipler & divider! SiLabs has a desktop application called ClockBuilder that can do some calculation of the PLL divider/multiplier for you. It's windows only, but you only need to use it once for calculation." <- that doesn't help stoke my confidence at my current experience/knowledge level). I have some health issues that are limiting my physical activity, so electronics, computer programming, etc. are becoming my new hobbies and so far radio and playing with interfacing the Arduino to it has been a hoot! I'm sure I'll keep plugging away at them, as my experience and knowledge increases projects like these I'm sure will interest me...one has to crawl before they walk.

I wasn't really looking to create a universal mod, I was just looking to mod my particular radio. I agree though, it may be a good idea to look at what is common amongst the majority of popular radios and design my project to accommodate as many radios as possible - especially since I'm prepping for my ham test and will no doubt want to bring my radio up to 10 meter eventually (possibly down to 12?).

I do plan on using a Nano, Mini, or something similar. I just used an Uno as it's what I had on hand and it was able to do what I was asking of it (I currently have a Mega, Uno, Leonardo and Pro Micro) There's no real issue porting between Arduino boards as the Arduino IDE does a good job compiling for the target board (though just because it compiles doesn't mean it will run - things like the Micro Pro not having the complete Port D can get past the compiler). I have no issue with anyone doing anything with my code, I'm just having fun developing it, I have no urge or desire to create any form of a commercial product (actually, I have no urge to become tech support - if I get bored and move on to another project I don't want to be abandoning customers).

It's interesting about the radio switches and stuff. I'm not really trying to improve the radio because of those issues, nor am I trying to increase the demand on them. I'd like to integrate something into them that basically makes them function as normal with the enhancements as transparent as possible - I want it to look stock.

The code not being spaghetti is a goal, but again, one has to learn to crawl before they walk. Doesn't mean I'm not open to new methods, just means I'm not fretting over every line of code and whether it could be done better - if my goal is being accomplished then I'm happy. Hopefully as I challenge myself with new programming objectives my skills will grow and the code will get better.

It may be fun to continue improving the radio and interfacing it to Arduinos, the pc, etc.. But then again, it's not really the goal either. I have no real goals. Again, this is just my new hobby - it's simply taking my mind off my health and other issues.

I've appreciated your help and input - please do continue to check in on the thread!

Take care,

Steve
 

dxChat
Help Users
  • No one is chatting at the moment.
  • @ Wildcat27:
    Hello I have a old school 2950 receives great on all modes and transmits great on AM but no transmit on SSB. Does anyone have any idea?
  • @ ButtFuzz:
    Good evening from Sunny Salem! What’s shaking?
  • dxBot:
    63Sprint has left the room.
  • dxBot:
    kennyjames 0151 has left the room.