How a phone counts its own loops

Looping needs no camera and no referee: the phone measures its own throw. Here is what happens between the moment it leaves your hand and the moment the score shows.

Two sensors every phone carries

An accelerometer measures the forces the phone feels. Lying on a table, it reads the pull of gravity, about 9.8 m/s². A gyroscope measures how fast the phone turns around each of its three axes, in degrees per second.

Both were put in phones to rotate the screen, count steps and steady photos. Looping reads them through the browser, dozens of times a second.

Spotting the flight

The moment the phone leaves your hand, nothing pushes on it any more. It is in free fall, on the way up as much as on the way down, and the accelerometer reads next to nothing. That sudden silence is the signature of a flight. It ends with a sharp peak, when a hand or the mattress stops the phone.

A spinning phone blurs the picture: its accelerometer does not sit exactly at its centre, so the spin itself presses on it. The game therefore does not look for a plain zero. It checks that what the accelerometer reads is exactly what the spin measured by the gyroscope explains. A phone shaken in the hand, or spun on a table, does not pass that test.

A flight has to last at least 0.3 second to count: about eleven centimetres up, enough to tell a throw from a twitch of the hand.

Counting the turns

During the flight, the gyroscope gives the spin speed many times a second. Multiply each reading by the time it covers, add everything up, and you get the total angle the phone turned through, whatever the axis: end over end (a flip), around its length (a barrel roll) or flat like a spinning top (a flat spin).

A loop is 360°. The number on screen is the count of full turns, and a turn counts from 80 % of it. People watching a throw see about a fifth of a turn more than the free flight holds, because the phone already turns in the hand at the release and still does at the catch. The leaderboard, for its part, goes by the total angle, to the degree.

Where the height comes from

The game does not see the ceiling: it times the flight. Something thrown up and caught at the same height spends half its airtime rising and half falling, and that gives the height: 0.5 s in the air is about 30 cm, 0.75 s about 70 cm, one second about 1.2 m.

It is an estimate. Catch the phone lower than you threw it and the figure flatters you a little.

When the sensor cannot keep up

Every gyroscope has a ceiling: a spin speed beyond which it keeps answering the same number. We measured about 1,150 °/s on some Android phones, 2,300 °/s on others and 4,000 °/s on a recent iPhone, which is eleven turns a second.

When a throw goes over the ceiling, the game does not invent the missing turns. It keeps the minimum it really measured and says so on the result, or refuses the throw when it can guarantee nothing. A score may be lower than the truth; it is never higher.

Why the server keeps the score

Your phone records the throw; it does not judge it. The raw readings go to the game's server, which computes the score with the same rules for everybody and checks that the readings describe a real free flight. A recording can only count once.

That is what makes a leaderboard trustworthy: nobody can send a number, only a throw. Without a network, the throw is kept on the phone (up to twelve, for seven days) and counted when the connection is back.

What the game reads, and what it does not

Looping reads the motion sensors and nothing else: no camera, no microphone, no location. What is recorded, and for how long, is written in the legal notice.

Play Looping

Read more

English Français Español Português Deutsch Italiano Nederlands Polski Türkçe Русский Українська العربية हिन्दी বাংলা Bahasa Indonesia Tiếng Việt ไทย 日本語 한국어 中文