Pinout
Pinout
Use the Wire library for I2C communication with both the RDA1846 and the LCD.
Use a common RotaryEncoder library (like the one by Matthias Hertel - you might need to install this via
the Arduino Library Manager) to handle the rotary encoder input.
Implement functions to initialize the RDA1846 and set its frequency based on the programming guide.
Set the RDA1846 to RX mode for the specified frequency (146.500 MHz initially, then adjustable).
Assumptions:
The RDA1846's SEN pin is tied LOW, setting its I2C address to 0x71. If tied HIGH, change
RDA1846_I2C_ADDR to 0x2E.
You are using a 26 MHz crystal for the RDA1846 (as seen in the provided schematic example). If using
12.8 MHz or another, adjust the rda_init() values.
The LCD's I2C address is 0x27. Find yours using an I2C scanner sketch if needed.
Rotary Encoder Pins: CLK to D2, DT to D3, SW (Switch) to D4 (optional). D2 and D3 are required for
interrupts.
Libraries Needed:
Wire.h (Built-in)
RotaryEncoder.h (Install via Library Manager: Search for "RotaryEncoder" by Matthias Hertel)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <RotaryEncoder.h>
// LCD I2C Address (Commonly 0x27 or 0x3F) - Use I2C Scanner if unsure
#define LCD_ROWS 2
// Frequency Settings
#define REG_CHIP_ID 0x00 // Read only? Not explicitly listed for write
#define REG_CTRL 0x30 // TXON, RXON, Channel Mode, SQON, VOXON, PDN_REG, etc.
long lastEncoderPos = 0;
bool rda_init();
void update_lcd();
void setup() {
Serial.begin(115200);
Wire.begin();
// Initialize LCD
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("RDA1846 Control");
// Initialize RDA1846
if (!rda_init()) {
lcd.setCursor(0, 1);
Serial.println("RDA1846 Initialized.");
rda_set_frequency(currentFrequencyHz);
lcd.clear();
void loop() {
if (frequencyChanged) {
Serial.println(" MHz");
if (rda_set_frequency(freqToSet)) {
} else {
// if (digitalRead(ROTARY_PIN_SW) == LOW) {
// // Add action for button press (e.g., toggle TX, scan, menu)
// }
void handleEncoder() {
currentFrequencyHz += FREQUENCY_STEP_HZ;
frequencyChanged = true;
} else {
} else { // Counter-Clockwise
currentFrequencyHz -= FREQUENCY_STEP_HZ;
frequencyChanged = true;
} else {
lastEncoderPos = newPos;
Wire.beginTransmission(RDA1846_I2C_ADDR);
if (error != 0) {
Serial.print(regAddr, HEX);
Serial.println(error);
// delayMicroseconds(50); // Small delay might be needed between writes for some I2C devices
bool rda_init() {
Serial.println("Initializing RDA1846...");
// Default is 0xFFFF. Let's try 0x0888 (roughly -7dB for both channels)
// rx_on = 1 (bit 5)
// tx_on = 0 (bit 6)
// pdn_reg = 1 (bit 2 - must be high with PDN pin for normal operation)
// sq_on = 0 (bit 3)
// vox_on = 0 (bit 4)
// Let's be explicit: rx_on=1 (bit 5), pdn_reg=1 (bit 2). Others 0 for now.
return false;
// Split into high (14 bits for 29H) and low (16 bits for 2AH) parts
uint16_t high_data = (freq_reg_val >> 16) & 0x3FFF; // freq<29:16> (Mask to 14 bits)
return true;
}
void update_lcd() {
lcd.setCursor(0, 0);
lcd.print("Frequency:");
lcd.setCursor(0, 1);
lcd.print(freqStr);
Install Libraries: Make sure you have LiquidCrystal_I2C and RotaryEncoder (by Matthias Hertel) installed
in your Arduino IDE.
Wiring:
Arduino <-> LCD: Connect SDA to A4, SCL to A5, VCC to 5V, GND to GND.
Arduino <-> Rotary Encoder: Connect CLK to D2, DT to D3, GND to GND, + to 5V (if needed, some
modules have pull-ups). Optionally connect SW to D4.
Connect RDA1846 VDD/AVDD pins to a stable 3.3V supply (or the output of its LDO if using >3.3V
source). Do not connect directly to Arduino 5V.
Tie the RDA1846 SEN pin LOW (to GND) to use I2C address 0x71.
Tie the RDA1846 PDN pin HIGH (to 3.3V) to enable the chip (the code also sets the internal pdn_reg).
Connect the 26MHz crystal and its load capacitors (CX1, CX2 in the schematic) to XTAL1 and XTAL2 pins.
Connect Antenna circuitry (including RX/TX switch, PA, filters) as per RDA1846 typical application
schematics. For RX testing, you need at least the RFIN pin connected via a switch/filter to the antenna.
Run:
Open the Serial Monitor at 115200 baud to see initialization messages and frequency changes.
The LCD should show the initial frequency (146.500 MHz RX).
Turn the rotary encoder. The frequency on the LCD and Serial Monitor should change in 12.5 kHz steps.
Test Reception:
Set your Baofeng UV-5R (or other radio) to the exact frequency displayed on the LCD (e.g., 146.500
MHz).
Ensure the Baofeng is set to Narrowband (NFM or MN) mode to match the 12.5kHz channel width set in
the code.
Transmit from the Baofeng. You should hear the audio from the speaker connected to the RDA1846's
AFOUT pin (via an amplifier if needed).
This code provides the fundamental control structure. You would need to add functions for reading
registers, enabling TX, handling squelch/CTCSS, etc., for more advanced features.