Welcome, Guest. Please Login or Register
Arduino: Forum
09.09.2010 at 08:08:18


Pages: 1
Interfacing NS73M FM Transmitter Module (Read 10115 times)
cairn
Junior Member
**
Offline

Arduino rocks

Posts: 53

Interfacing NS73M FM Transmitter Module
25.10.2007 at 19:25:44
 
I am going to make a project to interface the NS73M FM Transmitter module from SparkFun with the Arduino. I haven't attempted a project like this before so I'd like to get an idea of whether or not I'm going in the right direction. I am going to communicate with the module over SPI, but it operates at 3 volts so here's what I have planned for the hardware hookup.



I based this off of the SparkFun sensor interfacing tutorial. I didn't bother to show the IIC/SPI select pin or PLL-lock (TEB) pin hook-up; I'll just put those on digital-out pins 8 and 9. Does this look ok? How much current is safe to pull through the 3V3 pin on the Arduino?

Once I'm certain I have the hardware interface set-up correctly, I'm going to attempt to modify the example PIC code from SparkFun for the Arduino. I appreciate any feedback!

Back to top
 
« Last Edit: 25.10.2007 at 20:31:12 by cairn »  
View Profile   IP Logged
follower
YaBB Moderator
*****
Offline

Arduino pebbles

Posts: 969
New Zealand
Re: Interfacing NS73M FM Transmitter Module
Reply #1 - 26.10.2007 at 03:45:28
 
Hi...

I can't help much with your specific questions but I just wanted to say "Hey, cool!" to seeing someone use the Arduino template I put together--thanks too for the credit. Smiley I like how you used an actual image of the device for the connections.

(As a side note, did you notice in the datasheet that using SPI seems to only let you talk to the device and not receive data from it, while I2C allows both? If you hadn't noticed it I thought it might have affected your decision on while protocol to use.)

So, what's the project? Smiley

--Phil.
Back to top
 
 
View Profile | WWW   IP Logged
cairn
Junior Member
**
Offline

Arduino rocks

Posts: 53

Re: Interfacing NS73M FM Transmitter Module
Reply #2 - 26.10.2007 at 16:36:37
 
Thanks for making the template Phil, it's come in useful! I did notice that I can get data from the device in IIC mode, but I don't have any experience with either IIC or SPI and the example code (as well as several tutorials I've found for other devices) is for SPI. If I can figure out IIC, I'll probably go with that instead.

I don't think I'll have time to finish this project before Halloween, but my idea is to have a bunch of small FM radios hidden throughout a 'haunted' house with each one set to a different frequency (I have a handful of these from Electronics Goldmine). Then I would broadcast pre-recorded voices and change the broadcast frequency with the Arduino so that the voices move around the room or lead people to different places. I could even mount a transmitter on a simple robot or RC car to have a voice move through the room.

The nice thing about the transmitter module is that it's a very small, low-power PLL transmitter so it will be frequency-stable. I work at a university and my office overlooks the main bus stop on campus. I'm also considering broadcasting some sort of random looping weird message each day and putting the frequency on a sign in my window for people to tune to as they come on to campus.

There's probably all kinds of fun you can have with a programmable FM transmitter! I'm going to try out this circuit tonight and see how it goes...
Back to top
 
 
View Profile   IP Logged
cairn
Junior Member
**
Offline

Arduino rocks

Posts: 53

ARRRduino!
Reply #3 - 04.12.2007 at 22:28:03
 
I'm cross-posting this on the Sparkfun forums, but I wanted to have an Arduino-specific explanation here. I created some code that allows the Arduino to control the NS73M FM transmitter (available on a breakout board from Sparkfun). The biggest problem I faced in making this work was that the NS73M communicates over SPI, but it needs a 4 bit register address and then 8 bits of data for that register. The Arduino SPI implementation (as well as the ShiftOut command) seem to be hard coded to send 8 bit data which wouldn't work. I had to do a little bit of bit-math to try to fake SPI. This is based very much on the example code provided by Sparkfun.

This is my first real Arduino project, so if anyone has any suggestions or improvements, I'd love to hear about them. I used the schematic above for hooking up the Arduino to the NS73M except that I connected the clock line to pin 12 instead of pin 13 to avoid any issues with the LED on pin 13.

This is only the first part of my project which I'll probably post in the "Exhibition" forum once it's complete. I'm calling it ARRRduino! :)

Code:
/*
    12-1-2007
    Cai Maver, caimaver(at)yahoo.com
    ARRRduino+NS73M v0.3

    This code allows an Arduino Diecimila to control an NS73M FM Transmitter Module (Arrr matey!)

    This sets the NS73M (available from Sparkfun, SKU#: WRL-08482) to transmit
    at 2mW with 75us pre-emphasis (the standard for North America) on 97.3 MHz.

    Use this formula to determine the register values for a new transmitting frequency (f):

    (f + 0.304)/0.008192 <-- use only the whole number and convert the result to
				   16-bit binary where the lower byte goes in register 3
				   and the upper byte goes in register 4

				   ex.: for 97.3 MHz, (97.3 + 0.304)/0.008192 = 11914.55...
					  11914 = B0010111010001010 so Reg 3=B10001010 and Reg 4=B00101110

    A future version of this code will allow for on-the-fly frequency changes

    Thanks to Nathan Seidle at Sparkfun and Jim "ZAPNSPARK" G. for sharing their NS73M code!
*/

int CK = 12;  //clock pin
int DA = 11;  //data pin
int LA = 10;  //latch pin



void setup(){
  Serial.begin(9600);  //begin Serial connection for debugging

  pinMode(CK, OUTPUT);
  pinMode(DA, OUTPUT);
  pinMode(LA, OUTPUT);
  digitalWrite(LA, LOW); //unlatch transmitter
  delay(100);		//Wait for VDD to settle


  spi_send(0x0E, B00000101); //Software reset

  spi_send(0x01, B10110100); //Register 1: forced subcarrier, pilot tone on

  spi_send(0x02, B00000011); //Register 2: Unlock detect off, 2mW Tx Power

  spi_send(0x03, B10001010); //Register 3: Set broadcast freq to 97.3, lower byte
  spi_send(0x04, B00101110); //Register 4: Set broadcast freq to 97.3, upper byte

  spi_send(0x08, B00011010); //Register 8: set Osc on band 2

  spi_send(0x00, B10100001); //Register 0: 200mV audio input, 75us pre-emphasis on, crystal off, power on

  spi_send(0x0E, B00000101); //Software reset

  spi_send(0x06, B00011110); //Register 6: charge pumps at 320uA and 80 uA

  Serial.print("Transmitting");  //for debugging


}


void loop(){

}




void spi_send(byte reg, byte data)  //routine to send Register Address and Data as LSB-first SPI
{
    int x;
    int n;
    digitalWrite(LA, LOW);

    for(x = 0 ; x < 4 ; x++)	     //send four-bit register address
    {
	  digitalWrite(CK, LOW);	   //Toggle the SPI clock
	  n = (reg >> x) & 1;		//n is the xth bit of the register byte
	  if (n == 1){
		digitalWrite(DA, HIGH);    //Put high bit on SPI data bus
	  }
	  else {
		digitalWrite(DA, LOW);     //Put low bit on SPI data bus
	  }
	  Serial.print(n);		   //send bit to serial connection for debugging
	  digitalWrite(CK, HIGH);	  //Toggle the SPI clock
    }

    for(x = 0 ; x < 8 ; x++)	     //send eight-bit register data
    {
	  digitalWrite(CK, LOW);	   //Toggle the SPI clock
	  n = (data >> x) & 1;
	  if (n == 1){
		digitalWrite(DA, HIGH);    //Put high bit on SPI data bus
	  }
	  else {
		digitalWrite(DA, LOW);    //Put low bit on SPI data bus
	  }
	  Serial.print(n);		  //send bit to serial connection for debugging
	  digitalWrite(CK, HIGH);	 //Toggle the SPI clock
    }
    delayMicroseconds(1);		 //might not be needed, supposedly unstable command anyway

    digitalWrite(LA, HIGH);	     //Latch this transfer
    delayMicroseconds(4);
    digitalWrite(LA, LOW);

    digitalWrite(CK, LOW);		//This is to keep CK pin at 0V at end of data transfer
    Serial.print("\n");		   // send new-line to serial for debugging

}
 

Back to top
 
 
View Profile   IP Logged
mellis
YaBB Administrator
*****
Offline



Posts: 3102
Cambridge, MA
Re: Interfacing NS73M FM Transmitter Module
Reply #4 - 04.12.2007 at 22:40:12
 
We're going to be adding a parameter to shiftOut() that allows you to specify the number of bits, so hopefully that will make easier to do things like this.
Back to top
 
 
View Profile | WWW   IP Logged
mrmeval
Senior Member
****
Offline

Arduino rocks

Posts: 388
Greenwood, Indiana
Re: Interfacing NS73M FM Transmitter Module
Reply #5 - 06.12.2007 at 02:01:04
 
YaY! I need 16 bits now and more later. Wink

mellis wrote on 04.12.2007 at 22:40:12:
We're going to be adding a parameter to shiftOut() that allows you to specify the number of bits, so hopefully that will make easier to do things like this.

Back to top
 
 
View Profile   IP Logged
Gilles
YaBB Newbies
*
Offline

Arduino rocks

Posts: 2

Re: Interfacing NS73M FM Transmitter Module
Reply #6 - 06.07.2008 at 01:33:42
 
Hi every one,

I finaly succed with the programming of the synthetizer but the range of the transmitter is only a few meter. And there is also a lot of hissss.... May be i have a problem with the antenna coupling?

If anayone have succed with this module, do you have a longer range of transmission than a few meter? And what kind of antenna do you use? And how does it connected with the Sparkfun board? Any coupling? As i said, directly connected, a 31 inch wire antenna have only a few meters range, with a lot of hissss....

There is so little information on this part (to say the least...), i dont know what to do next.

I would appreciate any help.
Thanks
Gilles
Back to top
 
 
View Profile   IP Logged
cairn
Junior Member
**
Offline

Arduino rocks

Posts: 53

Re: Interfacing NS73M FM Transmitter Module
Reply #7 - 06.07.2008 at 03:50:55
 
Gilles wrote on 06.07.2008 at 01:33:42:
I finaly succed with the programming of the synthetizer but the range of the transmitter is only a few meter. And there is also a lot of hissss.... May be i have a problem with the antenna coupling?

If anayone have succed with this module, do you have a longer range of transmission than a few meter? And what kind of antenna do you use? And how does it connected with the Sparkfun board? Any coupling? As i said, directly connected, a 31 inch wire antenna have only a few meters range, with a lot of hissss....


I have the ns73m working great with just a ~31" wire directly to the rfo pin, no decoupling. I don't know what frequency your broadcasting at, but try changing the oscilator band up or down by one, I'd bet that makes the wierd hiss go away (assuming your audio input is clean).
Back to top
 
 
View Profile   IP Logged
Gilles
YaBB Newbies
*
Offline

Arduino rocks

Posts: 2

Re: Interfacing NS73M FM Transmitter Module
Reply #8 - 06.07.2008 at 21:12:02
 
Thank you cairn,


I rework the shiftout parameter and it woks great now, quality is good but the range still a little short to me. Can I expect more than 4 meters  Huh

Gilles

Back to top
 
 
View Profile   IP Logged
cairn
Junior Member
**
Offline

Arduino rocks

Posts: 53

Re: Interfacing NS73M FM Transmitter Module
Reply #9 - 06.07.2008 at 21:41:33
 
Four meters might be about right, depending on your environment and antenna placement. The NS73M only puts out 2mW at full power (make sure register 2 is set for 2mW out) which isn't much; it's about the same as you might expect from one of those mp3 player broadcasters that are sold for use in cars. I've used the FM amplifier kit from QKits with the NS73M for more power. If you google for "Part 15 broadcasting" you'll find all kinds of info for making the most out of micro-power transmitters - www.part15.us is a good place to start.
Back to top
 
 
View Profile   IP Logged
qwerty
YaBB Newbies
*
Offline

Arduino rocks

Posts: 1

Re: Interfacing NS73M FM Transmitter Module
Reply #10 - 24.11.2008 at 06:05:37
 
hi!
can you explain better the amplifier kit from Qkits? I think I don't understand really well what they do!

thanks! and thanks so much for all the info about using this transmitter! Smiley
qwerty
Back to top
 
 
View Profile   IP Logged
cairn
Junior Member
**
Offline

Arduino rocks

Posts: 53

Re: Interfacing NS73M FM Transmitter Module
Reply #11 - 24.11.2008 at 19:15:14
 
Hi qwerty-

The amplifier from QKits will increase the broadcast range from the NS73M module.  It's really easy to use; you just connect the "RF out" on the NS73M module to the "RF In" on the QKits amplifier and then connect your antenna to the "RF out" on the amplifier. There's no additional programming or set-up required. I hope that answers your question.

Also, after posting the code above, Mike Yancey and I collaborated on many improvements for using the NS73M module. He made a really great web page that explains how to use the module along with how to include an LCD and rotary encoder/switch for selecting the broadcast frequency. The code is available on his page and it's been updated to use I2C instead of SPI which made things simpler.
Back to top
 
 
View Profile   IP Logged
mrmikehansen
YaBB Newbies
*
Offline

Arduino rocks

Posts: 1

Re: Interfacing NS73M FM Transmitter Module
Reply #12 - 06.06.2010 at 06:06:50
 
Is it possible to boost the output power on this? I've been playing around a little bit using the diagram and code on this page.
Back to top
 
 
View Profile   IP Logged
Pages: 1