Esp8266 only works when Arduino is connected to a computer

Hi everyone,

I am working on a payment system using the Arduino Mega, RFID cards, and an esp8266 to send data to a server through an HTTP post request.

When I have the Arduino connected to my laptop, it works well, and the esp8266 connects to wifi and is able to send the data to the server.

However, when I unplug the USB cable, the esp8266 is no longer able to connect to wifi.

What am I doing wrong??

Kind regards and thank you in advance :),
Alex

Payment_system_-_without_sensitive_information.ino (17.7 KB)

How is the system powered when not connected to USB ?

Using a 9V dc adapter, like this one:

How is the 8266 powered ?

Going from the point of view that the ESP is powered through the Mega's 3.3v, i think that either the 3.3v regulator can not provide the power because it is now getting 9v as input voltage and needs to dissipate more heat, or the 5v regulator can not power the 3.3v regulator sufficiently. (i am just not quite sure how the regulators are connected and it varies per Mega (clone) board. Easiest solution is to either use a step down to 5v to power directly onto 5v Rail, or either use a 7805 TO-220 to power the 5v rail, or a 3.3v TO-220 regulator to power the 3.3v rail.

Thank you for your answers :slight_smile:

Could I simply power the Arduino using the USB cable??

Could I simply power the Arduino using the USB cable??

You have already said that it works when powered that way

Try powering it from a 'phone charger with a USB output instead of the laptop. It will not care (or know) where the 5V is coming from as long as the power source can supply enough current

Yep, that's what I meant :slight_smile: and it works!

alexoort:
Yep, that's what I meant :slight_smile: and it works!

Never mind, it still doesn't work. It is able to connect to wifi, but it can still not connect to the server.

Should I power the esp8266 externally using a 5V power supply??

Kind regards,
Alex

Try powering it from a 'phone charger with a USB output instead of the laptop.

those chargers rarely provide sufficient current, the ESP will need about 280mA (at times, particularly when connecting wifi) USB ports are rated to 500mA so should have enough to power both the Mega & the ESP.

Should I power the esp8266 externally using a 5V power supply??

Oh dear, no don't do that, the esp takes 3.3v, nothing more than that. Unless you have a 3.3v regulator available you really shouldn't try that. What you could try is use both chargers, one on the 'jack-plug' and one on the USB port, together they might actually be able to provide enough. other quick fix may be adding a sizable capacitor on the 3.3v volt rail.
The best is still to provide 3.3v to the ESP with a dedicated 3.3v regulator (as i mentioned before) take input straight from the 9v power supply, use a TO-220 package, add a capacitor on the 3.3v rail (1uF is enough), the regulator will probably warm up a bit, (stepping down from 9v) but an extra heatsink should not be required (though adding a bit of Alu to serve as such won't hurt)
The best is to step down in 2 steps first to 5v then to 3.3v.
Simplest would be to get a proper 5v power supply that provides at least 500mA and power the ESP through the Mega's 3.3v regulator (as you do when using the USB port)

those chargers rarely provide sufficient current, the ESP will need about 280mA (at times, particularly when connecting wifi) USB ports are rated to 500mA so should have enough to power both the Mega & the ESP.

With that in mind I deliberately said

It will not care (or know) where the 5V is coming from as long as the power source can supply enough current

However, I have a number of 'phone chargers that can apparently output up to 2 Amps but, of course, there are many variations and manufacturers have been known to be less that honest

Deva_Rishi:
What you could try is use both chargers, one on the 'jack-plug' and one on the USB port, together they might actually be able to provide enough.

Yes! Thank you, this worked :slight_smile:

alexoort:
Yes! Thank you, this worked :slight_smile:

Think of it as temporary solution.

I've powered my WeMOS esp8266 boards off of a DollarTree USB wall charger. A simple experiment might be to put a simple blink program on the board (if the board has an accessable LED), then plug it into the wall charger and see if the LED continues to blink.

I've powered my WeMOS esp8266 boards off of a DollarTree USB wall charge

a wemos has a 5v pin doesn't it ? i think he has an ESP-01 connected to a Mega. ESP-01 take nothing over 3.3v (ok 3.4 or 3.5 maybe)

You were right, it was a temporary solution :(, after a few trials it stopped working again.

Deva_Rishi:
Simplest would be to get a proper 5v power supply that provides at least 500mA and power the ESP through the Mega's 3.3v regulator (as you do when using the USB port)

I have a 5V/3.3V power module as well, like this one:

Can I use this to power the esp-01??

Kind regards,
Alex

Can I use this to power the esp-01??

Yes that should be OK, make sure the output you use is set 3.3v. I can how it is exactly wired, but there should be no harm in trying, in fact i think you probably can power both with that. (but start with just the ESP-01) Keep in mind that for the Mega & the ESP to communicate the need to have their GND-pins connected.
It would be good to know how that unit is actually connected, where does the ams1117 3.3v gets it's input power from etc. look at the pinout and while it's not connected to power, you can use a multimeter to find out.