This program runs on a Raspberry Pico RP2040 to provide a web server when connected to an Espressif ESP8266. This allows the Pico to be monitored and controlled from a browser. The Pico RTC can also be updated with the current time from NTP servers and the ESP8266 GPIOs can be accessed from the Pico.
It was written as an exercise in learning the Pico SDK so is more complex than it needs to be. The web server runs on Core 1 and the example runs on Core 0. FIFOs and interrupts are used to communicate between the cores, and mutexes used for coordination. The Pico and ESP8266 communicate over a UART serial connection. Logging is output over the Pico USB.
The program consists of:
blinkLed.pio(optional, used for learning about PIOs)
The ESP8266 provides wifi connectivity for the Raspberry Pico. The ESP8266 needs to be loaded with Espressif AT firmware after which no programming of the ESP8266 is required. The AT firmware resources can be downloaded from Espressif:
- AT firmware. Note
ESP8266 NonOS AT Binis no longer available and has been replaced by
ESP8266 IDF AT Binwhich I have not tested and is not suitable for 1MB flash. A copy of the old firmware
ESP8266_NonOS_AT_Bin_V1.7.4.ziphas therefore been stored in this repository.
- Flashing tool.
|0 (TX)||3 (RX)|
|1 (RX)||1 (TX)|
The ESP8266 can be powered from the Pico, or a separate power source can be used but retaining the common GND connection. Pico pin 2 is used to reset the ESP8266.
Requires the Pico SDK and appropriate toolchain.
The following user configuration must be completed in the
#define WIFISSID "****" // wifi SSID
#define WIFIPASS "****" // wifi password
#define STATICIP "192.168.1.135" // static IP for PicoWebServer
#define GATEWAY "192.168.1.1" // gateway IP (eg router)
#define TIMEZOME 0 // +/- local time offset in hours from UTC