0
\$\begingroup\$

Link to Logic Level Shifter: https://www.sparkfun.com/products/12009

I noticed that the output of my logic level shifter was extremely noisy. It appears that every channel is floating. Internally the outputs are pulled high by 10k's, and I have seen many examples online of no pulldowns used. I added these 4.7k (+LED) pulldowns to observe their effect, but the outputs are still floating. The HV side will connect to a motor encoder, which takes [3.5-20V], and the LV side will connect to an ESP32-S3 DevkitC, which has a tolerance of 3v3 on its IO pins.

I also initialized the encoder inputs as INPUT_PULLUP, but that did not work (nor did INPUT_PULLDOWN).

figure2. Connecting HV1 to 5v. All LEDs should be off except HV1 and LV1

figure 1. 3v3 on the LV side, 5v on the HV side. All LED's should be off, as no logic signal is applied to any pin, and 4.7k pulldowns exist at each pin.

\$\endgroup\$
5
  • \$\begingroup\$ First off, I think you need to do a better job soldering those headers into the board. In some cases I'm not sure anything much was done, at all. I don't think I should be able to see the gaps I believe I'm seeing. Next is that while you do describe in vague terms what's hooked to the HV and LV pins, I'd like you to be specific. I gather the LV pin is tied to a 3.3 V source. But what exactly is the HV pin tied to? And no, don't tell me about a motor. I hope it is a good voltage rail and that you will say what the voltage is (and that there's no motor being used while testing this board.) \$\endgroup\$ Commented Feb 3 at 18:51
  • \$\begingroup\$ Also, it looks to me as though you are tying an LED+resistor between ground and an LV3 pin, for example, and another LED+resistor between ground and the HV3 pin. And probably doing that for each side of each BSS138. Is that correct? \$\endgroup\$ Commented Feb 3 at 18:53
  • \$\begingroup\$ Yes thank you, I did not mention that HV is tied to a 5v supply; HV1&2 are connected to the encoderOUT pins of a motor encoder, which are at 5v. To test I'm just spinning the motor axle and observing pulses. Yes, in the attached photos I am attempting to pull down the outputs using a resistor+led \$\endgroup\$ Commented Feb 3 at 19:19
  • \$\begingroup\$ And yes the solder joints look bad from above, but from the side one can see they are fine; perfect cone shape \$\endgroup\$ Commented Feb 3 at 19:27
  • \$\begingroup\$ You have a lot of observations. What is it that you expect from a FET level shifter that does not fit your observations and why do you expect something else? What is the question you need help with, and what help? \$\endgroup\$
    – Justme
    Commented Feb 3 at 21:37

1 Answer 1

3
\$\begingroup\$

The bi-directional logic level shifter is not meant to drive load(s) on either or both sides. It is used for signaling or data communication between the low-side (LV) and the high-side (HV).

By connecting loads (each with a 4.7kΩ resistor and an LED) on both sides you get voltage dividers on LV and HV like the following example

enter image description here

Notice that LV is 2V and HV is 4.2V, which are calculable, and they are not floating. This is not how it is supposed to be used.

The voltage level shifter is only suitable for communicating devices that have open-drain output driver, meaning the connected devices should only pull (sink current) but not push (source current). Here is an example

enter image description here

The circuit uses switches in place of open-drain output drivers. By closing the switch (imitating sinking current to GND) on the LV side only, you will see the LV voltage drops to 0V and the HV will drop very close to 0V too. Similar effect will happen if you close the switch on the HV side only or both sides. Otherwise both sides will be pulled up to their respective power supply voltages (3.3V and 10V in this case like the figure above).

Internally the outputs are pulled high by 10k's, and I have seen many examples online of no pulldowns used.

Of course you can't find one because it is not meant to be used that way.

Edited Again

If your purpose is to send data from HV to LV and the transmitter's output driver is a push-pull type, you can use the Bi-directional Logic Level Shifter, provided that it must be a unidirectional communication.

Here is the circuit where the receiver is on the LV side and the transmitter is on the HV side.

enter image description here

You can push and pull by clicking on the SPDT switch on the HV side, imitating a push-pull output driver. I removed the pull-up resistor on the HV side because it is not needed (but no harm if it remains). I added a 100Ω resistor on the LV side to prevent voltage spikes from damaging the MCU's receiving pin when the transmitter switches between 0V and 10V. The transients are due to fast switching that get coupled from the HV side to the LV side through the MOSFET parasitic capacitance.

Here is the result

HV side (transmitter with push-pull output driver) LV side (receiver)
10V 3.3V
0V ~0V

Here is the circuit where the transmitter is on the LV side and the receiver is on the HV side.

enter image description here

There is no need for the 100Ω transient suppressing resistor because it will not do any harm to the circuit on the HV side.

Here is the result

LV side (transmitter with push-pull output driver) HV side (receiver)
3.3V 10V
0V ~0V
\$\endgroup\$
5
  • \$\begingroup\$ Thank you for the care you put into this response, now I understand why my setup was not working. I'll mark this as the answer as it has prompted me to forgo the LLS entirely and connect the motorEncoderOUT directly into the microcontroller, which I originally thought wouldnt work as the encoder specified minimum 3.5v, but the esp can read max 3.3. \$\endgroup\$ Commented Feb 4 at 0:58
  • \$\begingroup\$ If it is a unidirectional voltage level shifting from HV to LV, then the simplest and cheapest way is a voltage divider using 2 resistors. Another way is to use 74LVS1G17 single Schmitt trigger buffer. Feed it 3.3V power and it can convert 5V input to 3.3V output. 74LSV1Gxx is a 5V-tolerant logic device family. \$\endgroup\$
    – kaosad
    Commented Feb 4 at 1:35
  • \$\begingroup\$ Actually for your problem, you can use the Bi-directional Logic Level Shifter. See my edited answer. \$\endgroup\$
    – kaosad
    Commented Feb 4 at 2:04
  • \$\begingroup\$ Sorry, I'd made an incorrect statement in my previous answer, which I've rectified. Actually LV transmitter and HV receiver works too. The reason is that when LV is 3.3V, VGS = 0V and hence the transistor is OFF when the HV side is pulled up to 10V beyond 3.3V. I've added a simulation example. \$\endgroup\$
    – kaosad
    Commented Feb 4 at 13:41
  • 1
    \$\begingroup\$ @ThomasCoor You can't connect a 5V output to a 3.3V input directly. The 5V output can output minimum of 3.5V under some load out but it can be 5V. And the ESP can handle 3.3V max, in theory higher like 3.6V is the absolute maximum but your 5V output would try to push current out which the ESP32 would have to clamp to 3.6V so that is a lose-lose situation for both chips, it is bad design and it stresses both chips and can degrade or damage the chips. \$\endgroup\$
    – Justme
    Commented Feb 4 at 13:44

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.