Wemos D1 R2 not working on PCB

I'm making a PCB for automatic dispenser and use Wemos D1 R2 as the microcontroller. The microcontroller works fine with the code and if I supply 12V to the microcontroller first then put it on the PCB they work fine too. But if I put the microcontroller on the PCB first then supply 12V to them, the don't work. What's happening? Why they couldn't work?
Is there any way to make them work without modifying my PCB?

Please anyone help me

What PCB?

We know nothing about this PCB, nothing about your code, and nothing about how you have the Wemos setup when it's off this mystery PCB - so impossible to say what's going on!

What investigation/testing/debugging have you done?

You say the Wemos works off the board: so take measurements in the "working" state, and corresponding measurement in the "non-working" state (on the PCB) - compare & contrast ...

What's this all about, "12V"?

This one says it'll take 24V:

The PCB consist relay module. The code only consist digitalwrite high and low for pin D3 and nothing else.
Without PCB, the microcontroller works fine, then while it's on and working, I put the microcontroller on the PCB and they work fine too (state 1).
But, if I put the microcontroller while it's off to the PCB and turning on both of them together, they won't work (state 2).

In state 1, pin D3 could go around 3.3V for HIGH and around 0V for LOW

In state 2, pin D3 only staying at 1,...V and not going HIGH or LOW

How to make they work even in state 2?

The PCB schematic looks like this:
https://www.electronics-tutorials.ws/wp-content/uploads/2014/04/switch1.gif?fit=273%2C245?fit=273,226

Post some good clear photos of your setup - with & without the PCB.

Where is this 12V coming from?

The PCB:


Microcontroller with PCB:

Microcontroller without PCB:

Steps to make them work together (state 1):


Unplugged microcontroller


Plugged microcontroller


Plugged microcontroller on PCB

These steps won't work (state 2):


Unplugged microcontroller on PCB


Plugged microcontroller on PCB

How to make state 2 works?

Maybe there's some "interference" with the boot pins. If they're pulled-down at boot then it's stuffed.
That would explain why it would be ok if powered and then mated to the relay board.

image

Remove the 10k resistors, I'd say, and it will likely come right.
The boot pins are D0, 3, 4, 8, rx, tx (a.k.a. GPIO 0, 2, 15, 3, 1)

PE ─ After further consideration - the transistor (B-E) will still "pull down" a boot pin too.
Which outputs have relay circuits? Post Your Code.

1 Like

I haven't make the complete code for all components. But for the outputs are D3- D7

And D3 and D4 are boot pins.
Try removing the 1k resistor on the "D3" and "D4" circuits.

In this case, how is power being supplied to the relay PCB?

That's just one channel (one relay) - please show the full schematic for the complete board.
And/or a link to its details/specifications.

ADDED:

image

So what is that "+Vcc" supposed to be?
Is it supposed to be 12V from the barrel jack on the bottom PCB ... ? :thinking:

This is why we need to see the full schematic for the complete relay board.

ADDED 2:
image
or, perhaps, it's intended that you supply 12V there, and the relay board powers the Arduino? :thinking:

Again, full schematic would clarify.

Looks like the 12V are definitly missing :slight_smile:
Wonder why people do electronic projects without a voltmeter to check stuff.

You must have something - post that!

Alias for GPIO 0 & 2, so yes, they can not be pulled LOW at boot or the ESP will go into an alternate boot mode. and the transistor pulls them LOW.
Basically those pins are not suitable to drive an NPN transistor.

RX is not a boot pin, it can be pulled LOW or HIGH at boot without issue D8 / GPIO 15 should not be pulled HIGH.

Go for the end of the resistor that goes to the GPIO pin, so you could connect that end to a different pin to make it work.

I suspect through the VIN pin, but without the full schematic this is guess work.

2 Likes

@hocrux17
It will never work!
As @runaway_pancake pointed out you have boot pin conflicts.

D2 and D3 have 10K pull-ups on the WEMOS-D1 board and D8 has a 10K pull-down.
You have D2 and D3 connected to a 1K and 10K to ground and D8 connected to a pullup to 5V, that will keep the WEMOS-D1 from booting.

You need to redesign your relay board.

2 Likes

That would explain why it works if power is applied to the Wemos (ie, the Wemos is booted) before it's plugged into the PCB!

Design a board to go between the two that has a PCF8574 (I2C I/O expander).
D1, D2 are there and waiting.
An opportunity to free the 8266ers from the boot pin curse.

It's a trap, not really a curse. Actually just a simple TTL buffer or inverter is fine.
Other issue is that some pins go HIGH momentarily during Boot as well, which can be seriously disturbing.

Your suggestion is almost right. The 1k isn't really the problem, but maybe it's affected by them too. But, the real problem is the D8 pin.

You said that "The boot pins are D0, 3, 4, 8, rx, tx (a.k.a. GPIO 0, 2, 15, 3, 1)
PE ─ After further consideration - the transistor (B-E) will still "pull down" a boot pin too.
Which outputs have relay circuits? Post Your Code."

D8 isn't output and I make it as an input for DS18B20. I connect the D8 with 5V through 4.7k ohm resistor and that's the problem.

I tried your suggestion to remove the 10k ohm from D3 and D4 but it still won't work. Then I tried to remove the 4.7k ohm from D8 like I said before. Then it works.

But now I'm confused to put my DS18B20 to which pin as input pin. Do you have any suggestion?

The jack on PCB connects to VIN of microcontroller. This means plugging through the microcontroller jack or plugging through the PCB's jack are the same things. Well there's no difference that occurred.

Both jack could power PCB and the Arduino.