New to League One, Northampton will face another side who won promotion last season after Barnsley's dramatic play-off success put them into the Championship.
The tie will take place at Oakwell in the week commencing 8th August and after the first weekend of league fixtures.
The Cobblers were handed a home clash with Fleetwood Town on the opening day of the new season when the fixtures were announced earlier on Wednesday.