Git Product home page Git Product logo

picowebserver's Introduction

PicoWebServer

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:

  • PicoWebServer.cpp
  • PicoWebServer.h
  • blinkLed.pio (optional, used for learning about PIOs)

ESP8266

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 Bin is no longer available and has been replaced by ESP8266 IDF AT Bin which I have not tested and is not suitable for 1MB flash. A copy of the old firmware ESP8266_NonOS_AT_Bin_V1.7.4.zip has therefore been stored in this repository.
  • Flashing tool.
  • Instructions.

Connection Pins

Pico ESP8266
0 (TX) 3 (RX)
1 (RX) 1 (TX)
2 RST
GND GND

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.

Configuration

Requires the Pico SDK and appropriate toolchain.

The following user configuration must be completed in the PicoWebServer.h file:

#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

Example

The files PicoWSexample.cpp and PicoWSpage.h provide an example of using the PicoWebServer to display the following content on a browser. The web page refreshes every 10 seconds using AJAX and JSON: image2

picowebserver's People

Contributors

s60sc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.