Monthly Archives: April 2016

Arduino FM Radio

Recently my 5.1 stereo amplifier system went kaput. The speakers and subwoofers are still working, but the DVD/FM/AUX amplifier kept failing to output sound. It has served its job well over its expected life.

So I am going to make an arduino – controlled FM radio with an integrated amplifier for the speakers.

Plans:

For the microcontroller, I am intending to use the Arduino Pro Mini 3.3V 8 MHz. As for the FM receiver module, the RDA5807M or the TEA5767 looks like a good choice. I will probably use the RDA5807M due to its advanced features such as RDS and bass boost. There will be a 2.4″ touch screen for channel selection and displaying information. For the speaker amplifications, I am going to use one of those ready-made amplifier boards, either the TDA7492 or TPA3116 ones. The amplifier boards has to have subwoofer outputs as well. I might add in a infrared controller as well, if I find that necessary. There will also be an AUX input that will be switched by a relay if I want to plug in my phone or a wireless bluetooth receiver.

Where I got my parts:

Speaker Amplifier (TPA3116) – Ebay

Radio Receiver IC (RDA5807M) – Ebay

2.4″ Touch Screen LCD (ILI9341) – Ebay

Arduino Pro Mini (8MHz 3.3V) – Ebay

 

 

1. Testing

The first test I did with the products bought was the touch screen LCD. I used the UTFT & UTouch library from Rinky Dink Electronics.The UTFT library was really slow on my 8MHz Atmega328P – powered arduino pro mini, and overclocking it to 16MHz didn’t do much either. It was really slow, especially when clearing the screen (takes almost 5 seconds). I then decided to use Adafuit’s ILI9341 library with its GFX library which runs way faster. I simply ran the graphicstest sketch to make sure everything is working.

As for the touch screen, I am still going to be using the UTouch library. However, to calibrate the touch screen, we have to use the UTFT to display the calibration points. However, there is no need to change any pins. I simply changed the pin declaration of the UTFT in the code to the one shown below.

UTFT    LCD(ILI9341_S5P, 11, 13, 10, 4, 5);

Then just run the UTouch_Calibration example and follow the instructions shown on screen, including editing the calibration details at UTouchCD.h

 

As for the pin connections for the LCD.

LCD                    Arduino Pro Mini 3.3V

VCC        —>     VCC

GND       —>     GND

CS           —>     D10

RESET   —>     VCC

DC         —>     D5

MOSI    —>     D11

MISO    —>     D12

SCK      —>     D13

LED     —>      VCC

—–Touch Screen Controller—–

T_CLK    —>     A1

T_CS       —>     D7

T_DIN    —>     A0

T_DO     —>      D9

T_IRQ     —>     D8

The second test was to test the RDA5807M FM module. However, it does not usually come in a breadboard friendly 2.54mm pin spacings, so I had to make a ‘breakout’ board using a perforated board.

  1. The first step is to measure out the space required for the FM module. Leave at least 1 hole spacing in between the FM module chip and the pin headers.
  2. The next step is to cut the perforated board. For me, I used a dremel with a cutting wheel. You can use a small saw or score the perforated board using a X-acto or a penknife multiple times, and then breaking it.20160130_181516
  3. Place the small piece of the perf board on the breadboard with the copper side facing up, with two 5-way pin headers to the perf board.

20160130_181645

  1. Tin the semicircle pads of the RDA5807M IC. This helps the wire bond easily to the pads easily when soldering.
  2. Strip a long piece of solid core wire and tin it with solder. Touch the end of the wire to the pad of the IC and then heat the wire and the pad. The solder should reflow easily.
  3. Then bring the wire to the pin header and heat up both the wire and pin header. The solder should reflow easily.

20160130_182251

  1. Trim the extra wire by using a wire cutter.
  2. Repeat for the other pins.

20160130_183215

I used Mathertel’s universal FM radio library for Arduino. It supports multiple FM radio ICs, including the RDA5807M and it supports all of its features such as RDS and channel searching. I used the TestRDA5807M example sketch. Remember to change the FIX_STATION define to the channel that exists on the FM spectrum.

As for the pin connections,

RDA5807M                    Arduino Pro Mini 3.3V

VCC                  —>     VCC

GND                 —>     GND

SDA                  —>     A4

SCL                   —>     A5

ANT                  —>     Long piece of wire or to coaxial socket from wall

 

 

RDA5807M                   Headphone Jack

Lout                 —>     L (Tip)

Rout                 —>     R (Ring)

GND                 —>     GND (Sleeve)

 

 

 

 

 

 

 

 

 

For me, I also connected the TPA3116 Amplifier in parallel with the headphone jack and then powered it with a 24V power supply.

2. Casing Layout Planning

For the casing, I used an ABS project box with removable front and back panels. It is about 20 x 14.5 x 7.5 cm. I used Adobe Illustrator to plan out the layout so that when making the holes and cutouts for the casing I can just print out in 1:1 scale and use the guidelines on the paper to cut the casing.

Illustrator

3. Fabrication

However, I made a mistake while making the holes for the fan. I was using the dremel circle cutter to cut it. This was my first time using it and I accidentally made the hole bigger than it should as I measured the distance.of the centre of the cutter bit to the centre of the guiding pin, where the correct way is to measure from the edge of the bit to the edge of the guiding pin. The oversized hole had made it impossible to mount the fan as the M4 holes that were supposed to be drilled next to it was too close to the larger circular hole.

I then decided on cutting out the front panel. Using the toothed blade on the dremel, I cut the cutout for the LCD first.

It didn’t turn out that great either, but at least better than the back panel.

In the end I decided to use a sheet of thin aluminium as the panel backing. I bought 2 4 x 8″ pieces at Sim Lim Tower and they costed me about $3.80 each. I didn’t measure the thickness, but they were little bit thinner than the plastic panels.

20160303_094645

As they are larger than the panel, I had to cut it to size. Using a ruler, I measured the dimensions of the plastic panel, then scribed the aluminium using a sharp knife. I then set the distance of the straight cutter using a ruler as the measurement guides on it weren’t precise enough.

 

 

Using the dremel 561 multipurpose cutting bit, I turned up the speed of the dremel to 25000 rpm and then inserted the aluminium sheet in, like how I use a scroll saw. It is important to wear protective goggles and a mask, because the high rotational speed of the cutting bit can throw the aluminium shavings all around. For me, I also taped a garbage bag below the dremel to catch the shavings.

Once done, I printed a copy of the drawings I did on illustrator on a sheet of A4 paper, cut it and then taped it to the aluminium panel. Using the circle cutter, I cut the hole for the fan. As for the slots for the speaker terminals, I originally used a diamond cutting wheel but halfway through I realised that there is a better method. It is to drill a hole on one of the slots and then, measure the distance from that hole to the edge using the straight cutter, then insert the cutting bit into the drilled hole, turn on the dremel, then move the aluminium slot upwards to cut the slot. I did the same for the cutout for the LCD, except to drill four holes on each corner.

As for the holes for the front panel, I was a simple task of just drilling M6 holes for the potientometers. Always drill the small pilot hole before drilling a larger hole. I learnt the this the hard way when the drill bit was skipping around and as you can see in the picture below, the hole was slightly off. The small little hole beside the larger hole is for the potientometer notch that holds it in position. I didn’t plan out the holes for the 2.1mm power jack and the coaxial jack, so I just drilled it anywhere that seems fitting on the back panel.

20160303_160630

A little bit of filing and deburring on all of the drilled holes and cutouts helps to remove sharp edges.

With that all done, it is time to move on to the soldering

 

4. Soldering

I used a perforated copper board for all of the components. There is not much space left in the box left after placing the amplifier, so I cut to size so that it will fit into the left space.

20160305_165553.jpg

The first step in soldering in a prototyping perforated board is to plan out the component placement.

20160307_153644

The next thing to solder the major components such as the arduino, fm radio ic chip and the relay. I used 0.1″ female headers as sockets so that I can replace the component if it happens to malfunction.

 

More updates to come!

Advertisements