Hacking a Baofeng UV-5R to turn it into a cyberpunk “Arduino sdr”
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Update video coming soon - but the new parts look PRETTY SLICK!!
Just gotta work out how to weather it now...
PCBWay reached out and offered to provide some help on this project, which has reinvigorated me to finish the cad model and get some parts off to them to get printed on much better printers than my hacked up Ender 3!
Here are some updates on the cad model - it's a bit of a chonky unit, but that's what I get for hand wiring everything. I'll be be able to fit a few lipo pouch cells in there though.
I'm going to have the black part printed in TPU, and then I'll be able to stretch it over the nylon body. Then it will be capped off with the yellow bezel, which will be CNC machined from aluminium.
I'll update when I have some parts printed!
I’ve done a big video, showing off the state of the case (not great….) and more importantly the UI and all of the features I’ve added!
Grab some popcorn and enjoy
Macros are cool. They work exactly how I'd hoped! For example check out this macro for setting the squelch...
Nested in the menus is a submenu for SQUELCH. In this menu one can set the number (3 in the screenshot) to a number between 0 and 9.
Then when actioning the SET_SQLCH button, the following Arduino function is called
void CALLBACK_FUNCTION setSquelch(int id) {
key_menu();
key_num(0);
key_menu();
key_num(menuSQUELCH.getCurrentValue());
key_exit();
}
this function presses menu, presses 0 to navigate to the squelch setting, presses menu to edit the squelch setting, reads the number from the OLED screen and then presses to corresponding key on the keypad, then presses exit.
Amazing. It's no faster than doing the same on the Baofeng directly, but it's way cooler.
Oh and if you want to do it the old way, just navigate to the keypad "app" where you can emulate any of the keypad keys and perform any task you'd like, or enter any frequency manually.
Neat.
Using a canvas in Fusion 360, I drew up the start of the frame for the radio. I printed a sample last night, and I'm not confident I can fit everything in it without making it super thick... I might have to use some smaller lithium cells as fitting 2 18650's is going to make it into a brick (more than it already is!)
How good is that font matching by the way? Wow!
Just a quick one, while adding the NOKOTA logo to my cad model for the radio, I "what the fonted" it, and looks like the Cyberpunk 2077 devs used a font called White Rabbit. One of many Matrix nods in the Cyberpunk 2077 universe, neat.
So I've gotten the multitude of wires finally wired up, from the radio to the analog switches, to the Arduino Mega. I mapped all of the pins to their various functions (I decided to forgo trying to remember which trigger pin triggered which of the 4 switches on which of the 4 IC's, so I just wired it up, and then made a simple Arduino sketch to test each digital pin and see what function it performed. The findings were as follows.
pinMode(16, OUTPUT); // Keypad 5
pinMode(17, OUTPUT); // Keypad 9
pinMode(18, OUTPUT); // Keypad 6
pinMode(19, OUTPUT); // Keypad 8
pinMode(20, OUTPUT); // Keypad 0
pinMode(21, OUTPUT); // Keypad 7
pinMode(22, OUTPUT); // Keypad 4
pinMode(23, OUTPUT); // UNUSED BROWN WIRE
pinMode(24, OUTPUT); // DOWN
pinMode(25, OUTPUT); // Keypad 3
pinMode(26, OUTPUT); // UP
pinMode(27, OUTPUT); // Keypad 2
pinMode(28, OUTPUT); // EXIT
pinMode(29, OUTPUT); // SCAN
pinMode(30, OUTPUT); // MENU
pinMode(31, OUTPUT); // Keypad 1
(Unused brown wire is a spare, and I'm trying to decide if I use it for A/B switch [which switches the radio between two settable frequencies] or the channel / frequency modes, or the FM mode, if I want to enable the FM tuner. A/B or FM makes most sense to me.)
Oddly enough, the rotary encode stopped working unless I commented out the pinMode declaration for the pin 16. I moved the encoder switch button from pin 6 to pin 12, and it works fine. So for some reason, pin 6 and pin 16 interfered somehow... But once the encoder was moved to pin 12, it all worked perfectly!
Scrolling through UHF Channels and the radio tuning to the correct frequency.
The scan function also works, tonight I'm going to build more functions to pack this out!
The tune functions look like this
void CALLBACK_FUNCTION UHFCH01(int id) {
Serial.println("Tune to UHF 1");
key_exit(); // press exit key
key_num(4); // press passed number key
key_num(7); // press passed number key
key_num(6); // press passed number key
key_num(4); // press passed number key
key_num(2); // press passed number key
key_num(5); // press passed number key
}
void CALLBACK_FUNCTION UHFCH02(int id) {
Serial.println("Tune to UHF 2");
key_exit(); // press exit key
key_num(4); // press passed number key
key_num(7); // press passed number key
key_num(6); // press passed number key
key_num(4); // press passed number key
key_num(5); // press passed number key
key_num(0); // press passed number key
}
And the key_num(x) function, and other key functions look like this
void key_num(int x) {
switch (x) {
case 0:
digitalWrite(20, HIGH); // press button
delay(delayTime); // pause
digitalWrite(20, LOW); // release button
delay(delayTime);
Serial.println("0");
break;
case 1:
digitalWrite(31, HIGH); // press button
delay(delayTime); // pause
digitalWrite(31, LOW); // release button
delay(delayTime);
Serial.println("1");
break;
case 2:
digitalWrite(27, HIGH); // press button
delay(delayTime); // pause
digitalWrite(27, LOW); // release button
delay(delayTime);
Serial.println("2");
break;
case 3:
digitalWrite(25, HIGH); // press button
delay(delayTime); // pause
digitalWrite(25, LOW); // release button
delay(delayTime);
Serial.println("3");
break;
case 4:
digitalWrite(22, HIGH); // press button
delay(delayTime); // pause
digitalWrite(22, LOW); // release button
delay(delayTime);
Serial.println("4");
break;
case 5:
digitalWrite(16, HIGH); // press button
delay(delayTime); // pause
digitalWrite(16, LOW); // release button
delay(delayTime); // pause
Serial.println("5");
break;
case 6:
digitalWrite(18, HIGH); // press button
delay(delayTime); // pause
digitalWrite(18, LOW); // release button
delay(delayTime); // pause
Serial.println("6");
break;
case 7:
digitalWrite(21, HIGH); // press button
delay(delayTime); // pause
digitalWrite(21, LOW); // release button
delay(delayTime); // pause
Serial.println("7");
break;
case 8:
digitalWrite(19, HIGH); //...
Read more »
I wired 4 digital pins from the Arduino to the inputs of the first analog switch IC, and then the four inputs and outputs to the pads of the Baofeng UV5R buttons (1,2,3 and SCAN)
I whipped my code into shape and the results were great! I'm using a 400ms delay for holding down the buttons, and between the button presses. But I reckon I can shorten that down quite a bit.
The wiring is a dog. I'm not loving it. The astute among you might think this is a good project for a PCB, and forgive the Eagle gore but I've had a crack...
This was my idea for a carrier board to hold the Arduino, and give me solder pads on the sides to hold the wires for the buttons. I might still go this route - but I'm in a hurry so I think I'll plunge ahead with hand wiring the whole thing!
Regardless, this test is awesome, and proves the concept even further. The idea is that the front of the unit will show the original Baofeng screen (just as a reference to the currently set frequency) as well as the OLED screen, the rotary encoder on top, with the original Baofeng power / volume knob also up there.
The Arduino Mega clone I'm using can take up to 18v in, so I'll be able to power it directly from the 2s Lipo battery that the UV5R uses (I've added a wire after the Baofeng radio switch, that will power the Arduino) I'll be adding a USB-C charger to a couple 18650's to take care of power, and the original Baofeng screen will still show the battery level, which is pretty neat.
Once electronics are done, I'll press on with the case! I've started on it, but the only cad model I could find is a shitty STL - and I'm having no luck converting into a parametric model. If anyone has any tips or is able to help - please reach out! I'll attach a link to the STL.
STL from - https://sketchfab.com/3d-models/nokota-radio-cyberpunk-2077-641dc25a8e25498ea9a52b71153b7dab
well, it’s not the cleanest implementation - but what’s wrong with having 100+ functions?!
When clicking on a menu item, it will call the linked function - that’s awesome!
I could do it with a number entry item from TcMenu, but then it’s all on one line, and I think scrolling through the long list of channels is way more interesting, I want to see as many of those pretty yellow pixels as possible.
It’s also cool to see the rolling shutter effect from my phone camera on the oled screen in this photo.
Create an account to leave a comment. Already have an account? Log In.
Nice work.
I personally would have bypassed the UV5R's internal MCU and re-implemented everything on one MCU that way you don't have to navigate the UV5R menus by pressing buttons using a jog wheel. You could just have a jog wheel native menu system.
To my knowledge those radios use the RDA1846 SINGLE CHIP TRANSCEIVER chip and a RDA5802 Single chip FM Tuner, both of which you can control via I2C.
Additionally for that cyberpunk goodness, it might be fun to add a GPS receiver and switch the MCU from an Arduino to something with a bit more oomph, say an ESP32. This would give you the ability to run APRS quite comfortably. Add a Lora module and you could even make it MeshCom compatible.
Depending on your MCU it may even be possible to add support for WSPR or JS8call. I know they aren't that common on VHF/UHF but WSPR is becoming more popular for beacons so if the MCU could decode it would be very nifty for understanding propagation.
Oh one last thing. With a GPS receiver and a decent MCU and an SD card slot for TLE files, you could have the radio auto tune and auto correct for doppler shift of satellites.
I've been wanting to build what I mention above for a while now, unfortunately I'm terminally ill and don't have the energy to work on such projects any more.
meybe add quansheng enclosure? meybe add some more buttons
Wow this is awesome!!
Ive been a ham for years and ive had a uv5r collecting dust not being used. might have to try this at some point.
Good progress, Taylor! I wrote this up for the blog, should publish soon. Looking forward to more!
hey Dan it’s all finished now - make sure you check out the final product video :)
What a great looking project! You should enter this in the Cyberdeck contest -- perhaps a litle unconventional, but it fits the aesthetic perfectly!
Thanks Dan! Let's hope I pull it off before the contest deadline ;) I'll be submitting once it has more of a physical form
http://www.whence.com/minimodem/ or https://play.google.com/store/apps/details?id=com.aicodix.rattlegram
I haven't even played the game and I want to do this!
Become a member to follow this project and never miss any updates
By using our website and services, you expressly agree to the placement of our performance, functionality, and advertising cookies. Learn More
would you be willing to share the cad files i would like to use this to create my own design implementing a phone with it