Matt Hughes i like to grow tiny trees and tinker on stuff

Arecibo message from an Arduino

A couple of weeks ago I came across an article about the Fermi Paradox while enjoying a cigar and beer on the porch. It explained several reasons why we have not made contact with an extraterrestrial civilization, even though there are theoretically millions in existence.

As I tend to do when coming across similar topics, I went on a reading frenzy. This led me to the Arecibo message, humanity's first attempt to send a message to an extraterrestrial intelligence. This message was transmitted a single time from Puerto Rico's Arecibo radio telescope in November 1974.

Space exploration and related research is fascinating to me, and it inspired me to create an Arduino circuit to mimic the transmission of the Arecibo message.

The message is essentially a 1679-character binary string transmitted via radio waves:


The original message was transmitted at the following radio frequencies, with each 0 and 1 transmitted for about 1/10 of a second:

0: 2380 MHz
1: 2380 MHz + 10 Hz  

For this project, the output of the message is routed to a speaker or piezo buzzer instead of a radio transmitter. Here are the musical tones used:

0: 440 Hz (A)
1: 659 Hz (E)

The circuit

The circuit for this project is very simple, and only requires three components:

  1. Arduino (tested with Uno)
  2. 100Ω resistor
  3. Speaker or piezo buzzer

Fritzing circuit layout

The code

The first attempt at this project did not go smoothly, due to the length of the message string (1679 characters). Attempting to compile and upload the sketch would result in a cryptic error message in the Arduino IDE:

Exception in thread "Thread-1" java.lang.StackOverflowError 
at java.util.regex.Pattern$GroupHead.match(
at java.util.regex.Pattern$Loop.match(
at java.util.regex.Pattern$GroupTail.match(
at java.util.regex.Pattern$BranchConn.match(
at java.util.regex.Pattern$CharProperty.match(
at java.util.regex.Pattern$Branch.match(
... and so on for about 100 lines

After trying a few different things (like storing the char[] value in PROGMEM), I came across the Flash Arduino library. This allowed me to create a FLASH_STRING object and construct it over several lines in the IDE, which solved the compliation/upload error. It was also much easier to parse the string value with Flash than the default PROGMEM syntax.

Download the Arduino sketch and circuit layout on GitHub

Required libraries:

See it in action

Future enhancements

Right now, there's not much to this project, but it dealt with pretty interesting subject matter. It did serve as a good intro to using large string values with the Arduino.

In the future, I would like to to hook up the Arduino to an AM, FM, or shortwave transmitter and transmit the binary message via radio instead of a speaker.