Introduction: HiFive1 Web Server With ESP32 / ESP8266 WiFi Modules Tutorial

The HiFive1 is the first Arduino-compatible RISC-V based board built with FE310 CPU from SiFive. The board is about 20 times faster than Arduino UNO yet like the UNO board HiFive1 lacks wireless connectivity. Fortunately, there are several inexpensive modules on the market to mitigate this limitation.

In my previous tutorials, we have seen how to add minimalistic WiFi connectivity via AT commands or achieve worldwide reachability with MQTT broker.

In this tutorial, we will add a Web Server capability to the HiFive1.
Any device on the local network will be able to communicate with the Web Server using a Web Browser.

This project demonstrates how to control the HiFive1 built-in RGB LED via a simple Web page.

Materials Needed For This Project:

  • HiFive1 board (can be purchased here)
  • ESP32 Dev Module or ESP8266 NodeMCU 1.0
  • 4 jumper wires

Step 1: Environment Setup

First, you need the Arduino IDE

1. Follow the instructions to install the HiFive1 board Arduino package and USB driver.

2. Install the ESP32 or ESP8266 board package by adding an appropriate URL to the "File->Preferences->Additional Boards Manager":

  • ESP8266 - http://arduino.esp8266.com/stable/package_esp8266com_index.json
  • ESP32 - https://dl.espressif.com/dl/package_esp32_index.json

Step 2: Wiring the ESP32

If you are using an ESP8266 skip to step 3.

Connect the jumper wires in the following way:

  • GPIO 10 (HiFive1) - > Tx (ESP32)
  • GPIO 11 (HiFive1) - > Rx (ESP32)

Make sure that the IOREF jumper is set to 3.3v.

Step 3: Wiring the ESP8266

Connect the jumper wires in the following way:

  • GPIO 10(HiFive1) - > Tx (ESP8266)
  • GPIO 11(HiFive1) - > Rx (ESP8266)

Make sure that the IOREF jumper is set to 3.3v.

Step 4: Programming

HiFive1 Code:

Before programming set the "Tools->Board" to "HiFive1", the "Tools->CPU Clock Frequency" to "256MHz PLL", the "Tools->Programmer" to "SiFive OpenOCD" and set the correct Serial Port.

ESP32/8266 Code:

During the programming, the ESP board should have the hardware Rx and Tx pins disconnected.

After the code was successfully uploaded, reconnect the Rx and Tx pins on the ESP to ensure communication between the HiFive1 and the ESP.

For ESP32 - Set the "Tools->Board" to "ESP32 Dev Module", the "Tools->Programmer" to "AVRISP mkll" and set the correct Serial Port.

For ESP8266 - Set the "Tools->Board" to "NodeMCU 1.0 (ESP-12E Module)", the "Tools->Programmer" to "AVRISP mkll" and set the correct Serial Port.

Step 5: Final Result

In order to connect to the ESP Web Page, open a browser on your PC or mobile device and enter the IP Address (You can find the IP Address by uncommenting the line with WiFi.localIP() in the setup function. Remember to re-comment the line after finding the IP in order for the sketch to work properly).

In my case, the IP's were: ESP32 - 10.0.49.94 and ESP8266 - 10.0.51.252.

Set your Serial Monitor’s Baud Rate to 115200 used in the sketch.

Your final page should look like in the attached pictures.