arduino uno wifi rev2 sleep (lower power consumption)

Hi,

I'm working on a project for my home office. I have an arduino uno wifi ref 2 that is connected to a LED strip, a button and a capacitatorpotentiometer. The button is used to turn the lights on/off and change color. The potentiometer is used to change the brightness. The project is also connected to a google nest using mqtt and wifi (but thats unimportant here).

The goal of the project is to keep it always running, but of course the light can be turned on or off. My question is how do i reduce power usage when the light are turned off?

If i just put the digital output on the pins that are used by the leds strip to LOW will this make sure no power is used by the leds? I read online about the sleep function and then using a button to power the arduino back up again. How would this work (code example please, because i can't find one online)? And would this be the best way to go?

EDIT: the question about the leds turning off has been answered, does anyone have more information about the use of the sleep function with the arduino uno wifi rev2 specific?

Thanks in advanced,
Arno

internetofthings2018:
The capacitator is used to change the brightness

Really? I would like to see a diagram showing how you accomplished that.

Whoops, i meant a potentiometer. Very new to arduino and electrical circuits.

Thanks for the heads up.
Any idea about my question of turning off the arduino/leds?

What kind of led strip? NeoPixels or something else. In case of ordinary led strips, writing a LOW or HIGH depending on the way they are wired will indeed switch them of.

For NeoPixels, just set every led to black.

Search the web for Arduino sleep or Arduino low power, maybe in combination with the name Nick Gammon.

With the Arduino that you use, the saving might not be that great; you will also have to try to reduce the power consumption of the WiFi part.

Hi,

They are some off-brand led strips.
Is turning the leds to low with digitaloutput the same as putting an analogwrite to 0? Or is there a diffrence in power consumption?

I will try searching some more about the sleep mode but couldn't find any example for the arduino uno wifi ref 2. Will try asking that question in the arduino uno wifi ref 2 topic.

Thanks for the reply

internetofthings2018:
Is turning the leds to low with digitaloutput the same as putting an analogwrite to 0? Or is there a diffrence in power consumption?

This is the analogWrite function; as you can see, for the values 0 and 255, it does a digitalWrite. So there is no difference.

void analogWrite(uint8_t pin, int val)
{
    pinMode(pin, OUTPUT);
    if (val == 0)
    {
        digitalWrite(pin, LOW);
    }
    else if (val == 255)
    {
        digitalWrite(pin, HIGH);
    }
    else
    {
      ...
      ...
    }
}

You can find the function in C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\wiring_analog.c; adjust to your needs for other operating systems.

sterretje:
For NeoPixels, just set every led to black.

Just keep in mind that they draw 1 mA per LED when dark. :roll_eyes:

Okay thanks for the clarification. Thats half of my question answered :smiley:

I will ask to move this post to the arduino wifi rev2 topic for my 2nd question about sleep.