---

Showing posts with label tea5767. Show all posts
Showing posts with label tea5767. Show all posts

Thursday, May 1, 2025

Tuesday, April 15, 2025 Accessible FM Radio Case Study - Part 3 - Audio Tests

[Part 1] [Part 2] [Code and Design Files]

After some promising results with the PCB loop antenna, in this post, I'm starting to look at the audio output.

The intention for the final system is to design a single PCB incorporating the power supply, radio receiver, power amplifier and antenna. But before launching in to this, I want to do as much testing and developing as possible using the modules that I have to hand.

In Part 2 I was getting reasonable signal strengths from the PCB antenna, but I hadn't really listened to the reception, except through headphones.

The TEA5767 module I used has an audio amplifier built-in, but its the now obsolete TDA1308 which is a stereo amplifier offering 80mW at 32Ω per channel. No good for driving a speaker directly.

To try out what I have so far, I had a rummage around and found an old version of the MonkMakes Amplified Speaker and connected it to the output of the radio module and to the 5V supply of the Arduino.


I was not expecting results. The Amplified Speaker, is a very low power quite tinny thing and the quality was pretty awful. Key point were:

  • Terrible sound quality
  • Significant hiss
  • Clicks every time the Serial Monitor reported the signal strength.
Touching the antenna to increase the signal strength got rid of the hiss. I am not too worried about this, as the FM reception at our house is pretty bad. Window-sills being required even for really good FM receivers.

The USB interference is not be a problem for the final device, as it will be battery powered, but it does serve as a warning that interference could well be a problem for the future.

I wanted to make sure that the TEA5767 output wasn't inherently low quality, so I connected the audio out of the TEA5767 module to the line-in of HiFi. The results were very acceptable. The USB click was still there, but overall reception was better (slightly different position).

Looking at datasheets and browsing component catalogues, I quite like the look of the PAM8320. It's a class D (think PWM) amplifier that can provide up to 20W. I don't need anything like that much power, but having some oomph in reserve is usually a good thing.

I think its getting close to the time, where I start to design the system as a whole.

Tuesday, April 15, 2025

Accessible FM Radio Case Study - Part 2 - PCB Antenna

[Part 1] [Part 3] [Code and Design Files]

In the first part of this series, I looked at the overall requirements for the project. A key one of these was to avoid the need for the classic 1/4 wave telescopic antenna, which is, something of a hazard.

Cars haven't had telescopic antenna for some time now. It turns out they are generally a conductive trace built into the car glass. (Not much use for this project). However, I had noticed the 'shark-fin' antenna on the top of cars. It seems, that according to this research paper. It is possible to make a compact PCB antenna suitable for receiving FM broadcast transmissions in the normal range of 88-108 MHz.

PCB antenna design

The research paper gives a detailed design for the PCB, including all dimensions. I have recreated this in KiCAD and you can find the design files and even generated CAM files for production in the github repository for this project.


The PCBs came back from JLCPCB and looked good, so I made a couple of the boards up using the surface mount components specified in the paper. You can see the values in the picture above.

I actually made up 2 boards, one with the intended SMA co-axial connector, and one using a chopped off end of a 3.5mm audio connector, to make it easy to connect the antenna to the TEA5767 board that I was using for testing.


I used a hot glue gun to stick down the audio lead to prevent the wires pulling off.



TEA5767 Module

As a first test of the feasibility of using this type of PCB coil antenna, I used the TEA5767 module shown here.


There are two 3.5mm headphone style sockets on the board. One is for stereo output, and can directly drive headphones and the other is for attaching an antenna. 4 header pins provide power and the 2 I2C bus lines.

The module has an I2C interface that I will control using an Arduino Uno. The I2C interface allows you to set the tuning and volume, but also, crucially allows you to obtain the signal strength.

I can use this to compare the performance of the antenna against other antenna options, by tuning to a known radio station and then switching antennas.

The TEA5767 module is also 5V operation so I can connect it directly to the Arduino Uno and use the Arduino to power it.

The wiring is as follows:

  • 5V on the Arduino (red) to Vcc on the radio module.
  • GND on the Arduino (blue) to GND on the radio module.
  • SCL on the Arduino (yellow) to SCL on the radio module.
  • SDA on the Arduino (orange) to SDA on the radio module.


You can find the Arduino test sketch here.

/*
 * Modified from original library and examples by big12boy 2017
 * https://github.com/big12boy/TEA5767
 * 
 * Mostly reformat and recomment and simplification.
 * 
 * Signal strength only updates if you do a reset. Use Arduino Reset button
 * 
 * Tested on Arduino Uno connected to TEA5767 module. 
 * 
 * This used to test TEA5767 basic operation and measure signal strength for various antenna.
 * 
 * See blog post here for more detail: 
 * https://www.doctormonk.com/2025/04/accessible-fm-radio-case-study-part-1.html
 * 
 */

#include <TEA5767.h>
TEA5767 radio = TEA5767();

float frequency = 93.0; // Enter your own Frequency in MHz. Look up the frequency of a station near you. 
long baud = 9600;       //Enter your own Baudrate. I always use 9600.

void setup() {
  Serial.begin(baud);
  Wire.begin();
}

void loop() {
  radio.setFrequency(frequency);
  printReady();
  printStereo();
  printSignalLevel();
  
  Serial.println();
  delay(1000); 
}

void printReady(){
  int rdy = radio.getReady();
  Serial.print("Ready: ");
  Serial.println(rdy);
}

void printStereo(){
  bool stereo = radio.isStereo(); 
  Serial.print("Stereo: ");
  Serial.println(stereo);
}

void printSignalLevel(){
  short level = radio.getSignalLevel(); 
  Serial.print("Signal (0-15): ");
  Serial.println(level);
}

Before running the program on your Arduino, change the line: 

float frequency = 93.0;

to a frequency of a station that you can receive strongly with an FM radio. In my case, this is BBC Radio 4.
When you open the serial monitor in the Arduino IDE and set the baud rate to 9600, you should see something like this:


You can, of course, plug some headphones in to the radio module to hear how much noise is accompanying the signal.

Test Results

Trying to keep all other things constant, the antenna options I measured, were:

  • No antenna, sig strength 0/15
  • 23cm telescopic antenna, sig strength 4/15
  • PCB antenna, sig strength 8/15
On listening to the audio on headphones, the quality was quite reasonable with only a little hissy noise.

This is really good news, and I'm hoping we can do without the telescopic antenna.

In Part 3 of this series, I'm going to start looking at audio amplifier and speaker options, as this will inform decisions about the power supply.

Friday, April 11, 2025

Accessible FM Radio Case Study - Part 1

In this series of blog posts, I am going to document my journey (which I am about to start) in designing a FM Radio receiver for which I have the very specific requirement of being usable by my brother, who suffered a stroke a few years ago. This has left him with cognitive impairment and use of just his left arm.

This blog will effectively form my notes, and follow my usual design process which is:
  1. Investigate technologies
  2. Create 'spike' examples to de-risk various aspects of the design
  3. Breadboard or strip-board prototype
  4. Testing
  5. Prototype PCB creation
  6. Enclosure and user testing
As I hope this will end up in a design that will help others, I am going to release all the CAD and firmware files under an open license. 


User interface

  • Volume control - rotary, a pot, therefore with absolute positioning and no turning down to silent.
  • On/Off switch - probably a stylish toggle switch, but low physical resistance and ok for one handed operation without having to hold the radio.
  • Three preset buttons. Real switches with an indicator to see which is selected. Obvious icons (probably on paper) to select the channel. Talk (BBC Radio 4), Classical (BBC Radio 3), Pop (BBC Radio 2).
  • A separate interface (behind a panel - or using a BLE phone app) to configure stations

Other requirements

  • Large capacity LiPo battery power
  • USB charge and pass through
  • Decent power amplifier and speaker
  • FM broadcast receiver (*)
  • Bluetooth audio for wireless headphones
  • No eye-pokey antenna
  • Stable enclosure (one-hand friendly)
* Why FM rather than DAB or Internet Radio. Well DAB is power hungry and offers no real advantage (except perhaps future-proofing) over FM. 

As for internet radio? Well, this was my first thought as it solves the antenna problem. However, when I have looked at this before, it's quite difficult to get stable URIs for station streams, especially for BBC stations, which is likely all my brother will listen to.

Looking at what was commercially available, I found this


Which is actually pretty close to what I was planning. And if all else fails, I could easily see myself getting one for my brother. However, although you can't see it here, it has an eye-poker antenna and is powered by D-cells. Neither of which I am keen on.


Technologies

At the moment, my initial list of technologies to experiment with includes:
  • A PCB antenna (as used in 'shark-fin' car antenna) -- this is the big risk, and subject of my next blog post.
  • The  RDA5807M radio receiver IC (I might also try TEA5767 to see which is more sensitive)
  • An ATTiny1614 microcontroller 
  • A power amp probably D-class. Ideally 10W or more
I've ordered some RDA5807M modules from Aliexpress and started designing a PCB FM broadcast antenna using the research paper I found. I will need both the radio module and the PCB antenna for my first experiments.

Friday, March 23, 2012

TEA5767 FM Radio Breakout Board for Arduino

Update: Monkmakes.com now selling a breakout board for this: http://www.monkmakes.com/#!/~/product/category=0&id=36087884



I recently failed to resist buying two TEA5767 FM Radio modules from eBay for almost nothing. These little modules use the I2C serial protocol and so are ideal for connecting to an Arduino.

These things are tiny. This image is much larger than the real thing. In fact, the connectors on the side are at a smaller pitch than the 0.1 inch found on the Arduino connectors.

So, the first just was to make a little breakout connector using a bit of stripboard.





First cut the tracks on the back like this:

Then solder short lengths of solid core wire in place, either side of the breaks in the strips. 
 Bend the cut ends inwards so that they will meet the connectors on the module. Trim the ends of so they just reach the module. I actually cut mine a bit short (see below) which made thins more difficult.
Before trying to solder the leads to the module, fit a crocodile clip over the leads to act as a heat sink, otherwise the leads are likely to become detached from the strips beneath.
When all the pins are soldered, solder in a link wire between pins 3 and 6. This is also the ground connection.
I also attached 0.1inch header sockets for ease of experimentation.
Here is the pinout for the finished module. On the left we have the IC2 connections SDA and SCL that will go to pins A5 and A4 respectively on the Arduino Uno.

The right hand side has a connection ANT (antenna) left and right audio and ground.
Connect all the left hand connections to the Arduino as described above.

If you want to be able to control the tuning of your radio (you don't have to, you can just set the frequency in the sketch) then optionally use a solderless breadboard to hold a pot (I used 10K linear).

The pot should be connected with the center slider to Arduino pin A0 and one end to GND and the other to +5V. Turning this pot will change the frequency.

Note that I actually used a Freetronics USB Droid board, as that was what I had to hand, rather than an Uno, but an Uno will work fine.

On the right-hand side of the breakout board (top in the picture above) I attached a 3.5mm socket to one channel and GND and poked a length of wire into the ANT socket to act as an antenna.

The sketch is very simple, all the real action is in the function setFrequency(). 

In the 'loop' the analog reading from the pot is converted into the frequency range and then rounded to 1 decimal place, to make it easier to tune.

The output from the module requires amplification. An iPod dock with aux-in will work fine and I was surprised at the quality of the sound, given the price.

For a similar but more advanced project have a look at: http://www.electronicsblog.net/arduino-fm-receiver-with-tea5767/ I found this very useful when making this project.

#include <Wire.h>

unsigned char frequencyH = 0;
unsigned char frequencyL = 0;

unsigned int frequencyB;
double frequency = 0;

void setup()
{
  Wire.begin();
  frequency = 93.0; //starting frequency
  setFrequency();
  Serial.begin(9600);
}

void loop()
{
  int reading = analogRead(0);
  //frequency = map((float)reading, 0.0, 1024.0, 87.5, 108.0);
  
  frequency = ((double)reading * (108.0 - 87.5)) / 1024.0 + 87.5;
  frequency = ((int)(frequency * 10)) / 10.0;
  
  setFrequency();
  Serial.println(frequency);
}

void setFrequency()
{
  frequencyB = 4 * (frequency * 1000000 + 225000) / 32768;
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB & 0XFF;
  delay(100);
  Wire.beginTransmission(0x60);
  Wire.write(frequencyH);
  Wire.write(frequencyL);
  Wire.write(0xB0);
  Wire.write(0x10);
  Wire.write((byte)0x00);
  Wire.endTransmission();
  delay(100);  
}



About the Author
These are my books. Click on the image below to find out more about them.