I am trying to read two gas sensors (MQ4 for methane and MQ7 for carbon monoxide) with my NodeMCU ESP8266. Both sensors require 5v (for the heaters) and have 4 pins (GND, VCC, DO, AO). Digital outputs are HIGH when a threshold is exceeded (adjustable on the breakout board). In order to read analog outputs, I am using MCP3008 10 bit ADC, which works with higher accuracy at 5V. ESP8266 is however 3.3V.
I am using 8-channel bi-directional level shifter to communicate with MCP3008. MCP3008 and sensors are connected to Vin and GND on NodeMCU ESP8266 board, which provides 5V.
Level shifter is also connected to 5V on HV side and 3.3V on LV side. Level shifter works fine for digital outputs of sensors. But when it comes to SPI between MCP3008 and NodeMCU ESP8266, I always read high values (1023). When I get rid of the level shifter and power MCP3008 with 3.3V with a potentiometer, I can read values between 0-1023. Also the sensors output analog values between 0-5V (tested with lighter gas and multimeter). So there must be a problem between level shifter and SPI communication.
On the software side, I tried to do the communication manually, with SPI.h and Adafruit_MCP3008.h libraries. They work fine, when I remove level shifter and operate MCP3008 with 3.3V.
I was wondering, what the problem might be? I don't have an oscillator and it is my first "real" electronics project. Excuse my lack of jargon... Thanks!
EDIT: I use this level shifter: https://www.amazon.de/gp/product/B01FRQUQCS/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1