Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266 I/O 5V restistant #10

Open
HenkeGoransson opened this issue May 12, 2021 · 11 comments
Open

ESP8266 I/O 5V restistant #10

HenkeGoransson opened this issue May 12, 2021 · 11 comments

Comments

@HenkeGoransson
Copy link

is the NPN-transistor really needed?
Shouldn't it be possible to connect TX directly to RX without level shifting?
Would make the entire wireing alot easier.

@bortek
Copy link
Contributor

bortek commented May 14, 2021

I am not sure if you can run w/o it. Why dont you remove it and test without it?

@Anteus
Copy link
Contributor

Anteus commented May 14, 2021

Searched a bit on that too. And some report it is fine and some say it's speced at 3.3V and might fry the microcontroller but still reported it working with 5V for an extended period. But might decrease lifespan of it.

@HenkeGoransson
Copy link
Author

I have a Wemos mini D1 which I plan to test this on. Can get back to you when i've tested.

@weigu1
Copy link

weigu1 commented Jul 22, 2021

Hi,
Normally Rx is open collector. So if you use a pull-up (10k) to 3.3V, you have only 3.3V. The serial signal is inverted, but the newer core software of the ESPs is capable to invert the signal!

Serial.begin(115200, SERIAL_8N1, SERIAL_FULL, 1, true); // true inverts the signal

You find the circuit on:
http://weigu.lu/microcontroller/smartyReader_P1/index.html

@jdrozdnovak
Copy link

Hello,
Were you successful with removing the NPN?

@HenkeGoransson
Copy link
Author

The D1 can handle 5v but it needs the invertion.
Haven't tried what weigu1 mentioned that you can initialize it with inverted function.

@jagheterfredrik
Copy link

I tried with an ESP32, it worked fine with inverting there instead of using the NPN. I tried using the internal pullup resistor but I don’t think it’s large enough so I added a 10k resistor to 3.3V. I did have to use additional capacitors (2x10uF) to get the ESP32 to power correctly.

If the ESP8266 can power fine without additional caps, I think all you need is a 10k resistor.

@robinelfving
Copy link

robinelfving commented Sep 18, 2022

Does this mean that i can connect D1 like this:

5V and RTS to 5V.
Data GND and GND to GND.
TX to RX and invert the pin in code.

In other words exclude the voltage divider and NPN-transistor?

@jagheterfredrik
Copy link

No transistor nor divider needed. Pullup resistor and a capacitor (if the energy meter doesn’t supply enough current)

@robinelfving
Copy link

Thank you Fredrik!

@Anteus
Copy link
Contributor

Anteus commented Nov 11, 2022

For those who want to do the same to invert the pin in software just change uart to below. Might need to change GPIO ports if not on NodeMCU ESP8266.

logger:
  level: INFO

uart:
  id: uart_bus
  rx_pin:
    number: RX
    inverted: true
  baud_rate: 115200
  rx_buffer_size: 1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants