Car FM Modulator

Introduction

  • This project consists of building a portable FM modulator, to be used for music playing in cars which don't have Bluetooth connectivity.
  • This idea occured to me when I had a long drive in my Dacia Logan, having no CDs or Bluetooth speakers, and barely any radio signal.
  • Features: Bluetooth pairing, frequency selection (using the potentiometer), information display, audio play from SD memory.

General description

Hardware Design

List of components

  • Arduino UNO R3
  • Breadboard + dupont wires
  • 3.5mm jack wire
  • KT0803K FM transmitter (I2C)
  • MH-M28 BLE stereo receiver
  • LCD 1602 (I2C)
  • SD card reader
  • Push button
  • 10K potentiometer
  • 2 1K resistors

Pin connections

  • KT0803K:
    • VCC - 5V
    • GND - GND
    • SDA - PC4 (Arduino)
    • SCL - PC5 (Arduino)
    • 3.5mm Jack - 3.5mm Jack (KT0803K)
  • MH-M28:
    • VCC - 5V
    • GND - GND
    • R (stereo sound was too resource intensive) - PB1 (Arduino)
  • LCD 1602:
    • VCC - 5V
    • GND - GND
    • SDA - PC4 (Arduino)
    • SCL - PC5 (Arduino)
  • SD card reader:
    • 5V - 5V
    • GND - GND
    • SCK - PB5
    • MISO - PB4
    • MOSI - PB3
    • CS - PB2
  • Push button:
    • Vin - PD2 (Arduino)
    • GND - GND (Arduino)
  • Voltage divider (1K resistor + 10K potentiometer)
    • Vin (resistor) - 5V
    • Vout (between resistor and potentiometer) - PC3 (Arduino)
    • GND - GND

Software Design

External libraries used

Lab concepts used

  • Lab 0 - GPIO
  • Lab 2 - Interrupts
  • Lab 4 - ADC

Lab concepts abstracted away by libraries:

  • Lab 3 - Timers + PWM
  • Lab 5 - SPI
  • Lab 6 - I2C

Arduino GPIO configuration

  • PC3 - input (for ADC)
  • PD2 - input & pull-up (for button)
  • PD3 - output (Bluetooth receiver power)

Flow

Synopsis: A button is pressed to toggle the frequency selection, or held (>1s) to switch between playing audio from Bluetooth or the SD card. While in frequency selection mode, the ADC is continuously running and reading values from a voltage divider containing a potentiometer (knob), while the LCD is displaying the current selected value (read from the ADC on interrupts) and the transmitter is playing on the previous established frequency. While not selecting, the ADC is turned off in order to save energy, and the transmitter is playing on the established frequency (selected when the mode changes), while the LCD displays it. While playing audio from the SD card, the power supply is cut from the Bluetooth receiver, and wav files are played, in order, from the disk. A press of the button skips to the next song.

On setup, several registers are configured:

  • DDRC, DDRD and PORTD for GPIO configuration (as above);
  • EICRA and EIMSK for enabling interrupt on falling edge for pin PD2, in order to detect button presses.
  • ADMUX, ADCSRA and ADCSRB for setting up the ADC with the following configuration: AVcc (5V) reference, interrupt enable, auto-trigger enable, free-running mode and channel 3 (input on ADC3/PC3).

Then, using library calls, LCD and FM transmitter are set up. A default transmitting Frequency of 90.0Hz is set, and the region is EUROPE.

Two interrupt handlers are set up, INT0 and ADC:

  • INT0: notify that the button has been pushed (after debouncing the input);
  • ADC: update the selected frequency value.

The main execution loop converts the ADC raw value into a transmitting frequency (between 87.5MHz and 108MHz) and displays it on the screen if in selection mode.

Results

  • The modulator manages to emit audio on the selected frequency at a reasonable quality.
  • Its range is about 10 meters, but it can be extended via an antenna (a simple wire will suffice). However, this is not usually desired as we do not want to interfere with others' radios.
  • Audio played from a SD card is very noisy (because it is reconstructed using PWM). A low-pass filter or a dedicated DAC would have improved the quality.

Challenges

The initial plan was to use Adafruit Si4713 as an FM transmitter. It was a circuit with more advanced capabilities (such as broadcasting text info about the radio “station”), and more (>0) documentation on the Internet. The order came late from China, and, to make matters worse, the chip was broken (wasn't even responding to a I2C address sweep). I couldn't find any replacement of the same model.

I have later found out that the Adafruit Si4713 had been discontinued :-( .

The replacement, KT0803K has almost no documentation online, the retailer, ElecHouse, doesn't even list the product on their website and the only provided demo code didn't work with an ESP32 (the initial microcontroller choice). More so, it accepts input only as 3.5mm jack, so I had to buy a compatible Bluetooth receiver (MH-M28).

Finally, SD card readers were very hard to find, as all customary sellers have gone out of stock. I managed to get one, but a new challenge arose: how to connect a GPIO pad audio output to a jack input? The answer was the Bluetooth receiver: it has both jack and pads output (connected to eachother), so I could drive the audio signal from the pads straight to the jack.

pm/prj2025/eradu/alexandru.sima1512.txt · Last modified: 2025/05/30 09:49 by alexandru.sima1512
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0