Your comparator will always return true because you compare if the pot voltage is bigger than 0.
You have to put on the inverting input the voltage ref you compare to.
What do you exactly want to do?
In your arduino sleep hardware circuit, Vref is at ground so the comparator will fire with very little voltage at the Vin terminal. Add another pot connected as shown for Vin (or a fixed voltage divider) with the wiper connected to the Vref (-) input to set the level that Vin must reach to fire the comparator. Your AD820 opamp is specified as single supply capable.
i have noticed myself that the signal will only work when:
i have the trigger set up in LOW this could explain the following in the comments of the code:
"*/ In all but the IDLE sleep modes only LOW can be used."
and more bizare is that i have to switch the - and the + of the comperator, instead of using + as the input from the potmeter, i have to switch it with - and add the Vref/ground/0 to the + signal. (maybe aloyse-tech stated this, then i would like to know why, as since the diagram included says to add the Vref to - and not +.)
infact i want to notice the slightest voltage difference of like 1mV so thats why i have connected the comperator Vref pin to ground, anything other than 0 is desired to be used. The idea of this is to measure a tiny current of 1mA over a 300 Ohm resistor so that would be 300mV trigger which is almost zero.
So it works now only in the conditions mentioned above.