Here is the thing. I have a hall sensor connected (thorugh pin2) in an Arduino NANO. I would like to make the device to sleep mode 3 min after the sesnor stopped reciving data. Then as soon as the sesnor recives data the board must be powered up.
So, what is the problem?
Is that possible? How you make it?
Is that possible?
Parts of what you want are possible. It is possible to put the Arduino to sleep.
Parts of what you want are not.
after the sesnor stopped reciving data.
The sensor is ALWAYS receiving data. The sensor may keep reporting the same value for long periods of time, but it is ALWAYS alert to changes in its environment. So, it never stops receiving data.
If you want to go to sleep when the sensor has reported the same value for 3 minutes, you need to keep track of when changes to the sensor's output change, so you can determine if the last change was 3 minutes ago.
Then as soon as the sesnor recives data the board must be powered up.
As I said, the sensor is ALWAYS receiving data when it is powered.
There are some internal and external events that can wake the Arduino.
There are levels of sleep with corresponding reductions in power consumption. You need to choose the sleep level based on how much power you are trying to save AND on what internal and external events that might happen can wake the Arduino.
How you make it?
With a lot of research and hard work and testing.
Why would you put the MCU on a NANO to sleep? If it is in order to save energy, other components on the board continues to gobble up energy even if the MCU is sleeping - so in that regard it make little sense..
If it is in order to save energy, other components on the board continues to gobble up energy even if the MCU is sleeping - so in that regard it make little sense..
Whether other components on the board continue to draw power depends on whether you have turned them off before sleeping, or not. It is possible to put the board to sleep in very low power mode.
The presence of a hall effect sensor, usually used with rotating components, suggests that something is moving, which suggests that there my be power nearby. But, OP has provided precious few details.
OK so the thing would be. I need the Arduino to be in sleep mode and as soon as the sensor gives different value, the Arduino must be awake
pep_moyanofont03:
OK so the thing would be. I need the Arduino to be in sleep mode and as soon as the sensor gives different value, the Arduino must be awake
What does that statement add to your original post?
You have NOT provided any new information. Pin 2 is an external interrupt pin, so, if you attach an interrupt handler to the pin, the hall effect sensor can wake the Arduino when it is sleeping.