• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    Python
  • License
    Other
  • Created over 2 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Small FM Radio with RDS and OLED

FM Pocket Radio with RDS

PocketRadio is an ATtiny402/412 controlled FM radio with RDS (RDA5807MP), an integrated audio amplifier (TC8871 or XPT8871), a LiPo battery charger (MCP73831 or TP4054), an OLED display (SSD1306) and three buttons. You can directly connect a protected 3.7V LiPo battery, a 3W / 4Ω speaker and an FM antenna.

pic2.jpg

Hardware

Schematic

wiring.png

RDA5807MP FM Radio Tuner IC

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 RDA5807MP is controlled by the ATtiny via I²C.

TC8871 Audio Amplifier IC

The TC8871 is an FM-free, Class AB/Class D selectable power amplifier. When the working voltage is 5V, the maximum driving power is 5W (2Ω, BTL load, THD>10%). The application circuit of TC8871 is simple, only a few peripheral devices are needed, and the feedback resistor is integrated; the output does not need an external coupling capacitor or a power-up capacity and buffer network. The amplification can be selected via the value of the resistors R3 and R4 (Gain = 2 * 100kΩ / (10kΩ + R3), R4 respectively), which determines the maximum volume. Keep in mind that the resistors together with the coupling capacitors C3 and C4 form a high-pass filter whose cut-off frequency is determined using the following formula: f = 1 / (2 * π * R3 * C3), R4 and C4 respectively.

MCP73831 Li-Ion Battery Charger IC

For battery charging the MCP73831 is used. The MCP73831 is a highly advanced linear charge management controller for use in space-limited, cost-sensitive applications. It employs a constant-current/constant-voltage charge algorithm with selectable preconditioning and charge termination. The constant current value is set with one external resistor (I = 1000V / R6). Charging is done via the built-in USB-C connector. The MCP73831 can be replaced by the much cheaper TP4054.

ME6209 Voltage Regulator

The ME6209A33 is a 3.3V positive voltage output, three–pin regulator, that provides a high current (up to 250mA) even when the input/output voltage differential is small. Low power consumption (3µA) and high accuracy (+/-2%) is achieved through CMOS technology. It allows input voltages as high as 18V with a dropout voltage around 80mV@40mA.

pic6.jpg

Software

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.

Compiling and Uploading the Firmware

  • Connect your UPDI programmer to your PC and to the UPDI header on the board. Set your programmer to work at 3.3V!
  • Use one of the following methods to compile and upload the firmware:

If using the Arduino IDE

  • Open your Arduino IDE.
  • Make sure you have installed megaTinyCore.
  • Go to Tools -> Board -> megaTinyCore and select ATtiny412/402/212/202.
  • Go to Tools and choose the following board options:
    • Chip: ATtiny402 or 412
    • Clock: 1 MHz internal
    • Leave the rest at the default settings.
  • Go to Tools -> Programmer and select your UPDI programmer.
  • Go to Tools -> Burn Bootloader to burn the fuses.
  • Open the sketch and click Upload.

If using the makefile (Linux/Mac)

  • Make sure you have installed the latest avr-gcc toolchain.
  • Open a terminal.
  • Navigate to the folder with the makefile and the sketch.
  • Run DEVICE=attiny412 PROGRMR=serialupdi PORT=/dev/ttyUSB0 make install to compile, burn the fuses and upload the firmware (change DEVICE, PROGRMR and PORT accordingly).

Building Instructions

Solder all components to the PCB. Place the 40mm speaker in the corresponding cutout on the board. Glue the speaker in place with hot glue. Make sure that the glue is airtight all around to achieve good sound quality. Solder the connection cables between speaker and board. Solder the wire antenna to the corresponding pad on the board. A 75cm (30" = λ / 4) long 28AWG flexible silicone insulated wire works very well.

pic7.jpg

3D print the case. Cases with different heights are available in the "3dprint" folder. Choose the case that matches the height of your battery and speaker. Glue the battery into the case with double-sided tape. Thread the wire antenna through the small hole in the housing. To improve the sound quality, you can pack a foam mat between the battery and the PCB inside the case. This should fit snugly against the outer walls of the housing.

pic8.jpg

Connect the battery to the JST connector on the board. Pay attention to the correct polarity, unfortunately there is no standard here! At the latest now you should upload the firmware (see above). Use the UPDI pads on the board for this. Place the board on the case and screw it with four M2x5mm self-tapping screws.

pic4.jpg

There are different loudspeakers with 40mm diameter. The flatter ones allow the radio to be built more compactly, while the taller ones have better sound quality.

pic9.jpg pic10.jpg

The size of the battery also affects the size of the radio. In operation, the radio consumes around 100mA - 125mA at 3.7V and medium volume. So a battery with a capacity of 1200mAh should provide around 10 hours of playtime.

pic11.jpg

Operating Instructions

  1. Make sure that the wire antenna is laid as straight as possible horizontally or vertically.
  2. Turn on the radio using the power switch.
  3. The radio should automatically tune to the last station scanned and volume used.
  4. Use the volume buttons to select the volume from 0 to 15.
  5. The next station is searched for with the "CH+" button.
  6. When the OLED shows "Bat: weak", you should soon recharge the battery via the USB-C port.

pic1.jpg

References, Links and Notes

  1. ATtiny412 Datasheet
  2. RDA5807MP Datasheet
  3. TC8871 Datasheet
  4. MCP73831 Datasheet
  5. ME6209 Datasheet
  6. SSD1306 Datasheet
  7. ATtiny13A TinyPocketRadio
  8. ATtiny85 TinyFMRadio
  9. 128x64 OLED on Aliexpress

pic3.jpg

License

license.png

This work is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License. (http://creativecommons.org/licenses/by-sa/3.0/)

More Repositories

1

ATmega-Soldering-Station

T12 Quick Heating Soldering Station
C++
915
star
2

Power-Boards

Collection of DC/DC Converters, Battery Chargers and Power Supplies
381
star
3

CH32V003-GameConsole

Handheld RISC-V Mini Game Console with OLED Display
C
214
star
4

C64-Collection

Collection of cartridges, adapters and replacements for the Commodore C64
C
162
star
5

ATtiny13-TinyUPS

Uninterruptible Power Supply
C++
142
star
6

CH552-USB-Knob

Rotary Encoder with NeoPixels and USB Interface
C
142
star
7

AVR-Programmer

Collection of AVR Programmers and Accessories
C
136
star
8

Development-Boards

Collection of various development boards for microcontrollers (e.g., CH55x, CH32, PY32, STC8, STM32) and accompanying example software.
C
133
star
9

ATmega-Transistor-Tester

Small version of the famous component tester from mikrocontroller.net
C
116
star
10

ATtiny13-TinyOLEDdemo

I²C OLED on an ATtiny10/13/202
C++
98
star
11

CH32X035-USB-PD-Tester

USB Power Delivery Testing Device and Variable Power Supply
C
97
star
12

ATtiny13-TinySolder

T12 Quick Heating Soldering Station
C++
75
star
13

ATtiny13-TinyRemote

IR Remote Control
C++
68
star
14

ATtiny85-TinyFMRadio

FM Radio with RDS
C++
64
star
15

ATtiny85-TinyTerminal

USB controlled OLED Display
C++
61
star
16

ATtiny814-USB-PD-Adapter

USB Type-C Power Delivery Trigger and Monitoring Board
C
57
star
17

ATtiny85-TinyCharger

Single-Cell Li-Ion Battery Charger with Monitoring
C++
57
star
18

CH32V003-FM-Transmitter

Portable Digital Stereo FM Radio Transmitter
C
54
star
19

CH552-USB-OLED

USB controlled I²C OLED
C
54
star
20

ATtiny13-TinyTacho

Simple RPM-Meter
C++
52
star
21

ATtiny84-TinyCalibrator

OSC Calibrator and High-Voltage Fuse Resetter for 8-Pin ATtinys
C++
52
star
22

ATtiny412-USB-Power-Isolator

2.5kV Isolator for the USB Power Rail
C
50
star
23

MCU-Templates

Templates for bare-metal firmware development for some entry-level microcontrollers
C
50
star
24

ATtiny85-USB-Tester

Simple USB Power Tester
C++
49
star
25

ADuM3160-USB-Isolator

2.5kV USB 2.0 Isolator with 200mA Power Supply and Full Speed (12Mbps) Support
48
star
26

ATtiny814-Power-Analyzer

Power Supply Analyzer with USB Interface
Python
48
star
27

MCU-Flash-Tools

Simple ISP Flash Tools for various Microcontrollers
Python
46
star
28

CH552-MacroPad-plus

Programmable MacroPad with Rotary Encoder and NeoPixels
C
45
star
29

ATtiny85-TinyLoad

Electronic Dummy Load
C++
44
star
30

CH32V003-FM-Receiver

Portable Digital FM Radio Receiver with RDS
C
43
star
31

ATtiny13-TinyRemoteXL

12-Button IR Remote Control
C++
42
star
32

ATtiny13-TinyPocketRadio

FM Stereo Radio with Headphone Plug
C++
41
star
33

ATtiny13-TinyProbe

Simple Logic Probe
C++
39
star
34

ATtiny85-TinyKnob

Rotary Encoder with USB Interface
Assembly
38
star
35

ATtiny13-TinyDecoder

IR Remote Receiver and Decoder
C++
37
star
36

ATmega-EEPROM-Programmer

Parallel EEPROM Programmer for 28C64B and 28C256
C++
37
star
37

ATtiny85-USB-C-Tester

Simple USB-C Power Delivery Tester
C++
34
star
38

AVR-Development-Boards

Collection of AVR Development Boards
C
32
star
39

ATtiny412-I2C-Rotary-Encoder

Rotary Encoder with I²C Interface
C
32
star
40

ATtiny85-TinyDFPlayer

MP3-Player
C++
31
star
41

VUSB-AVR

V-USB Board Definition Package for Arduino IDE
C
30
star
42

ATtiny85-IR2USB

IR Remote to USB HID Converter
C++
28
star
43

ATtiny13-TinyRemoteRF

RF Remote Control
C++
28
star
44

ATtiny84-TinyHVSP

High-Voltage Serial Programmer and Fuse Resetter
C++
27
star
45

SAMD-Development-Boards

Collection of SAMD Development Boards, Programmers, Tools and Firmware
C
26
star
46

CH552-MouseWiggler

Simple Board that can be used as a Mouse Jiggler, a Rubber Ducky or a Caps Blocker
C
25
star
47

CH552-USB-NRF

USB controlled nRF24L01+ 2.4GHz Transceiver
C
25
star
48

ATtiny13-VolumeAdjuster

Automatic Volume Adjuster for TVs and Sound Systems
C++
23
star
49

CH32X035-USB-PD-Adapter

Portable Programmable Power Supply
C
23
star
50

ATtiny13-ContinuityTester

Simple Continuity Tester
C++
21
star
51

ATtiny13-TinyTouchLight

Dimmable USB Night Light with Capacitive Touch Control
C++
20
star
52

ATtiny412-BatteryCapacityTester

Single-Cell Li-Ion, LiPo and LiFePO4 Battery Capacity Tester
Python
20
star
53

CH552-DAPLink

CMSIS-DAP compliant debugging probe with SWD, JTAG, and VCP support
C
20
star
54

ATtiny85-PhoneChargeGuard

USB Phone Charge Guard
C++
19
star
55

ATtiny412-VoiceChanger

Change the Pitch of your Voice
Python
19
star
56

ATtiny13-NeoController

Control almost any number of NeoPixels with an IR Remote
C++
18
star
57

ATtiny814-USB-RTC

Real-Time Clock USB-Stick
C
18
star
58

ATtiny412-USB-PD-Inverter

Turn your USB PD Power Adapter into an AC Power Source
C
17
star
59

CH552-Macropad-mini

Programmable Macropad with NeoPixels
C
16
star
60

ATtiny13-TinyMoisture

Soil Moisture Monitor
C++
15
star
61

CH32V003-USB-Joystick

Simple Joystick with USB Interface
C
14
star
62

CH552-picoDAP

CMSIS-DAP compliant SWD Programmer
C
14
star
63

ATtiny13-TinyBling

It just does bling bling ...
C++
14
star
64

ATtiny814-NRF2USB

USB Serial Controlled 2.4GHz Transceiver
C
13
star
65

ATtiny85-TinyCandle

Tea Light Candle Simulation
C++
13
star
66

ATtiny13-TinyNightLight

Night Light with NeoPixels and Rotary Encoder
C++
12
star
67

ATtiny84-TinyICOC

In-Circuit Oscillator Calibrator for AVR Microcontrollers
C++
11
star
68

CH32X033-USB-Knob

Rotary Encoder with NeoPixels and USB Interface
C
11
star
69

ATtiny13-TinyCandle

Simple Candle Simulation
C++
10
star
70

ATtiny13-TinyPlayer

IR Remote Controlled MP3 Player
C++
10
star
71

ATtiny13-TinyDice

Tiny Electronic Dice
C++
9
star
72

ATtiny814-AquaTimer

Programmable Timer for Aquariums
Python
8
star
73

CH32V003-IR-Remote

Simple 5-Button IR Remote Control
C
8
star
74

CH32V003-USB-Knob

Rotary Encoder with USB Interface
C
6
star
75

ATtiny13-TinySat

Solar Powered Blinken Lights
C++
6
star
76

ATtiny412-HamsterTracker

Simple Fitness Monitoring Device for your Pet Hamster
Python
6
star
77

ATtiny13-TinySonar

Ultrasonic Range Finder
C++
6
star
78

ATtiny85-RocketLamp

Dual Core ATtiny85 Board
C++
6
star
79

CH32X033-USB-NRF

USB controlled nRF24L01+ 2.4GHz Transceiver
C
6
star
80

CH32V003-NeoPixel-Pendant

It just does bling bling ...
C
5
star
81

CH32V003-Mouse-Wiggler

Simple USB Plug that can be used as a Mouse Jiggler, a Rubber Ducky, or a Caps Blocker
C
5
star
82

CH32V003-I2C-Knob

Rotary Encoder with I2C Interface
C
4
star
83

CH32V003-USB-IR-Receiver

IR Remote Control to USB HID Converter
C
4
star
84

CH32V003-MacroPad-plus

Programmable MacroPad with Rotary Encoder and NeoPixels
C
4
star
85

TinyRDA

RDA5807 FM radio library using TinyI2C
C++
3
star