The resistor is in the wrong place it is supposed to be IN SERIES (in between) the Nano GND and the 5V supply GND.
What happens now is that Nano is always ON, regardless if USB charger is in use or not.
Yes , of course. What did you expect ? The resistor simply provides a means of measuring current with the Nano analog input . This has nothing to do with shutting down the Nano other than to provide the necessary information (current) for use in a script that shuts down the Nano when the current exceeds some specified Value. To my knowledge, you have not provided us with your reason for wanting to shut down the Nano and the suggestion to buy the resistor was in response to the comment below to add a
current shunt to measure the current.
So I would add a current shunt en measure the current to the device. And turn on the display if the current gets above a threshold.
When you have corrected that error you need to :
Measure the voltage on the end of the resistor that is NOT connected to GND and use that to determine when to go into shutdown mode and then you need to decide on what the criteria is for waking up before you can write the Interrupt routine for waking up.
The voltage across the resistor will tell you the current , based on Ohm’s Law:
Icurrent sense resistor= Vcurrent sense resistor/Rcurrent sense resistor
IVcurrent sense resistor= Vcurrent sense resistor/0.1 ohm
Let Vcurrent sense resistor = 0.005 V (5 mV (1 analog count)
then I=0.005/0.1 =0.050 V (50 mV)
If you want to measure current less than 1 A you should replace the 0.1 ohm resistor with a 10 ohm
that will give you a voltage 10 times higher than the 0.1 ohm resistor , so the same example above
would give you a voltage of 0.005*10 = 0.05 V (50mV) (10 analog counts instead of 1).
For a 10 ohm resistor , the maximum current is 500mA (0.5A) because the voltage drop at that current
is 5V , which is the highest voltage you can measure with a 10 ohm resistor. If it is a 1W resistor, the maximum current you could measure would be 0.2A (200mA) , without exceeding the resistor power rating. With a 3W resistor, you could measure 500mA (2.5W).
By measuring the voltage, you can calculate the current and use that for determining when to shutdown
the Nano using code.
You might want to look at this tutorial on arduino auto-shutdown with relay