When I was young, we often have power blackouts during typhoon (back then power cables were hung in open air and would snap under strong wind; years later new cables were all buried underground). You can try to read books if there are enough daylight, or listen to the radio. I still remember lying in bed, listening to radio during those terrifying stormy afternoons.
FM radios may not be as practical as Internet radios or YouTube playlists these days, but something about them are still fascinating. I still listen to them from time to time. As nostalgic as I am, and without any formal engineering or circuitry training, it was truly exciting to find out that I can actually build one on my own.
The core of it is a TEA5767 FM radio module, which is controlled via I2C bus and can run on 3.3V/5V. I even wrote a MicroPython driver for it (because no one ever did so):
MicroPython ESP8266/ESP32 Driver for TEA5767 FM Radio Module
Or you can simply control it like this:
from machine import Pin, SoftI2C
i2c = SoftI2C(scl=Pin(5), sda=Pin(4), freq=400000)
def radio_frequency(freq):
freqB = 4 * (freq * 1000000 + 225000) / 32768
i2c.writeto(0x60, bytearray([int(freqB) >> 8, int(freqB) & 0XFF, 0X90, 0X1E, 0X00]))
radio_frequency(106.7)
If you want to do it on Arduino, there are already many other projects you can look into. arduino_TEA5767 is a pretty simple and easy-to-use Arduino library, although it doesn't grant you any control options.
The TEA5767 has many features, including semi-auto station search and several noise control mode. I didn't use them all in my own project, but you can try them out yourself.
I glued a 8 ohms 0.5W speaker in the smartphone rack made by WOODSUM (which I bought in discounted price), and connect it to the radio module via a 3.5mm-to-wire adapter. There are only one speaker, hence I set the TEA5767 in mono mode. Since the module has no volume control, and the volume is not too loud on speaker (perhaps I should use a smaller one in the first place), I used a potentiometer as volume control and use a audio amplifier module to increase it. The potentiometer was installed on the back plate, through the hole reserved for phone charging cable.
A rotary encoder was installed on the smartphone rack where the clock intended to be. When you turn it clockwise or anticlockwise the frequency would change by +/-0.1. The frequency is displayed on a 0.96" SSD1306 OLED display. I also put in a list of specific stations that you can cycle through by pressing down the rotary encoder.
One problem with rotary encoders is that you have to read the clock and data pin fast enough (but not too fast) to be able to determine the rotate direction. This is why I didn't add the search mode on TEA5767, because you'll have to constantly read actual frequency from the module, and that takes a little extra time in the loop. However, it would be possible with different control methods.
The whole thing is powered via a power module and a 7.5V 1A charger. The TEA5767 can powered by D1 mini alone, but the reception quality would be a bit worse. Also, I need to power the amplifier module as well.
P.S.
Fun fact: this project actually originated from one of my failed proposal in one of the previous jobs, which is modeled as the homage of the EKCO AD65 (1934):
This model even has a servo with a LED attached to simulate the rotating backlit dial. The overall design is pretty much the same as in this project.
Comments