Cross section measurements of charged pion photoproduction in hydrogen and deuterium from 1.1 to 5.5 GeV