Jimmy hands $2 worth of dimes to the conductor and finds a seat at the back of the bus.

He settles himself in for what is going to be a long night - taking off his scuffed leather shoes and resting his head against a window opaque with condensation.

Jimmy, 47, has had the same routine for the last three years since losing his job as a chef at Microsoft.

He gets on the bus at midnight and rides the 35-mile journey between San Jose and Palo Alto, California, again and again until sunrise. He can spend up to $8 (£5) a night just trying to keep warm and off the streets - money he can ill afford.

The 22 bus is the only route that runs 24 hours in Silicon Valley and it has become something of an unofficial shelter for the homeless.

Related Articles

This small pocket of the Golden State has become the most extreme example in the US of the growing schism between the haves and have nots.

Santa Clara - the county which encompasses Silicon Valley - has the highest percentage of homeless in America, according to the latest Department of Housing report.

Yet it also has the nation’s highest average household income and some of the most expensive homes in the country - all down to the high-tech economy on its doorstep.

Silicon Valley is enjoying the most sustained period of wealth creation in history, but the area is crippled by income disparity. Where once a robust middle-class thrived, there exists only the super-rich and the extreme poor.

The 22 bus drives past Jimmy’s old employer Microsoft, as well as the headquarters of Google, Facebook and Apple.

On our journey, we pass a “Google bus” going in the opposite direction towards San Francisco. Employees are ferried to and from work in their own private blacked-out coaches dubbed “Gbuses”, which have themselves come to be a symbol of the inequality.

“It’s a tale of two cities,” Jimmy says. “At least that’s the poetic way people describe what’s going on here.

“What these techies don’t realise though is that we’re no different to them - they’re just one misstep, one paycheck away from being us.”

Jimmy, who moved from Chicago to California in the early 1990s for work, is wearing a slightly tattered suit and tie, as he does most days, in the hope it will help him find a job. He sends off a dozen applications a day from the local library, but he rarely even hears back.

He keeps a length of rope wrapped round his ankle, hidden under his trouser leg, “just in case one day I decide I’ve had enough.”

According to the most recent census data, as many as 20,000 people will experience homelessness in the county this year.

Protesters block a bus taking Apple employees to work in Silicon Valley in December 2013

Those who are not sleeping on the streets here are sleeping in what is known as The Jungle - the largest homeless encampment in the US. Hundreds of makeshift tents and treehouses go on for miles in a lawless sprawl.

Ray Bramson, the City of San Jose’s homelessness response manager, says: “There’s 5,000 sleeping rough on any given night - we just can’t deal with that.”

Over the last few years rent in the area has skyrocketed - in some cases up to 300 per cent of the national average - due to the high-salaried tech employees moving in.

“When you think homeless, you think of someone on the streets with no money, no job,” he says. “That’s changed. Being employed no longer guarantees you can afford to rent here. People simply lack the sustainable salaries they need to survive.”

The state’s minimum wage was recently increased from $8 to $10 an hour. “It’s a step in the right direction,” Mr Bramson says, “but unfortunately the self-sufficiency standard is around $15.”

Our bus jolts to a stop as the driver spots someone waiting in the dark at the side of the road. It is now 2am. He lays down the ramp for the woman, who has a large cart full of her worldly belongings.

She is not the only woman, Sandra Pena spends one night a week on Hotel 22.

A well-spoken, well-educated and strikingly beautiful woman of 52, she is not the average night passenger.

Silicon Valley (ALAMY)

She spent nine years working as a technician for Arantech - which was at one time one of the bigger tech firms in Silicon Valley, until she was made redundant in 1989.

Shortly after, she decided to start up her own construction business, which enjoyed some success.

But at the height of the recession in 2009 she lost it all and had her home repossessed.

She started living out of her truck, doing odd job for neighbours, until she could no longer afford that either.

“I was hit by everything at once, and sometimes you just can’t pick yourself up from that,“ says Sandra, who is wearing pristine blue jeans and a button-down blouse. “Never, ever, would I have imagined myself in this situation.”

When there are no free beds at the local shelter, Sandra sleeps on the bus.

“I get the day pass for $6 - which if you buy at the right time can last you all through the night to the next morning,” she says. “I like it for the quiet …. and the alone time.

“The only downside is that you get woken up at the end of the line and are made to wait 15 minutes to get on the next one,” she says.

As a native of Santa Clara she has seen the area change beyond recognition.

Apple's new headquarters in Cupertino

It was once known for its orchards, earning it the nickname the Valley of Heart’s Delight. Until the 1960s, it was the largest fruit production region in the world and Del Monte was the biggest employer in town.

Then the tech companies started moving in, growing outward from Stanford University, which had begun nurturing start-ups with grants and academic support.

“Growing up here it was all ranches and orchards, I was a cowgirl. You had everything you could want, and great weather all year round. I don’t blame them all for coming here, but they offer the people who live here nothing,” says Sandra, who is currently completing a building course at an employment centre, which she hopes will lead to a job.

Chris Richardson, director of programme operations at the homeless organisation Downtown Streets, which has been helping Sandra, said: “Hotel 22 is an open secret in the homeless trade - for a couple of bucks people can get a relatively undisturbed night’s sleep.”

He says the problem has become so out of control there are twice as many homeless as there are available beds.

“You see camps of people sleeping rough just two miles from Sergey Brin’s (Google co-founder) house,” he says. “And the irony is, not even his engineers get paid enough to live here.

“We are trying to get tech billionaires involved in what we’re doing. They donate millions to good causes, but almost nothing to the local community they are helping destroy.

“It’s not necessarily their fault, but they are stakeholders in the homelessness problem and have the power and brains to change it.”

Eileen Richardson, Downtown Street’s founder, is a venture capitalist and former tech CEO herself, previously heading up the online music site Napster. She volunteered with the homeless on a sabbatical leave 10 years ago and was so shocked by what she saw she started up her own organisation to help.

At their weekly meeting, the team leader makes an announcement to the some-100 guests gathered - Google is hiring. The company is holding a jobs fair in a few weeks’ time and they are looking for chefs, cooks and cleaners.

Some groan, but most are keenly listening and a group stay behind after to sign up. In desperate times you cannot be too proud to “make a deal with the devil”, one guest says.