A man fighting a drug problem was caught on camera when he stole headphones from a Bolsover store.
Staff the Factory Shop in Market Place, were informed about the theft and CCTV footage showed Mark Harris take a boxed item from display.
Becky Mahon, prosecuting, told Chesterfield magistrates that Harris was identified by police after they viewed the footage.
“He said he intended stealing something when he went into the shop and he sold the headphones for £5,” said Ms Mahon.
Harris, of Nesbit Street, Hillstown, Bolsover, admitted theft on January 12.
He had previous convictions for dishonesty and had been locked up in the past.
He was given an 18-month conditional discharge and ordered him to pay £12 compensation and £15 to a victims-of-crime fund, with £40 costs.
Bob Sowter, for Harris, said: “He needed some money for food and he sold the headphones soon afterwards for £5.”