How to use level shifters
|We have seen how to connect nodemcu and arduino in this post. In that post I just mentioned that we should use a level shifter when connecting two signals that work at different voltage. When connecting a nodemcu with arduino uno we need a level shifter because arduino works as 5v and nodemcu works at 3v3 (at least in case of UART communication nodemcu is working without any level shifter,but it is better to use one).
Level Shifters
There are two types of level shifters
Bi-Directional and Uni-Directional , it is better to buy a bi directional one, so you can use for both I2C and UART communications.
This level shifter has four channels , means you can convert four signals from Higher voltage to lower voltage and vice-versa. In our case we just need two channels. Generally level shifters will have HV (high voltage) side and low voltage side.
we need connect 3v3 from nodemcu to LV, and gnd of nodemcu to gnd on LV side of the level shifter. on HV side connect arduino 5v to the HV pin, arduino gnd to gnd pin on HV side.
The above picture shows how to connect nodemcu and arduino uno to have them communicate using UART. On arduino side, the Tx, Rx can softserial as well.
If you want to know more about level shifters, Sparkfun has a grate article about level shifter .