You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+56-47Lines changed: 56 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,7 @@
4
4
5
5
[TEA5767](https://www.sparkfun.com/datasheets/Wireless/General/TEA5767.pdf) is a cheap but functional FM radio module, which allow you to build DIY FM radios. It comes with an antenna via a 3.5mm jack but have no internal volume control.
6
6
7
-
This driver has been tested on ESP8266, ESP32 and RPi Pico running MicroPython v1.16.
8
-
9
-
The CircuitPython version can be found [here](https://github.com/alankrantas/circuitpython-TEA5767).
7
+
This driver has been tested on ESP8266, ESP32 and RPi Pico running MicroPython v1.16. The **CircuitPython** version can be found [here](https://github.com/alankrantas/circuitpython-TEA5767).
10
8
11
9
## Wiring
12
10
@@ -21,49 +19,60 @@ Both 3.3V and 5V power works; 5V may results better sound quality.
21
19
22
20
## Import and Initialize
23
21
24
-
To import and initialize the module:
22
+
Upload ```TEA5767.py``` to your board. You can use [Thonny](https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/) to do so.
radio.search(True, dir=1, adc=7) # turn on search mode and set search parameters
90
+
radio.mute(True)
91
+
radio.standby(True)
85
92
```
86
93
87
-
If the search mode is enabled, the radio would attempt to find a station with strong signal whenever you set a new frequency.
88
-
89
-
* dir = search direction; 1 = search upward along frequency (default), 0 = downward.
90
-
* adc = desired signal ADC resolution (sound quality), default 7. Can be set as 0, 5, 7 or 10. The radio would try to find a station which ADC level satisfied this setting.
94
+
```radio.mute()``` is simply turning off the sound output. If you want to save power, use ```radio.standby()``` instead.
91
95
92
-
The radio might need some time to find a new station.
96
+
The TEA5767 also allows you to turn off right and/or left speaker, but I decided not to implement these functions.
radio.search(True, dir=1, adc=7) # turn on search mode and set search parameters
99
105
```
100
106
101
-
```radio.mute()``` is simply turning off the sound output. If you want to save power, use ```radio.standby()``` instead.
107
+
*```dir``` = search direction; ```1``` = search station by increasing frequency (default), ```0``` = decreasing.
108
+
*```adc``` = desired signal ADC resolution (sound quality). Available values are ```0```, ```5```, ```7``` (default) or ```10```. The radio would try to find a station which ADC level satisfied this setting.
102
109
103
-
The TEA5767 also allows you to turn off right and/or left speaker, but I decided not to implement these functions.
110
+
When the search mode is enabled, the radio would attempt to find a station with strong signal **whenever you set a new frequency or change it**.
111
+
112
+
The radio may need a bit of time to tune on a stable signal, so it would be recommended to run ```radio.read()``` and keep updating your external display with ```radio.frequency``` on loop.
104
113
105
114
## Read Status From the Radio
106
115
107
116
Some variables will be updated after calling ```radio.read()```:
108
117
109
118
```python
110
119
radio.read()
111
-
my_variable= radio.frequency
112
-
my_variable= radio.search_mode
113
-
my_variable= radio.is_ready
114
-
my_variable= radio.is_stereo
115
-
my_variable= radio.signal_adc_level
120
+
frequency= radio.frequency
121
+
search_mode= radio.search_mode
122
+
is_ready= radio.is_ready
123
+
is_stereo= radio.is_stereo
124
+
signal_adc_level= radio.signal_adc_level
116
125
```
117
126
118
-
* radio.frequency: current frequency, float number (may be changed in search mode)
119
-
* radio.search_mode: search mode status (True/False)
120
-
* radio.is_ready: station is ready (signal is strong enough)? (True/False)
*```radio.signal_adc_level```: station ADC resolution? (0, 5, 7 or 10)
123
132
124
133
You may need to call it a few times with some time delay when the search mode is enabled (the radio frequency would jump around a bit).
125
134
@@ -129,7 +138,7 @@ You may need to call it a few times with some time delay when the search mode is
129
138
radio.update()
130
139
```
131
140
132
-
This method will be automatically called by many other methods of the radio. If you wish to change some parameters, you can manually call ```radio.update()``` to update radio.
141
+
This method will be automatically called by many other methods of the radio. If you wish to change some parameters, you can manually call ```radio.update()``` to update radio status:
133
142
134
143
```python
135
144
radio.stereo_mode =True
@@ -138,11 +147,11 @@ radio.high_cut_mode = True
138
147
radio.update()
139
148
```
140
149
141
-
By default ```radio.update()``` will wait 50 ms at the end and then call ```radio.read()```.
150
+
By default ```radio.update()``` will wait 1 ms at the end and then call ```radio.read()``` for the I2C bus have maximum delay of 400 us.
142
151
143
152
## A Simplified MicroPython Version Without Using This Driver
144
153
145
-
If you just want to tune the frequency of TEA5767, you can use code as short as below (simply paste it into your script):
154
+
If you just want to set the frequency of TEA5767, you can use code as short as below (simply paste it into your script):
0 commit comments