Esp8266 Web Server
Esp8266 Web Server
Hi everyone,
I have a rp2040-zero connected to a esp8266 wifi chip.
I want to turn it into a web server to activate a switch from the webpage and i actually found a few examples lying around...
The main problem starts at the imports, as with every example i try to implement, i always get the same result:
"Umport esp" doesn't work,
"import network" doesn't work,
"from network import WLAN" doesn't work
And also "import socket" doesn't work.
From my googling I come to think that my micropython should already have these libraries, while my board for some reason doesn't....
I've teied to look for the ".py" files it was missing, updating firmware from thonny, updating firmware manually to the latest version, but nothing.
Still stuck and I hope I'm not alone and that there's someone who can help me out here.
Thank you in advance!
I have a rp2040-zero connected to a esp8266 wifi chip.
I want to turn it into a web server to activate a switch from the webpage and i actually found a few examples lying around...
The main problem starts at the imports, as with every example i try to implement, i always get the same result:
"Umport esp" doesn't work,
"import network" doesn't work,
"from network import WLAN" doesn't work
And also "import socket" doesn't work.
From my googling I come to think that my micropython should already have these libraries, while my board for some reason doesn't....
I've teied to look for the ".py" files it was missing, updating firmware from thonny, updating firmware manually to the latest version, but nothing.
Still stuck and I hope I'm not alone and that there's someone who can help me out here.
Thank you in advance!
Re: Esp8266 Web Server
When you say: "does not work", which error do you get. The heap size of the ESP8266 is very small. So you can run only short scripts, like <200 lines of code. You can extend that by using pre-compiled code or embedding it as frozen bytecode. But the latter requires building your own firmware.
Re: Esp8266 Web Server
Hi,
Doesn't work means I get the following error:
And the same for all the other libraries mentioned...
It's not the esp8266 module the problem, but rather my rp2040-zero not having the libraries that i should need to then interface with the WiFi chip.
Doesn't work means I get the following error:
Code: Select all
ImportError: no module named 'network'
It's not the esp8266 module the problem, but rather my rp2040-zero not having the libraries that i should need to then interface with the WiFi chip.
Re: Esp8266 Web Server
The RP2040-zero has no network (e.g. WiFi, LAN, or BT) interface, and thus no network module.
Re: Esp8266 Web Server
Yes, but with the power of gpio pins, I've added a esp8266 chip... Picture below, only imagine it's a rp2040-zero on port 0 and 1 instead of a pico
There must be a way to use WiFi and the network library if these esp boards exist and all say are compatible with pi and arduino, right?
There must be a way to use WiFi and the network library if these esp boards exist and all say are compatible with pi and arduino, right?
Re: Esp8266 Web Server
Sure. Something like that is the Arduino 2040 Nano connect, which combines a RP2040 with a NINAW10 module, which is ESP32 based. But it requires a completely different Firmware for the RP2040, with all the network stuff integrated.There must be a way to use WiFi and the network library if these esp boards exist and all say are compatible with pi and arduino, right?
Using an ESP8266 as a WiFi interface would require similar work.
There was once a Python lib which uses a serially attached WIFi device. Traces of that must be in the Forum.
maybe this one: viewtopic.php?f=21&t=9664&hilit=esp8266+serial+wifi
Re: Esp8266 Web Server
As we now know what you are trying to accomplish, I would recommend to create the web server on the 8266 and set your contact from there.
If the Pico also needs control, you could connect one ESP output to a Pico input.
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas
My repositories: https://github.com/karfas
Re: Esp8266 Web Server
Ok so if I'm understanding this correctly, the esp8266 in the picture it's actually it's own thing?
Like I can connect with some serial to USB and put code in that through my computer?
And so in this case it would then become the wifi module doing it's own wifi thing and then exchanging data and commands with the rp2040 through UART?
Like I can connect with some serial to USB and put code in that through my computer?
And so in this case it would then become the wifi module doing it's own wifi thing and then exchanging data and commands with the rp2040 through UART?
Re: Esp8266 Web Server
I have no idea what the "esp8266 on the picture" is. And yes, they are normally (even in some cheap network-enabled wall plugs) programmable when you attach a usb/uart or rs232/uart converter.
To use the ESP network from the pico (as in your picture) you need most likely special firmware on both sides, as others also pointed out.
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas
My repositories: https://github.com/karfas