Watching a dung beetle with its head to the ground, its rear in the air, and its hind legs kicking an enormous ball of poop—it’s difficult to imagine that these critters navigate by the sky.

A new study published Monday in the journal Proceedings of the National Academy of Sciences by team of scientists in Sweden and South Africa has just added another piece to this poop-rolling puzzle. The scientists found that a species of beetle active during the daytime (diurnal beetles) used different navigational cues and had a different internal GPS system from another species active at night (nocturnal beetles).

“The previous work they’ve done is mainly behavioral,” says Paul Graham , who studies insect navigation at the University of Sussex and was not involved with this research. “But the real development here is that they’re actually in the brains of beetles as well...that’s quite a big step,” he says.

How to Trick a Dung Beetle

The group of scientists, headed by postdoctoral researcher Basil el Jundi of Lund University in Sweden , went to South Africa and messed with the minds of the local dung beetles. When one of these beetles discovers a pile of another animal’s poop, it carves itself a slice, shapes it into a ball, and rolls the tasty nugget away in a straight line, to savor far from the crush of the dung beetle crowd. (Play “Dung Beetle Derby” on the National Geographic Kids website.)

“We usually give them a ball,” says el Jundi. “They climb on top of this ball, they do a short orientation dance, and then they go down and then they start to roll in a particular direction.”

Once a beetle started rolling in a particular direction, the researchers used mirrors to change where it would perceive the sun or the moon to be. Depending what caused the beetle to adjust its course, the scientists could tell how dependent it was on the sun or moon (or neither) to navigate.

They found that the diurnal species uses the sun to navigate during the daytime, and the moon at night. But the nocturnal species is a little weird: During the day, when the light is bright, they use the sun to find their way. At night, when only the dim light of the moon and stars are in the sky, they switch to using a kind of patterned light called polarized light that’s generated by sunlight and moonlight scattering in the atmosphere. Humans can’t see it, but insects can.

Unlike a person holding a compass that always points north, these nocturnal dung beetles have a "dynamic compass," el Jundi says, that lets them adapt to changing light.

Beetle Brains

Back in the lab, el Jundi and his colleagues took a closer look at the dung beetles’ brain cells, or neurons. They discovered that the compass neurons in the nocturnal species could switch their responses: During the day, the neurons respond to the position of the sun, and at night they respond to polarized light.

The neurons of the diurnal species that used only the sun and the moon to navigate showed no such switch, reflecting their reliance on a celestial body to navigate. In the bright light of day, using the sun to find your way isn't a problem.

But at night, the moon is a dim and inconstant guide. So el Jundi and his co-authors speculate that the nighttime dung-rollers adapted to the poorer light by switching from navigating by a celestial body to navigating by the polarized light spread out across the night sky—maximizing the visual information available to the beetles’ brains.

Sometimes there isn’t even polarized light to navigate by—like on a moonless night. In those cases, el Jundi thinks that these beetles use the Milky Way .

“Sometimes in neuroscience we forget that we’re meant to be investigating how the brains of animals create behaviors in [the] real world,” Graham says. “It’s really beautiful when you get a proper behavior—especially something fun, like a beetle rolling dung balls.”