Tuesday, April 10, 2012

Steampunk FM Radio - Part 2

In my last post I looked at the finished project.

I don't think I would recommend building it the way I describe here. There are a few unsatisfactory things about it. Mainly its difficult to tune - the pot tends to drift a little. Perhaps a vernier dial, or better a rotary encoder. It could also do with a pre-amplifier - the output from the TEA5767 just isn't that high. As a receiver, its also not that sensitive and needs a better antenna than the 2ft of solid core wire dangling out the back that I gave it. Although to be fair I live on the wrong side of a hill for good FM reception,

Anyway, because I don't like to see projects without any details given of how they work, here it is, help your selves and may it inspire you to do it better.

It uses the amp and speaker from a scavenged PC USB powered speaker (right hand side) the TEA5767 module and breakout, described in an earlier post, and a small ATTiny45 board, that has ICSP connector and a 7805 voltage regulator - from another project.

Tuning is accomplished by turning the pot read by an ADC on the ATTiny. This then maps to a frequency that is sent to the TEA5767 by I2C.

The ATTiny is programmed using the Arduino IDE as described here http://hlt.media.mit.edu/?p=1229

It uses the TinyWireM library to the I2C communications. Note you will need to change the header TinyWireM.h to 8MHz instead of 1. See the instructions on the link above.

Here is the script:

#include <TinyWireM.h>

const int potPin = 3;

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

unsigned int frequencyB;
double frequency;

void setup()
  frequency = 97.4; //starting frequency

void loop()
  int reading = analogRead(potPin);
  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;

void setFrequency()
  frequencyB = 4 * (frequency * 1000000 + 225000) / 32768; 
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB & 0XFF;
  TinyWireM.beginTransmission(0x60);   //writing TEA5767

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

No comments: