So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By DR2000
#93289 Hi! I'm currently trying to learn to use the esp 8266 connected to BLYNK for a competition, but I'm unable to use the digital pins to power anything. I'm using a ESP8266 12-E NodeMCU Kit. I tried connecting the pins to a voltmeter and it shows that there is enough volts. I am also able to turn the on board LED on and off using BLYNK. Here is my code.
Code: Select all// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLqKhQ3hsc"
#define BLYNK_DEVICE_NAME "NodeMCU"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

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

#include "BlynkEdgent.h"

BLYNK_WRITE(V0)
{
  if(param.asInt()==1){
    digitalWrite(5, HIGH);
  }
  else{
    digitalWrite(5,LOW);
  }
}

BLYNK_CONNECTED()
{
  Blynk.syncVirtual(V0);
}
void setup()
{
  pinMode(5, OUTPUT);
  Serial.begin(9600);
  delay(100);

  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
}


Here is a photo of the circuit.
Image

Sometimes it will turn on and off without orders from the BLYNK app, sometimes it will work but it rarely does consistently.


SOLVED: there was problem with the motor apparently and the d2 pin
User avatar
By pratheek
#93333 Congrats you got it working.

You have debugged the problem using a multimeter and got the right readings for voltage. Make sure the motor that you are using draws less current than what the nodemcu pins can supply(Sink: 20ma, Source~10ma). If not you will damage the NodeMCU.

You can put a Mosfet/Transistor or a Motor Driver to drive the Motor to be safe.