(CNN) -- For hours at a time, Ronaldo Marcelo Wanderlei da Silva pedals on a stationary bike for a cause. But it is not an ordinary bike, nor an ordinary cause.
Da Silva is an inmate at the prison in Santa Rita do Sapucai,Brazil, near Sao Paulo. He is among a small group of inmates who have been given the chance to lower their sentences by exercising on customized stationary bikes attached to car batteries that charge as they pedal. The batteries are in turn used to power street lights in the local plaza.
The program exists only at this one prison, but is not the only recent effort at out-of-the-box thinking in Brazil's penal system.
Jose Henrique Mallmann, a judge in Santa Rita do Sapucai, came up with the idea for the pedaling program while doing internet searches for cost-free, clean energy sources. It was a personal curiosity, he said, and it led him to a story about an American gym that is partly powered by its patrons' bicycle workouts.
In his small city, it was easy to adapt the idea and put it in practice with the local prison, he said.
The program provides a type of poetic justice, he said. Most inmates at some point deprived a sense of security from their victims. Now, by providing clean energy that powers the city's plaza at night, they are providing a sense of security.
"This has been very well received. We are very satisfied with the public reaction," Mallmann said.
Brazil's prisons, by and large, are overcrowded and unpleasant places. According to the ministry of justice, Brazil's prisons are at 167% of capacity, as of December 2011. The prison population has more than doubled since 2001.
But new initiatives are finding creative ways to address these issues while helping inmates and society at the same time.
Another recent program -- this one at the federal level -- allows inmates to reduce their sentence for reading books. The idea is to help inmates be better prepared for success when they reintegrate with the outside world.
Inmates can shave four days off their sentence through each book they read, up to 48 days per year, the new law states. The "Redemption Through Reading" program, as it's known, requires the inmates to write a book report. The law goes as far as to specify that these reports must be written neatly and must not stray from the topic of the book.
The books available to inmates will include literary classics and scientific and philosophical tomes, among others.
"There is very alarming crisis in the penal system," said Leonardo Schmitt de Bem, a Brazilian professor and expert on criminal law. "Proposals like this, which reduce sentences and give a social and cultural foundation to people are very interesting."
The reading program addresses the overcrowding problem and gives inmates a cultural foundation, he said. Reading is an important tool because a large percentage of Brazilian prisoners come from poor backgrounds and have little education.
Nearly half of Brazilian inmates -- 46% -- have not completed more than nine years of basic education, according to the ministry of justice. More than 26,000 prisoners (5%) are illiterate.
The new law gives inmates something to do, and better prepares them for then they reintegrate with society, de Bem said.
"It is a necessary measure given the prison crisis in Brazil," he said.
The program has existed for several years, but was codified into the law just last month. It is a "pioneering" initiative, de Bem said, but would have much greater impact if it were imposed on all prisons, not just the federal ones, which hold just a fraction of the country's inmates.
In Santa Rita do Sapucai, Mallmann says he has bigger dreams than having inmates powering street lamps. He envisions a system where the battery power is converted into electricity that can be used to power houses.
In the short term, the goal is to power the city's entire plaza with clean energy produced by the prisoners.
Currently, there are four bicycles that require 10 hours of pedaling to fully charge one battery. The energy is enough to power 10 street lamps, out of 34 lamps that provide light for the plaza.
Authorities hope to expand the number of bikes to 10 in the near future, Mallmann said.
For every 16 hours of pedaling, inmates have their sentences reduced by one day, with no maximum on how much they can bike, he said.
Da Silva, the inmate at the Santa Rita do Sapucai prison, said at first the prison population didn't know what to make of the stationary bicycles, but estimates that now, some 80% of prisoners want to participate.
"I started to learn more about the project and only then I understood how important it is for the city," he said.
For now, there are two teams of four inmates who were chosen to participate, based on their good behavior.
"The project is very good for the prisoners, it shows the good they can do," he said.
Da Silva is serving a five-and-a-half year sentence for assault, and has erased 20 days off his punishment since he began pedaling two months ago, he said.
The 36-year-old said that the time on the bike also gives him time to reflect on his situation.
While he's pedaling, "I think about my imprisonment, about my freedom, my wife, my kids," he said.