Introduction: Portable FM Radio Transmitter
In this project, we will create an FM transmitter using Arduino.
Step 1: What You Will Need
- An arduino Nano, or any Arduino of your choosing.
- A 16x2 Arduino LCD.
- Elechouse FM module V 2.0
- A button switch
- A 220 Ohm resistor
- A 500k Ohm variable resistor
- A 50k Ohm variable resistor
- A 10k Ohm variable resistor for the LCD
Step 2: The Assembly
The idea for this part is to complete the whole setup of our circuit in order to accomplish the objective, making an FM transmitter.
Begin by taking your breadboard, some jumpers and your Arduino. Look for pins A0, A1, A4, A5, D2, D3, D4, D5, D9, D10, D11, Ground and 5V.
Once located we'll start by connecting the variable resistors which will serve as knobs which in the future will change the frequency we'd like to transmit at. Now, remember in the part list three variable resistors were mentioned. For this part we will use the 500k and 50k ones. Naturally, the 50k will serve us as a marker for each unit of frequency and the 500k one will serve us for marking decimals.
For the assembly, connect the middle terminal of the 500k variable resistor to A0, the left terminal to ground and the right one to 5V. Then, proceed to the same for the 50k one, but this time the middle terminal will go to the A1 pin of the Arduino.
Now that we have assembled the knobs we will assemble the part of the circuit which includes the FM transmitter. Take the module and look at the pins. You should see the Vcc terminal, the Ground terminal, an SDA pin and an SCL pin. It should be obvious that Vcc goes to 5V, and Ground goes to GND. Now for the SDA and SCL, you'll have to look into the serial interface for the Arduino of your choosing, more specifically look for the I2C one. For the arduino Nano, SDA is in pin A4 and SCL in pin A5, so proceed to connect to each respective pin and you'll have assembled the transmission part.
Furthermore, we will connect the switch. The switch serves the function of changing between states into saving the frequency at which we will want to transmit and setting the frequency at which we will want to transmit. The connection of a switch is pretty simple, simply connect to on terminal the resistor which will go to source, and then connect to the same terminal a short to Arduino pin D9 in order to be able to look for changes in the switch in the future. The second terminal will go to ground.
Finally, there are plenty tutorials for connecting the LCD for the Arduino, that is why I will not explain how to do it. Nevertheless, I will include the link I used for connecting said LCD without a driver.
The link is in spanish, but the explanation is sufficient for anyone who doesn't speak the language.
Also, I consider useful looking at both schematics included in this section.
Step 3: The Code
The first thing you'll notice is the inclusion of a library named FMTX.h This is the library made by Elechouse for the use of their own module. You can find this library and more information about the use of this module in the respective datasheet, which you will find in the following link:
Now the code uses the principle of digital electronics rising flank. Picture a switch connected to source and a LED. Intuitively you'll see that if you push the button the LED will turn on, and if you let go, the LED will turn off. Now, the idea is to keep the LED on for the first push of the button and for the consequent one, the LED will turn of. We will apply the same principle for our code. The first state will be for setting the frequency at which we will want to transmit and the second for saving. For transmitting at that frequency you'll have o return to the first state.
Question 3 years ago on Introduction
Hey, I am receiving a conflicting declaration 'typedef uint16_t u16' error. Any advice?
4 years ago
Can the transmitting range be increased?
5 years ago
Cool design. What kind of range were you able to transmit?
Reply 5 years ago
Using the integrated coil for the transmitter I was able to transmit at a 1 meter radius