💾 Archived View for alienagain.flounder.online › radio.gmi captured on 2023-06-14 at 13:54:01. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

AM transmission with Arduino nano hack

Before getting to this, a very big disclaimer. Radio communication, transmission, etc is subject of different limits according to each country. Further than "following the law" thing, is more about an organizational issue. Some channels are reserved for emergency services, such as snow rescue teams or ambulances. So it's crucial to understand how the organization works in your area according to your reach so you don't create interferences in such cases. On the other hand, some AM spectres are reserved for radio program or conversation among friends. Be careful so you can respect those channels and their times (some channels that appear to be abandoned are not, at certain times). So I strongly recommend taking a look at the available radio manuals according to your country. It's also a lot of fun to learn about this sort of things so go ahead!

Now, considering the above, let's get to it. Arduino is a programmable very common and fun microcontroller. It has a few pins you can use to control sensors, leds, buttons... If you are into electronics you probably know about it. My personal favorite arduino flavour is Nano, since it's small and very flexible when it comes of usability.

Well, there's a very interesting "hack" of Arduino Nano (and UNO, among others) microcontrollers. While it's not conceived for radio transmission, it has a 16MHz clock which, divided by 10 (1.6 MHz) can be used to toggle one of the pins described above, giving a frequency of 800 KHz, since one toggle turns the output on, and second toggle turns it off. This will send some sort of a simple "morse" like sound though AM. If you attach a wire to that pin it serves as an antenna and sends a clearer signal. If you attach the other part of the wire to a plant or you hold it, you (or the plant) can become part of that antenna and get and even clearer signal :)

But even more interesting! Arduino have this "melody maker" library that helps you creating simple beeps and boops for music making. If you mix a code using that library and the "AM" hack, there you you go! AM simple music transmission! There's even a guy who came up a very simple solution for attaching a serious sound source (such MP3) to that very same hack idea to transmitt further sounds.

In any case, regarding of the music and more complex applications, sending morse to AM through arduino nano is simple and cheap. So it might be a nice security project. The following code will send a ping up, wait 500 ms, and down, before waiting another 300 ms, through pin 9.

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() 
  {
  pinMode (ANTENNA, OUTPUT);
  delay (500);
  pinMode (ANTENNA, INPUT);
  delay (300);
  }  // end of loop

The value `OCR1A = 9` doesn't have anything to do with the pin, but with the frequency:

OCR1A - Frequency
15 - 500 khz
14 - ~530 khz
13 - ~570 khz
12 - ~610 khz
11 - ~670 khz
10 - ~730 khz
9 - 800 khz
8 - ~890 khz
7 - 1000 khz
6 - ~1140 khz
5 - ~1330 khz
4 - 1600 khz
3 - 2000 khz
2 - ~2670 khz
1 - 4000 khz
(0 - 8000 khz *would not recommend)

The formula is (16÷(OCR1A+1)÷2)×1000 = frequency in khz

9 is 800 khz, as described in the brief introduction above. But if you think that your preferred setting due to your country, personal situation etc is different, go ahead and change that value.

Some interesting applications that can be done easily:

If you are interested into radio signals you might also have some ideas in mind :)

Anyway I hope you liked this hack, feel free to further investigate but please remenber the disclaimer and keep your radio signal environment safe!!