adafruit_si4713

CircuitPython module for the SI4713 RDS FM transmitter. See examples/simpletest.py for a demo of the usage. Based on the Arduino library at: https://github.com/adafruit/Adafruit-Si4713-Library/

  • Author(s): Tony DiCola

Hardware:

Software and Dependencies:

class adafruit_si4713.SI4713(i2c: I2C, *, address: int = 99, reset: DigitalInOut | None = None, timeout_s: float = 0.1)[source]

SI4713 RDS FM transmitter. Initialize by specifying:

Parameters:
  • i2c (I2C) – The I2C bus connected to the board.

  • address (int) – The I2C address if it has been changed. Defaults to 0x63

  • reset (DigitalInOut) – A DigitalInOut instance connected to the board’s reset line, this will be used to perform a soft reset when necessary.

  • timeout_s (float) – The amount of time (in seconds) to wait for a command to succeed. If this timeout is exceed a runtime error is thrown. Defaults to 0.1

property audio_signal_status: int

Retrieve the ASQ or audio signal quality status value from the chip. This is a byte that indicates if the transmitted input audio signal is overmodulating (too high) or above/below input audio level thresholds. See page 25 of AN332 for more discussion of this value: https://www.silabs.com/documents/public/application-notes/AN332.pdf

configure_rds(program_id: int, station: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray | None = None, rds_buffer: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray | None = None) None[source]

Configure and enable the RDS broadcast of the specified program ID. Program ID must be a 16-bit value that will be broacast on the RDS bands of the transmitter. Specify optional station and RDS buffer strings that will be used to broadcast the station and currently playing song information, or later set the rds_station and rds_buffer to change these values too. The station value is up to 96 bytes long, and the buffer is up to 106 bytes long. Note this will configure RDS properties of the chip for a typical North American RDS broadcast (deviation, mix, repeat, etc. parameters).

gpio_control(gpio1: bool = False, gpio2: bool = False, gpio3: bool = False) None[source]

Control the GPIO outputs of the chip. Each gpio1, gpio2, gpio3 parameter is a boolean that indicates if that GPIO channel (corresponding to GPIO1, GPIO2, GPIO3 of the chip respectively) is driven actively (True) or is high-impedence/off (False). By default any unspecified GPIO is set to high-impedence/off unless otherwise provided.

gpio_set(gpio1: bool = False, gpio2: bool = False, gpio3: bool = False) None[source]

Drive the GPIO outputs of the chip that are enabled with active output. Each gpio1, gpio2, gpio3 parameter is a boolean that indicates if the associated GPIO (corresponding to GPIO1, GPIO2, GPIO3 of the chip respectively) is driven high (True) or low (False). By default all GPIO are assumed to be set low (False) unless otherwise specified. Note that you must first set GPIOs to active output with the gpio_control function to see their output physically change.

property input_level: int

Read the input level of audio to the chip and return it in dBfs units.

property interrupt_status: int

Read the interrupt bit status of the chip. This will return a byte value with interrupt status bits as defined by the radio, see page 11 of the AN332 programming guide: https://www.silabs.com/documents/public/application-notes/AN332.pdf

property rds_buffer

Set the RDS broadcast buffer to the specified byte string. Can be at most 106 bytes long and will be padded with blank spaces if less.

property rds_station

Set the RDS broadcast station to the specified byte string. Can be at most 96 bytes long and will be padded with blank spaces if less.

received_noise_level(frequency_khz: int, antenna_capacitance: float = 0) int[source]

Measure the received noise level for the specified frequency (in kilohertz, 76mhz - 108mhz and must be a multiple of 50) and return its value in units of dBuV (decibel microvolts). Will use automatic antenna capacitance tuning by default, otherwise specify an antenna capacitance in pF from 0.25 to 47.75 (only steps of 0.25pF are supported).

reset() None[source]

Perform a reset of the chip using the reset line. Will also perform necessary chip power up procedures.

set_tx_power_capacitance(tx_power: int, capacitance: float) None[source]

Set both the transmit power (in dBuV, from 88-115) and antenna capacitance of the transmitter. Capacitance is a value specified in pF from 0.25 to 47.75 (in 0.25 steps), or 0 to indicate automatic tuning. You typically don’t need to use this function unless you want explicit control of tuning antenna capacitance, instead for simple transmit power changes use the tx_power property (which assumes automatic antenna capacitance).

property tx_antenna_capacitance: float

Read the transmit antenna capacitance in pico-Farads (pF). Use the set_tx_power_capacitance function to change this value (must also change transmit power at the same time). It’s uncommon to adjust this beyond the automatic tuning option!

property tx_frequency_khz: int

Get and set the transmit frequency of the chip (in kilohertz). See AN332 page 19 for a discussion of the constraints on this value, in particular only a multiple of 50khz can be specified, and the value must be between 76 and 108mhz.

property tx_power: int

Get and set the transmit power in dBuV (decibel microvolts). Can be a value within the range of 88-115, or 0 to indicate transmission power is disabled. Setting this value assumes auto-tuning of antenna capacitance, see the set_tx_power_capacitance function for explicit control of setting both transmit power and capacitance if needed.