ATtiny85 RDA5807 TinyFMradio: Your Portable FM Radio with RDS

TinyFMradio FM Radio with RDS

FM Radio with RDS, Audio Amplifier, Rotary Encoder and OLED Displa. TinyFMRadio is an ATtiny45/85 controlled FM radio with RDS (RDA5807) with an integrated audio amplifier (XPT8871 or TC8871), an OLED display (SSD1306) and a rotary encoder. You can directly connect a protected li-ion battery, a 3W / 4 Ω speaker and an FM antenna.

Hardware
The low-cost RDA5807MP is a single-chip broadcast FM stereo radio tuner with fully integrated synthesizer, IF selectivity, RDS/RBDS and MPX decoder. The tuner uses the CMOS process, supports multi-interface and requires the least external component. All these make it very suitable for portable devices.

Get new posts by email:

Schematic ATtiny85 TinyFMradio FM Radio with RDS

Schematic Tinyfmradio Fm Radio With Rds 1
Schematic Tinyfmradio Fm Radio With Rds

Software
The firmware is just a demo sketch that implements basic functionality. By pressing the rotary encoder button the RDA5807 seeks the next radio station. Turning the rotary encoder increases/decreases the volume. Selected frequency and volume are stored in the EEPROM. Station name, frequency, signal strength, volume, and battery state of charge are shown on an OLED display.

I²C Implementation
The I²C protocol implementation is based on a crude bitbanging method. It was specifically designed for the limited resources of ATtiny10 and ATtiny13, but should work with some other AVRs as well. Due to the low clock frequency of the CPU, it does not require any delays for correct timing. To save resources, only the basic functionalities which are needed for this application are implemented. For detailed information on the working principle of the I²C implementation, visit TinyOLEDdemo.

Controlling the RDA5807
The FM tuner IC RDA5807MP is controlled via I²C by the ATtiny. It has six writable 16-bit registers (addresses 0×02 – 0×07) and six readable 16-bit registers (addresses 0×0A – 0×0F). The RDA5807 has two methods of write access, a sequential one in which the registers are always written starting from address 0×02 and an indexed method in which the register address is transferred first and then the content. Both methods are determined by different I²C addresses. To transfer the 16-bit register content, the high byte is sent first. The RDA5807 is controlled by setting or clearing certain bits in the respective registers. The details of the meanings of the individual registers can be found in the data sheet. The current register contents are saved in the RDA_regs arrays. The RDA implementation is based on the work of Maarten Janssen.

Tinyfmradio Fm Radio With Rds Pcb
Tinyfmradio Fm Radio With Rds Pcb

Rotary Encoder Implementation
The implementation for the rotary encoder uses pin change interrupts on only one of the pins and is written in such a way that bouncing is automatically suppressed.

Compiling and Uploading the Software

If using the Arduino IDE

  • Make sure you have installed ATtinyCore.
  • Go to Tools ⇾ Board ⇾ ATtinyCore and select ATtiny25/45/85 (No bootloader).
  • Go to Tools and choose the following board options:
    • Chip: ATtiny45 or ATtiny85
    • Clock: 1 MHz (internal)
    • B.O.D.: disabled
    • Leave the rest at the default settings
  • Connect your programmer to your PC and to the ICSP header of the device.
  • Go to Tools ⇾ Programmer and select your ISP programmer (e.g. USBasp).
  • Go to Tools ⇾ Burn Bootloader to burn the fuses.
  • Open TinyFMRadio sketch and click Upload.

If using the precompiled hex-file

  • Make sure you have installed avrdude.
  • Connect your programmer to your PC and to the ICSP header of the device.
  • Open a terminal.
  • Navigate to the folder with the hex-file.
  • Execute the following command (if necessary, replace “t85” with your chip and “usbasp” with the programmer you use):
avrdude -c usbasp -p t85 -U lfuse:w:0x62:m -U hfuse:w:0xd7:m -U efuse:w:0xff:m -U flash:w:tinyfmradio.hex

If using the makefile (Linux/Mac)

  • Make sure you have installed avr-gcc toolchain and avrdude.
  • Connect your programmer to your PC and to the ICSP header of the device.
  • Open the makefile and change the chip if you are not using ATtiny85 and the programmer if you are not using usbasp.
  • Open a terminal.
  • Navigate to the folder with the makefile and the Arduino sketch.
  • Run “make install” to compile, burn the fuses and upload the firmware.
Tinyfmradio Fm Radio With Rds 1
Tinyfmradio Fm Radio With Rds

Bom ATtiny85 TinyFMradio FM Radio with RDS

QuantityCommentDesignatorFootprint
Resistors 1/4W
410k (103)R1,R7,R8,R90603
31k (102)R2,R5,R60603
24k7 (472)R3,R40603
Capacitors
7100nC1,C5,C6,C8,C14,C15,C160603 – Ceramic capacitor
147uC21206 – Ceramic capacitor
1470uFC3CAP-SMD_D10.0-L10.3- Electrolytic capacitor
210uC4,C70603 – Ceramic capacitor
21uC9,C110603 – Ceramic capacitor
11nC100603 – Ceramic capacitor
2390nC12,C130603 – Ceramic capacitor
Semiconductors
1LED-BlueLED1LED-0603 – Led Blue
1RDA5807MPU2SOP-8_150MIL – Fm receiver
1XPT8871ESU3HSOP-8 – Power amplifier
1XC6206P332PRU4SOT-89 – 3.3V voltage regulator
1ATTINY85-20SUU1SOIC-8_208MIL – Microcontroller
Miscellaneous
1Slide SwitchPOWERSLIDE SWITCH DPDT 1P2T JB
2HeaderSPK,VINHDR-1X2/2.54
1Rotary EncoderSW1BOURNS_PEC11R-4XXXF-SXXXX
1HeaderANTHDR-1X1/2.54
1I2CI2CHDR-4X1/2.54
1ICSP-6ICSPICSP-6
132.768 khzY1XTAL-32KHZ – Crystal
Download files, PCB in PDF, Gerber

Download

Mirror

Firmware

References, Links and Notes
  1. ATtiny25/45/85 Datasheet
  2. RDA5807MP Datasheet
  3. SSD1306 Datasheet
  4. TC8871 Datasheet

Source: https://oshwlab.com/wagiminator/attiny85-tinyfmradio

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Share on the social networks!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Photo of author
About the author
Xtronic.org blog author. Electronics technician for the technical school of Brasilia - Brazil. Interested in electronics, circuits and technology in general.
Share:

Leave a Comment