The nearly 9,000 hogs at Loyd Ray Farms in Yadkin County, N.C., produce 400,000 gallons of manure every week. Since the waste had too high a nitrogen content to be used as fertilizer, owner Loyd Bryant used to pump that waste into a local lagoon, where it released methane, ammonia and "an unholy stink," according to the Los Angeles Times.

But now all of that waste is going to good use. Thanks to Duke University's new Carbon Offsets Initiative, the 154-acre farm now gets half of its electricity from a new waste-to-fuel system that has also solved the environmental problems caused by the manure. It reduces emissions from the waste, improves the health of Loyd's hogs, and creates a fertilizer he will use to grow corn, wheat and beans.

According to the Carbon Offsets Initiative website, the waste-to-fuel project "collects methane generated by hog waste and burns it to support the operations of the innovative system and create electricity for use on the farm. The destruction of the methane — a greenhouse gas 21 times more potent than carbon dioxide — creates GHG [greenhouse gas] offsets, and the renewable energy generated by the system creates renewable energy credits."

The $1.2 million system was the first full-scale offsets project completed in the Carbon Offsets Initiative. It was funded by Duke University, Duke Energy and Google — the university and Google will get carbon offset credits from the system — and was made from off-the-shelf parts and freely available designs.

The system "is not overly complicated and stands to yield many more benefits beyond energy production and environmental protection," Tatjana Vujic, director of the Carbon Offsets Initiative, told the Times. "Farmers like the idea of using every bit of what comes off their farms. They can manage their waste and save money while doing it.''

The system has several components. First, the hog waste is placed in an anaerobic digester, which contains bacteria that consume the manure and release methane gas. The methane is then burned to power a 65-kilowatt microturbine, which generates electricity to power support the entire waste management system and much of the farm's normal operations. After the manure is processed in the digester, liquid waste enters an aeration bin, where it is treated for ammonia and other pollutants. The resulting water can be used for irrigation or for flushing out barns. By the time the system is done, it has met all of North Carolina's environmental standards for reduction of odors and emissions.

"It would sound pretty crazy at one time, but we see it works," Bryant told local station Fox8 in October.

Under North Carolina law, the state's utilities must get 0.07 percent of their electricity from hog waste beginning in 2012 and 0.2 percent by 2018, the same amount it must generate from solar.