Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ Electronics
➜ Microprocessors
➜ Turn your Arduino into an AM radio transmitter!
Turn your Arduino into an AM radio transmitter!
|
Postings by administrators only.
Refresh page
Posted by
| Nick Gammon
Australia (23,094 posts) Bio
Forum Administrator |
Date
| Mon 23 Jan 2012 11:09 PM (UTC) Amended on Wed 23 Sep 2015 05:50 AM (UTC) by Nick Gammon
|
Message
| This simple project shows how you can make your Arduino into an AM-band transmitter.
Wiring: Plug a wire into pin D9.
Sketch:
const byte ANTENNA = 9;
void setup()
{
// set up Timer 1
TCCR1A = bit (COM1A0); // toggle OC1A on Compare Match
TCCR1B = bit (WGM12) | bit (CS10); // CTC, no prescaler
OCR1A = 9; // compare A register value to 10 (zero relative)
} // end of setup
void loop()
{
pinMode (ANTENNA, OUTPUT);
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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,113 views.
Postings by administrators only.
Refresh page
top