Sketch is not working with Nano perfectly like Mega2560

It's just my hunch that the 3.3V supply was the culprit. If that is proven with the help of the MEGA2560, OP can get am1117-3.3 to supply the 3.3V.