A prosecutor said the government settled for a sentence slightly below the minimum recommendation because it wanted to spare victims the pain of testifying if the case went to trial.
Troup admitted putting the camera in the shower at Penn High School sometime around December 2010, The South Bend Tribune reported.
Two students found the camera weeks later at the South Bend school and put it in a drawer after they couldn't access the recordings. They told a swim coach about the camera in November 2011 after a discussion about Jerry Sandusky, a former assistant football coach at Penn State who was convicted of child sexual abuse.
Troup worked at the school district for more than 20 years. He was fired in December 2011 after criminal charges were filed.
"I'm sorry for what I did," Troup said in court. "I made a mistake. I let my community down."