ESP8266

i looked at the example here:

it is working, but i found a very strange thing happening - the Wifi module responds ok only if its VCC/GND pins connected to 5v and GND of the USB to UART adapter.

if i try a different power source (batteries/other power outlet) i get strange output text from it.

i compared the voltages/amp of the USB and my other sources and made sure they are the same and still - with USB as power sources output of WIFI in serial monitor is ok while with other it isn't.

why is that?

second issue i'm now having is not being able to upload code it even though using it from the serial monitor with AT commands works fine.

this is the output i'm getting when trying to upload this (empty) sketch:


void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
}


output:

Sketch uses 26,726 bytes (13%) of program storage space. Maximum is 200,000 bytes.
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm_sync failed
error: espcomm_open failed