Go Down

Topic: Turn your Arduino into an AM radio transmitter! (Read 2 times) previous topic - next topic

Nick Gammon

Jan 23, 2012, 11:14 pm Last Edit: Jan 24, 2012, 06:14 am by Nick Gammon Reason: 1
This simple project shows how you can make your Arduino into an AM-band transmitter.

Wiring: Plug a wire into pin D9.


Code: [Select]
const byte ANTENNA = 9;

void setup()
 // set up Timer 1
 TCCR1A = _BV (COM1A0);  // toggle OC1A on Compare Match
 TCCR1B = _BV(WGM12) | _BV(CS10);   // CTC, no prescaler
 OCR1A =  9;       // compare A register value to 10 (zero relative)
 }  // end of setup

void loop()
 delay (500);
 pinMode (ANTENNA, INPUT);
 delay (300);
 }  // end of loop

Theory: The 16 MHz clock is divided by 10 (that is, 1.6 MHz) and that is used to toggle pin 9 at that rate, giving a frequency of 800 KHz, since one toggle turns the output on, and second toggle turns it off.

If you hold the Arduino near an AM radio tuned to around 800 KHz you should hear a hissing toggling on and off (like Morse code) as the carrier is turned on and off for 0.5 / 0.3 second intervals.


what stopped you from implementing a real morse lib into the code ? ;)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Nick Gammon

Trying to keep it simple. :)

But I'm sure adding Morse into it would be pretty trivial.


Nice work.

I am going to try it. Just one wire... SIMPLE hook-up... and load the code... you are done...

Thank Nick Gammon


Well the next logical step would be to add in the tone library and allow a audio frequency tone output pin to modulate the timer output pin 'AM carrier frequency', then you would be talking true Amplitude Modulation, AM. However with everything being square wave outputs, don't now how easy it would be to combine these two signal outputs into a single AM output. Needs a little cleaver passive filtering and combining function circuit.


Go Up