Downloading 1GB of data with MicroPython ESP8266 port

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by pfalcon » Sun Nov 13, 2016 9:53 am

I have attached the schematics of Wemos D1 mini, which I found on the net, just for interest.
It shows a voltage divider between the module's A0 pin and the ESP module's analog input, meaning that the DC range on A0 is 3.3 V,
This is offtopic on this thread, please open a separate one (as it's indeed important information, if confirmed).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by Roberthh » Mon Nov 14, 2016 11:14 am

Sorry @pfalcon, I did not see your first posts until I was puzzled over jms's post.
USB plug gets warm - how do you know, tell us how you found that out. And I'd like to say that I would personally consider the only "scientific" method is to look at the entire board via infrared camera (imager). Also, did you measure power consumption of the board when this happens?
Well, I've simply use my finger. That might not be 'scientific', but for that moment that was sufficient information. A USB plug must not get substantially warmer than the environement. It even heated up the connector at the cable. If it does, it's a problem, and it does not leave sufficient voltage swing for the regulator, which was cool b.t.w., like the other parts on the board, except the ESP module. I do not have an IR camera at hand, but I can get a good wirde or IR temp sensor, if you're interested. But doing a quality anaylsis of the Wemos board was not my interest at this moment.

Just as a side note: The device hard wired to 5V, which was pretty unstable when supplied through USB, reached 8 GB this morning. If we agree that this is sufficiently much, I can re-start it w/o the gc.collect().

@jms: yes. I could solder a large capacitor to the board to buffer short voltage drops. Since the supply path goes from the USB plug through a diode in to the regulator, which is also connected to the 5V pin, I can attach it there, comfortably at a 0.1 inch pitch.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by pythoncoder » Mon Nov 14, 2016 11:24 am

@Roberthh Very useful information, thanks.

@pfalcon While the temperature rise is ominous I'd suggest that the "scientific" method would be to use a voltmeter or scope. The voltage drop is of more practical use than a precise temperature measurement. Is it causing the regulator to drop out?
Peter Hinch
Index to my micropython libraries.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by Roberthh » Mon Nov 14, 2016 11:50 am

@pythoncoder: Hello Pete, yes, you're right. I skipped the scope test assuming that it would show voltage drops, and went to the next step of supplying a stable power. But I can re-do that with another Wemos device and my single Huzzah. But still these would be single observations. It does not tell much about every device of a specific kind being good or bad. But you have also a few items on hand, so maybe we could share our findings. That will end up at least with a statisctics of a handfull.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by Roberthh » Wed Nov 16, 2016 9:09 pm

Hello @pfalcon, @jms, @pythoncoder and all. I continued my testing on this topic
with respect to the comments you made.

Temperature

Since I do not have access to an infrared camera, I used a Fluke thermocouple
module. Finding at an environmental temperature of 20°C (all values in °C):

Code: Select all

               Huzzah Feather | Wemos D1 a | Wemos D1 b| Wemos D1 b w AP_IF
---------------------------------------------------------------------------
ESP module cover   24             30          29.5          31.5
USB connector      28             27.5        27.5          27
3.3V Regulator     29             28           28           28
So it looks most likely the increased temperature on the USB plug is originated from the active
components of the module and propagated through the power planes in the PCB. The
Huzzah Feather shows lower temperature on USBs probably because the distance
between module and USB connector is larger.
The average Vcc difference between the power supply and the 5V internal supply
of the most suspicious device was 50mV. That includes cable & connector. So at
the average current consumption that hardly could warm up the connector.
Nevertheless, driving the device though a short cable from a power supply made
it more stable, so I looked for the reason.

Vcc glitches

In order to do the test @pythoncoder suggested,
I hooked up an oscilloscope to the 3.3 V rail of the Wemos D1 a device. The trigger
was set to 3.18 V, time resolution 50 us/div and 1 Gs/s. The test software
was set up with AP_IF enabled. I could not see any coincidence
between faults of the test software and Vcc glitches. Both happened, but at different times.
The rare trigger events of the oscilloscope were glitches from close by switched
electric devices (I did not use a shielded probe).

Supply current

The average supply current of the device while the test was running is 80..85 mA,
depending on the operation mode. ~80 mA with just the STA_IF on,
~85 mA with both STA_IF and AP_IF enabled.
I made a USB cable with a 0.5 Ohm resistor in GND to display the current
fluctuations. The base supply current of the device is about 45 mA, with short
current peaks while the download test is running. With AP_IF disabled, these amount to
about 180 or 250 mA at a duration of about 50µs each.
When the AP_IF is enabled, additional power peaks amount to 250 mA and 1.4 ms
duration, repeated about every 100 ms. That alone accounts for a larger average
current.

Run tests

The difference between the device connected by USB cable to the PC and by a short
cable to a 5V linear power supply seems to be the buffering capacitor close to the
module. @jms was perfectly right in his concise and somewhat cryptic comment about that.
Adding a 10uF SMD capacitor to the 5V rail on the Wemos D1 devices not only made
the current figures look more nice, but more important improved reliability.

Both devices, one connected by USB to my PC, and the other to the 5V power supply,
run the test now since 24 hrs reaching a download amount of 6 GBytes, with an average amount
of 400 MBytes between timeouts. The software set-up is close to @pfalcon's
initial test. The only changes:

- AP_IF disabled
- control prints are made every MByte instead of every kByte. That reduces the
log file size, if taken from picocom's output.

Especially the gc.collect() in the DL-loop is removed again.

With the AP_IF enabled, the download test was never stable. It 'keeled over' after
10 .. 150 MBytes of data transferred.

Summary

So my conclusion of the test is:

- Disable AP_IF, if you do not need it.
- For the Wemos D1, solder a capacitor of at least 10uF to the board at the 5V
rail. You may also simply solder a wired capacitor in the 5V and GND port.

Adding a larger capacitor (like 1000 uF) did not substantially improve
reliability with AP_IF enabled.

Note: According to the Wemos D1 schematics I found there should be 5 capacitors
with more than 20uF at the 3.3V rail of the Wemos D1, and 1 uF at the 5V rail.
On my devices, I could spot only 3 capacitors on the 3.3V rail, which looked
the same as the supposed 1 uF capacitor. I did not unsolder them to determine
their value. The schematics of the Huzzah feather device, which performed much
better, show 10 uF || 100 nF on both the 5v and 3.3 V rail.

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by kfricke » Wed Nov 16, 2016 9:38 pm

I do not want to capture this thread, but think it is worth to point to this issue regarding unperceived active AP_IF I did file on Github a little while ago.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Downloading 1GB of data with MicroPython ESP8266 port

Post by pythoncoder » Thu Nov 17, 2016 8:27 am

@Roberthh Useful information. When we were developing the TFT GUI (which draws a similar current) I found issues powering it via USB. On occasion display flicker was apparent on some tests. For all that USB is supposed to be capable of supplying 500mA it does depend on the quality of the source, the length of the lead and the quality of connectors.

I think where devices consume currents on the order of 250mA - even if only as transients - it's wise to use soldered connections to a good quality supply. And, as you point out, adequate decoupling.
Peter Hinch
Index to my micropython libraries.

Post Reply