Code P0505 indicates that there's a problem detected with your Idle Control System. It could be caused by any of the following:
* faulty Idle Air Control (IAC) valve
* clogged throttle body/improper adjustment
* intake manifold gasket air leak
* intake air hose air leak
now run your car on idle until your engine reaches operating temperature. that means, rev up your car up to 3000 rpm until your radiator fan comes on. and making sure nothing is powered on in your car such as headlights, fan, defogger, air conditioner. etc.
after the radiator fan comes on, release the rpm and see where it falls.
if it's less than 400 rpm, then you'll need to clean the ports in the throttle with carburetor cleaner, clean out the gunk in the screen inside your IAC valve, adjust your idle speed screw, or replace the IAC valve altogether. A new one costs about $190 at your local auto parts store.
if it's greater than 500 rpm (which might be the case since you've mentioned idling between 1000 and 2000rpm), then you'll need to plug the upper port or hole inside the throttle opening and see what happens.
if your rpm drops, then you'll need to adjust the idle speed screw until you achieve 450 rpm. otherwise, you may have an air leak somewhere in the throttle valve or hoses - secure and stop any air leaks you find.
Also, borrow/buy an On Board Diagnostic (OBD) scanner to help you easily reset and clear the error code when you think you've resolved the issue. If the code reappears, then that means there's still a pending issue.
Good luck!