Matt Hughes tinkerer, grower, craftsman

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:

00000010101010000000000001010000010100000001001000100010001001011001010101010101010100100100000000000000000000000000000000000001100000000000000000001101000000000000000000011010000000000000000001010100000000000000000011111000000000000000000000000000000001100001110001100001100010000000000000110010000110100011000110000110101111101111101111101111100000000000000000000000000100000000000000000100000000000000000000000000001000000000000000001111110000000000000111110000000000000000000000011000011000011100011000100000001000000000100001101000011000111001101011111011111011111011111000000000000000000000000001000000110000000001000000000001100000000000000010000011000000000011111100000110000001111100000000001100000000000001000000001000000001000001000000110000000100000001100001100000010000000000110001000011000000000000000110011000000000000011000100001100000000011000011000000100000001000000100000000100000100000001100000000100010000000011000000001000100000000010000000100000100000001000000010000000100000000000011000000000110000000011000000000100011101011000000000001000000010000000000000010000011111000000000000100001011101001011011000000100111001001111111011100001110000011011100000000010100000111011001000000101000001111110010000001010000011000000100000110110000000000000000000000000000000000011100000100000000000000111010100010101010101001110000000001010101000000000000000010100000000000000111110000000000000000111111111000000000000111000000011100000000011000000000001100000001101000000000101100000110011000000011001100001000101000001010001000010001001000100100010000000010001010001000000000000100001000010000000000001000000000100000000000000100101000000000001111001111101001111000

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(Pattern.java:4554)
at java.util.regex.Pattern$Loop.match(Pattern.java:4683)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$BranchConn.match(Pattern.java:4466)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3694)
at java.util.regex.Pattern$Branch.match(Pattern.java:4502)
... 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.