Between spreading illnesses, ruining crops, and infesting our homes, insects have had a long, adversarial relationship with humans. But not all insects are pests — think bees — and if scientists and engineers have their way, several more species will soon become our unwitting allies.

In labs throughout the world, researchers are hacking the brains and bodies of insects, creating so-called "biobots" that can do their bidding. Just as insects have recently been hailed as a potential solution to our impending food security crisis, the shudder-inducing creatures may also save human lives in various other ways.

Related: How Eating Crickets Could Help Save the Planet

For example, crawling cyborg insects could someday explore disaster zones and aid in search-and-rescue operations. By effectively surveying areas inaccessible to rescue teams, these remote-controlled insects could help find people buried under collapsed buildings. Similarly, a mass of airborne biobots could quickly search forests, canyons, and other areas for missing hikers.

That's just the start. Robo-insects could also be a boon to homeland security, surreptitiously surveilling criminals and enemy combatants or safely detecting explosives or noxious chemicals.

"Right now, the concept and the technology is already mature," says Hong Liang, an engineer at Texas A&M University who's been researching cyborg cockroaches for the past decade. "We're working on the implementation."

There's no one-size-fits-all approach to employing insects as tools, however. Researchers have looked into using a number of insect species for various real-world applications, and have tried several different approaches to control the animals' behaviors to our own benefit.

Crawly Saviors

For search-and-rescue missions that require navigating tight spaces filled with rubble and debris, crawling insects are best.

In her work, Liang has experimented with several cockroach species, but she favors discoid cockroaches from Latin America. Like other species, discoid roaches are low maintenance, easy to obtain, and they recover quickly from injuries. But this species is slower, larger, and calmer than its German or American cousins, making them easy to work with and able to carry greater weight. "And they don't smell bad like the other roaches," Liang says.

To create cyborg cockroaches, Liang and her team insert electrodes into nerve clusters called ganglia that run down the center of the body and control the movement of the insect's legs. The electrodes are attached to a small backpack, containing small circuits, wireless transmitters, and a rechargeable battery, glued to the insect's back.

A Madagascar hissing cockroach is outfitted as a "biobot." Alper Bozkurt / NCSU

Pressing a button on a remote controller causes the backpack to send electrical signals to a particular ganglion. These signals cause a leg to move out of sync with the roach's normal gait, resulting in a turning motion, with the sharpness of the turn controlled by the specific frequency and voltage of the shock.

When these cyborg roaches are eventually used in the field — which, depending on funding, may be soon, Liang says — tiny cameras, microphones, and other onboard sensors could help them gather information about the environment and locate people in need of saving.

The insects could be deployed quickly to disaster scenes and may succeed where other search-and-rescue tools don't quite do the job, such as when listening devices can't pick up the telltale sounds of a person buried under rubble, or when canines are unavailable or can't be used due to safety concerns.

Deploying the Horde

Get the mach newsletter. This site is protected by recaptcha

Liang's approach to creating cyborg roaches isn't the only one.

At North Carolina State University, engineer Alper Bozkurt and his team steer roaches (specifically Madagascar hissing cockroaches, which is another large, slow species) by spoofing their senses. That is, stimulating roaches' sensory organs with low voltage causes them to engage a natural avoidance behavior — stimulating the left antenna may make the roach think there's an obstacle or danger coming from the left, causing it to hang right, and vice versa.

With this approach, manually controlling the biobot roaches isn't entirely necessary for search-and-rescue operations, Bozkurt says.

Recently, Bozkurt and his colleagues compared the ability of uncontrolled roaches to completely explore an area with those of biobots given random sensory commands to move forward, left, or right. They found that the biobots automatically surveyed regions far faster because the random commands caused them to move more, move quicker, and spend more time away from walls and in open spaces.

Related: Robo-Bees May Bring Fix to Pollination Problem

Given these results, one could imagine a horde of the hissing roaches being released into a collapsed building, each one outfitted with a backpack that gives random commands and contains infrared sensors to detect body heat. Once the roaches detect a human heat signature, a rescue team could use radio signals from multiple roaches to triangulate their exact location and the buried people in relation to them. "Once you find the people, you can build a map of the under-rubble environment," Bozkurt explains.

Beyond rescue operations, these robo-roaches could explore places too dangerous for people and be used for surveillance and espionage, if outfitted with cameras or microphones. They could be deployed, for instance, into a warehouse suspected of housing criminal activity.

Aerial Biobots

In some applications— such as battlefield surveillance and search-and-rescue endeavors involving more open spaces — flying cyborgs may be necessary, though the path to creating them is turbulent.

"We've been able to make the insects do simple maneuvers, such as go right or go left," says Bozkurt, who works with moths. "But trying to make them go from Point A to Point B by following a complicated route hasn't been possible yet." A main issue, he explains, is that that making the insect turn in the air often messes up its aerial balance and its ability to generate lift, ultimately causing the moth to crash.

Once you find the people, insects can help build a map of the under-rubble environment.

Scientists in Singapore have had better results with giant flower beetles, which have tiny muscles below their wings that are involved in wing folding and flight steering. By electrically stimulating these muscles, they can make the beetles take off, hover, turn left or right, and land, though the movements aren't quite precise. In other work, the team also showed tight gait control of beetles by stimulating specific leg muscles.

Researchers with the DragonflEye Project of Draper — an 85-year-old research and development organization — are crafting an entirely different approach to controlling flying insects. Instead of spoofing insects' sensory systems or directly activating muscles with electrical stimulation, the project seeks to control dragonflies' special "steering" neurons using light.

These neurons act as messengers between the sensory neurons that take in information from the environment and the motor neurons that control muscle movements. "They are a joystick that tells the system how to coordinate flight activities," says Jesse J. Wheeler, DragonflEye biomedical engineer and project lead. Stimulating these neurons would allow Wheeler and his team to tap into the high-level coordinated steering commands of the wings, making it possible to give general flight directions without having to control individual wing movements.

A first generation version of the backpack guidance system that includes energy harvesting, navigation and optical stimulation on a to-scale model of a dragonfly. Charles Stark Draper Laboratory

Using electricity for this task is too crude, however. "The problem is if you draw a tiny current into the nerve core, you would activate all the nerves around it," Wheeler says, adding that light activation would provide more specificity.

Draper partnered with Howard Hughes Medical Institute researchers, who are genetically modifying dragonflies' steering neurons to make them sensitive to light. The insects can then be strapped with a Draper-designed backpack that delivers targeted light pulses to specific steering neurons. The backpack also contains a navigation system, sensors, wireless transmitters, and miniature solar panels.

Instead of manually controlling the insects, the team could theoretically program a dragonfly (via the backpack) to do certain tasks, such as investigating a building in a warzone, which it will carry out autonomously. Wheeler thinks the system may be ready for real-world tests in about two years.

Robot or Cyborg?

Bozkurt suggests biobots are just a stepping stone to miniaturized insect-like robots, which aren't yet possible due to technological limitations. "If you look at the history of science, before having our automobiles we were riding various beasts of burden," he says, explaining that biobots are modern science's beasts of burden.

But Liang thinks there are benefits to keeping robot-like insects around. They're more inexpensive and energy-efficient than full robots, she says, and have the ability to sense the environment on their own and respond in kind, such by evading unstable rubble or escaping from guard dogs or other dangers during espionage missions.

Related: Tarantula's Strange Hair May Bring Better Digital Screens

Some insects, such as locusts and bees, can also be trained to home in on certain scents, including the chemical cues of explosives. The insects could eventually be remotely guided to collect samples for further analysis, making them useful for homeland security applications.

Liang suggests there may be other, more science fiction-like uses to the cyborgs not necessarily possible with full robots. For instance, if your home is infested with roaches, you could release a robo-roach to find their main hiding spaces. The roach, perhaps outfitted with attractive chemical cues, could then be guided outside of your home, luring the other roaches out in a kind of Pied Piper fashion. "This is a crazy idea, but I think it will be possible," she says.

Compared with machines, cyborg insects are "more versatile and flexible, and they require less control," Liang says. "They're more real."

Follow NBC MACH on Twitter, Facebook, and Instagram.