CC-BY-SA 3.0

Recommend Projects

ATtiny85 TinyFMradio SMD

2 years ago 5651
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments



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.



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, support multi-interface and require the least external component. All these make it very suitable for portable devices.



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. In order to save resources, only the basic functionalities which are needed for this application are implemented. For a 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 0x02 - 0x07) and six readable 16-bit registers (addresses 0x0A - 0x0F). The RDA5807 has two methods of write access, a sequential one in which the registers are always written starting from address 0x02 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.

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.

References, Links and Notes

  1. ATtiny25/45/85 Datasheet
  2. RDA5807MP Datasheet
  3. SSD1306 Datasheet
  4. TC8871 Datasheet
  5. ATtiny13 TinyPocketRadio




This work is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License. (






ID Name Designator Footprint Quantity BOM_Manufacturer Part
1 Header VIN,SPK HDR-1X2/2.54 2 2.54-1*2PFemale
2 HT7333-A U4 SOT-89 1 HT7333-A
3 32.768 khz Y1 XTAL-32KHZ 1 VT-200-F-32.768kHz-20PPM-6pF
4 I2C I2C HDR-4X1/2.54 1 Header-Female-2.54_1x4
5 1000uF C3 CAP-SMD_D10.0-L10.3-W10.3-H10.2 1 EEE1CA471P
6 1k R2 0603 1 0603WAF1001T5E
7 10k R7,R1,R8,R9 0603 4 0603WAF1002T5E
8 20k R6,R5 0603 2 0603WAF2002T5E
9 4k7 R3,R4 0603 2 0603WAF4701T5E
10 ATTINY85-20SU U1 SOIC-8_208MIL 1 ATTINY85-20SU
11 Slide Switch POWER SLIDE SWITCH DPDT 1P2T JB 1 New SchematicLib
12 ICSP-6 ICSP ICSP-6 1 ?
13 Rotary Enc SW1 BOURNS_PEC11R-4XXXF-SXXXX 1 PEC11R-4015F-S0024
14 Header ANT HDR-1X1/2.54 1 Header-Male-2.54_1x1
15 10u C7,C4 0603 2 CL10A106MA8NRNC
16 100n C1,C8,C15,C14,C5,C16,C6 0603 7 CC0603KRX7R9BB104
17 1u C9,C11 0603 2 CL10A105KB8NNNC
18 1n C10 0603 1 CL10B102KB8NNNC
19 390n C12,C13 0603 2 CC0603KRX7R6BB394
20 47u C2 1206 1 CL31A476MQHNNNE
21 XPT8871ES U3 HSOP-8 1 XPT8871ES
22 LED-Blue LED1 LED-0603 1 19-217/BHC-ZL1M2RY/3T
23 RDA5807MP U2 SOP-8_150MIL 1 RDA5807MP


The owner does not allow comments in this project now

Comments (7)

SP634 Reply

Hello! I want to make this radio, but I can not compile the hex file from your ino. Сould you please provide me with this hex file? Thanks

SP634 Reply


SP634 Reply

One more question: how is the battery voltage monitoring function implemented?

Stefan Wagner Reply

@SP634  The internal 1.1V voltage reference is measured against VCC with the ADC of the ATtiny. From this the supply voltage is calculated, which should normally be 3.3V due to the LDO. If the voltage of the battery falls below this value, the output voltage of the LDO and thus VCC of the ATtiny also decrease. At below 3.2V the display "Bat: weak" appears.

SP634 Reply

Great! Radio is working (on a breadboard).Thanks a lot for this project and for your comments

Stefan Wagner Reply

@SP634  Thank you for your feedback. Have fun!

如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.