Morse Code Twitter Wall: A Bit About Morse Code

Morse code was invented as a way of transmitting alphanumeric data across a telegraph wire. The length of each letter, number, or symbol in Morse is inversely proportional to its English language frequency. The letter “E” is a single dot and “T” is a single dash. Most letters combine the two base “characters” — the letter “J” is a dot and three dashes.

The unit of time in Morse is the dot. A dash should be three dots long, and the space between dashes and dots in a single character is a single dot.

To simplify writing characters in Morse in my Arduino code, I’ve attached the single dot intra-character space to the symbol. So to write a dot, I need to turn on the LED for our dot’s length, then turn it off for the same amount of time.

int DOT_LENGTH = 100;

void dot() {
    setPin(led, HIGH);
    setPin(led, LOW);

void dash() {
    setPin(led, HIGH);
    delay(DOT_LENGTH * 3);
    setPin(led, LOW);

This enables me to write the letter “L” (dot-dash-dot-dot) very simply as:


The letter “E” takes 2 × DOT_LENGTH (here, 200 milliseconds) to write: one for the dot, one for the intracharacter space. “T” takes 400 ms. The longest letters contain three dashes and a dot, for 1600 ms.

So with a little math, we can figure out the maximum length of a tweet. The number zero, represented by five dashes, takes the longest to “display”. Since a single dash (400 ms) and its following space (200 ms) takes 600 ms, a zero would take 2200 ms (two seconds). The theoretically longest tweet is therefore 140 zeroes, which would take 140 × 2.2 seconds = 308 seconds to display. (More than five whole minutes!)

Fortunately, this is the very worst case. Assuming a mean tweet length of 68 characters, and a random distribution of letters* such that the average letter length is about 11.25 dot lengths including its intercharacter space, we multiply to find that on average a tweet can be displayed in Morse in 76.5 seconds.

I’ve also set DOT_LENGTH as a constant variable at the top of the program. I can only assume that as I gain more experience reading Morse, I can reduce this number to effectively speed up the “reading” of tweets.

My initial version of the Morse Twitter wall will poll for a new tweet every two minutes. This number is entirely made up. However, it ends up not being that far off base; if an average tweet will take a minute and a quarter to display, then many tweets will be displayed twice before a new tweet is requested.

This also means that I can poll at will rather than at some kind of interval. I was initially afraid of running afoul of Twitter’s API limit (180 requests every 15 minutes), which also had to include my desktop Twitter client’s needs. However, polling for a new tweet would on average happen 12 times every 15 minutes, well below my 180 request limit.

For a woefully outdated introduction to Morse code sponsored by the United States Army Signal Corps (circa 1966), watch this video.

Last time: Project Intro: Morse Code Twitter Wall
Next time: The (Ridiculously Simple) Hardware.

*Since the lengths of the letters in Morse are inversely proportional to their frequency in English text, this particular estimate is higher than it needs to be. However, since I only included letters in this sample, and punctuation and numbers contain five or six dashes or dots, this should even out the error in this estimate.

Project Intro: Morse Code Twitter Wall

I’ve had a fascination with Morse code ever since I was a kid. Still, I never really got anywhere with it. Most ten-year-olds have more interesting things to do than to tap out messages at five words per minute. And it doesn’t take much knowledge of human nature to guess that the kind of kid who had a fascination with Morse code, likely wouldn’t find someone else to be on the other end of the telegraph key.

Now I’m an adult, a software developer and technologist. Even though the range of interfaces available to us now are so wide-ranging, I’m still fascinated by the fact that a single blinking light can convey complex information.

Conveniently, I’ve also been interested in learning how to use Twitter’s API to programmatically interact with the service. So it was tempting (if not a little awkward) to combine the two projects.

Since I had an Arduino and some LEDs lying around, I thought it might be a worthwhile exercise to use the Arduino as a driver to convey information through Morse code.

My goals for this small but manageable project are as follows:

  • Configure the Twitter API and learn some basics.
  • Refamiliarize myself with Arduino sketches by writing a Morse code translator
  • Get in the habit of documenting and sharing my project, which includes these blog posts and publishing code on GitHub

One of the panelists at the Dragon*Con 2010 “Creating Your Hackerspace” session said something that has stuck with me to this day.

“Your project is never finished until you’ve blogged about it.”

In that spirit, I intend to (over?)-document here what I’ve learned.

Future posts will likely include:

  • What is Morse code?
  • Arduino configuration
  • Java client and Twitter API
  • Serial communications
  • Putting it all together

So far I’ve only spent a couple of hours on the entirety of this project. Setting up the infrastructure and retraining myself on how to do some really basic things have been most of my effort.

I know this isn’t the most groundbreaking project — at a glance it’s kind of stupid — but the building blocks can be upgraded to create some useful applications. For example, it’s not a big step to change the Twitter aggregator to grab weather data, and the single LED to an LCD display so as to produce a standalone weather reporter. So my aim is to get components talking and playing nice with each other, so as to allow some branching out in the future.

The probability of seeing a falling meteor while skydiving

This video is making the Internet rounds today, and it is absolutely astonishing.

A Norwegian skydiver, Anders Helstrup, was almost hit by a meteoroid hurling through the atmosphere.

I thought when I first saw this video, “WOW… what are the odds of that?”

I think that it’s possible to figure that out. This is a Fermi problem — there’s no right answer. But by putting together a series of guesses, one can come surprisingly close using basic estimation principles.

In 2012, the United States Parachute Association estimates there were 3.1 million skydives (which, in case you’re scoring at home, included 19 fatal accidents).

There were 49 fatal skydiving accidents worldwide, and 19 in the United States. Skydiving in the States is likely no more or less dangerous than elsewhere, and so it’s a reasonable assumption to conclude that since 40% of the fatalities happened in the US, then 40% of the jumps occurred here. So if there were 3.1 million jumps in the United States, there were (3.1 million) / 40% = 8 million jumps worldwide.

That was the easy part. Now, how to calculate the number of meteoroids that are falling on the Earth?

The one that passed “a couple of meters away” from Helstrup must have survived the atmosphere, at least in part. And per the meteorite hunter, it is likely a “bit bigger” than the one he held in his hand at 8:30 of the video. This appears to be about four inches (10 cm).

Using a power law given by Wikipedia, the number of rocks larger than 5 cm that impact Earth is approximated by N(>D) = 37D-2.7, where D is the diameter of interest (in meters). This formula’s only valid through about 5 cm, per the Wikipedia article. But this is a Fermi problem and we’re only approximating anyway, so it’s not a huge stretch to take it down to 1 cm. A centimeter is about as small as a flying rock would be and still be noticed. So N(>0.01m) = 37 × 0.01-2.7 ≈ 10 million impacts per year. (Sleep well tonight!)

Not only does a skydiver have to be near a falling meteoroid, she must be near a falling meteoroid at the same time it’s falling.

First, let’s look at physical distance. We’ll assume that the meteoroids fall uniformly over the Earth’s surface. But skydivers do not. They tend to only jump over land (go figure). Since land makes up about 29% of Earth’s surface, we take 29% of the impacts to even be eligible for skydiver proximity — down to 2.9 million per year.

I have no way of estimating how much of the Earth’s surface is actually likely to see skydivers. However, there are large, large swaths of Africa, Russia, Canada, and Australia that are so remote that there are few people and likely no skydivers. There’s also really no nice way to put this, but skydiving (requiring a private plane and all) is generally a sport limited to richer countries, so that will further restrict the places on Earth likely to see parachutists. With no proof at all I’ll estimate that about one-fifth of the Earth’s surface is skydive-able. That takes our impacts eligible for skydiver proximity from 2.9 million per year down to about 600,000 per year, or about 1600 per day.

Next let’s look at time. There are 600,000 falling rocks every year within range of a possible skydiver. How much time is spent in the air by rocks, and how much time by skydivers? Comparing these two numbers should give us a sense of the likelihood of the two being in the same place at the same time.

Most skydivers exit their plane at about 12,500 feet. This allows for a minute of freefall time, and about four minutes of canopy time, for a total of five minutes air time. Since there are about eight million jumps worldwide a year, skydivers spend approximately 40 million minutes in the air each year, or 2.4 billion seconds.

At an approximate terminal velocity of 200 miles per hour or so (and only counting the fact that we care about the lower 12,500 feet of its fall), a meteoroid is in the air for about 45 seconds. Multiply this by the 600,000 eligible meteoroids and we get 27 million seconds of annual meteoroid-in-the-air time.

27 million seconds of meteoroid time divided by 2.4 billion seconds of skydiver time means that on average, there is a meteoroid in the air for about 1% of the time that there’s a skydiver in the air. (Skydivers, sleep well tonight!)

But this is over the total skydive-able land of the Earth, which is about one-fifth of the Earth’s land area, or 6% of its surface. What are the odds that the meteoroid will be “within a couple of meters” of a skydiver?

Assuming that a meteoroid is likely to be anywhere within that 6% of Earth (about 12 million of the Earth’s 196.9 million square miles), and people are also likely to be anywhere within that 6% of Earth, then the odds of them being in the same square mile are one in 12 million.

But the odds of them being “within a couple of meters” of each other? Let’s assume that means the same ten square meters (a square 3.1 meters on a side). There are 2.6 million square meters in a square mile, so even if we could guarantee the skydiver and meteoroid were in the same square mile, the odds of the two being a couple of meters apart is about 0.0004% (four parts in a million).

So the combined odds are one in twelve million (8.3 × 10-8) times (4 × 10-6), or about 3.3 × 10-13 or 0.000 000 000 033%.

The probability of a skydiver and one-centimeter meteoroid intersecting in time is about 1%.

The probability of a skydiver and a one-centimeter meteoroid intersecting in space is about 0.000 000 000 033%.

Multiply these together, and the combined likelihood of what you saw in the video occurring is approximately 0.000 000 000 000 33%, or 3.3 &times 10-15. The probability is 300 trillion to 1.

Three hundred trillion to one.


There are all kinds of approximations above, several of them I’m sure just outright wrong. There’s no real answer to this problem, only a very large ballpark estimate. I expect I may even be off a couple orders of magnitude here. But I’ll gladly accept feedback as to how to improve the estimate.

Streaming vs. long-term exclusive broadcast rights

Due to the inability of my four-year-old to handle technology and not become a total nutball, last month we put our television behind lock-and-key, requiring us to disconnect from cable television. I thought this would be problematic for someone like me who enjoys the occasional NFL playoff game.


There were multiple options to stream, though not all were free. had a free stream of the New England-Denver game. There were ads, but only a few and those that were had been repeated quite a few times over the duration of the broadcast. As a Verizon Wireless subscriber I could pay $5 to watch this game and several others.

And it appears that will be streaming the Super Bowl next week. For free.

In 2010, CBS and Turner paid $10.8 billion for fourteen years’ exclusive rights to broadcast the NCAA Men’s Basketball Tournament (“March Madness”). I really can’t understand why media corporations would enter into massive long-term deals to broadcast headlining sporting events, given the state of what’s already available with streaming. YouTube started in 2005 and AppleTV came out in 2007, so the idea of widespread streaming services wasn’t new when CBS and Turner made their mega-deal. I have to imagine that five years from now we’ll have even more streaming options, even if some are questionably legitimate or cost a couple bucks.

Smarter people than I have done the math on this, so I’m sure the exclusive rights to broadcast March basketball makes sense to CBS and friends. I just can’t believe that the rights would have increasing value over time. It’s like a baseball team signing a 35-year-old shortstop to a ten-year contract — you have to expect that you’re paying for production over the first couple years and not the last few.

Another go at this

My last iteration of this blog was all about physics education, which was completely fantastic since I was a physics teacher. Now, since I’m writing software (and have been for the last half-decade), I felt like I needed to make a fresh start.

This blog has no stated theme in terms of content, but that’s probably for the best. I hope that you will find the occasional gem here (or, more selfishly, that I can come up with the occasional gem to post here).

Thanks in advance for reading. Allons-y!