The project “Arduino FM Transmitter” is a radio station with transmits either voice or music nearby area, within the range of 50 meters range.
The transmitted FM signal is received by any FM receiver. Previously, we had posted an Arduino-based FM Receiver with the facility of automating or manual tuning. The project uses very few components i.e Arduino uno board (MCU) and an FM transmitter V2.0 module. This project has various applications like it can be implemented in college hospitals etc. where announcements have to do.
The block diagram of the Arduino FM transmitter is shown in figure 1 and the circuit diagram is shown in figure 2.
The main part of this project is the FM transmitter V2.0 module which is easily available in electronics stores. FM transmitter V2.0 contains a microphone as well as a headphone jack. The microphone change the sound signal to an electrical signal which is to be modulated. As the module also consists of a headphone jack so one can directly connect a mobile or computer or mp3 with the help of a 3.5mm male to male audio connector. FM transmitter V2.0 module uses I2C interface technology to communicate with Arduino. It contains four pins +5V, GND, SDA (serial data I2C pin), and SCK (Serial cock I2C pin).
Software: – The software is written in Arduino programming and burned the program in Arduino uno using Arduino IDE. Download the library from here. The complete Arduino code is shown below.
/** check for data setting new frequency. Users could input data from the Serial monitor. Data must start with ‘&’ and follow by 4 numbers, such as &8000. The first two are the integer part of the new frequency (Unit: MHz), and the last one is the decimal part. And the channel must be between 70MHz and 108Mhz. For example, &756 is 75.6MHz, and &666 is out of range. */
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
#include "arduino_fm_trans.h" float fm_freq = 90.1; // Here set the default FM frequency void setup(void) { Serial.begin(9600); Serial.print("FM-TX Demo\r\n"); /** Initial, set FM channel and select your area: USA EUROPE JAPAN AUSTRALIA CHINA */ fmtx_init(fm_freq,AUSTRALIA); Serial.print("Channel:"); Serial.print(fm_freq, 1); Serial.println("MHz"); } void loop(void) { if(Serial.available()){ switch(Serial.read()){ case '&': u8 i,buf[4]; float ch; i=0; delay(30); while(Serial.available()&&i<4){ buf[i]=Serial.read(); if (buf[i]<= '9' && buf[i]>= '0') { i++;} else{ i=0; break; } } if (i==4){ ch = (buf[0]-'0')*100+(buf[1]-'0')*10+(buf[2]-'0')*1+0.1*(buf[3]-'0'); if(ch>=70&&ch<=108){ Serial.print("New Channel:"); Serial.print(ch, 1); Serial.println("MHz"); fmtx_set_freq(ch); }else{ Serial.println("ERROR:Channel must be range from 70Mhz to 108Mhz."); } }else{ Serial.println("ERROR:Input Format Error."); } while(Serial.available()){ Serial.read(); } break; } } } |
PARTS LIST OF ARDUINO FM TRANSMITTER
Arduino uno board
FM transmitter V2.0 module
Arduino: 1.6.13 (Windows 10), Board: “Arduino/Genuino Uno”
C:UsersNEWAppDataLocalTempccVKSAjH.ltrans0.ltrans.o: In function
main':
ccVKSAjH.ltrans0.o:(.text.startup+0x110): undefined reference to fmtx_init(float, country_type)’
ccVKSAjH.ltrans0.o:(.text.startup+0x26e): undefined reference to `fmtx_set_freq(float)’
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
Sir, These are the error messages I’m getting when I tried to compile the program which is in this page along with the library. Can you please let me know why I’m getting this and How can I solve it?