Mystery Problem with Standalone Arduino

You have R3 on the "PWM" line shown as going to 12V. That is a blunder.

If you really want to test 22pf capacitors, you want one of those testers advertised on eBay where you hold the capacitor against the pads on the tester PCB, or use a one inch piece of wire inserted into the connector on the "live" side, to probe the capacitor.