MALMESBURY, England — When Michael Aldred joined the British home electronics maker Dyson two decades ago, he had a simple goal: to quickly build a robotic vacuum cleaner.

But Aldred and his team kept running into roadblocks.

Their first attempt, unveiled in 2001, was too clunky for James Dyson, the company’s founder. The next prototype involved creating a computer vision system that would allow the machine to skirt independently around furniture; it took more than a decade to perfect.

As smartphones became everyday tools, Dyson’s robotics team again had to rethink the vacuum cleaner, adding internet connectivity so the machine could send notifications — with a heat map of where it had cleaned — to a mobile device. After a nearly 20-year odyssey, the robot cleaner, priced at an eye-watering $1,000, finally hit stores worldwide last year.

“At times, I really asked myself what I had signed up for,” Aldred said in an interview at Dyson’s rural headquarters near the border with Wales. “But James Dyson always told us to focus on the product. Everything else would follow.”

Not many consumer electronics brands would spend almost two decades — and tens of millions of dollars — building a vacuum cleaner that retails for more than a midrange laptop.

But combining an almost obsessive eye for design and engineering, the privately held Dyson has cornered the nonglamorous market of high-end vacuum cleaners, lights and hair dryers — and in the process bucked the technology truism that companies rarely make money in the difficult arena of hardware.

Even as other hardware brands like Samsung, smartwatch maker Fitbit and camera designer GoPro have struggled with physical products because of low-priced copycats and thin profit margins, Dyson has shown an uncanny ability to mint money. Its latest robot cleaner, which is selling briskly, exemplifies that and puts Dyson in rarefied company alongside Apple as one of the few tech companies worldwide to consistently profit from consumer gadgets.

Lauren Fleishman/The New York Times
Lauren Fleishman/The New York TimesLaura Howard, a design engineer, in the hair science research lab at Dyson headquarters in Malmesbury, England.

“It is extremely difficult to make money if you’re not in the premium segment of the market,” said Tim Bajarin, president of Creative Strategies, a tech consulting firm. “That’s what Apple and Dyson have done well — being best in breed for technology and industrial design.”

Dyson said its pretax profits rose 41 per cent last year to 631 million pounds (US$785 million), while revenue rose 45 per cent to 2.5 billion pounds, partly because of the weakened British pound. Dyson, 69, who founded the company in 1992, is worth about 5 billion pounds.

The company, with 8,500 employees split mostly between Britain and a factory in Malaysia, is growing rapidly in China, where the country’s emerging middle class remains eager to spend on designer goods, including expensive vacuum cleaners.

“Asia is a huge growth area for us,” said Max Conze, Dyson’s chief executive, who joined from Procter & Gamble in 2010. “Five years ago, 85 per cent of what we sold was corded vacuum cleaners. Now, more than 80 per cent comes from new products.”

Dyson is indeed moving beyond vacuum cleaners, hair dryers and air purifiers. The company said it would spend more than $2 billion on battery technology, machine learning and other high-tech wizardry to create new products, many of which remain under wraps behind tight security at its headquarters.

At Dyson’s headquarters — chosen for its proximity to Dyson’s original workshop — employees remain tight-lipped, even among themselves, about their projects. During a tour of the company’s facilities, prototypes were covered in tarps while large areas of the open-plan offices were off limits. Photographs of engineers’ computer screens were prohibited, and machinery in some of the research labs was obscured with black trash bags.

“It’s a little like a brainwashing atmosphere,” said Mario Cosci, an electronic engineer who joined Dyson six years ago. “When you work every day with people who are driven, you can’t swim against it.”

Lauren Fleishman/The New York Times
Lauren Fleishman/The New York TimesAn employee cafeteria at Dyson headquarters in Malmesbury, England, Feb. 20, 2017. The company, with 8,500 employees split mostly between Britain and a factory in Malaysia, is growing rapidly in China, where the country’s emerging middle class remains eager to spend on designer goods, including expensive vacuum cleaners.

Not everything Dyson has tried has turned to gold.

In 2000, the company released a washing machine priced at 1,000 pounds, or double the cost of rival products. Despite positive reviews, Dyson pulled the plug five years later after failing to turn the machine into a profitable business. Now, the original washing machine prototype stands unloved in a corridor in one of Dyson’s research buildings.

At many publicly listed companies, such a failure might have cost people their jobs. But at Dyson, where 14.5 per cent of annual revenue is earmarked for research and development, engineers took the mistake in stride and began diversifying into other products.

For Steve Courtney, head of Dyson’s new products unit, that included moving into cordless vacuum cleaners in 2005, even though analysts said the machines would hurt sales of the company’s corded products. It also meant releasing bladeless fans four years later that borrowed heavily from Dyson’s vacuum technology — the product range was later extended to internet-connected air purifiers.

And when the company began selling US$400 hair dryers last year, its mostly male engineering team not only learned to professionally blow-dry hair to understand how rival products worked, but also again copied the battery, motor and fan technology from Dyson’s existing products.

“We may go through a lot of pain and it may take a lot of time, but then we can transfer what we develop into something completely new,” Courtney said. “We need big new areas, new markets.”

Dyson’s ambitions have raised some eyebrows, particularly after it bought Sakti3, a Michigan startup specializing in solid state batteries, for US$90 million in 2015. This technology could be more than three times as powerful — and significantly safer — than batteries used now in smartphones and electric cars.

Dyson later claimed his company would invest more than US$1 billion by 2020 to figure out how to mass-produce these solid-state batteries, although experts question whether Sakti3’s technology will ever go beyond the lab.

Lauren Fleishman/The New York Times
Lauren Fleishman/The New York TimesA jet engine from a Concorde on display at Dyson headquarters in Malmesbury, England, Feb. 20, 2017. Even as other hardware brands have struggled with physical products because of low-priced copycats and thin profit margins, Dyson has shown an uncanny ability to mint money.

“The community was surprised by the investment,” said Eric Wachsman, director of the energy research center at the University of Maryland, who is developing a rival project. “No one knows if their technology will work or not.”

Mark Taylor, Dyson’s research director, said the company was committed to making the battery technology work.

None of this is stopping Dyson’s long-term planning. At the modernist campus of Imperial College London, Andrew Davison, a computer vision expert, has worked with Dyson on a 5 million pound research project aimed at helping robots better interact with the world around them. (Dyson separately sponsors a Design Engineering School at the British college.)

Davison, an Imperial College professor, helped Dyson build the computer vision used in its robotic cleaner. His team is now combining that technology with machine learning and artificial intelligence so that one day, the company’s products may navigate the real world, just as its autonomous vacuum cleaner now scuttles around people’s houses.

“We’re looking really far out,” Davison said. “Most of the work that we do is years away from being in an actual product.”