Vending machines are everywhere in Japan, lining side streets and train stations.

The country has one machine for every 25 people, offering a range of goods from tomatoes and cans of hot coffee to noodle stew, beer and Buddhist charms.

And they generate a lot of sales: more than $42 billion in 2015.

Drinks firm Dydo Drinco, whose rivals include industry giants like Coca-Cola (KO) and Suntory (STBFY), relies on vending machines for more than 80% of its revenue. But in a saturated market that faces competition from 24-hour convenience stores, the challenge is to come up with new ways to keep people coming back for more.

Related: Japan's Rakuten bets big on drones for online shopping

Dydo's president, Tomiya Takamatsu, wants to move beyond the company's core customer base of middle-aged male office workers.

"We would like to earn a new group of customers, including young people, students and inbound foreign tourists," he said.

Dydo has previously introduced machines that talk to customers and also offer the chance to win a bonus drink through a "roulette" game.

The aim now is to use smartphones to make the company's roughly 280,000 vending machines across Japan more fun for consumers.

The company has developed its own app through which users can collect points that count toward prizes. The system is linked to Line (LN), Japan's most popular instant messaging app, and games like Final Fantasy and Dragon's Quest.

But the app won't help much with getting foreign visitors to use the machines: it's only available in Japanese.

Dydo and other companies have addressed that issue by using multilingual machines to appeal to the large numbers of Chinese and South Korean tourists.

"Vending machines are Japanese culture," Takamatsu said. "I want [tourists] to experience vending machines and use them more frequently."

Related: These billboards will target you as you drive by

By linking smartphones to vending machines, businesses see potential for mining data about consumer behavior.

Another idea is to add a function allowing commuters to pre-order drinks that they can pick up from a vending machine along their route.

Figuring out how to make that kind of thing work is a job for Mitsuhiro Saka, general manager at a huge Fuji Electric factory. Situated near the city of Nagoya, the plant churns out 100,000 vending machines every year.

"Demands from clients are getting more and more advanced, but we are engineers," Saka said. "The more challenging the task we get, the more motivated we become."

-- Melissa Hassett and Yoko Wakatsuki contributed to this report.