(SOLVED) Sparkfun Thing Dev (ESP8266) only works when USB connected to PC

The Sparkfun Thing Dev works fine with Blynk as long it is connected to PC (right after upload or when just reconnecting to pc). If using any other power source afterwards than PC, eg the usb charger output, battery 5v on VIN etc, it does not seem to start up and no connection to Blynk app. As mentioned, if I just reconnect the USB to the PC (no new upload), it works again (connects to app). I am using the joystick controller merged (0-1023 both axis) to V1 to control two motors using an additional motor control hw (TB6612FNG).

Here is the code:

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "myauth";

// Your WiFi credentials.
// Set password to "" for open networks.

char ssid[] = "wifinetwork";
char pass[] = "wifipassword";

#define AIN1 12
#define BIN1 13
#define AIN2 16
#define BIN2 4
#define PWMA 15
#define PWMB 0
#define STBY 1

#define PWM_MAX 1024
#define PWM_MID ((PWM_MAX + 1) / 2)

#define LEFT 0
#define RIGHT 5

  int x = param[0].asInt();
  int y = param[1].asInt();
  bool forward = true;

  if(y > PWM_MID) {
    digitalWrite(13, HIGH);
    digitalWrite(4, LOW);
  else if(y < PWM_MID) {
    digitalWrite(4, HIGH);
    digitalWrite(13, LOW);
    forward = false;
  else {
     digitalWrite(4, LOW);
     digitalWrite(13, LOW);

  int speedL, speedR;

  if(forward) {
    speedL = speedR = y;
  else {
    speedL = speedR = PWM_MAX - y;

  if(x > PWM_MID) {
      speedR -= (x - PWM_MID); 
  else if(x < PWM_MID) {
     speedL -= (PWM_MID - x); 
  analogWrite(LEFT, speedL);
  analogWrite(RIGHT, speedR);  

void setup() {
  Blynk.begin(auth, ssid, pass);
 // Serial.println("test print");
  // Setup all of our pins 
  pinMode(AIN1, OUTPUT); digitalWrite(AIN1, LOW);
  pinMode(AIN2, OUTPUT); digitalWrite(AIN2, LOW);
  pinMode(BIN2, OUTPUT); digitalWrite(BIN2, LOW);
  pinMode(BIN1, OUTPUT); digitalWrite(BIN1, LOW);
  pinMode(PWMA, OUTPUT); 
  pinMode(PWMB, OUTPUT); 

void loop() {

Now I see that there is an example with BLYNK and joystick, it uses another library:

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

void setup() {
    Blynk.begin(auth); // does not use ssid, pass as I did

I will try if this helps in the afternoon.

make sure that you do not use the tx, rx pins, this also can produce similar behaviour.

Thanks for the suggestion @wanek, but the RX/TX pins are left unconnected.

Regarding the two ways to connect to blynk:

  • Blynk.begin(auth, ssid, pass);
  • Blynk.begin(auth);

The latter resulted in this serial output:
[262] Getting IP…
[564] DHCP Failed!

I see now that the example I came over is for Ethernet, not Wifi. So this method will not have access to internet since it is not going through the local wifi, so that is not solving the issue. My dev board does not have an ethernet port, so this was a bad idea.

Going back to the main issue, what could it be?

your sketch is very simple, i do not think that is the problem.
this is why i insist on the pins:

  • remove all wiring from the pins -> check if the problem persist

  • comment out all the pin configurations -> check if the problem persist

i see that the rx tx are free. but i also see that you are using 0, 16, 15??? (can not find on the official pinout), 1??? also can not find…

look here: https://cdn.sparkfun.com/datasheets/Wireless/WiFi/ESP8266ThingV1.pdf

I am using ESP8266 Thing-Dev, its different, see here.

Pin 1 is not used as you see in the code, it is just defined. Pins 0, 16 and 15 are there and should be ok to use…? Anyway, everything work as long as the board is powered from PC.

If I disconnect everything and only run Blynk.begin the problem is not there, so this seems to be a bug in Blynk to me.

if you disconnect everything, without changing anything in your code, and it works, i think it is definitely not a blynk bug.

after you disconnected everything, try to plug back the cables step by step.
put one cable, and test if it works or not… i have a feeling that the problem is hardware related (wiring)

Blynk doesn’t even know what power source you use, so not likely a bug. However not enough power or wrong voltage, etc. will probably affect your WiFi transmitter on the board. You say you have tried those? Does the board show up in your router’s DHCP listing when externally powered? Can you ping it from another computer (assuming it responds to a ping wien USB powered in the first place).

You are of course right guys, it is a wiring issue.

I must have been really fast earlier on when testing with the usb charger output, because that does now work. So I found my multimeter and see that when running with USB/5V the 5V board output is 5V and the 3.3V output is 3.3V, but when running from battery (4.5V) the 5V board output is ~0V. I used 5V board output as VCC reference for the motor control, and that made the it all not work. Blynk rulez.

1 Like

hm, thats strange. it should pass through the 4.5 v to the 5v board, and you should have 3.3v also…

what battery you have? lithiums can not have 4.5v, max 4.25. did you check the battery with dmm?

I use stock 3xAA 1.5V batteries, if i had applied 4 of them I would never run into this, or if the 5V output had just forwarded the 4.5volts, yes, it is strange that it doesn’t forward it, but it looks like as designed since I only see a 3.3V linear regulator in the design, the schematics looks like missing out the 5V output pin. Anyway, this is not Blynk related and the case may be closed.

1 Like