In 2006 the US Defense Advanced Research Projects Agency (Darpa) asked America's scientists to submit "innovative proposals to develop technology to create insect-cyborgs" .

It was not your everyday government request, but it was an utterly serious one. For years, the US military has been hoping to develop "micro air vehicles" – ultra-small flying robots capable of performing surveillance in dangerous territory. Building these machines is not easy. The dynamics of flight change at very small sizes, and the vehicles need to be lightweight enough to fly, yet strong enough to carry cameras and other equipment. Most formidably, they need a source of power, and batteries light enough for microfliers just don't have enough juice to keep the crafts aloft for very long. Consider the tiny, completely synthetic drones that engineers have managed to create: the DelFly Micro, which measures less than 10cm from wingtip to wingtip, can stay airborne for just three minutes.

Darpa officials knew there had to be something better out there. "Proof of existence of small-scale flying machines… is abundant in nature in the form of insects," Amit Lal, a Darpa programme manager and Cornell engineer, wrote in a pamphlet the agency issued to the prospective researchers.

Perhaps, Darpa officials realised, the military didn't need to start from scratch; if they began with live insects, they'd already be halfway to their dream flying machines. All they'd have to do was figure out how to hack into insects' bodies and control their movements.

Darpa's call essentially launched a grand science fair, one designed to encourage innovation and tap into the competitive spirit of scientists around the country. The pamphlet outlined one specific application for the robo-bugs –outfitted with chemical sensors, they could be used to detect traces of explosives in remote buildings or caves – and it's easy to imagine other possible tasks for such cyborgs. Insect drones kitted out with video cameras could reveal whether a building is occupied and whether those inside are civilians or enemy combatants, while those with microphones could record sensitive conversations, becoming bugs that literally bugged you.

Darpa's call for insect cyborgs piqued the interest of Michel Maharbiz, an electrical engineer at the University of California, Berkeley. He figured that most scientists taking on Darpa's challenge would work with flies or moths, longtime laboratory superstars, but Maharbiz came to believe that beetles were a better bet. Compared with flies and moths, beetles are sturdy animals, encased in hard shells, and many species are large enough to carry significant cargo. The downside: scientists didn't know much about the specific nerve pathways and brain circuits involved in beetle flight.

That meant that the first challenge was to unravel the insects' biology. Maharbiz and his team began working with several different beetle species and eventually settled on Mecynorrhina torquata, or the flower beetle. It is a scary-looking bug – more than 5cm long, with fearsome claws and a rhinoceros-like horn on the forehead in males. The flower beetle's transformation began with a quick trip to the freezer. In the icy air, the beetle's body temperature dropped, anaesthetising the insect. Then Maharbiz and his students removed the bug from the icebox and they poked a needle through the exoskeleton, making small holes directly over the brain and the base of the optic lobes, and threaded a thin steel wire into each hole. They made another set of holes over the basalar muscles, which modulate wing thrust and are located on either side of the beetle's body. The researchers pushed a wire into the right basalar muscle.

Stimulating it would cause the beetle's right wing to start beating with more power, making the insect veer left. They put another wire into the left basalar muscle; they would use it to steer the beetle to the right. The loose ends of all these wires snaked out of their respective holes and plugged into a package of electronics mounted with beeswax on the beetle's back. This "backpack" included all the equipment Maharbiz needed to wirelessly send signals to the beetle's brain: a miniature radio receiver, a custom-built circuit board and a battery.

Then they put all the pieces together. One of Maharbiz's students called up their custom-designed "Beetle Commander" software on a laptop. He issued the signal. The insect's wings began to flap. The empty white room the researchers used as an airfield filled with a buzzing sound, and the bug took flight. The beetle flew on its own – it didn't need any further direction from human operators to stay airborne – but as it cruised across the room, the researchers overlaid their own commands. They pinged the basalar muscles, prompting the beetle to weave back and forth through the room, as if flying through an invisible maze.

As soon as Maharbiz presented his work, the news stories came fast and furious, Wired pronounced: "The creation of a cyborg insect army has just taken a step closer to reality" and the Daily Mail panicked: "Spies may soon be bugging conversations using actual insects, thanks to research funded by the US military". A columnist speculated about the possibility of a swarm of locust drones being used as vehicles for launching deadly germs.

Maharbiz bristles at the most sinister suggestions, at the media coverage that suggests his beetles are the product of, as he puts it, "some evil government conspiracy". His beetles haven't been sent out into the field yet – they still need some refinement before they're ready for deployment – but if and when they are, Maharbiz says he expects his bugs to be used abroad, in routine military operations, but not to track US citizens. (Of course, some people may find that "equally reprehensible", he acknowledges.) There are civilian applications, too. Imagine, Maharbiz tells me, an army of beetlebots, steered to the scene of an earthquake. The bugs could be outfitted with temperature sensors, guided through rubble and programmed to send messages back to search teams if they detect any objects that are close to human body temperature; rescuers would then know exactly where to search for survivors. Whatever the application, future insect commanders will have options that go beyond beetles. Maharbiz is working on a remote-controlled fly, which he anticipates being especially difficult to build. "The fly is so small and the muscles are so packed and everything's so tiny," he says.

Insects could give us a cyborg-animal air force, zooming around the skies and searching for signs of danger. But for terrestrial missions, for our cyborg-animal army, we'd have to look elsewhere. We'd have to look to a laboratory at the State University of New York (SUNY) Downstate, where researchers have built a remote-controlled rat.

We have been rooting around in rat brains for ages; neuroscientists often send electrical signals directly into rodents' skulls to elicit certain reactions and behaviours. Usually, however, this work requires hooking a rodent up to a system of cables, severely restricting its movement. When the SUNY team, led by neuroscientist John Chapin, began their work more than a decade ago, they wanted to create something different – a method for delivering these electrical pulses wirelessly. Such a system would allow scientists to manipulate a rat's movements and behaviours while it was roaming freely and give us a robo-rodent suitable for all sorts of special operations. Rats have an excellent sense of smell, so cyborg rats could be trained to detect the scent of explosives, for instance, and then steered to a field suspected to contain land mines. (The task would pose no danger to the animals, which are too light to set off mines.) Or they could be directed into collapsed buildings and tasked with sniffing out humans trapped beneath the rubble, performing a job similar to the one Maharbiz imagines for his cyborg insects. "They could fit through crawl spaces that a bloodhound never could," says Linda Hermer-Vazquez, a neuroscientist who was part of the SUNY team at the time.

Graphic: Giulio Frigieri

They began by opening up a rat's skull and implanting steel wires in its brain. The wires ran from the brain out through a large hole in the skull, and into a backpack harnessed to the rodent. ("Backpack" seems to be a favourite euphemism among the cyborg-animal crowd.) This rat pack, as it were, contained a suite of electronics, including a microprocessor and a receiver capable of picking up distant signals. Chapin or one of his colleagues could sit 500m away from the rat and use a laptop to transmit a message to the receiver, which relayed the signal to the microprocessor, which sent an electric charge down the wires and into the rat's brain.

During training, the SUNY scientists used an unconventional system of reinforcement. When the rat turned in the correct direction, the researchers used a third wire to send an electrical pulse into what's known as the medial forebrain bundle (MFB), a region of the brain involved in processing pleasure. Studies in humans and other animals have shown that direct activation of the MFB just plain feels good. (When the scientists gave the rats the chance to stimulate their own MFBs by pressing down on a lever, the animals did so furiously – hitting the lever as many as 200 times in 20 minutes.) So sending a jolt of electricity zinging down to a rat's MFB acted as a virtual reward for good behaviour.

Over the course of 10 sessions, the robo-rats learned to respond to the cues and rewards being piped into their brains. As a demonstration, the researchers simulated the kind of search-and-rescue task a robo-rat might be asked to perform in the real world. They rubbed tissues against their forearms and taught the rodents to identify this human odour. They constructed a small Plexiglas arena, filled it with a thick layer of sawdust and buried human-scented tissues inside. When they released the robo-rats into the arena, the animals tracked down the tissues in less than a minute. The scientists also discovered that the rats that received MFB rewards found the target odours faster and dug for them more energetically than rodents that had been trained with conventional food rewards. As Hermer-Vazquez recalls: "The robo-rats were incredibly motivated and very accurate."

Greg Gage and Tim Marzullo, a pair of former neuroscience postdoctoral fellows, are taking these techniques and making them available to anyone with an internet connection and about £50 to spare. In 2009, Gage and Marzullo established Backyard Brains, a company that sells low-cost kits that will turn any interested amateur into a neuroscientist, if only for a day or two. Their first product was a little contraption known as the SpikerBox. On sale for $99.99 (£65), the device lets customers observe neural firing in a cockroach in real time. (A set of three roaches is $12 extra.) The procedure is simple: just insert two needle-like electrodes into a cockroach's leg, and the SpikerBox will do the rest, amplifying the electrical activity of the insect's neurons and transmitting it to an attached computer or smartphone as that characteristic visual pattern of peaks and valleys. For their second product, Gage and Marzullo decided to push the boundaries further, to venture beyond brain observation and into brain control. Taking inspiration from the world of cyborg animals, they created a kit that provides their customers with all the tools they need to take over the nervous system of a living cockroach. In principle, the Backyard Brains RoboRoach is nearly indistinguishable from the beetles Maharbiz is making in a university lab – and that is precisely what is so remarkable about it. It means we can all experiment with bionic bugs in our own homes.

If you're new to the hobby of animal mind manipulation, the cockroach is an excellent place to start. Because a roach relies on its long, fluid-filled antennae for a host of sensory and navigational functions, its nervous system is stunningly easy to hack; all a wannabe roachmaster has to do is thread a wire inside each antenna. ("It's like it's designed to be a cyborg," Marzullo says.)

The wires run out of its antennae and into a small black box Marzullo has glued on to its head. He plugs this "connector" into the cockroach backpack, a red-and-green assemblage of circuit boards. The electronics are slightly modified versions of circuit boards that come from a widely available toy: a plastic, remote-controlled inchworm called the HexBug that retails for about £7.50 at toy stores. When these circuit boards are linked to the head-mounted connector, Marzullo and Gage can use the remote control that comes with the toy to deliver pulses of electricity to the roach. "The world's first commercially available cyborg," Marzullo says.

Marzullo has kindly prepared a roach for me. Its sticky legs tickle my palm as I carry it to the sidewalk. I place it down gingerly, and it begins to scuttle off. I fumble with the remote before finding the "L" button. I hit it, and the roach abruptly spins to the left. The effect is less dramatic after that, but convincing.

Gage and Marzullo attract controversy because they are taking biotechnology out of the lab and putting it into the hands of the public. And they are criticised for meddling with animal bodies for "trivial" purposes. Most people, Marzullo explains, have accepted the use of animals for scientific research, military defence or food. "But if you exploit animals for education," he says, "people aren't cool with that." Is educating students about the nervous system – and potentially encouraging a new generation of neuroscientists – a less-justifiable use of animals than hunting out mines or earthquake survivors? It's time to start thinking through these issues, because now that the tools of brain control have been liberated from the lab, there's no telling how they'll be used.

Indeed, there is a growing community of "biohackers", science enthusiasts who are experimenting with genes, brains and bodies outside the confines of traditional laboratories, working on shoestring budgets in their garages and attics, or joining the community labs that are springing up around the globe. Some of these resourceful do-it-yourselfers are even building their own versions of high-tech laboratory equipment that normally costs thousands of dollars.

Backyard Brains is tapping into this movement, giving amateurs access to some of science's most sophisticated tools and techniques. The latest, greatest cyborg critters may come not from state-of-the-art labs, but the minds of curious kids and individual hobbyists. Though scientists will continue to build their cyborg animals, Maharbiz says he fully expects that "kids will be able to hack these things, like they wrote code in the Commodore 64 days". We are heading towards a world in which anyone with a little time, money and imagination can commandeer an animal's brain. That's as good a reason as any to start thinking about where we'd draw our ethical lines. The animal cyborgs are here, and we'll each have to decide whether we want a turn at the controls.

This is an edited extract from Frankenstein's Cat by Emily Anthes, published by Oneworld