Driving LED directly with microprocessor?

Imagine you wanted an LED light to turn on when you open one of your cabinets…that would light just the contents of that cabinet…with a very small strip of LED lights…like 5 or 10 individual leds.

Is it possible to use a wemos d1 or other esp8266 device to not only control on/off, but power the lights as well from the 5V USB plug attached to the D1 Mini?

I would normally use a 12V power adapter to provide juice to the LED and the D1 (stepping down the power) then run data to the LED…but…

in this case, I’m using non addressable white LED’s with only a + and - connection.

You need an average of 150mA with spikes of 500mA to run the D1 mini.

You need (a minimum) of 20mA per LED at 5V. So 200mA for 10 LEDs.

So a 1Amp 5V plug pack should be fine. With this low a current to the LEDs you will only need to feed it from one end.

To switch the power on and off to the LEDs you will require a power transistor or MOSFET as the individual GPIOs are only capable of supplying 12mA.