The 29-year-old former West Brom and Birmingham man made 38 appearances during his single season with the Robins before leaving earlier this summer when his contract expired.
And he will be a Cobbler from August 1 as Aidy Boothroyd looks to harness Carter's experience in their promotion push.
"Darren's pedigree is clear for everyone to see," he told the club's official website. "I think we've got a really, really good player on our hands, he's got a great record and he's in absolutely fantastic shape.
"He has had a lot of other offers so I'm delighted we've managed to get him. He's a terrific professional, he scores goals from midfield and he's a winner."
- Sports & Recreation
- Aidy Boothroyd