Passersby insert change and get a box saying which of 24 items provided by food bank they have chosen to fund

Tucked between a lifesize nativity scene and a sparsely decorated Christmas tree in downtown Madrid sits a vending machine with a difference. Covered in photographs of milk bottles, lentils and rice, this "solidarity machine" is a charity's attempt to keep up with the increasing number of Spaniards turning to food banks for help.

Passersby insert their change and choose which of the 24 items provided by the food bank they want to fund. Items cost between €1 and €3 (80p-£2.50): 1kg of sugar costs €1 and a dozen eggs €2. The machine spits out a little box that shows what has been purchased.

"People walking by stop and stare. It looks like we have a tobacco vending machine sitting next to a church," said Adrián Gutiérrez, campaign co-ordinator for the Spanish NGO Mensajeros de la Paz. "Most of them laugh when they find it what it's all about. Then they want to try it out."

Volunteers clad in fluorescent yellow vests hover around the machine, happy to answer any questions. "Rice, milk, chickpeas", they yell out when asked for suggestions on what to buy. The machine, designed and donated by a local company, is locked up each night.

The idea came about when the group was brainstorming ways to increase donations to their annual food drive. "We're right in the middle of one of Madrid's main shopping streets, so people aren't likely to be carrying food they can donate," Gutiérrez said. "It's something new, something different, to get people excited about donating."

Juan Ponce de León, a volunteer with the campaign, said the machine was part of a wider effort to bring in as many donations as possible this year. "These days are quite sad in Spain," said the 70-year-old. "The crisis has left so many without food. These are trying times."

According to the Catholic charity Caritas, three million Spaniards live in severe poverty (on less than €307 a month), double the number in 2007. Food banks across the country say demand for their services is far outpacing donations.

Ponce de León said he hoped the machine would generate enough interest to help families at least get through the holiday season. "It's the least we can do," he said, shaking his head. "After that, who knows what will happen to all those in need?"