SI473X Library for Arduino
Se você estiver entendendo este texto, talvez queira ler este documento em Português
This document is aimed at the Arduino developers, radio experimenters, hobbyists and anyone interested in building a receiver based on the Si473X IC family from Silicon Labs. This project is about an Arduino library for the SI473X BROADCAST AM, SSB and FM/RDS RADIO RECEIVERS. Frequency ranges of AM and SSB modes are 150kHz to 30MHz, and FM mode is 64 to 108 MHz. |
This library is intended to provide an easy-to-use interface for controlling the SI47XX (including the boards "PL102BA-S V:2.1 10628" and "NE928-10A V:01" based on SI4730) by using Arduino platform. It also has support to the SSB mode on SI4735-D60 and SI4732-A10 devices. The communication protocol used by this library is the I²C.
This library was built based on "AN332 Si47XX PROGRAMMING GUIDE REV 1.0" and AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE AMENDMENT FOR SI4735-D60/SI4732-A10 SSB AND NBFM PATCHES. It also can be used on all members of the SI473X family respecting, of course, the features available in each IC version. Please, follow the contents below to get the most out of this document.
This library can be freely distributed using the MIT Free Software model. By using or installing Library you are agreeing to the terms of the MIT licence.
Copyright (c) 2019 Ricardo Lima Caratti.
Contact: [email protected]__.
If you find this project useful, consider making a donation so that the author of this library can purchase components and modules for improvements and testing of this library. Click here to donate or use the QR code below.
I hold a Master's degree in Educational Technology from the Federal University of Ceará, where I delved into the ways technology can enhance learning experiences. My passion for computer science led me to specialize in it, focusing on Distributed Systems Development with an Object-Oriented approach, at the University of Brasília. My academic journey began with a Bachelor's degree in Information Systems from the União Pioneira de Integração Social (UPIS-Brasília). Outside the classroom, my main hobbies are electronics and Amateur Radio.
Technically, no Arduino application needs a library. In some cases, not using libraries may be the correct decision. But there are some good reasons to consider using a library.
Libraries typically allow for easier design and maintenance of code. A library may also implement the functionality you need on multiple hardware choices, thus making the code more portable.
Imagine that you want to use an LCD or other display device in a project that monitors temperature and atmospheric pressure conditions. There are several good libraries for display devices available for Arduino users, and most of the features you might want are implemented in these libraries. There is no point in re-inventing the wheel by avoiding a library. Unless you require a feature that no library supports, it is generally wise to use a library, especially since a library can make porting code to different hardware easier.
Use of a library can reduce programming complexity and boost application robustness. It makes life easier for other developers, and also for yourself. You do not have to be a software engineer to understand why this is the case. A library, in this way, is similar to an IC. It is often possible to manually implement the functionality of many IC chips in a circuit, but doing so would dramatically increase the cost, complexity, size, and sometimes the failure rate of a project. Circuits are often better when some functions are abstracted away inside an off-the-shelf IC chip. The user of an IC only needs to know how to interact with the chip, and not how the chip itself is wired.
Finally, if you already use a library to handle the I2C bus (Wire.h), TFT, OLED, SPI devices, and Serial UART communication, then it makes sense to use a library to handle the SI473X devices. The PU2CLR Arduino Library can offer more comfort, development agility, and robustness to your project. Unlike closed-source solutions, this library is open-source. This means you can learn how the library works by studying the code, if you choose.
I began my journey to create an Arduino library for the SI473X family of devices in early November 2019. The initial plan was to construct a receiver using an Arduino board, a handful of components, and the SI4735 device manufactured by Silicon Labs. After watching some videos on YouTube, it became clear that a receiver based on the SI4735-D60 had the potential to exceed the original scope of the project—it could even receive amateur radio and citizens band stations in SSB mode. Through forums and websites, I discovered a significant demand from hobbyists and experimenters interested in using the SI4735 device, particularly for SSB mode. With this in mind, I shifted my focus. Instead of merely developing a basic receiver around the SI4735, I opted to create a comprehensive Arduino library that would fully support not only the SI4735 but the entire SI473X device family.
With this library, more than 60 examples were developed using various display types. These examples can assist the experimenter in building their own receiver.
Judging by the groups created around the SI47XX devices, I estimate that this library is currently being used by thousands of experimenters, applications and commercial receivers. If you are an experimenter or a radio enthusiast and want to try to build your own receiver based on the SI473X devices, then this library is for you.
The following video is a little joke that shows the trajectory of the construction of this library. "PU2CLR SI4735 Arduino Library. IT IS OPEN SOURCE IT IS FREE. IT IS FOR YOU".
{% include libhistory.html %}
If you want to support this library development, consider joining this project via Github. Alternatively, make suggestions on new features and report errors if you find them. Thank you!
This library uses the I²C communication protocol and implements most of the functions offered by Si47XX (BROADCAST AM / FM / SW / LW RADIO RECEIVER) IC family from Silicon Labs. This library also has primitive functions that make it easier for you to implement commands that may not have been implemented yet. See setProperty, getProperty sendCommand, getCommandResponse and getStatusResponse functions and also How to customize PU2CLR Arduino Library. It is worth noting, however, that this library is constantly improving. Check the API documentation before implementing a new function. It is likely that your function is already implemented. See the API documentation for this library. The main features of this library are listed below.
There is a Facebook group called Si47XX for Radio Experimenters where the purpose is exchanging experiences with projects based on Silicon Labs SI47XX IC family. You will be welcome to the group Si47XX for Radio Experimenters.
You can also be a member of group.io SI47XX for hobbyists
{% include groupio.html %}
Follow a project using this library on hackaday.io
Copyright (c) 2019 Ricardo Lima Caratti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You can install this library on your Arduino environment using different methods. The best ways to do that are described below.
This is the easiest method to install this library.
{% include libinstalling.html %}
First, you have to download this library in zip format. After, unzip the SI4735-master.zip file in your Arduino Library folder.
With that approach, you will have the most current version of the library. However, it may not be the most stable version. This is because the current version is always in development. Prefer releases. Do you need some old version (release) of this library? If so, check here.
The commands below Install the latest version of the PU2CLR SI4735 Arduino Library from github. As said before, unlike a release (installed from Arduino IDE) this method installs the current version of the PU2CLR SI4535 Arduino Library (latest modifications even if not yet released).
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
export ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true
./bin/arduino-cli lib install --git-url https://github.com/pu2clr/SI4735
Run the command shell (cmd / Command Prompt) and follow the steps below.
echo off
curl -fsSL https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip --output arduinocli.zip
tar -xf arduinocli.zip
set ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true
.\arduino-cli lib install --git-url https://github.com/pu2clr/SI4735
It will be useful if you intend to use ESP32, ESP8266, Teensy, Raspbery PI PICO, Arduino DUE, ATTiny etc.
On Arduino IDE, preferences, Aditional boards manager URls. See image below.
The list below refers to the board URLs used by the examples. You can remove the boards you do not want to use.
http://arduino.esp8266.com/stable/package_esp8266com_index.json
http://dan.drown.org/stm32duino/package_STM32duino_index.json
http://drazzy.com/package_drazzy.com_index.json
https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json
https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json
https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
https://raw.githubusercontent.com/DavidGuo-CS/OSOYOO_Arduino/main/package_osoyoo_boards_index.json
https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
https://raw.githubusercontent.com/dbuezas/lgt8fx/master/package_lgt8fx_index.json
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
https://raw.githubusercontent.com/nulllaborg/arduino_nulllab/master/package_nulllab_boards_index.json
https://www.pjrc.com/teensy/package_teensy_index.json
After adding the Board URL you want to use, go to Tools menu, select the Boards item and then select Boards Manager... option. Finally, look for your board and install it.
See the ESP32 setup example on Arduino IDE
The SI4732-A10 and SI4735-D60 are DSP receivers IC from Silcon Labs. They have great performance on AM, SSB (LW/MW/SW) from 150kHz to 30MHz and FM (VHF) from 64 to 108 MHz. It is important to note that the engineers and programmers at Silicon Labs did an excellent job by implementing all the internal resources in this IC family. This library implements just the interface that allows you to use the SI473X resources with Arduino based board controller. The SI473X can be programmed by sending commands and getting responses. You can control it via a microcontroller like Arduino using I²C communication protocol. To make the SI473X perform an action, the microcontroller has to send a set of bytes (command and arguments) that the device interprets and executes the given command. The image below illustrates the interaction between the MCU and the SI473X device.
The image below shows the SI473X-D60 block diagram. It was extracted from Silicon Labs Si4730/31/34/35-D60 / BROADCAST AM/FM/SW/LW RADIO RECEIVER (page 21). Note that the author of this Library highlights in red the pin operating voltages that can be connected to the Arduino. Be aware of the operating voltage of the Arduino pins you will use in your project. Preferably use an Arduino with 3.3V operating voltage. If you are not using a 3.3V version of Arduino, you must use a kind of 5V to 3.3V converter on RST, SCLK, SDIO and SEN (depending on your project).
According to the Si47XX PROGRAMMING GUIDE/AN332, the Si4732-A10 has the same firmware FMRX component and AM_SW_LW RX component as that of Si4735-D60. It is considered as the most recent revision as D60. So, all descriptions related to the SI4735-D60 also apply to Si4732-A10. Including SSB patch support. See the Si4732-A10 block diagram below.
While the Si4735-D60 provides the 0x11 I²C bus address when the SEN pin is connected to the ground, the SI4732-A10 provides the same address when the SEN pin is connected to the +VCC. Also, this library provides the function getDeviceI2CAddress to detect the I²C bus address automatically. This way, you don't need to worry about this setup if you use this function. See getDeviceI2CAddress().
This library has been written for the Arduino platform and has been successfully tested on many boards. See Boards where this library has been successfully tested
Board | InterrupT (IRQ) Pins | I²C / TWI pins | successfully tested | Voltage converter |
---|---|---|---|---|
328-based (Nano, Uno or Mini 5V) |
D2 and D3 | A4 (SDA/SDIO), A5 (SCL/SCLK) | Yes | Yes |
328-based (Pro Mini 3.3 / 8Mhz) |
D2 and D3 | A4 (SDA/SDIO), A5 (SCL/SCLK) | Yes | No |
LTG8F328 based board |
D2 and D3 | A4 (SDA) and A5 (SCL) | Yes | No |
Mega 2560 | 2, 3, 18, 19, 20 and 21 | 20 (SDA/SDIO), 21 (SCL/SCLK) | Yes | Yes |
32u4-based (Micro, Leonardo or Yum) |
0, 1, 2, 3 and 7 | 2 (SDA/SDIO), 3 (SCL/SCLK) | Yes | Yes |
Zero | Any digital pins except pin 4 | D8 (SDA/SDIO) and D9 (SCL/SCLK) | Not tested | No |
Due | Any digital pins | 20 (SDA/SDIO), 21 (SCL/SCLK) | Yes | No |
ESPRESSIF ESP32 | Any GPIO pins | Most pins (usually 21 and 22) | Yes | No |
ESPRESSIF ESP8366 | GPIO13 and GPIO14 | GPIO4 (SDA) and GPIO5 (SCL) | Yes | No |
STM32F103 | PA0, PA1 | PB6 (SCL) and PB7 (SDA) | Yes | No |
STM32F104 | PA0, PA1 | PB6 (SCL) and PB7 (SDA) | Yes | No |
RP2050 Rpi Pico |
Any GPIO pins | GP1 (SCL) and GP0 (SDA) | Yes | No |
The main purpose of the schematic below (prototype) is to test the Si4735 Arduino Library. It does not intend to be a real radio for exigent listeners. However, it is possible to start with it and then, if you wish, you can include some devices to the circuit to improve, for example, its sensibility beyond other desired features. Click here to see a complete set of schematics and tips
The image below shows a version of Silicon Labs SSOP Typical Application Schematic connect to the host MCU (Arduino Pro Mini 3.3V). Pay attention to the Si4735-D60 SEN pin (16). When the SEN pin is connected to the ground, the I²C bus address is 0x11. When the SEN pin is connected to +3.3V, the I²C bus address is 0x63. By default, the "Si4735 Arduino Library" uses the 0x11 I²C bus address (SEN pin connected to GND). If you want to use the address 0x63 (SEN connected on +3.3V), see the functions (methods) getDeviceI2CAddress, setDeviceI2CAddress and setDeviceOtherI2CAddress.
Please, check the folder extras/schematic/. There, you will find other schematics with OLED, LCD, Nokia 5110, TFT, buttons and encoders setup. Also, check the comments at the beginning of each sketch example. You will find the SI473X, button, encoder, display and Arduino settings.
The SI4735-D60 and SI4732-A10 have SSB patch support
See some Shortwave antenna configuration on Si47XX ANTENNA, SCHEMATIC, LAYOUT, AND DESIGN GUIDELINES; AN383
Pay attention to the appropriated Arduino pinout to select the correct interrupt (IRQ), RST, SDIO and SCLK pins. The previous table shows some Arduino board pinout.
Be sure about the pinout of your device and Arduino connections. For example: the Si4735-D60/Si4730_D60 SEN pin (16 on SSOP version and 6 on QFN version) when connected to the ground, the I²C bus address is 0x11. When this pin is connected to +3.3V, the I²C bus address is 0x63. See the functions getDeviceI2CAddress and setDeviceI2CAddress to correct setup. If you follow the schematic used in this project, you do not need to do anything (the default I²C bus address is 0x11). If you do not know how this pin is configured on the board, use getDeviceI2CAddress.
The table below shows the component parts used to build the radio prototype based on Si4735 and used the Silicon Labs SSOP Typical Application Schematic as main source. However, some parts were included by the author of this project.
Part | Description |
---|---|
C1 | 22nF Monolithic Multilayer Chip Ceramic non polarized capacitor (Place it close to VA pin) |
C2 | 1nF Monolithic Multilayer Chip Ceramic non polarized capacitor |
C3 | 470nF Monolithic Multilayer Chip Ceramic non polarized capacitor |
C4 | 100nF Monolithic Multilayer Chip Ceramic non polarized capacitor (Place it close to VD pin) |
C5 and C6 | 22pF (Crystal load capacitors) |
C7 and C8 *1 | 4.7uF Monolithic Multilayer Chip Ceramic non polarized capacitor |
R3 | 2.2K |
(R4 and R5) *2 | 2.2K to 10K (pull-up resistors) |
L1 | Ferrite loop stick (about 500 μH) |
X1 | 32.768 kHz crystal |
SI4735 | digital CMOS AM(LW, MW and SW)/FM radio receiver IC |
Notes from Silicon Labs Broadcast AM/FM/SW/LW Radio Receiver documentation (page 12):
Term | Description |
---|---|
API | Application Programming Interface (API). In this context, it is an interface that you can use to simplify the implementation and maintenance of your software (Arduino sketch). All API documentation about this library can be found on https://pu2clr.github.io/SI4735/extras/apidoc/html/index.html. |
Arduino Libraries | Libraries are files written in C or C++ (.c, .cpp) which provide your sketches with extra functionality. The SI4735 Library provides extra functionalities to make easier the Arduino deal with Si473X devices |
BPF | Band Pass Filter |
DFS | I²S - digital frame synchronization input |
DIN | I²S - digital data input |
DCLK | I²S - digital bit synchronization input clock |
ESD | Electrostatic discharge. Device used to protect the receiver from static electricity discharge |
IDE | Integrated Development Environment |
I²C | I²C - Inter-Integrated Circuit |
I²S | Serial bus interface used for connecting digital audio devices |
Sketch | Name that Arduino environment uses for a program |
Interrupt | In this context, it is an Arduino Resource. Allows important tasks to be performed regardless of the flow of your program |
C++ | A object-oriented programming (OOP) language. It is a superset of the C language with an additional concept of "classes." |
programming guide | In this context it refers to Si47XX PROGRAMMING GUIDE (REV 1.0) |
LNA | Low Noise Amplifier |
POC | Proof of Concept |
SEN | Serial enable pin, active low, used as device select in 3-wire and SPI operation and address selection in 2-wire operation |
CTS | Clear to send |
STC | Seek/Tune Complete |
RESP | Response byte (n = 1 to 15) |
RESPONSEn | Response register (16-bit) in 3-Wire mode (n = 1 to 8) |
RST | Also RSTb—Reset pin, active low |
RCLK | External reference clock |
SSB | Single Side Band |
Attack | attack-time delay - the time needed for a receiver to respond to an incoming signal |
SDIO | Serial data in/data out pin |
SCLK | Serial clock pin |
Soft Mute | Resource used to attenuate the audio outputs and minimize audible noise in very weak signal conditions |
Firmware Upgrades | The Si4732-A10 and SI4735-D60 contain on-chip program RAM to accommodate minor changes to the firmware |
{% include apidoc.html %}
This library has two documentation sources:
Doxygen is a tools that can generate documentation from source code. This tools help the development team to keep the documentation updated.
If you prefer, you can also read the documentation directly from the SI4735.cpp and SI4735.h. These files are also well documented.
This library has more than 120 functions. The table below shows the mains functions used in a regular receiver. Full details on the functions shown below can be read on https://pu2clr.github.io/SI4735/extras/apidoc/html/.
Method / Function | Description |
---|---|
setup | Use this function to start the device up with the parameters shown below. |
getStatus | Used to get the current status of the Si4735. |
getCurrentRSSI | Get the current receive signal strength (0–127 dBμV). |
getCurrentSNR | Gets the current SNR metric (0–127 dB). |
getFrequency | Gets the current frequency of the Si4735. |
frequencyUp | Increments the current frequency on current band/function by using the current step. |
frequencyDown | Decrements the current frequency on current band/function by using the current step. |
setFrequencyStep | Sets the current step value. |
setVolume | Sets volume level (0 to 63). |
setFM | Sets the radio to FM function. |
isCurrentTuneFM | Returns true if the current function is FM (FM_TUNE_FREQ). |
getCurrentPilot | Checks the current pilot. Indicates stereo pilot presence. |
setAM | Sets the radio to AM function. It means: LW MW and SW. |
setAmSoftMuteMaxAttenuation | Sets the Am Soft Mute Max Attenuation. |
setAutomaticGainControl | Automatic Gain Control setup. |
getAutomaticGainControl | Queries Automatic Gain Control STATUS. |
setBandwidth | Selects the bandwidth of the channel filter for AM reception. |
isAgcEnabled | Checks if the AGC is enabled (returns true if enabled). |
setRdsConfig | Sets RDS property. |
getRdsStatus | Gets the RDS status. Store the status in currentRdsStatus member. COMMAND FM_RDS_STATUS. |
getRdsReceived | Get the Rds Received FIFO. |
getRdsSync | Get the Rds Sync. Returns true if RDS currently synchronized. |
getRdsSyncFound | Get the Rds Sync Found. Returns true if found RDS synchronization. |
getRdsText2A | Gets the Text processed for the 2A group. |
getRdsText2B | Gets the Text processed for the 2B group. |
getRdsText0A | Gets the station name and other messages. |
getRdsTime | Gets the RDS time and date when the Group type is 4. |
reset | Reset the SI473X. |
queryLibraryId | Queries the library information of the Si47XX device. |
patchPowerUp | This method can be used to prepare the device to apply SSBRX patch. |
downloadPatch | Transfers the content of a SSB patch stored in an array of bytes to the SI4735 device. |
downloadPatchFromEeprom | Transfers the content of a SSB patch stored in an eeprom to the SI4735 device. |
setSSBConfig | Sets the SSB receiver mode. |
setSSB | Tunes the SSB (LSB or USB) receiver to a frequency between 520 and 30 MHz in 1 kHz steps. |
setSSBAutomaticVolumeControl | Sets SSB Automatic Volume Control (AVC) for SSB mode. |
setSSBBfo | Sets the SSB Beat Frequency Offset (BFO). |
setSSBAudioBandwidth | SSB Audio Bandwidth for SSB mode. |
setSBBSidebandCutoffFilter | Sets SBB Sideband Cutoff Filter for band pass and low pass filters. |
setTuneFrequencyAntennaCapacitor | Only FM. Freeze Metrics During Alternate Frequency Jump. |
setI2CFastModeCustom | Sets the I²C bus to a given value. |
setI2CStandardMode | Sets I²C bus to 100kHz. |
setAudioMuteMcuPin | This function sets the mcu digital pin you want to use to control the external audio mute circuit. |
The Si47XX family works with many internal data that can be represented by data structure or defined data type in C/C++. These C/C++ resources have been used widely here. This approach made the library easier to build and maintain. Each data structure created here has its reference (name of the document and page on which it was based). In other words, to make the SI47XX device easier to deal with, some defined data types were created to handle byte and bits to process commands, properties and responses. The goal of this approach is separating data from code.
All data types defined in Si4735 Arduino Library are explained here
This library was developed using the C++ language and the Object-oriented Programming approach. Methods are functions that belong to the class, in this case SI4735 class. Click here to go to API docummentation.
All methods defined in Si4735 class are explained here. The list below refers to the method groups implemented by the Si4735 class.
Methods of this group are useful to configure the way that the Si47XX devices have to be initiate.
Allows to query the part number, chip revision, firmware revision, patch revision and component revision numbers.
The Si4735 class has a set of methods to query the current frequency, RSSI, SNR, multipath, and the antenna tuning capacitance value (0-191).
Methods to query AGC status. Returns whether the AGC is enabled or disabled and it returns the gain index.
The SI4735 class has a set of methods to setup filters on AM and SSB mode.
Methods to setup the audio mode (Digital or Analog), volume, mute etc.
This library implements some RDS features of the SI4735. All functions to deal with RDS are documented here. Below you have some videos showing the RDS functionalities implemented by the PU2CLR Si4735 Arduino Library.
{% include videoRDS2.html %}
{% include videoRDS1.html %}
See RDS example implementations for more details.
The list below points to some sketch examples that use RDS implementation.
ATTENTION: While utilizing interrupts is often the preferred approach for capturing RDS messages, applications using Arduino based on ATmega328 face limitations as they can only utilize two pins for interrupts (D2 and D2). These pins are typically allocated for encoder control, leaving no interrupt-capable pins available for FM/RDS application control. In such scenarios, resorting to the polling approach becomes necessary for retrieving RDS messages.
The code below shows the polling approach to get RDS messages.
#include <SI4735.h>
#define RESET_PIN 16 // Arduino Nano / UNO pin A2
SI4735 rx;
void setup()
{
rx.setup(RESET_PIN, FM_FUNCTION);
rx.setFM(8400, 10800, currentFrequency, 10);
delay(500);
rx.setRdsConfig(3, 3, 3, 3, 3);
rx.setFifoCount(1);
}
char *utcTime;
char *stationName;
char *programInfo;
char *stationInfo;
void showStationName() {
if (stationName != NULL) {
// do something
}
}
void showStationInfo() {
if (stationInfo != NULL) {
// do something
}
}
void showProgramaInfo() {
if (programInfo != NULL) {
// do something
}
}
void showUtcTime() {
if (rdsTime != NULL) {
// do something
}
}
void checkRds() {
// The char pointer variables above will be populate by the call below. So, these variable (pointers) need to be passed by reference (pointer to pointer).
if (rx.getRdsAllData(&stationName, &stationInfo , &programInfo, &rdsTime) ) {
showStationName(stationName); // you need check if stationName is null in showStationName
showStationInfo(stationInfo); // you need check if stationInfo is null in showStationInfo
showProgramaInfo(programInfo); // you need check if programInfo is null in showProgramaInfo
showUtcTime(rdsTime); // you need check if rdsTime is null in showUtcTime
}
}
void loop()
{
.
.
.
if (rx.isCurrentTuneFM()) {
checkRds();
}
.
.
.
delay(5);
}
The SI4735 class implements a set of methods to apply patches and deal with SSB mode. All API documentation about patches can be seen here.
The SSB patches used in some examples of this library were tested only on SI4735-D60 and SI4732-A10 devices. The updates used in those examples are unlikely to work on other SI47XX devices.
First of all, it is important to say that the SSB patch content is not part of this library. The patches used with test purpose here were made available by Mr. Vadim Afonkin on his Dropbox repository. Also, on Silcon Labs website, support and community, there is a topic called "SSB and/or ASK/FSK/nPSK demodulation on Si radio chips". If you follow that topic, you will see a post from a member called "DASM" making available a link to a patch for the SI4735-D60 and SI4732-A10. The structure of this file is a bit different if compared with Vadim's files amrx_6_0_1_ssbrx_patch_full_0x9D29.csg and amrx_6_0_1_ssbrx_patch_init_0xA902.csg. However, they have the same idea and can be easily adjusted for patching. If you have some experience with C, all you have to do is follow the recommendations of the SI47XX PROGRAMMING GUIDE AN332; page 219.
PLEASE NOTE THAT THE AUTHOR OF THIS LIBRARY DOES NOT ENCOURAGE ANYONE TO USE THE SSB PATCHES CONTENT FOR COMMERCIAL PURPOSES. IN OTHER WORDS, WHILE THIS LIBRARY SUPPORTS SSB PATCHES, THE PATCHES THEMSELVES ARE NOT A PART OF THIS LIBRARY.
In this context, a patch is a piece of software used to change the behavior of the SI4735-D60 and SI4732-A10 device.
There is little information available about patching the SI4735-D60 and SI4732-A10. The following information is the understanding of the author of this project and it is not necessarily correct.
A patch is executed internally (run by internal MCU) of the device. Usually, patches are used to fix bugs or add improvements and new features over what the firmware installed in the internal ROM of the device offers. Patches for the SI4735 are distributed in binary form and are transferred to the internal RAM of the device by the host MCU (in this case, Arduino boards). Since the RAM is volatile memory, the patch stored into the device gets lost when you turn off the system. Consequently, the content of the patch has to be transferred to the device every time the device is powered up.
I would like to thank Mr Vadim Afonkin for making the SSBRX patches available for SI4735-D60 on his Dropbox repository. On this repository you have two files, amrx_6_0_1_ssbrx_patch_full_0x9D29.csg and amrx_6_0_1_ssbrx_patch_init_0xA902.csg. Please note that the patch content of the original file is in const hexadecimal representation in an ASCII text file. If you are not using C/C++ or if you want to load the files directly to the SI4735, you must convert the supplied hexadecimal constants into their numerical equivalents.
Hexadecimal C/C++ constant | Binary representation | Decimal representation |
---|---|---|
0x15 | 00010101 | 21 |
0x01 | 00000001 | 1 |
0xFF | 11111111 | 255 |
ATTENTION: The author of this project cannot guarantee that procedures shown here will work in your development environment. Proceed at your own risk. This library works with the I²C communication protocol to send an SSB extension PATCH to SI4735-D60 and SI4732-A10 devices. Once again, the author disclaims any and all liability for any damage or effects this procedure may have on your devices. Procced at your own risk.
All methods/functions to deal with SSB on Si4735-D60 can be seen here.
This library implements many SSB examples. See the table below.
{% include videoSSB.html %}
See SSB example implementations here.
Depending on your MCU memory size, to use SSB mode may not be possible due to the large amount of memory required by the patch. To solve this problem this library implemented the function downloadPatchFromEeprom. This function reads the patch content from an external EEPROM and transfers it to the SI4732-A10 or SI4735-D60 devices. To run this function you must have an external I2C EEPROM device configured with your MCU and the Si4732/35 device on I²C bus. Also, the EEPROM must have the patch content generated by the sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM stored in it. See folder TOOLS.
The example SI4735_06_SSB_EEPROM shows this functionality on an Arduino Pro Mini.
The example SI47XX_03_SSB_Tiny4kOLED implements this functionality on an ATtiny85.
To store the SSB patch content into an external EEPROM connected to your MCU via I2C bus, you need to run a special sketch first to program the EEPROM. See sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM.
Attention: The full ssb patch needs about 16KB on eeprom. All data that you have stored before into your eeprom device will be lost after the execution of the sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM.
The EEPROM device used for testing was the AT24C256 Serial I²C Interface
Watch the video: ATtiny85 working with SI4735-D60 and SSB
{% include eeprom.html %}
You can store useful receiver data into the internal Arduino EEPROM. Current band information, Bandwidth, step, mode, audio volume and filter are examples of data that can be stored into the internal EEPROM and restored when you turn the receiver on again. See the section Storing data into the internal EEPROM before shutdowning for details.
First of all, passive Crystal and digital audio modes cannot be used at the same time on SI47XX devices. The document Si47XX ANTENNA, SCHEMATIC, LAYOUT, AND DESIGN GUIDELINES; AN383; rev 0.8; page 6; you will find the following note: "Crystal and digital audio mode cannot be used at the same time". So, for Digital Audio, you have to remove the crystal, and capacitors connected to the crystal from the circuit.
This library supports the external clock reference and has implemented the digital audio functions. You can configure digital audio and external clock reference by using the functions: setup, radioPowerUp, digitalOutputFormat, digitalOutputSampleRate, setRefClock and setRefClockPrescaler.
The schematic below shows the Digital Audio setup using an SI4735-D60 with an ESP32 Devkit.
You can check the schematic above via SI47XX_06_ESP32/DIGITAL_AUDIO_SERIAL_PLOTTER example
The table below shows the SI4735, DAC MAX98357A and ESP32 wireup
Si4735 | Function | DAC MAX98357A | ESP32 |
---|---|---|---|
pin 1 | DOUT | DIN | SerialData / GPIO32 |
pin 2 | DFS | RC | WordSelect / GPIO25 |
pin 3 | DCLK | BCLK | ContinuousSerialClock) / GPIO33) |
The table below shows the SI4735, DAC CJMCU and ESP32 wireup
Si4735 | Function | DAC MAX98357A | ESP32 |
---|---|---|---|
pin 1 | DOUT | DIN | SerialData / GPIO32 |
pin 2 | DFS | WSEL | WordSelect / GPIO25 |
pin 3 | DCLK | BCLK | ContinuousSerialClock) / GPIO33) |
See the API Documentation for more details.
Maybe you need some Si47XX device functions that the PU2CLR SI4735 Arduino Library has not yet implemented. Also, you may want to change some existent function behaviors. This topic describes some approaches to add new SI473X features to your application.
Please, check the API documentation before implementing something you think is new. It is possible that what you want has already been implemented.
This library has primitive functions that make it easier for you to implement commands that may not have been implemented yet. The methods setProperty, getProperty sendCommand, getCommandResponse and getStatusResponse can be used to setup the SI473X devices directely. They can also be useful to check some features of the SI473X devices. To use those methods you have to be guided by the "AN332 Si47XX PROGRAMMING GUIDE REV 1.0" and AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE AMENDMENT FOR SI4735-D60 SSB AND NBFM PATCHES Silicon Labs documentation. If you are familiar with bit operators in C / C ++, you will have no problem in using the above functions.
The example below configures the GPIO by sending the 0x81 (GPIO_SET) command(AN332 Si47XX Programming guide page 195).
SI4735 rx;
uint8_t args[] = {0b00001010} // will set the GPIO 1 and 3 to high
uint8_t response[0]
.
.
.
rx.sendCommand(0x81,1,args);
.
.
rx.getCommandResponse(1,response);
.
.
.
The best way to customize the PU2CLR SI4735 Arduino Library for your needs is extending the current version of the library by using C++ OOP approach. For example:
#include <SI4735.h>
class MyCustomSI4735 : public SI4735 { // extending the original class SI4735
public:
// New functions / methods
int methodA() { // some SI47XX command that PU2CLR SI4735 Arduino Library does not implement
return 0;
}
int methodB() { // another SI47XX command that PU2CLR SI4735 Arduino Library does not implement
return 1;
}
// Overwriting existent methods
void setTuneFrequencyAntennaCapacitor(uint16_t capacitor) {
// Here, your setTuneFrequencyAntennaCapacitor code that will replace the original code
// Tip: currentFrequencyParams is a protected member of SI4735 class and can be referred in your code
currentFrequencyParams.arg.ANTCAPH = 0; // it is just an example
currentFrequencyParams.arg.ANTCAPL = capacitor; // it is just an example
return;
}
void reset() {
/// your reset code that will replace the original reset code
pinMode(resetPin, OUTPUT);
delay(1);
digitalWrite(resetPin, LOW);
delay(50);
digitalWrite(resetPin, HIGH);
}
};
MyCustomSI4735 radio; // the instance of your custom class based on SI4735 class
void setup()
{
Serial.begin(9600);
while (!Serial);
Serial.println("Customizing Si4735 class example.");
radio.setup(12, 0); // Arduino pin 12 as reset and FM mode (0)
radio.setFM(8400, 10800, 10390, 10);
// Setting the tune capacitor with your code instead Si4735 library code.
radio.setTuneFrequencyAntennaCapacitor(100);
// Calling new functions implemented by you.
Serial.println(radio.methodA());
Serial.println(radio.methodB());
}
void loop() {
// Your code with your custom SI4735 library.
}
If you use that approach, all you have to do is download the current version of PU2CLR SI4735 Arduino Library. Instead of using the PU2CLR SI4735 Arduino Library class directly, you can use your own class that extends the original class. This way, you always have the current version of the library customized for your needs. So, no extra work will be needed when you update the PU2CLR SI4735 Arduino Library. In other words, your custom code will always be synchronized with the PU2CLR SI4735 Arduino Library code.
Please, check the API documentation before implementing something you think is new. It is possible that what you want has already been implemented.
See also:
Depending on your setup, the system can hang at the beginning.
It has been observed in several tests. Some tips:
Attention: The pins numbers above is considering Si473x-D60(SSOP) package.
If you are using Arduino Mini Pro, UNO or similar, pay attention to the pin 13 and the use of on internal pull-up resistor. This pin has a LED and a resistor connected on the board. When this pin is set to HIGH, the LED comes on. If you use the internal pull-up resistor of the pin 13, you might experiment problem due to the voltage drop caused by the LED circuit. If this occurs in your project, do one of the following:
This problem can be a little complicated to solve. It can occur in many situations. I have observed that very few times in my experiments:
Example:
void setup() {
si4735.setMaxDelayPowerUp(500); // now the delay after power up will be 500 ms
si4735.setup(RESET_PIN, FM_FUNCTION);
}
Example:
void setup() {
si4735.setMaxDelaySetFrequency(50);
si4735.setup(RESET_PIN, FM_FUNCTION);
}
Some users may be uncomfortable with the loud popping of the speaker during some transitions caused by some Si47XX device commands. This problem occurs during the receivers transition from the power down to power up. Every time the user changes the mode (FM to AM or AM to FM, Si47XX devices mnust be powered down and powered back up which causes the click sound.
The SI473X devices have HIGH DC (DC bias) component in the analog audio output pins (SI4735-D60 pins 23 and 24). When the device goes to power down mode, the voltage on the audio pins drops to 0V. The device does it internally and there is no way to avoid that. When the device goes to power up, those audio pins suddenly go to the HIGH DC again. This transition causes the loud pop in the speaker. So far, the author of this library has not found an internal SI473X device solution to solve the loud popping of the speaker. The internal SI473X mute or volume commands will not stop the clicking sound. However, it is possible to solve this problem by adding an extra mute circuit and control it by the MCU (Atmega, ESP32, STM32, ATtiny85 etc).
The schematic below shows this approach.
Considering that you are using a MCU based on Atmega328. When the D14 (A0) is HIGH the Si47XX output audio will be drained to the ground. At that condition, no audio will be transferred to the amplifier input and, consequently, to the speaker. So, no loud click in the speaker.
When the D14 is LOW, most of signal audio output from the Si47XX will be transfered to the input of the amplifier.
The code below shows all you have to do in your sketch to implement this resource.
#include <SI4735.h>
#define AUDIO_MUTE 14 // Pin A0 - Switch AGC ON/OF
Si4735 r;
void setup() {
.
// It is all you have to do to control an external audio mute circuit if you have one.
r.setAudioMuteMcuPin(AUDIO_MUTE); // Tells the system to control an external audio mute circuit.
r.setup(RESET_PIN, -1, 1, SI473X_ANALOG_AUDIO); // Starts on FM mode and ANALOG audio mode.
.
.
.
}
{% include audiomute.html %}
Some low power audio amplifiers IC also implement a mute circuit that can be controlled externally. You can find this resource on LM4906, LM4863, KA8602B, MC34119, PAM8403 and HT82V739 devices.
/**
Converts a number to a char string and places leading zeros.
It is useful to mitigate memory space used by sprintf or generic similar function
*/
void convertToChar(uint16_t value, char *strValue, uint8_t len)
{
char d;
for (int i = (len - 1); i >= 0; i--)
{
d = value % 10;
value = value / 10;
strValue[i] = d + 48;
}
strValue[len] = '\0';
}
TIP: The SI4735 Arduino Library has a function to format numeric values like frequency, bfo, rssi etc. See convertToChar documentation
Example:
.
.
.
void showFrequency()
{
char freqDisplay[10];
if (band[bandIdx].bandType == FM_BAND_TYPE)
{
rx.convertToChar(currentFrequency, freqDisplay, 5, 3, ','); // Formats the FM frequency
}
else
{
if (band[bandIdx].bandType == MW_BAND_TYPE || band[bandIdx].bandType == LW_BAND_TYPE)
rx.convertToChar(currentFrequency, freqDisplay, 5, 0, '.'); // Formats LW and MW frequency
else
rx.convertToChar(currentFrequency, freqDisplay, 5, 2, '.'); // Formats SW frequency
}
showValue(0, 0, oldFrequency, freqDisplay, 2, 11);
}
.
.
.
Explanation: The first byte of each line of the original patch content is either a 0x15 or 0x16 command. To shrink the patch size stored on the controller, the first byte on each line is omitted. Since the first byte on each line is either 0x15 or 0x16, it is not necessary to explicitly store them. Since most lines start with the 0x16 byte, only the line numbers beginning with 0x15 must be stored. The downloadCompressedPatch method will insert the value 0x15 when it's on a line that is marked as beginning with 0x15, and will insert 0x16 on all other lines.
#include <patch_ssb_compressed.h> // SSB patch for whole SSBRX initialization string
const uint16_t size_content = sizeof ssb_patch_content; // See ssb_patch_content.h
const uint16_t cmd_0x15_size = sizeof cmd_0x15; // Array of lines where the 0x15 command occurs in the patch content.
void loadSSB()
{
.
.
rx.setI2CFastModeCustom(500000);
rx.queryLibraryId(); // Is it really necessary here? I will check it.
rx.patchPowerUp();
delay(50);
rx.downloadCompressedPatch(ssb_patch_content, size_content, cmd_0x15, cmd_0x15_size);
rx.setSSBConfig(bandwidthSSB[bwIdxSSB].idx, 1, 0, 1, 0, 1);
rx.setI2CStandardMode();
.
.
}
This library can be useful to develop cross-platform software. So far, it has been successfully tested on the architectures shown below.
The table below shows the some boards where this library has been successfully tested.
Board | Need voltage converter | I²C Pins | Used Reset Pin | Features | |
---|---|---|---|---|---|
1 | Arduino Pro Mini 3.3V 8MHz | No | A4 and A5 | 12 | More... |
2 | Mega 2560 Pro | Yes | 20 and 21 | 12 | More... |
3 | ESP WEMOS LOLIN32 | No | GPIO21 and GPIO22 [4] | GPIO25 [5] | More... |
4 | ESP32 Dev Module | No | GPIO21 and GPIO22 [4] | GPIO25 [5] | More... |
5 | ESP32 Wrover Module | No | GPIO21 and GPIO22 [4] | GPIO25 [5] | More... |
6 | ESP8266 | No | GPIO4 and GPIO5 | GPIO2 | More... |
7 | Arduino UNO | Yes | A4 and A5 | 12 | More... |
8 | Arduino NANO ATmega 328 | Yes | A4 and A5 | 12 | More... |
9 | Arduino NANO ATmega 168 | Yes | A4 and A5 | 12 | More... |
10 | Arduino NANO 33 IoT | No [6] | A4 and A5 | 12 | More... |
11 | Arduino Yún / ATmega-32u4 | Yes | 2 and 3 | 12 | More... |
12 | ATtiny84 | No | 7 and 8 | 6 | More... |
13 | ATtiny85 | No | 5 and 7 | 2 (D3) | More... |
14 | Arduino DUE | No | 2 and 3 | 12 | More... |
15 | BlueDuino 3.3V (ATmega-32u4) | No | 2 and 3 | 10 | More... |
16 | Arduino Mini Pro 5V 16Mhz | Yes | 2 and 3 | 10 | More... |
17 | STM32F746G-DISCO | No | - | - | More... |
18 | STM32F103 Series | No | PB6 (SCL) and PB7(SDA) | PA12 | More... |
19 | STM32F411 Series | No | PB6 (SCL) and PB7(SDA) | PA12 | More... |
20 | Raspberry Pi Pico | No | GP0 (0) and GP1 (1) | GP16 (16) | More... |
21 | WeAct Studio RP2040 Pico | No | GP0 (0) and GP1 (1) | GP16 (16) | More... |
22 | Seeeduino XIAO | No | A4 and A5 | 3 | More... |
23 | Teensy 3.1 | No | A4 and A5 | 12 | More... |
24 | Teensy 4.1 | No | A4 and A5 | 12 | More... |
25 | Atmega8 | No | PC4 and PC5 | PD6 | More... |
26 | Atmega32 | No | PC1 and PC0 | PB2 | More... |
27 | Atmega128 | No | PC1 and PC0 | PB2 | More... |
28 | LGT8F328P | No | A4 and A5 | 12 | More... |
29 | LUATOS ESP32C3 | No | GPIO4 and GPIO5 | GPIO8 | More... |
The table below shows some SI473X, SI474X devices and Si4730 based-boards where the PU2CLR SI4735 Arduino Library has been successfully tested.
SI473X board / IC | I²S | FM | RDS | AM | SSB | LW | MW | SW | Tested |
---|---|---|---|---|---|---|---|---|---|
SI4735-D60 | X | X | X | X | X | X | X | X | Yes |
SI4735-B20 | X | X | X | X | X | X | X | Yes | |
SI4732-A10 (*1) (*3) | - | X | X | X | X | X | X | X | Yes* |
SI4730-D60 (*2) | X | X | X* | X | X* | X | X* | Yes | |
SI4734-D60 | X | X | X | X | X | X | Yes | ||
NE928-10A SI4730 | - | X | X | Yes | |||||
PL102BA V2.11 10628 (*2) | - | X | X* | X | X* | X | X* | Yes | |
SI4743-C10 | X | X | X | X | X | X | X | Yes | |
SI4745-C10 | X | X | X | X | X | X | X | Yes |
Acording to Silicon Labs guide AN332, the SI4732-A10 has the same firmware FMRX component and AM_SW_LW RX component as that of SI4735-D60. See Si47XX PROGRAMMING GUIDE; AN332; page 2. So, like the SI4735-D60, it is possible to use it to listen to SSB mode with the SI4732-A10.
Although the SI4730-D60 does not officially support SW, several tests performed during the development of this library, as well as tests performed by other experimenters, it was observed excellent performance of this IC on HF/SW band. See "Si47XX PROGRAMMING GUIDE; pages 2 and 3; Table 1 - Product Family Function" for more details. See the video Si4730-D60 ultimate testing (FM/RDS + LW + SW). It is important to note that the author of this library does not guarantee all SI4730-D60 devices sold on the market will work in LW and SW bands and FM with RDS as well.
Digital Audio setup (I²S) did not work during the tests.
{% include videocross.html %}
This item describes some tools and accessories you might need to build your radio based on SI4735. Most of the accessories used in this project you will find on eBay and AliExpress.
Arduino Pro Mini | Arduino Pro Mini |
---|---|
FT232 USB Adapter | FT232 USB Adapter |
---|---|
Magnifier | Solder |
---|---|
Adapter for SI4735 | Soldering Accessories |
---|---|
It was a bit hard to solder the kind of CI on adapter. However, by using a electronic magnifier it was possible.
Si4735 on Adapter | Si4735 on Adapter |
---|---|
The basic circuit built on protoboard is based on the “SSOP Typical Application Schematic”, suggested by the Silicon Labs Documentation (Si4730/31/34/35-D60-BROADCAST AM/FM/SW/LW RADIO RECEIVER; page 19). Two pull-up 4.7K resistors were added on I²C bus (It is an arbitrary value. Actually, this value may vary depending on your devices connected to the bus). Also, it is recomended to add two 4.7uF capacitors between the CI audio output and audio amplifier. The photos below do not show these capacitors. See C7 and C8 on schematic.
The figure below shows a suggestion to shrink the prototype and connections. If you are just doing prototyping, I recommend this approach due to the short connections with the Si4735 (recommended by the manufacturer).
The configuration above connected to Arduino Pro Mini is shown below.
The following photo shows the most common prototyping approach. Use this approach if you don't want to solder the components on the adapter plate.
The figure above shows the very basic shematic implementation (no Button or Encoder). See the folder examples for more details and other configuration with LCD and OLED
Here you can see some experiments using this library. Watch them.
{% include video01.html %}
The table below shows some radios based on SI47XX
Manufacturer | Model | Device | More information |
---|---|---|---|
Tecsun | PL310ET | Si4734 | About |
Tecsun | PL-330 | Si4735 | Review |
Tecsun | PL-365 | Si4735 | Review |
Tecsun | PL-360 | Si4734 | Review |
Tecsun | PL380 | Si4734 | Reviews |
Tecsun | PL880 | Si4735 | Reviews |
CountyComm | GP-7/SSB | Si4735 | Reviews |
Degen | DE1103 DSP | Si4735 | Review |
Degen | DE1123/Kaito KA1123 | Si4734 | Review |
Degen | DE1125/Kaito KA801 | Si4734 | Reviews |
Degen | DE1126 | Si4734 | Review |
Degen | DE1127 (discontinued) | Si4734 | Review |
Sangean | ATS-909X | Si4735 | Review |
Sangean | ATS-909X2 | Si4735 | Review |
XHDATA | D808 | Si4735 | Review |
RADIWOW | R-108 | SI4734 | Review |
C Crane | CC Skywave | Review | |
Unknown | ATS-20 | SI4732 | Review |
Unknown | ATS-25 | Si4732 | Review |
Unknown | ATS-100 | Si4732 | Review |