Sometimes intelligence is so deeply hidden, buried in loss, pain, poverty and sheer distance from other great things, that only luck can dig it out.

In 2000, luck found a teenage orphan working as a human scarecrow in his uncle's cornfield at Lake Nyamirima in Uganda.

As he tells it, Christopher Ategeka was standing in the field one day, rocks in hand as he watched for invading monkeys, when another boy arrived panting: "A person came looking for you. He was on a motorcycle!"

Ategeka dropped the rocks and ran toward the house, where he found Ben Isoke, a local businessman who had come to tell the bright teen about a charity in Fort Portal offering to send children to school.

"It was exciting!" Ategeka said.

But things weren't so simple. If the uncle discovered that his nephew wanted to leave the fields and go to school, "he would go crazy," Ategeka said, recalling the man's taste for beatings and forcing miscreants to spend nights in a water-filled ditch.

Still, school was more than tempting. It was Ategeka's dream. So instead of milking the cows one morning, he took off for Fort Portal some 14 miles away, navigating the narrow, unpaved roads on foot.

He arrived blistered and parched. He knocked at the charity's door.

Carol Adams, an American whose belief in the teachings of Jesus led her from a plum job tending horses on Maui to the orphanages of east Africa, founded YES Uganda in 1996 to help children with nowhere else to turn, like the dusty youngster who now stood outside.

What happened next set in motion the events that would lead Ategeka to UC Berkeley, where he would earn a pair of degrees in mechanical engineering and study for a third. He would win honors and prizes, and found a nonprofit and a biotech company. He would give a TED talk.

But on that hot afternoon, after speaking briefly with the charity workers, Ategeka left, believing there was no money for his schooling and that his chance was lost.

A child orphaned

Like many Ugandans, Ategeka never knew his birthday. The mid-1980s was as close as he got.

Nor did he have a permanent home. Ategeka spent his early years in rural villages and counties of western Uganda called Kasusu, Mwenge, Nyakigumba, Kagote and, eventually, Lake Nyamirima. If there was any consistency, it was that the thatched huts he lived in lacked running water and electricity.

Some were in areas terrorized by guerrilla groups known for torturing children and forcing them to become child soldiers. Most were at the crossroads of the country's harshest realities: poverty and disease, sporadic schooling, drought and poor sanitation.

"My mom was just, like, a housewife," Ategeka said over an iced coffee on Shattuck Avenue in Berkeley. "My dad was a trader. He sold grains and fruits in the local market."

His parents' only child, Ategeka was an infant when they separated. He remained with his father, Selvario, following the Ugandan custom that favors the male lineage. His mother, Peace, left home.

When Ategeka was still little, perhaps 7, his world imploded. He was present when his father died a painful death from AIDS. He later learned that his mother, too, had died of AIDS.

Selvario left four more children: Beatrice, Tadeo, John and Penina. Their brother, Philip, had already died as he was carried to the hospital.

The children's mother was sick with AIDS and unable to support the family, Ategeka said. Nor could his grandmother, Erinora Kabadaki, who was deaf and mute, or his grandfather, who was estranged.

That left the child in charge.

"The culture has it that I would have to take responsibility," said Ategeka, who lost other relatives to AIDS, as well.

Caring for others

Child-headed households are a fact of life in Uganda, where AIDS, war and other disasters have left some 42,000 children under 18 as the family caretakers, according to the charity SOS Children's Villages International.

"You accept it and move forward," Ategeka said, voicing a philosophy he would come to rely on.

The little boy began by building a hut for himself and his siblings from reeds and trees they gathered nearby, he said. Next, he and the children went to work collecting trash and clearing gardens in exchange for food.

"Everyone survived," he said. "I took care of them."

In 1996, Ategeka enrolled in the Nyakasenyi Primary School in nearby Butiti, his school fees paid by his grandmother and her employer, Isoke, who would later tell him about YES Uganda.

"They knew I loved school," Ategeka said.

The child excelled, becoming the only pupil to pass his grade that year. But Isoke, with children of his own, could contribute to only one more year of school for him.

"Life took its own turn and we were all dispersed," Ategeka said of his siblings.

He went to live with his Uncle Aston, a man with many wives, dozens of children and no love of schooling.

"This man loved women like candy," Ategeka said. It was in Uncle Aston's cornfield that he took up his vigil against the monkeys. But he longed for school.

Life-changing trek

He was about 15 when he trekked to Fort Portal, never expecting to hear from the charity again.

"But this is the miracle," Ategeka said. "After a week or so, they actually came looking for me."

Isoke had secured a letter of recommendation for the teen from Francis Rwatooro, a local clergyman who told the charity that Ategeka had nowhere else to turn.

"He is a total orphan," Rwatooro wrote.

Yet when the charity's representatives arrived at Uncle Aston's place looking for Ategeka, the uncle said his nephew no longer lived there.

He did, of course. And someone "dug me out," Ategeka said.

After that, he left his uncle's farm for good. Adams of YES Uganda sent him to a school in Ruteete, about 6 miles away, where he did well. So Adams brought him back to a better school in Fort Portal and paid for him to live in a hostel.

"Life got really good," Ategeka laughed. "They bought me a bicycle and gave me three meals a day, which is a luxury, by the way."

By then, two of the benefactors who contributed to YES Uganda took an interest in the student who had been plucked from nowhere. They paid for him to attend the Kitante Hill boarding school in Kampala, Uganda's capital.

"To this day, I pinch myself. Is this real? Am I dreaming? I was now a human being," he said.

An Oakland home

The fairy godparents who paid his school fees turned out to be a couple from Oakland -Michael Helms, an accountant, and Martha Helms, a therapist. And like a fairy tale, they were willing to pay his college tuition - in California if he wished.

"It was exciting to have him come," Martha Helms said. "We knew he was going to go to Laney (community college in Oakland). But we had no idea what it would turn into. No idea that he would go to Berkeley. For a master's? We had no idea."

Neither did Ategeka. He arrived at San Francisco International Airport on Dec. 16, 2006. He'd never seen a plane up close before, much less flown in one. When the flight attendant handed him a warm towel, he watched to see how the other passengers used it, then kept it as a souvenir.

At the airport, he saw a group holding a sign reading "Christopher." They were the Helmses: Martha, Michael and their teenage daughter, Hillary. (Tristan, their son, was off at Penn State.)

"These are people who turn your life upside down. What do you say to them? Thank-you falls short," Ategeka said. "I ran out of words. I don't cry. I've cried enough in the past. We just, you know, hugged."

Culture shock

The airplane and his new family weren't the only unfamiliar things. Ategeka discovered microwaves, ovens, computers - even the asphalt culture.

"I wondered, 'how come there are no people on the street?' I'm used to cows, chickens and people" on the road, he said. "But here, there are just cars."

And then there was the burglar alarm.

A few nights after arriving in Oakland, Ategeka glanced out the window and marveled at the moon glowing above the city lights. He stepped outside to get a better look, and brrrinnnnggg!!

His heart leapt. "They're going to send me back!" he thought, terrified. But the Helmses just laughed and asked if he was OK.

"We see him as one of the family," Martha said. "He's personable and fun and warm."

Ategeka enrolled at Laney College and earned an associate degree in 2009. Two years later, Laney's president, Elnora Webb, was in the audience at UC Berkeley to hear Ategeka deliver the 2011 commencement address to his graduating class in the School of Engineering.

"Half the world lives on less than a dollar a day," he told the crowd. "I lived in those conditions. As engineers, we need to make those statistics change. From global warming to water pollution, from clean energy to power systems, and from spacecrafts to artificial limbs, the world relies on us to design, develop and test the best solutions."

Helping Ugandans

Ategeka stayed at Cal, taking his master's in mechanical engineering last year. Today he is pursuing a doctorate, has an apartment in Berkeley, and visits often with the family that loves him.

He's also following his own advice.

While still an undergraduate, Ategeka won the $25,000 Judith Lee Stronach Baccalaureate Prize for undergraduate research and used the money to found a nonprofit in Uganda called CA Bikes that teaches people how to make bicycles from local materials. He said the "CA" evokes not only California and Cal, but his own initials and those of Carol Adams.

Why bicycles? The ability to get to far-away schools and hospitals - and to avoid walking long and dangerous roads at night - saves lives, he said. "We give them to orphans and people who are HIV positive, and other vulnerable youth."

Labor and materials have to be local. Otherwise, if a bike breaks "that's the end of it," he said. "People don't know what to do with it."

CA Bikes also makes a "bike ambulance" - an enclosed, full-size bed that attaches to a bike or motorcycle - and hand-powered tricycles for people with disabilities.

Big Ideas prize

Ategeka visits Uganda regularly to check in on the program, which is based in Kampala and partnering with Zambikes, a similar nonprofit. To raise money, he helped start the CA Bikes Club on campus, which operates Good Wheels Exchange, a service that collects used bikes from outgoing students and sells them to incoming students.

It took second place in the 2013 Big Ideas competition at UC Berkeley and netted $6,000.

But the biggest boost came this spring when Ategeka won an $80,000 prize in a national competition from the Echoing Green Foundation, which honors "the world's most promising social entrepreneurs."

And if that weren't enough for a guy who's been in the country less than eight years and hasn't yet turned 30, this year Ategeka also co-founded Privail, a company working on a home-detection kit for HIV. His partner is Anwaar Al-Zireeni, a grad student in bioengineering.

"I'm thrilled to see where Chris has reached," Adams said via e-mail from Uganda because the country's phone system wasn't working. "He is so fortunate to have met the Helmses, who have given him more than any Ugandan could even dream of."

Adams said she knows many other children like Ategeka with the brains and ability to succeed - just not always the luck.

Yet one thing trumps even luck. "Again and again," Adams said, "I see attitude being the biggest factor to succeed. Chris was determined."

Ategeka's big ideas

-- CABikes.org is a nonprofit helping Ugandans build transportation with local materials.