Problem using multiplexer with NodeMCU v3 and Blynk

Hello there,

i have some issues using multiplexer 74HC4067 on my Node MCU V3 board, when im not using Blynk - everything’s fine. However when i try to use Blynk there are some reading sensors issues. MCU only has one analog input and i have 2 analog sensors(pH meter and resistance water level sensor)so im trying to implement multiplexer. I can’t understand why everything’s fine when im not using Blynk libraries, but when i try - there are reading issues. For example - when i try to read from pin C0 of the multiplexer, sensor is not reacting at all, when i try to read from pin C8 - everythings works perfectly, but on pin C9 there are data readings but they are some interrputs, for example value drops from 350 to 4 on it’s own, even though sensor is in the water. Any ideas what is the issue and how to fix it? For now im only trying to read sensor data from water level sensor using Blynk, after i fix that im going to try to implement pH sensor as well. I’m attaching wiring of the multiplexer(both nodeMCU and multiplexer are powered up by an external 5V power source, all GNDs are connected)and here is my code(in this example it’s for pin C0 of the multiplexer):


#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

int resistance;

BlynkTimer timer;

void multiplexer()

   digitalWrite(D0,LOW); digitalWrite(D1,LOW); digitalWrite(D2,LOW); digitalWrite(D3,LOW);
   resistance = analogRead(A0);

   Blynk.virtualWrite(V0, resistance);  

void setup()
  pinMode(A0, INPUT);
  timer.setInterval(1000L, multiplexer);

void loop() {;;


@mythical_snake please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:


I’ve edited my post, thanks for showing me how to upload code correctly, i wasn’t sure how to do that as I’m a new user here. Nonentheless, do you have any ideas why it might be not working on Blynk? I’d really appreciate any leads. I’ve seen some youtube tutorial videos on using multiplexer with nodeMCU and blynk where they use exact same pins(D0, D1, D2, D3)and everything seems to work just fine, i have no idea what could be the problem.

I’d suggest that you read this:

especially the section called “Defining your physical switch and LED”.

You will then realise that the Edgent sketch is using pins that you are also using for your multiplexer.


I see, everything makes a lot more sense now, thank you very much! First of all I did not uncomment my selected board, and when i did i simply changed pins corresponding to flash button and led indicator to other unused pins in setthings.h - and now multiplexer is working smoothly. Thanks again!

1 Like

Good, glad the guide worked for you and that it’s all working now.