[SOLVED] General question regarding GPIOs of Wemos D1 mini

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
upymar
Posts: 18
Joined: Sat Feb 04, 2017 7:47 am

[SOLVED] General question regarding GPIOs of Wemos D1 mini

Post by upymar » Wed Apr 29, 2020 3:09 pm

Hello community,

I've connected a Wemos D1 mini running micropython v1.12 on a breadboard with a rgb led.
G (GND) with the cathode of the led. D1,D2,D3 over a resistor to the connectors of r,g,b.

When supplying power by connecting the MicroUSB port the led glows slightly red. But without any code executed.

When defining the GPIOs with

Code: Select all

red = machine.Pin(0, machine.Pin.OUT, value=0) #D3
green = machine.Pin(4, machine.Pin.OUT, value=0) #D2
blue = machine.Pin(5, machine.Pin.OUT, value=0) #D1
the led is turned off like expected. red.on() and red.off() and so on for the other colors works as expected.

When executing machine.deepsleep() the led glows slightly red again.

Why is there a flowing current before executing any code and in deepsleep mode?
Last edited by upymar on Mon May 04, 2020 8:32 am, edited 1 time in total.

Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: General question regarding GPIOs of Wemos D1 mini

Post by Christian Walther » Wed Apr 29, 2020 8:52 pm

D3 is GPIO 0 which is one of the bootstrapping pins of the ESP8266. It must be pulled high in order to boot from flash rather than from the internal bootloader. On the D1 Mini, according to the schematic, that is achieved by a 12 kΩ resistor to +3V3 (R10, right center). That’s where your LED current goes through. Once you configure GPIO 0 as an output with value 0, it shorts the LED and it goes off.

You shouldn’t use GPIOs 0, 2, 15 (D3, D4, D8) as outputs if the pull-up/down resistors on the board interfere with your use.

upymar
Posts: 18
Joined: Sat Feb 04, 2017 7:47 am

Re: General question regarding GPIOs of Wemos D1 mini

Post by upymar » Mon May 04, 2020 8:30 am

Thank you,

this solved my problem.

Kind regards

Martin

kwiley
Posts: 140
Joined: Wed May 16, 2018 5:53 pm
Contact:

Re: [SOLVED] General question regarding GPIOs of Wemos D1 mini

Post by kwiley » Tue May 19, 2020 3:06 pm

Unrelatedly, I see you are using a D1 mini and you are using deep sleep. Does your D1 mini wake properly with a timer alarm (not a pushbutton or sensor interrupt)? If so, what D1 mini version is it and where did you get it? Thanks.

Post Reply