There are no ballpoint grenade pens, no wrist-mounted dart guns, no Aston Martins tricked out with smoke screens, bulletproof glass, revolving license plates or ejector seats. Still, the geek-approved contraptions at Lego’s research-and-development facility in Billund, Denmark, are as covetable as anything cooked up by Q Branch.

Q Branch, of course, is the section of Her Majesty’s Secret Service (MI6) that supplies James Bond with fanciful gadgetry. The headquarters of MI6 is a ziggurat-like fortress known within the intelligence community as Legoland. It gets its name from the toy company that has supplied earth with more than 600 billion tiny plastic bricks—about 80 for each inhabitant. The Lego company’s own HQ is a modest campus as neat and well-ordered as a quadratic equation. Huge colored bricks—a corporate nod to art—lie scattered in tidy piles, and simple rectangular buildings bear names like Idea House and Head Office.

Lego’s own MI6, its top-secret R & D lab, is on the second floor of a drab brick structure called the Tech Building. Inside, gearheads in jeans and fleece pullovers are surrounded by enough electronic ganglia to jump-start Frankenstein’s monster. Amid a spaghetti of wires and a blaze of red, green, blue, yellow and purple blocks is an amazing array of robot prototypes, all capable of exasperating behavior. Some of these marvels propel themselves on Lego wheels; others skitter around on Lego legs. There’s a scorpionlike robot that turns sharply, snaps its claws and searches for an infrared beacon “bug.” There’s a Mohawked android that flings little red balls as it rumbles. And there’s a fanged robot snake that, with the wave of a smartphone, shakes, rattles and rolls. Dangle your cell in front of the serpent’s head and it lunges to bite you.

All three gizmos are characters in Mindstorms EV3, the latest update of a do-it-yourself kit that enables budding Edisons to assemble robots, program them on PCs and Macs, and control them via Bluetooth, downloadable apps and voice commands. Like any other Lego, Mindstorms EV3 is a jumble of parts (nearly 600 separate elements) that can be plugged together many ways. The toy, which clocks in at $350 and will be in stores this fall, comes with 3-D interactive building instructions for 17 different bots that walk, talk and stalk. And, this being Lego, enterprising kids are encouraged to hack away and turn the components into whatever they can dream up.

***

Once upon a time, teachers lacked the tools to excite and engage pupils in engineering. And the technological know-how required to put together a juddering robot limited the audience to high-school and university students. That all changed in 1998 when Lego launched its first wave of programmable bots. By the second wave, in 2006, the programming language had become visual and kids could make bots do pretty much anything simply by stringing directives together on a computer. “Today a second grader can make her own wall-avoiding triceratops in 20 minutes,” says Chris Rogers, a professor of mechanical engineering at Tufts University.

With bricks, action and hues as vibrant as tropical sunsets, Lego created a way for novices to learn the basics of structural engineering: bracing, tension and compression, loading constraints, building to scale. By combining Lego bricks to sensors, servo motors and microprocessors, those novices can now explore everything from basic pulleys and belts to computer programming. “Mindstorms EV3 makes tinkering with machines cool again,” says Ralph Hempel, author of Lego Spybiotics Secret Agent Training Manual.

Mindstorms encourages young tinkerers to play their way into robotics. “It puts no limits on your fantasies,” says Niels Pugholm, a Danish college student who’s been playing with Legos from the time he was old enough to know he shouldn’t swallow them. “Most toys pre-tell a story; Mindstorms is exploratory and has no set rules. If I construct a Mars rover robot, I can rebuild it into a robotic arm and then a robotic humanoid. Lego robotics is a sneaky educational way to learn about design, planning, construction and, most importantly, reconstruction.” In Denmark, he says, it’s obligatory for a child to build a Babel Tower out of Legos that “inevitably gets demolished.”

The EV3 is the third generation of ­demolishable Mindstorms, and the second that’s been crowd-sourced. “The power of many,” says Marc-André Bazergui, one of a dozen Lego citizen developers—who call themselves the 12 Monkeys—impaneled to design the latest edition. Over the years, the many have fashioned Lego bots that solve Rubik’s Cubes, sort M&M’s by color and convert conventional toilets into robo-flushers.

Part of the so-called “maker movement,” Mindstorms’ fanatic online community shares ideas by uploading plans for new creations to Lego forums and posting videos to YouTube. Across the globe, schoolchildren belong to leagues and hold tournaments in which teams are challenged to design, build and program a Lego robot to complete a specific task related to a theme like climate control or transportation safety. In the United States, competitions are run by FIRST (For Inspiration and Recognition of Science and Technology), a nonprofit founded by the seemingly inexhaustible inventor Dean Kamen (creator of the Segway scooter). Every spring FIRST holds championships in four robotics divisions, spanning ages 6 to 18. At this year’s three-day Lego block party at the Edward Jones Dome in St. Louis, 650 teams vied for robotic superiority and more than $16 million in scholarships to 140 colleges.

Half of all stateside middle schools and about a quarter of all elementary and high schools have folded Mindstorms into their curricula. The Massachusetts Institute of Technology has a Lego Chair, which is not a chesterfield made of Lego bricks, but an endowed professorship at the college’s media lab. At Tufts, the robotics sets have evoked an equal number of dissertations and disquisitions with catchy titles like “Teaching Basic Cardio-Vascular Mechanics with Lego Models: A High School Case Study.”

Rogers worked with Lego to develop Robolab—a robotic approach to learning science and math—that’s been used in some 50,000 schools worldwide and has been translated into 15 languages. He stresses design thinking, the idea that you frame a problem by first imagining its solution. His approach is based on demonstration, critique and iteration: Everything can be made better, even failure. “The kids make an educated guess and then run experiments to prove their theories,” he says. “They see that there is no right or wrong answer, just an infinite number of ways to address a problem. Learning that is as critical to engineering as it is to life.”

Samuel Beckett exhorted: “Fail better.”

***

In Danish, Lego is pronounced LEE-go. In English, the construction craze that has gripped the civilized world is pronounced LEEgoMAINia. An Italian artist painstakingly re- created the works of old masters in Legos, including da Vinci’s Mona Lisa and Vermeer’s Girl With a Pearl Earring. A Chicago artist has designed Lego mini-scale sets of the White House, the Sydney Opera House and 15 other eminent edifices. Others have gone to extraordinary lengths to assemble the world’s largest Lego bridge (122 feet), the world’s longest Lego train track (4,923 feet) and the world’s tallest Lego tower (106 feet, seven inches; 450,000 bricks). It would take 40 billion eight-stud Lego bricks to build a stack to the moon, though no one has yet attempted this.

Not only does every significant new NASA spacecraft and mission now beget its own Lego model, but astronauts aboard the International Space Station have built them in orbit. There are Lego Darth Vader clocks, Lego Ninjago video games and a Lego Quidditch match. A year from now the animated adventure film LEGO: The Piece of Resistance is due in theaters. Featuring characters voiced by Will Ferrell and Morgan Freeman, the cartoon promises to be a real, ahem, blockbuster. At last count, four of the top 10 children’s chapter books on the New York Times best-seller list were from Lego. One of them, The Lego Ideas Book, carries the tag line “Unlock Your Imagination.”

Imagination is what has guided Lego from its founding in 1932 by Ole Kirk Kristiansen, a Geppetto-like carpenter with a small workshop in Billund, a rural hamlet in Jutland with the topography of a pancake. In a bid to beat the Great Depression, Kristiansen started making brightly colored wooden cars and pull-along ducks. Having concluded that his toy company needed a more evocative name than Billund Maskinsnedkeri, he truncated the expression leg godt, Danish for “play well.’’ In a fortuitous coincidence, Lego means “I put together” in Latin.

Lego, as understood by most adults, began in 1949, shortly after Kristiansen bought Denmark’s first injection-molding machine and began cranking out toys with some plastic parts. According to Lego legend, he happened upon some hollow, British-made blocks called Kiddicraft, which inspired his own Automatic Binding Bricks, the forerunner of the Lego brick. The design breakthrough was a studs-and-tubes mechanism that allowed the bricks to snap together, hold fast and yet somehow come easily apart. “Legos are the ultimate symbols of Danish character,” Niels Pugholm says. “They’re unassuming little objects that depend on logic and geometry. Perhaps because Denmark has so few natural resources, ingenuity is treasured.”

In 1958—the year of Kristiansen’s death—Lego patented its click-fit technology, which the company calls “clutch power.” The key is precision engineering; the tolerance of Lego’s Danish Modern prongs is one-fiftieth of a millimeter, ten times finer than a human hair. Over the next half-century Lego became one of the world’s most beloved toys. Roughly half the parents on the planet have been woken up by a disturbance in the middle of the night, dashed groggily into their kid’s bedroom and stepped barefoot on a Lego brick.

“Children are fantastic little creatures,” Mads Nipper, the company’s marketing chief , has said. “Next to drunk people, they are the only truly honest people on earth.” As the millennium approached, Lego exploited that honesty by going on a branding bender. The family-run firm made forays into children’s clothing, baby products, jewelry, video games and theme parks.

But something was rotting in the state of Denmark. By 2004 Lego had made some blockheaded financial decisions and was on the brink of bankruptcy or a takeover by Mattel, the world’s biggest toy retailer. Kjeld Kirk Kristiansen, CEO and grandson of the founder, appointed former management consultant Jorgen Vig Knudstorp to replace him and rebuild Lego, brick by brick. Which Knudstorp did, cutting costs, laying off staff, halving development times, scrapping the software division and slashing product lines. Seemingly relegated to the Great Toy Attic in the Sky, Lego made a remarkable turnaround.

One line Knudstorp left untouched was Mindstorms, which began life 15 years ago in collaboration with the MIT Media Lab. “The original patent on our interlocking brick expired in 1975,” says Nipper. “The only way to continue differentiating ourselves from our competitors was through creativity.” And not necessarily Lego’s own creativity: The company has outsourced Mindstorms innovation to its hard-core fan base.

The relationship between Mindstorms and its enthusiasts had always been symbiotic. A couple of months after the debut of the robotics kit in 1998, Stanford University graduate student Kekoa Proudfoot reverse-engineered its proprietary microprocessors and posted the design secrets. Other hackers pounced on his findings, designed new software and operating systems, and shared performance tweaks with the rest of the Internet. While Lego’s management and legal team debated how to handle the breach, Nipper suggested that the company should encourage open-sourcing.

Suing the modders, he reasoned, might alienate Lego’s adult hobbyists, who accounted for nearly half of Mindstorms sales and were, essentially, willing to work for free. In the company’s new business paradigm, development should be fan-driven and fan-controlled, with very little oversight from Lego. So little that a “right to hack” was written into the Mindstorms software license. “We came to understand that limiting creativity is the opposite of our mission,” Nipper says. “Our goal is to foster inquiry and ingenuity.” The strategy paid off: Mindstorms became the best-selling product in Lego’s history.

In 2005, with the kit due for a design upgrade, Lego trolled through online forums and websites for adult fanboys willing to be part of a Mindstorms User Panel, or MUP. The four finalists—all sworn to secrecy—and Lego’s engineering brain trust spent 11 months swapping e-mails about everything from firmware to input ports. In return for their contributions, the MUPpets got paid in Legos. “It’s the best possible relationship,” says panelist Ralph Hempel, a professional engineer who specializes in embedded systems design. “Money would complicate the issue. There is no other brand in the world that I would consider doing similar work for at no charge. Getting advance copies of robotics kits is just icing on the cake for me.”

For the latest version of Mindstorms, Lego expanded its user panel to a dozen brickheads (the 12 Monkeys) and studied how kids interact with robotic toys. Camilla Bottke, the company’s senior marketing manager, says kids don’t view robots as objects as much as extensions of themselves, things with character and personalities. “I think that’s a great concept, right up until the child has to build the robot and program it,” offers Hempel. “That’s when the reality sinks in of how much thinking and tinkering goes into making a design work.”

***

“You say you want a revolution,” sang a skeptical John Lennon. “Well, you know, we all want to change the world.” The problem with the digital revolution, echoes Dean Kamen, is that the ability to play with technology is often confused with the ability to understand it.

The 62-year-old engineer and entrepreneur holds forth from a hexagon- shaped house of his own design on the outskirts of Manchester, New Hampshire. He wears what is virtually his uniform: an open-neck button-down denim shirt and denim pants.

Kamen dropped out of college to develop the world’s first wearable insulin pump. He went on to create the Segway; a self-balancing, six-wheeled robotic wheelchair capable of going up and down stairs; and an electrical generator that can run on cow dung and produce potable water on the side. Of all his inventions—and Kamen holds 441 foreign and domestic patents—the one he’s proudest of is FIRST, a largely mental sport based on competitive robotics.

He started FIRST in 1989 to demystify engineering and grow a generation of innovators. “Too many high-school kids in this country, particularly women and minorities, drop out of science and math classes,” he says. “There’s no incentive, no encouragement.” Indeed, he argues, there are all sorts of subtle disincentives and discouragements. “Kids need access to challenging, hands-on projects that result in a tangible product. Instead of telling them why abstract concepts like algebra or trigonometry are important, science teachers should say, ‘Let’s build a Lego robot!’ With a little assistance, the kids build one and it solves a problem. Suddenly, they realize that math and science are very powerful tools. Suddenly, math and science are relevant and fun.”

Kamen envisions a time when youngsters revere pioneering scientists as much as, say, NBA superstars. “The one thing American culture celebrates is sports heroes,” he says. “Lots of athletic teenagers think they’re going to make a fortune by bouncing a basketball and becoming the next LeBron James. That’s not realistic for even the tiniest percentage of them. Becoming an engineer is.” Still, Kamen concedes the innate differences between classrooms and playing fields have helped make careers in sports more attractive than ones in tech. “When athletes work together, it’s called teamwork,” he says. “If you work together in science class, it’s called cheating.”

The Robotics Competition—FIRST’s equivalent of the major leagues—kicks off every January, when a committee of engineers reveals that year’s game and rules. Supervised by engineers, scientists or other adult mentors, teams of high-school students have six weeks to design and construct small, inelegant machines from kits. The only constraints are weight (the robot can’t exceed 150 pounds) and cost. (To mitigate economic, rather than engineering advantages, Kamen has established a kind of salary cap of $4,000 on additional parts.)

Though each team faces the same challenge, they devise vastly different design solutions. Local winners advance to one of the 58 regionals, where their bots battle for the chance to qualify for the finals in St. Louis. The championship is structured like March Madness, the NCAA Men’s Division I basketball tournament. Kamen calls it the “NCAA of smarts.” Each of the four divisions is named for a famous scientist (Archimedes, Curie, Galileo and Newton). The Final Four is played on the Einstein Field.

A recent Brandeis University study shows that kids who participate in robotics contests are more than twice as likely to pursue a career in science and technology, and nearly four times as likely to pursue one in engineering. “The robot is just a vehicle,” Kamen says. “In six weeks you can’t give a kid a meaningful education in robotics or technology or engineering. But by building robots, you can build self-confidence and a serious understanding of what life is like for people who work on and solve complex problems. For a lot of kids, robotics has the potential to change where they put their time and attention.”

On this particular January afternoon, about 750 kids from as far afield as Singapore are putting their time and attention into a FIRST tournament at the University of Delaware. A cross between a science fair and a “Big Bang Theory” costume ball, it’s one of the biggest single-day robotics events in the country. Entrants have come decked out as mad scientists, crash-test dummies and assorted grotesqueries that even Dr. Seuss wouldn’t have concocted.

Tinkertoy technology has transformed a field house into a veritable hardware emporium. Workshop cubicles are crammed with tawny ratchets and rusty wrenches; wide gray clusters of wheels, pulleys and extension arms; and everywhere, everywhere Legos. Banners bear team names like Bricktastic Builders, the Fellowship of the Brick, Lego-Nardo da Vinci.

Down on the Robotics Competition playing court, the most conspicuous confederacy—a quartet of New Jersey lads known as the Carbonauts—is clad in safety glasses, running shoes and what looks to be orange prison jumpsuits. “Legos inspire me and bring me back to reality,” says Ibrahim Elshahawi, a high-school senior planning a career in biomedical engineering. “I’ve learned that I can’t just build a robot. My ideas have to be more organized and sequential.”

The younger contestants are about half female. In the Robotics Competition, girls are few and far between. “Girls are more into aesthetics, logistical, detail-oriented,” offers a Carbonaut named Charles Verhoog. “We’re not into style points.”

“Guys are into smashing things,” says teammate C.J. Geering.

A teenage girl on another team—her pinkish tresses braided with Chinese finger traps—pops her head into the Carbonaut huddle and cracks, “You’d be surprised.”

A buzzer sounds. Egged on in the stands by cheering sections and hyperventilating parents, the teams set their folklift-like robots in motion on the course. The object: to snatch rubber rings from a vertical heap and deposit them on horizontal spokes. The Carbonaut bot grabs, drops, stalls, rams into walls and yet somehow...wins the heat.

Like a worn-down stock car, the triumphant bot is rolled back to the “pits,” where the Carbonauts monkey with the algorithm, changing speed and direction variables. Asked if he has ever participated in a tournament tarnished by a robotic doping scandal, teammate C.J. Geering deadpans, “The judges occasionally ask us for samples of electricity, but so far none of ours have been tainted. The last thing we want is to have to appear on a TV special with Oprah.”

Across a partition, Austin Hwa and Thomas McClure, clad in crimson cravats, toques and chef’s jackets, lounge beside a pyramid of Lego bricks. They’re members of Chef-Bot-Ardees, a mostly middle school contingent from Chadds Ford, Pennsylvania.

This year’s Lego League Challenge is to solve issues faced by the elderly. The chefs have whipped up a robotic walker fitted with a magnetic tray.

“The tray is magnetized to keep knives and forks from falling off,” explains Hwa.

“And spoons,” adds McClure, helpfully.

Thirteen-year-old Hwa says Lego robotics have put him on the tech track. McClure, who’s 10, isn’t so sure engineering is in his future. “Not to go off topic,” he says, “but I don’t think I’ll necessarily go into that line of work.”

He contemplates the Lego pyra- mid through the lattice of his fingers. “I’m in the fifth-grade band, the percussion section,” he says. “There’s a really high chance I’ll grow up to be a rock drummer.”