0
\$\begingroup\$

I have designed an extension board for the Wemos D1 Mini module, where I wish to expand to 4 available UARTs to interface with other sensors/modules. Debug is carried out by UART1 pins. For UART expansion I am using the CD4052 multiplexer powered by 3.3v. RX0 (RX pin) and TX0 (TX pin) of the ESP8266 are connected directly to the X COM and Y COM pins of the CD4052 IC. Select lines are driven by the ESP8266. Currently I am testing only for a single channel. I am able to transmit fine (see purple line in the pic, measured at the external sensor's Rx). I am also receiving some signals as verified by an oscilloscope (yellow line, with probe at ESP8266's RX pin), but the RX line does not drop to 0. The lowest it goes is to 2.8V while the high remains at 3.5V. So it is not registered in the Wemos as a digital signal. Oscilloscope trace.

I suspect the following reason: The internal resistance of the CD4052 is about 200+ ohms. The ESP8266 Rx pin is pulled by a strong pullup (i am not sure how many ohms), and thus the incoming Tx signal from the external sensor is not able to drive low the RX pin. The CD4052 datasheet says that the current transfer ability is in micro amps for each channel. My question is, is this the possible reason?

And if yes, what can I do about it? I have also tried to disable the internal pullup by writing "pinMode(RX, INPUT)" after the "Serial.begin()" command, but it doesn't seem to work.

\$\endgroup\$
2
  • \$\begingroup\$ Please supply a situational photo/schematic \$\endgroup\$
    – RemyHx
    Dec 2, 2022 at 5:24
  • \$\begingroup\$ The Wemos D1 Mini schematics are freely available. It looks like the RX line of UART0 is directly connected to the output of the CH340 USB to TTL converter. You could assign alternative pins (pins 13 and 15) to UART0 RX and TX. If you're using the Arduino platform, this is done by performing Serial.swap(). \$\endgroup\$
    – StarCat
    Dec 2, 2022 at 7:11

3 Answers 3

3
\$\begingroup\$

The Wemos D1 Mini schematics are freely available.

It looks like in the Wemos D1 Mini, the RX line of UART0 is directly connected to the output of the CH340C USB to TTL converter and this would interfere with any other outputs connected to the same pin.

A solution would be to assign alternative pins (pins 13 and 15) to UART0 RX and TX. If you're using the Arduino platform, this is done by performing Serial.swap().

\$\endgroup\$
1
  • \$\begingroup\$ Thanks a ton. This is the correct answer for me. I also found a similar answer in another forum: github.com/probonopd/WirelessPrinting/issues/… Since i can't modify the hardware now (I was not aware of the issue when i designed it), I have made a bypass to the connecting resistor, via a jumper. Will update another answer via some photos. \$\endgroup\$ Dec 2, 2022 at 8:01
2
\$\begingroup\$

Thanks to StarCat's direction, there are 2 ways to do it. One is to swap the pins UART to D7/D8 pins. But since I have already made the hardware custom PCB, i can't do this. The other way is to make a modification to the Wemos D1 Mini hardware which kind of solves the problem. The mod is to disconnect the connecting 150 ohm resistor from the RX of ESP8266 to the TX of CH340 (or equivalent) and instead connecting them via a jumper. When I have to program the Wemos, i add a jumper and its programmable. Else I can use it as a regular UART. Verified it on oscilloscope too. For next version of my hardware I will incorporate @StarCat's suggestion to use swap of pins. Wish i knew about this issue earlier. Image of Modification of Wemos D1 Mini ESP8266 RX <-> TX of CH340 IC via jumper

\$\endgroup\$
2
  • 1
    \$\begingroup\$ you missed in StarCats answer the part about swapping the UART to D7/D8 pins? \$\endgroup\$
    – Juraj
    Dec 3, 2022 at 9:29
  • \$\begingroup\$ Got it. edited and updated \$\endgroup\$ Dec 4, 2022 at 17:43
0
\$\begingroup\$

The uart_swap() method proposed by @StarCat is the standard solution. That is the original design rationale of the two alternative pins for ESP8266. However, this will use up 2 extra pins on the board, and while swapped, ESP8266 cannot communicate to PC via UART, you need to swap back before doing that.

Based on @Subir's solution, instead of changing the 150-ohm resistor to a jumper, you can consider changing the resistor to some larger resistance (above 1k ohm, depending on the TX signal strength of your external module, you need to try and error). In that way, ESP8266 can receive UART from both PC and external module without the need of port swapping, also freeing up the 2 ports for other purposes.

Furthermore, there is a DIY trick on increasing the resistance of an SMD resistor without soldering or buying a replacement resistor. An SMD resistor has a blackish resistive layer pasting on top through which electrical current flows. You can use a knife or scissor tip to scratch that layer to increase its resistance. For example, to double the resistance, you can half the cross-section area of the top layer, and so on.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.