ESP32 Thing + SparkFun Logic Level Converter = Cannot get them to work

Hey!

I have the [ESP32 Thing (3.3v) and a [Senseair S8 LP CO2 sensor (5v). I want to use the ESP32 Thing to both power and communicate (UART) with the sensor.

Now, the ESP32 Thing [hookup guide states: The ESP32’s operating voltage range is 2.2 to 3.6V. Under normal operation the ESP32 Thing will power the chip at 3.3V. The I/O pins are not 5V-tolerant! If you interface the board with 5V (or higher) components, you’ll need to do some level shifting.

Level shifting it is. Someone at the forum suggested buying the [SparkFun Logic Level Converter - Single Supply. I did exactly that, but unfortunately, I can only get part of it working. The power supply shifting from 3.3v to 5v works perfectly - the sensor lights up and is powered on. That being said, I cannot get the logic level shifting to work - I simply cannot communicate from Thing via UART to the sensor and back.

Can anyone please let me know what am I doing wrong here? Am I missing some connections? I am new to this so I am certain that I am making some errors here. What seemed wrong is that logic level (VCC) ground pins are empty - I do not know where to attach those.

Thanks,

johnbee

https://i.imgur.com/9LvhxEE.jpg](SparkFun Logic Level Converter - Single Supply - PRT-14765 - SparkFun Electronics)](ESP32 Thing Hookup Guide - SparkFun Learn)](https://senseair.com/products/size-counts/senseair-s8-lp/)](https://www.sparkfun.com/products/13907)

do not know this sensor, but i have run into similar issue with another sensor on the ESP32 It turned out that my sensor had level convertor on-board. Two level convertors after each other did not work. Here is what I did.

First : use VUSB from the ESP32 thing to power the sensor (that is ¬5V). NO need for level converter.

Second : Connect the ESP32 TX, sensor RX line. No need for a level converter.

Third: Make a voltage bridge for TX from the sensor. You need 2 resistors (R1 = 10K, R2 = 4K7) Connect the TX from the sensor to one end of the R2, connect the other end of R2 to ESP32 RX AND also to one end of R1. Finally connect the other end of R1 GND.

Thanks for the quick answer.

paulvha:
It turned out that my sensor had level convertor on-board. Two level convertors after each other did not work.

Is there any way to verify that this is the case with my Senseair S8 sensor? Is it mentioned somewhere at the [[Senseair S8 spec sheet](https://rmtplusstoragesenseair.blob.core.windows.net/docs/publicerat/PSP126.pdf)?

First : use VUSB from the ESP32 thing to power the sensor (that is ¬5V). NO need for level converter.

I did not mention this, but in the future the plan is to power the ESP32 Thing and everything attached to it from a 3.3v battery (since it has the built-in charging unit). Hence I will need to use the level converter.

Second : Connect the ESP32 TX, sensor RX line. No need for a level converter.

Alright. Are you basing this on the S8 spec sheet?

Third: Make a voltage bridge for TX from the sensor. You need 2 resistors (R1 = 10K, R2 = 4K7) Connect the TX from the sensor to one end of the R2, connect the other end of R2 to ESP32 RX AND also to one end of R1. Finally connect the other end of R1 GND.

Is there perhaps an off-the-shelf component that does this? I would much more prefer to buying.](https://rmtplusstoragesenseair.blob.core.windows.net/docs/publicerat/PSP126.pdf)

Hi

There is nothing in the specification that I could find. I looked for a schematic, but it was not there. However given that there is a DVCC_OUT voltage from the internal regulator on 3V3, makes me believe that the logic internal (as with many sensors) runs internal on 3V3. This is supported by the fact that they talk about internal pull-up resistors to DVCC_OUT. Maybe this even means that the in and output signals are already on 3V3. They specify GO ( go out 0.3V to DVCC_OUT + 0,5V. If you have oscilloscoop you could check.

The connection with a voltage bridge for a UART has worked for me all the time. The 3V3 signal is normally accepted as a 1. And lowering the TX from 5V to 3v3 with a voltage bridge always worked for me ( 5 /14.7K )* 10K => ~ 3.4V. That said in many tests I have done I have connected the UART TX/RX signal directly and my ESP32 is sitll alive.

Reading the converter hookup guide there is an important point. You are using the GND below the 3v3 connection, but it seems you should use the GND just above A1

VCCA Reference Ground
:zap: Warning: The reference GND that you choose can affect the serial data being sent depending on how far your device is from the rest of the ground plane. You may notice some data not being sent correctly between your devices (like some gibberish or garbage data on a serial UART). It is recommended to use the GND pin by the lower VCCA side above the A1-A4 pins when you are referencing ground on the low side.

As a last point… we assume it is hardware connection… but it could still be software. You need to select the right speed (9600 sems to be only supported by the S8) and then use the MODBUS protocol. Maybe the driver has debug capabilities and can tell you more.

I tried connecting ESP32 thing TX/RX directly to the RX/TX of Senseair S8 LP sensor and I can confirm that it works without the logic level converter. So the problem was related to the use of the logic level converter. Assuming that the Senseair S8 LP indeed has internal 3.3V logic (even though it is powered by 5V), then I still do not understand why the logic levels were not sent when hooked up via the logic converter.

If you identified the problem to be in the logic level converter then remove the sensor from the complexity. Only connect the level converter to the ESP32 and see if changing a pin on it on the 3.3v side results in a similar going pin on the high voltage-side. To simplify even further, you do not need to run code on the ESP32, just use it as a power source for the level converter. To test level conversion connect the data inputs of the level converter to GND or 3.3 volt of the ESP32, and check how voltages change on the high side.

Also check for conduction between the GND on the 3.3v power input to the GND of the data line. Similarly on the high voltage side. The way you have drawn it, and if a conduction path lacks between the GNDs then the data lines may be floating.

Thanks for the advice. I am certain that my SparkFun Logic Level Converter - Single Supply was simply defective. I reached out to Sparkfun support via email more than a week ago, but I have not heard back since. That is really not nice. In any case, I ordered a new SparkFun Logic Level Converter - Single Supply so I hope it will not be defective.