Nestled in a lush forest, Vale Encantado consists of some two-dozen homes that, in more than a century of existence, have never had proper sewage treatment. They flushed their waste directly into a stream, and from there, out into the Marapendi, a reeking lagoon by the Olympic Village.

In recent years, Barros has heard noises that Vale residents might be evicted to make way for higher-end housing. The government claimed the residents were degrading the forest and polluting the rivers, he said, and that its rustic little houses were an eyesore. Barros set out to fight those perceptions.

Through his job at a university, Barros met Tito Cals, an engineering graduate student. Cals teamed up with some colleagues and the organization Viva Rio to build Vale a sewage biodigester, after seeing some success with them in Haiti.

Cals’ team broke ground in 2013 using bricks, cement, and the labor of local workers. Two years and several financial setbacks later, there it sat: A bright-green igloo filled with poop.

Olga Khazan / The Atlantic

Now, the community’s waste will trickle through pipes into the concrete hemisphere, where anaerobic bacteria eat the waste and kill pathogens, getting the sewage about 80 percent “clean.” Then, it filters through a series of rock-and-plant pods, where the plant roots sanitize it further. From there, the wastewater still flows to the lagoon, but it’s about 99 percent less hazardous when it does.

The advantages of this system, according to Sarah Dorner, an associate professor of civil engineering at Polytechnique Montreal, is that it deals with the waste right at its source, rather than exporting it to some far-flung facility through miles of pipelines. Plus, it doesn’t use up gallons of clean water in the process.

Biodigesters are also cheaper and easier to build than more traditional sewage systems, which require ripping up roads and laying underground pipes. Before he met Cals, Barros asked a private company how much a new sewage system for the community would cost. The company quoted him a fee of 600,000 reais, or about $184,000. Cals’ biodigester cost about a sixth that amount.

There are, of course, drawbacks to the digester. The one in Vale takes up about as much space as a small studio apartment, so the most jam-packed of Rio’s favelas might have trouble squeezing one in. Most biodigesters also require pumps to keep the sewage flowing—fortunately for Vale, it’s perched on a steep hill.

What’s more, the biodigester needs buy-in. It has to be maintained over time, so if residents don’t want the thing in the first place, “even a small, easy-to-fix problem can lead a digester to be abandoned if there is no one prepared to diagnose and fix it,” said Alexander Eaton of SistemaBiobolsa, a biodigester company.