AM Transmitter With Arduino

Introduction: AM Transmitter With Arduino

Cool things can be done with ATmega MCUs. So I got the idea to build an AM transmitter with an Arduino Nano (Arduino UNO is also possible) The question is, how can amplitude modulation (AM) be achieved on a digital device? AM means that the amplitude of a carrier frequency is changed according to the amplitude of the input signal which we want to transmit. Mathematically spoken, we multiply the carrier with the input signal. But as an ATmega has only digital outputs, it can give only two values: high and low. Frankly spoken, there is no way to get real AM out of an Arduino. Nevertheless it is possible to produce some output signal that can be heard clearly with an ordinary AM radio receiver! The solution consists of transforming the analog input signal into a PWM signal, using the ADC and the 16-bit timer/counter1 of the ATmega MCU. The timer/counter2 generates the carrier signal, which can be varied in a wide range between 31KHz and 8MHz. This carrier signal is output on pin D11 in the rhythm of the PWM signal. The AM radio behaves like a low pass filter on the PWM, so we get back the original audio signal there. This is only a proof of concept, so I kept it simple. If you really want to use this as RF transmitter, you should add a low-pass fillter for anti-aliasing to the audio input and a low pass against the harmonics to the RF output. Watch the video to learn how it works.

Supplies

  • Arduino Nano or Uno
  • Breadboard
  • Capacitor 10 µF
  • 2 x Resistor 10k
  • Wire as antenna, min, 50 cm.

Step 1: Wire Up the Arduino

Join everything together like shown on the schematic. Although I made the project with an Arduino Nano, Arduino UNO can also be used, as it has the same MCU and pinout.

Step 2: Upload Sketch

Find a free frequency on your AM radio. Enter this frequency into line 11 of the sketch, then upload it to the Arduino. On the serial monitor, the actual carrier frequency is output as soon as the program has started. Tune your radio to this frequency, connect any music player to the input capacitor and enjoy the surprisingly good sound quality.

Hint: the longer the antenna wire, the more range you will attain. Best length is one quarter of the wavelength. For 1 MHz this is 75 meters of wire.

Be the First to Share

    Recommendations

    • Retro Tech Challenge

      Retro Tech Challenge
    • Halloween Contest

      Halloween Contest
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest

    12 Comments

    0
    ky5429560942
    ky5429560942

    Tip 3 months ago

    Thanks Dr. Volt, this is so ingenious and so simple to use!! ;) Didn't know you could transmit radio using code alone. Maybe our phones & computers can transmit FM via the same principle because their cpu clocks run in the Ghz range, it's be cool to see a program for that!

    0
    Doctor Volt
    Doctor Volt

    Reply 3 months ago

    I know that it is possible to transmit FM with a Raspberry Pi. Easy to find if you google for "Raspberry Pi FM transmitter" or similar.

    0
    laubach.aiden
    laubach.aiden

    Question 1 year ago

    Is it possible to use as a shortwave transmitter if you change the frequency to a shortwave frequency?

    0
    Seba2020
    Seba2020

    Answer 1 year ago

    What frequency would you like to use? If higher than CPU clock, you can make a bandpass filter to get chosen harmonic frequency (rectangular signal contains many odd harmonic frequencies), an amplifier (they lower amplitude than 1st harmonic) and maybe another bandpass filter before the antenna (if amplifier isn't linear enough). BTW the original circuit should contain some lowpass filter, so it wouldn't transmit on other harmonic frequencies, only on 1st one.

    0
    laubach.aiden
    laubach.aiden

    Reply 1 year ago

    Anything 3.4 mhz or higher

    0
    ky5429560942
    ky5429560942

    Reply 3 months ago

    Ofc it's possible. Make a crystal oscillator of some kind and connect it to a few stages of class A amplifiers to boost volts and milliamps. It doesn't have to be sinusoidal in the end. Then get rid of the "Carrier Frequency generation" section of the code, and hook up pin 11 to an transistor that enables transmission when the pwm signal is high (or low) and disables it when it's low (or high, if transmission is enabled when the signal is low).
    Try this, maybe it works: https://tinyurl.com/yjd5zzvk
    having a scope with >500Msps would really help.

    0
    carlzeissxone
    carlzeissxone

    1 year ago

    is it possible to do an reciever?

    0
    ky5429560942
    ky5429560942

    Reply 3 months ago

    Yeah, search up TDA7642, it's a chip with 10 or so npn amplifier stages that can, well, amplify the AM signal. You'll need a ferrite rod (10cm long by 1cm wide by 3mm tall, 55 windings. If you don't have that exact ferrite, find something similar.) And you need a variable capacitor. With the above inductor, you need around 300-600pf of capacitance to sweep the AM range, so I'd get one of those big variable capacitors that go from 40pf - 470pf. You can also add a 100pf capacitor in parallel to get the low frequencies in. You need minimal passive components and the chip runs off 1.5V, so this is ideal.

    You can also try this: http://www.talkingelectronics.com/projects/TheTran...
    I tested this cct and the sound is really, really small. Still troubleshooting and tweaking the cct to get it louder. So far, my improvements are to 1) connect the speaker directly from 3V to the output NPN (i used a 32 ohm earbud); ie. don't use the impedance-matching transformer and 2) add a 33uF electrolytic capacitor across the rails to prevent the current the speaker draws from lowering the rail voltage, which gets fed back into the darlington pair, creating a really loud feedback that drowns out the radio voices. I think you can make it even louder by increasing the biasing resistors on the rightmost PNP, that way the impedance of the 100n cap is relatively higher, so the amplitude of the waveform fed into the pnp will be higher.
    Maybe you can also make the transformer have more windings on the secondary side instead of less?
    I don't know how to perfect it yet, I just know that it works failproof (unlike a lot of internet ccts. XD)

    If you wanna go digital, try the https://www.amazon.com/Comimark-TEA5767-Philips-Pr... You might need to connect it to the 3.3v pin of arduino, and connect >200 ohm resistors from the arduino pins to the module (no need for level shifter, in my experience. If you're really concerned, use a voltage divider instead of just a resistor.)
    There's also cheaper modules that don't have amazon prime, so if you have patience unlike me, you can try those too. :)

    0
    iw2evk
    iw2evk

    11 months ago on Step 1

    i've an error during compiling on arduino nano see above

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.

    Arduino: 1.0.6 (Windows 7), Board: "Arduino Nano w/ ATmega328"
    sketch_oct18a.ino: In function 'void setup()':
    sketch_oct18a:15: error: 'PB3' was not declared in this scope
    sketch_oct18a.ino: In function 'void __vector_13()':
    sketch_oct18a:44: error: 'PB3' was not declared in this scope
    sketch_oct18a.ino: In function 'void __vector_11()':
    sketch_oct18a:48: error: 'PB3' was not declared in this scope

    0
    ky5429560942
    ky5429560942

    Reply 3 months ago

    Try replacing PB3 with just 3.
    If that doesn't work, add #include <avr/io.h> to the top. If that don't work, try updating or reinstalling arduino ide.

    0
    tomasvarga225
    tomasvarga225

    Question 1 year ago on Introduction

    How could it be possible to make the signal stronger (increase wattage), should i build my own amplifier ?

    0
    ky5429560942
    ky5429560942

    Answer 3 months ago

    Hey,
    It's been a year so I'm not sure if this is still relevant, but here's 3 simple circuits I came up with: https://tinyurl.com/yzaa8kqw (the bottom shows the theoretical power consumption of each amplifier at the bottom, but u shud experiment to see which gives you most range. Just because the inductor consumes 10W doesn't mean it will output 10W. And I also don't think it will actually consume 10W, because I powered it from my laptop USB)