Posts with «fm radio» label

Art Deco Radio Gets FM Reception

Taking a vintage radio and cramming it full of modern, Internet-connected, guts has long been a staple of the hacking and making scene. While some might see it as a crime to take what’s arguably a legitimate piece of history and turn it into nothing more than a slipshod case for the Raspberry Pi, we have to admit there’s a certain appeal to the idea. Taking the beauty of classic design and pairing it with more modern capabilities is getting the best of both worlds.

But this project by [Nick Koumaris] is a somewhat unique take on the concept. Rather than sacrificing a real vintage piece of hardware to house the electronics, he’s designed a 3D printable case that looks like a classic 1936 AWA Radiolette. But what’s really interesting to us is that he then puts a basic FM radio inside of it.

That’s right, no Internet radio streaming or smartphone Bluetooth compatibility here. It’s just a regular FM radio, not entirely unlike the kind of hardware you’d expect to be inside of a classic radio. Of course, it’s much more modern, and [Nick] actually built it himself from a TEA5767 FM radio module and an Arduino Pro Mini.

While functionally it might not be terribly exciting, we do appreciate that he went through the trouble to make a vintage-looking user interface for the radio. While physical buttons would arguably have been more appropriate given the era, the art deco inspired font and graphics that show on the device’s Nokia 5110 LCD do look really slick.

Purists will surely be happy to see another project where a piece of vintage piece of audio equipment wasn’t sacrificed at the Altar of Hack, but we’ve also played host to many projects which weren’t nearly as concerned with historical preservation.

Parts Bin Bonanza Leads to Arduino FM Radio

Trolling eBay for parts can be bad for your wallet and your parts bin. Yes, it’s nice to be well stocked, but eventually you get to critical mass and things start to take on a life of their own.

This unconventional Arduino-based FM receiver is the result of one such inventory overflow, and even though it may take the long way around to listening to NPR, [Kevin Darrah]’s build has some great tips in it for other projects. Still in the mess-o-wires phase, the radio is centered around an ATmega328 talking to a TEA5767 FM radio module over I²C. Tuning is accomplished by a 10-turn vernier pot with an analog meter for frequency display. A 15-Watt amp drives a pair of speakers, but [Kevin] ran into some quality control issues with the amp and tuner modules that required a little extra soldering as a workaround. The longish video below offers a complete tutorial on the hardware and software and shows the radio in action.

We like the unconventional UI for this one, but a more traditional tuning method using the same guts is also possible, as this retro-radio refit shows.


Filed under: Arduino Hacks, misc hacks

Retro-fit old radio with Arduino and FM module

“You can’t put new wine in old bottles” – so the saying goes. But you would if you’re a hacker stuck with a radio built in 2005, which looked like it was put together using technology from 1975. [Marcus Jenkins] did just that, pulling out the innards from his old radio and converting it to an Arduino FM radio.

His cheap, mains powered radio was pretty bad at tuning. It had trouble locating stations, and tended to drift. One look at the insides, and it was obvious that it was not well engineered at all, so any attempts at fixing it would be pointless. Instead, he drew up a simple schematic that used an Arduino Nano, an FM radio module based on the TEA5767, and an audio amplifier based on the LM386.

A single button on the Arduino helps cycle through a range of preset frequencies stored in memory. The Arduino connects to the FM radio module over I2C. The existing antenna was connected to the TEA5767 module. The radio module outputs stereo audio, but [Marcus] was content with using just a mono channel, as it would be used in his workshop. The audio amplifier is pretty straightforward, based on a typical application found in the data sheet. He put it all together on proto-board, although soldering the FM radio module was a bit tricky. The Arduino code is quite simple, and available for download (zip file).

He retained the original tuning knob, which is no longer functional. The AM-FM selector knob was fitted with a micro-switch connected to the Arduino for selecting the preset stations. Almost everything inside was held together with what [Marcus] calls “hot-snot” glue. The whole exercise cost him a few Euros, and parts scavenged from his parts bin. A good radio could probably be had for a few Euros from a yard sale and much less effort, but that wouldn’t be as cool as this.

Go deeper and explore how FM signals are modulated and demodulated for playback.


Filed under: radio hacks

DIY Arduino FM Radio (Part 2).

 Updates on 24 Oct. 2012.

If you have read my first blog on the topic, than you already know what I’m experimenting with. Low price FM Radio, build with TDA7088 / YD 9088. It was obvious, that technology from the early 90-x is outdated. I mean, simple “search and hold” function of the radio.

  • Scan function works only one way, up in the frequency.
  • After switching power “on/off” you have to tune it again on your preferred radio wave.
  • You have no means to know, what is the frequency it’s on.
  •  Occasionally you can’t “push” a tuner to the next station on the air, and have to send multiple commends.

The problem is that radio luck intellectuality, you can’t do much with  RS trigger.  Arduino, even it’s small and 8-bits only, just a monster on this matter, with CPU, ADC and EEPROM. Now it’s time to use them!  Radio-2 able to automatically scan all radio station in the area, store them in non-volatile memory, and plus do a manual “tunning” – mostly for debugging purposes.

This version of the shield requires 4 wires (plus a cap, 4 resistors, and radio, of course). Two power lines, the same like in the first project, and other two connected to pin 1 of the IC and to variable capacitance diode. You also have to cut a trace, which connects Varicap and pin 16. Look at the schematic above.

Digital pin 9 of the arduino, internally driven by TIMER 1, is PWM-ed frequency control voltage to tune a heterodyne.  FAST PWM mode, 10-bit is a compromise between PWM frequency and voltage resolution. We can’t get both, for example 16-bit PWM would drop a frequency down to 16 MHz / 65536 = 244 Hz, which is too low to be filtered by primitive  RC filter, and plus not adequate to do a fast “sweep” or changes in tunning. The same time 8-bit PWM has low voltage resolution, and consequently creates too big “steps” in bandwidth. Measurements show, that radio has about 1 V / 20 MHz sensitivity of the VCO, which would imply to have a resolution at least:  1 V / 20 MHz / 200 kHz = 10 mV, where 200 kHz is a “spacing” in FM broadcasting schedule.  8 bit analogWrite has a resolution 5 V / 256 = .19.53 mV. Even resistors divider improves this value on 0.6 times (3 v / 256 = 11.72 mV), it’s still bigger than necessary minimum. With 10-bits I have 3V / 1024 =   2.93 mV.   Using of external DAC isn’t an option for a few backs radio, but may be worse to try. PWM frequency with 10-bit equals to 16 kHz, which could be easily filtered out with 1-st order RC network.

Analog pin 3 (AN3 ADC), reading the “signal strength” output line from the YD9088.

uint16_t read_tuner()
  {
   uint16_t temp = 0;
      for( uint8_t i = 0; i < 16; i++ ) {
        ADCSRA |= (1<<ADSC);
        while(!(ADCSRA & 0x10));
        temp += ADC;
       }
    temp = 5 * temp / 16;
    return temp;
  }

As you can see, readings averaged over 16 values, which increases a resolution on two additional bits.

Search algorithm has a “window” of 5 samples, to be able to recognize a peaks in the incoming data.

for( uint16_t i = 1023, prn_dot = 0; i > 500; i-- ) {
     OCR1A = i;
     delay(200); // T = R x C = 1 M x 0.1 uF = 0.1 seconds.
     lpf[i%5] = read_tuner();

  uint16_t accum = 0;
       for( uint8_t jp = 0; jp < 5; jp++ ) {
         accum += lpf[jp];
         }
        accum /= 5;
        if ((prn_dot++) % 32 == 0) Serial.print("\n");
          Serial.print(" *");
        if ( accum > maxim )
         {
          maxim = accum;
          trigg = 1;
         }
        if ( accum < maxim )
         { 
          if ( trigg )
           { 
            if ( accum > BARRIER )
             {
              store_entry( posit, (i + 1));
                Serial.print("\n");
                print_transl( posit );
                prn_dot = 0;
              posit++;
              if ( posit >=20 ) return;
              }
             }
          maxim = accum;
          trigg = 0;
     }
   }
 }

All I have to do, is to set a threshold for radio station, in order to be distinguished from the background noise and interference. Tunning data are stored in 40 EEPROM bytes, list includes 20 radio stations overall.

Sketch, Arduino UNO:  FM_Radio_YD9088

 24 Oct. 2012

 In first part of this project, I already write about voltage – frequency non-linearity and how I get the coefficients to improve accuracy of the voltage-to-frequency (VTF) conversion formula, based on power regression. Formula in second part was slightly different, I used second degree polynomial (parabola) approximation, which provides better match to measurements data. Even LibreOffice helps a  lot with calculation, but in overall I spend a lot of time to figure out the values of the coefficients. Plus filling the data table in spreadsheet also quite time consuming. Can Arduino do this work, finding a coefficients to second degree polynomial that “fits” to experimental data? From mathematical / science point of view, the task is interesting itself, and could be a great part of any science project, not necessarily a radio tuner. The method I choose – Least Squares.

 To my great surprise, arduino solved a problem in a splits of second!  I upgrade a sketch, which includes a calibration procedure now, calling via “c” from the serial monitor console input-output interface (Hi, DOS era).

void calibrate()
 {
 //Least squares parabola (2-nd degree polynomial) coefficient calculation
 float arr[5][5] ={{0},{0}}, err[5] = {0}, coeff[5] = {0};

 err[0] = 5;
 for(uint8_t i = 1; i < 5; i++)
  {
   err[i] = 0;
   for(uint8_t j = 0; j < 5; j++)
    {
     err[i] += pow(calibration[j], i);
    }
  }
 for(uint8_t i = 0; i < 3; i++)
  {
   for(uint8_t j = 0; j < 3; j++)
    {
     arr[i][j] = err[i+j];
    }
  }
 for(uint8_t i = 0; i < 3; i++)
  {
   arr[i][3] = 0;
   for(uint8_t j = 0; j < 5; j++)
    {
     if (i==0) arr[i][3] += radio_table[j];
     else arr[i][3] += radio_table[j] * pow(calibration[j], i);
    }
  }
 for(uint8_t k = 0; k < 3; k++)
  {
   for(uint8_t i = 0; i < 3; i++)
    {
     if ( i != k )
      {
      for(uint8_t j = (k + 1); j < 4; j++)
       {
        arr[i][j] -= ((arr[i][k] * arr[k][j]) / arr[k][k]);
       }
      }
    }
  }

union split_float {
 uint16_t tegri[2];
 float loatf;
 } sf;

for(uint8_t i = 0; i < 3; i++)
 {
  coeff[i] = ( arr[i][3] / arr[i][i]);
  sf.loatf = coeff[i];
  store_entry(( 20 + 2 * i), sf.tegri[0] );
  store_entry(( 21 + 2 * i), sf.tegri[1] );
 }
}

In order to perform a calibration procedure, you would need 5 Radio Stations (RSts) available in your area, and their frequencies. (Calibration doesn’t have much sense, if there are less than 5).  Edit this line in the code:

const float radio_table[5] = { 92.5, 97.7, 100.7, 105.7, 107.3 };  

For better results, choose two RSts from both side of the band ( 88 and 108 for North America ) and others in the middle. The signal (RSSI) has to be strong, you may need an external antenna properly oriented for maximum RF field. Run a “scan” first, and see what you get in the list. After this part completed, run “c”.

Arduino starts / a scan : optional /, than would ask you to tune a radio  on the first RSt in the radio_table.  When calibration was done at least ones, print a list with “l” command (interface isn’t blocking, you can send any commands, except digits). If Rst in the list, than use “u” or “d” to tune a radio. Than use “v”  -  ”n” for fine tunning, plus “x”, pay attention to RSSI, find the best position. If you start calibration first time, you can’t use a radio_list, because MHz data would be far off or completely wrong. Use another radio with digital scale or you have to listen content and compare it to RSts broadcasting schedule.

Enter “y” and send. Follow the instructions on the screen. At the end, arduino would store coefficients in the EEPROM, print them out for your review and say “Finished”. Print a list again, and check if the data in front of MHz is correct.

CLI:

  1. “x” – print current settings, fine tunning / calibration / debug;
  2. “Dr” – read settings from the previously stored radio list. (D is digits 0 <-> 19).
  3. “Dw” – write settings to the radio list. (D is digits 0 <-> 19).
  4. “u” – change radio to next “UP” in the list;
  5. “d” – change radio to next “DOWN” in the list;
  6. “s” – full “SCAN” of the air, and save to EEPROM;
  7. “l” – print out a stations list from the memory;
  8. “v” – push tuner “up” on 1 step, debug (“ux”);
  9. “n” – push tuner “down” on 1 step, debug (“nx”);
  10. “c” and “y” – calibration of the VCO, voltage settings – frequency conversion.

Listing of commands isn’t final, and  may have some variation.

Sketch:  FM_Radio_calibration.


DIY Arduino FM Radio Shield.

I’ve been visiting local convenience store (Dollarama, here in Montreal, Canada) and notice nice looking FM Radio, just for only $3. Why not to try to interface it to my lovely Arduino? Idea looks quite challenging, the same time what is the point in interfacing a DSP radio shield to arduino? I don’t need a radio, I want to have fun experimenting with it, so  lets go to the bare metal!

You, probably, could find the same or very similar radio all around the globe, with two buttons user interface, powered by two AAA or one CR2032 coin battery (like in my case), and low price. Hardware design based on IC TDA7088 (depending on the manufacturer, may be “clones” SC1088, SA1088, CD9088, D7088, or YD9088). My radio has YD9088  inside. Quick search on a Google, brings a  data sheet. I’d say, It’s not very informative, but at least it shows basic application circuit.

 HARDWARE.

 The most difficult part of this project, is soldering to surface mount radio components. In minimum configuration just two wires, “interfacing” two front-panel buttons. (Other two, for powering up the radio from arduino +3.3 V on-board voltage regulator instead of battery, should be much easier to attach). I solder wires to the caps, on the side, which connected  to the pins 15 and 16 of the IC. In this case, there is minimum impact on usability of the radio, as buttons were not touch. May be important for debugging. If your soldering skills are not as good as mine, you could solder to the traces, removing buttons. On the pictures below you would find two more wires, attached to pin 1 and to earphone’s jack-connector, but they are not in use in this project, and you could left them out.

If you look at the electrical drawings of the shield, you would notice  1 k pot. I build a first version using just two resistors divider, as it shown in “Reset” signal line. But it turns out, that IC is quite capricious for the voltage level it senses on the “Scan” input. On some occasions, it refused  to change a station, and in some it flipped to “reset”. Trim the pot, to get voltage at pin 15 about 3.1 – 3.2 V.  It would be easy to measure voltage with DMM, temporary changing “delay” in this section of the code:

 if (incomingByte == 's') { // SCAN - UP 
  digitalWrite( scan_pin, HIGH ); 
  delay(50); 
  digitalWrite( scan_pin, LOW ); 
  } 

to 10000 or even 20000.  You may need something to be plugged in the earphones jack, as radio is using wires like an antenna. Headphones, or USB speakers cable, works quite well. BTW, the default value 50 may not be enough to “push” a radio up with strong RF signal. Try to send a few “s” simultaneously, “ss” or “ssss”. Setting delay higher than 50 is not recommended, as “jump” may be to wide, so you likely to miss something interesting in broadcasting.

SOFTWARE.

int tunning = 0;

const uint8_t scan_pin = 14;
const uint8_t reset_pin = 15;

void setup() {
Serial.begin(115200); 
 ADCSRA = 0x87; // turn on adc, freq = 1/128 , 125 kHz. 
 ADMUX = 0x44;

pinMode ( scan_pin, OUTPUT );
pinMode ( reset_pin, OUTPUT );
digitalWrite( scan_pin, LOW );
digitalWrite(reset_pin, LOW );
}

void loop() {
char incomingByte;

 ADCSRA |= (1<<ADSC);
 while(!(ADCSRA & 0x10));

 uint16_t temp = 0;

 for( uint8_t i = 0; i < 16; i++ ) {
 ADCSRA |= (1<<ADSC);
 while(!(ADCSRA & 0x10));
 temp += ADC;
 } 
 tunning = (5 * temp) / 16;

 if (Serial.available() > 0) {
 incomingByte = Serial.read();
 if (incomingByte == 'x') { // 
 Serial.print(F("\t Tunning = "));
 Serial.print( tunning, DEC);
 Serial.print(F("\t Frequency = "));
 Serial.println(( 92.5 + pow((3340 - tunning), 0.85)/ 24.5), 1);
}

 if (incomingByte == 's') { // SCAN - UP
 digitalWrite( scan_pin, HIGH );
 delay(50);
 digitalWrite( scan_pin, LOW );
 }
 if (incomingByte == 'r') { // RESET - RESTART
 digitalWrite(reset_pin, HIGH );
 delay(50);
 digitalWrite(reset_pin, LOW );
 }
 } 
}

As you can see, arduino is not doing much in the scetch, only constantly monitoring “tunning” line and checking serial if there is any command waiting to be proceed. CLI includes 3 commands, so far, “x”, “s” and “r”. Sending last two, is equivalent to pressing “switch to next” and “reset” buttons. First one, would print out current “tunning” settings of the radio in millivolts and in MHz. Very likely, you will have to change a coefficients in frequency calculation formula (power regression equation):

92.5 + pow((3340 – tunning), 0.85)/ 24.5

In order to find right digits, you would need to run a full “scan” of all available radio stations in your area. Write down a name of radio station, and corresponding voltage you are getting constantly sending “x”. Than, replace the names with appropriate frequency numbers to any radio station in your list. Look up for such data over Internet at  the station’s web page.  If you do have an another radio with digital scale, than tune this radio on the same radio station as your shield currently preset, and write down a frequency – voltage table.  Filling this data in LibreOffice spreadsheet and plotting a chart would reveal some-kind of non-linear curve:  On the picture you can see:  blue line – real data for my DIY FM Radio shield, orange line – linear approximation, and yellow line is a “power – polynom” approximation. Linear gives big error in the middle, around 1 MHz “off”. Polynomial is much better, and stay close to real data with accuracy +- 0.2 MHz, which is quite good. All you have to do, is “tweak” a coefficients to find the best approximation. Start with lowest frequency you get in your list ( 92.5 and 3340 in an example), than vary 24.5 to get close for highest radio station data. Very likely, 0.85 will be the same, I just have no clue why is it so. To do calculation right, a lot of information is missing, I even don’t know the varicap diode they use to tune a radio!