how install picoweb on ESP32?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
jrichard82
Posts: 9
Joined: Sat Mar 28, 2020 4:56 pm

Re: how install picoweb on ESP32?

Post by jrichard82 » Sat Mar 28, 2020 6:10 pm

import urequests
response = urequests.get('https://raw.githubusercontent.com/pfalc ... _init__.py')
with open('picoweb/__init__.py', mode='wb') as localfile:
localfile.write(response.content)
response = urequests.get('https://raw.githubusercontent.com/pfalc ... b/utils.py')
with open('picoweb/utils.py', mode='wb') as localfile:
localfile.write(response.content)

julien
Posts: 11
Joined: Fri Mar 27, 2020 10:16 pm

Re: how install picoweb on ESP32?

Post by julien » Sat Mar 28, 2020 6:34 pm

Hello,

Yes :) the web server is running now.
So here are all the steps.
I use a esp32 wroom 32D.
I flash the firmware 3d V1.11. I don't understand why the last firware doesn't worsk?
I create the folder picoweb manually on ESP32
import uos
uos.mkdir('picoweb')
I upload on the github the last vserion of the files in picoweb folder
I use thonny to copy paste the files into the picoweb folder in the esp32

import upip
upip.install('micropython-pkg_resources')
upip.install('micropython-ulogging')
upip.install('micropython-uasyncio')
Reset your esp32 ON/OFF
And start your program with picoweb, all is running

Is anyboddy can explain why the last version of the firmware doesn't works and we have to use an old firmware?
Very thanks for all your helps
Jl

User avatar
tve
Posts: 216
Joined: Wed Jan 01, 2020 10:12 pm
Location: Santa Barbara, CA
Contact:

Re: how install picoweb on ESP32?

Post by tve » Sun Mar 29, 2020 12:12 am

After a lot of troubleshooting my conclusion is that it's a memory fragmentation issue. The latest version probably has less memory available and in the end it runs out causing weird issues. I have the same symptoms using api.telegram.org and sometimes I manage to get:
api.telegram.org mbedtls -0x4290: RSA - The public key operation failed : BIGNUM - Memory allocation failed
but other times just weird stuff happens producing connection aborts where the underlying cause is that the wifi STA interface got shut down and I'm surmising due to memory allocation problems.
The MP heap uses the biggest chunk of memory (about 100KB) and leaves the smaller ones to esp-idf for communication and with TLS their usage gets stressed.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: how install picoweb on ESP32?

Post by jimmo » Tue Apr 14, 2020 5:59 am

julien wrote:
Sat Mar 28, 2020 4:31 pm
I think I am making a mistake. Picoweb does not seem to work with Micropython
I understand that it _is_ possible to make it work with regular MicroPtyhon, but the hassle probably isn't worth it.

I'd suggest trying any of the other HTTP server libraries. microdot (https://github.com/miguelgrinberg/microdot) is my personal recommendation but there's also TinyWeb, MicroWebSrv2, featherweb, etc.

jrichard82
Posts: 9
Joined: Sat Mar 28, 2020 4:56 pm

Re: how install picoweb on ESP32?

Post by jrichard82 » Thu Apr 16, 2020 4:10 pm

Yes I agree, memory fragmentation is an issue as the 8266 runs low on memory..

The biggest problem I saw with pico was memory usage. Using a browser like Chrome, it will create "speculative" connections to the device that it doesn't use - and won't let go of them. Those connections are expensive. featherweb times those connections out. The downside is you will sometimes see a "server unavailable" error. But thats better than crashing the esp... :D

julien
Posts: 11
Joined: Fri Mar 27, 2020 10:16 pm

Re: how install picoweb on ESP32?

Post by julien » Thu Apr 16, 2020 4:41 pm

Hello, On esp32 it works very fine, no problem. I find using picoweb much easier to use than the other frameworks offered. Congratulations again to the author of Picoweb.
julien

karunt
Posts: 4
Joined: Tue Dec 29, 2020 7:24 pm

Re: how install picoweb on ESP32?

Post by karunt » Thu Jan 21, 2021 2:56 pm

Any idea why downloading picoweb init.py from github causes my wifi connection to turn off? I get a "wifi: STA_DISCONNECTED: reason 200 beacon timeout" message, followed by nonstop "wifi: STA_DISCONNECTED: reason 201 no AP found" messages. Is is that my flash has too much stuff on it already, preventing the picoweb file from being downloaded in entirety? Very confused why this happens.

modulusmath
Posts: 30
Joined: Thu Jun 30, 2022 3:21 am

Re: how install picoweb on ESP32?

Post by modulusmath » Tue Aug 16, 2022 8:03 pm

jimmo wrote:
Tue Apr 14, 2020 5:59 am
julien wrote:
Sat Mar 28, 2020 4:31 pm
I think I am making a mistake. Picoweb does not seem to work with Micropython
I understand that it _is_ possible to make it work with regular MicroPtyhon, but the hassle probably isn't worth it.

I'd suggest trying any of the other HTTP server libraries. microdot (https://github.com/miguelgrinberg/microdot) is my personal recommendation but there's also TinyWeb, MicroWebSrv2, featherweb, etc.
Thank you for the suggestion! Google brought me here. 5 minutes later I am using microdot. Tremendous.

Post Reply