Sound like you have tried a lot of stuff. I know you have an iphone 5 though you might still have the same issue. iPhone 4S (and older) with a dirty/defect docking connector showed just these symptoms. You should check your lightning connector. Start by cleaning it prperly. If that does not help, try to replace it.