Sounds like the movie Screamers, based on Philip K. Dick's story "The Second Variety."
In the year 2078, the planet Sirius 6B, once a thriving mining hub, has been reduced to a toxic wasteland by a war between the mining company, known as the New Economic Bloc (NEB), and "The Alliance," a group of former mining and science personnel. After miners discovered that their extraction of ore released toxic gases, they went on strike, and the mining company hired mercenaries as strike breakers. Five years into the war, Alliance scientists created and deployed Autonomous Mobile Swords (AMS) — artificially intelligent self-replicating machines that hunt down and kill NEB soldiers on their own. They are nicknamed "screamers" because of a high-pitched noise they emit as they attack. Screamers track targets by their heartbeats, so Alliance soldiers wear "tabs" which broadcast a signal canceling out the wearer's heartbeat and rendering them "invisible" to the machines.
A fragile stalemate is in effect between the two exhausted, poorly supplied, and undermanned armies. The Alliance recovers a message from a dead NEB soldier, killed by screamers as he approached the Alliance compound, guaranteeing safe passage through NEB territory to discuss a truce. When Alliance commanding officer Joe Hendricksson (Weller) reports this development to his Earth-based superiors, he is told that peace negotiations are already underway on Earth; but Private "Ace" Jefferson (Andrew Lauer), newly arrived from Earth, says that is untrue. Hendricksson is not surprised; he has long suspected that both sides have simply written off Sirius 6B and abandoned their armies.
Hendricksson decides that the only realistic chance of survival for himself and his soldiers is to accept the NEB truce offer. He sets out for a meeting with the NEB commander, accompanied by Jefferson. While traveling through a destroyed city they come upon a war orphan, a young boy named David (Michael Caloz), clutching a teddy bear. Unwilling to abandon a defenseless civilian, they bring the boy along. The following night they are attacked by a reptilian screamer that they have never before encountered. Hendricksson is alarmed that their Alliance tabs did not protect them.
Trailer