-->
Page 1 of 2

Wemos D1 Mini + BJT Unstable

PostPosted: Mon Dec 17, 2018 11:47 pm
by zouje
Hi,

I am using a Wemos D1 Mini (Cheap clone) to control a 5V Songle relay. I have pin D4 set as an output and it is connected to the Base of a 2N3903 NPN BJT, through a 1KOhm resistor. The Emitter of the BJT is connected to ground, and the Collector is connected to +5V through a Songle relay coil (I measured 70Ohms for the coil). I also have a flyback diode across the relay coil.

When I RESET the Wemos board, even without commanding the D4 output, the D4 pin, as well as the 3.3V pin oscillate between 0 and 3.3V. This happens also if I keep the Collector unconnected to anything.

Does anyone have an idea about what the problem might be? I did some tests on the side, and with this setup, the BJT should consume about 2.5mA at the base (3.3V through 1KOhm resistor to the base). So even though I am using a cheap Wemos with a crappy 3.3V regulator, 2.5mA *should be* low enough not to cause any trouble.

Any help would be appreciated!

zouje.

Re: Wemos D1 Mini + BJT Unstable

PostPosted: Wed Dec 19, 2018 5:19 am
by schufti
D4 == gpio2 and this (as is D3 == gpio0) is known to oscillate during boot.

Re: Wemos D1 Mini + BJT Unstable

PostPosted: Wed Dec 19, 2018 6:12 am
by zouje
schufti wrote:D4 == gpio2 and this (as is D3 == gpio0) is known to oscillate during boot.


Hi schufti, thanks for your reply! I will try with other pins. However, the oscillations are sustained, ie. it keeps oscillating until I disconnect the BJT and RESET again. Fingers crossed!

Thanks

Re: Wemos D1 Mini + BJT Unstable

PostPosted: Wed Dec 19, 2018 10:59 am
by rudy
GPIO0 and GPIO2 must be high in order to run from the user code in flash. If either of those lines are low the ESP8266 will not work as expected. The load to ground can screw up the boot.

Also, this will explain the unexpected operation of the port pins. https://www.mjt.me.uk/posts/esp8266-gpi ... and-reset/