Sketch is not working with Nano perfectly like Mega2560

Unlike MEGA2560, the Nano doesn't really have a good 3.3V source. If you trace the circuit, you will find that 3.3V comes from the USB/TTL adapter. It is rather weak, maybe only able to supply 50mA or less depending on what USB/TTL adapter chip is used. Connect your MEGA2560 and try to power the sensors with it, while running code on Nano. All you need is to disconnect 3.3V from nano and connect to MEGA2560, then connect grounds of the two.