This repository contains firmware for the ESP8266 ESP-01 chip to be used for implementing wireless connectivity with the Pocket Science Lab (PSLab) open hardware platform.
The PSLab provides an array of test and measurement instruments for doing science and engineering experiments. Its built-in instruments include an oscilloscope, a waveform generator, a frequency counter, programmable voltage and current sources, and a logic analyzer. The PSLab also has UART, I2C, and SPI buses, via which external devices can be connected and controlled.
The PSLab is a fully open source device, and FOSSASIA provides a complete hardware and software stack under open source licenses:
-
You can get a Pocket Science Lab device from the FOSSASIA shop.
-
More resellers are listed on the PSLab website.
- The PSLab chat channel is on Gitter.
- Please also join us on the PSLab Mailing List.
The following tools are required to build and flash the firmware:
- Arduino UNO (with USB cable): This will act as a bridge to program the ESP01 chip.
- Jumper wires: For connecting the ESP-01 to the Arduino UNO.
- Resistors (Optional): Useful for logic level conversion to protect the ESP01 from higher voltage signals.
- Breadboard (Optional): For convenient and secure connections.
- Arduino IDE: The development environment for writing and uploading firmware to the ESP01.
Before flashing the firmware to the ESP-01, you need to set up the Arduino IDE with the required boards and libraries. Follow these steps:
-
Open the Arduino IDE.
-
Navigate to File > Preferences.
-
In the "Additional Board Manager URLs" field, add the following URL:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
If there are existing URLs, separate them with a comma.
-
Click OK to save the changes.
-
Go to Tools > Board > Boards Manager.
-
In the search bar, type ESP8266.
-
Select the latest version of the esp8266 by ESP8266 Community package and click Install.
-
Wait for the installation to complete.
Once these steps are completed, the Arduino IDE is ready to program the ESP-01 chip.
Before proceeding with flashing the firmware, it's important to upload a bare minimum sketch to the Arduino UNO. This ensures the board is in a known state and can act as a bridge for programming the ESP01.
Follow these steps:
- Connect the Arduino UNO to your computer using the USB cable.
- Open the Arduino IDE.
- Go to File > Examples > 01.Basics > BareMinimum to load the bare minimum sketch.
- Select the Arduino UNO board from Tools > Board.
- Select the appropriate COM Port from Tools > Port.
- Click Upload to flash the bare minimum sketch to the Arduino UNO.
This process ensures that the Arduino UNO is ready to act as a programmer for the ESP-01 chip.
To program the ESP-01 chip using the Arduino UNO, establish the following connections:
Arduino UNO | ESP-01 |
---|---|
RX | RX |
TX | TX |
3.3 V | VCC |
GND | GND |
RESET | GND |
GND | GPIO_0 |
3.3 V | CH_PD or CH_EN |
GND | RESET |
- All Ground pins from UNO and ESP-01 are common.
- 3.3 V connections are common from UNO.
- The RX pin connection between the UNO and the ESP-01 should be made through a voltage divider, since the ESP-01 operates on a 3.3 V logic level and receiving 5 V logic level from the UNO could damage it. A simple 3.3V voltage divider can be made very conveniently using two resistors (10K and 20K).
To flash the firmware onto your ESP01 chip using the Arduino IDE, follow these steps:
-
After cloning this repository, open the file containing the firmware (
ESP01Firmware.ino
) in Arduino IDE. -
Select the Generic ESP8266 Module board from Tools > Board.
-
Select the appropriate COM Port from Tools > Port.
-
Click Upload and wait for the sketch to compile and uploading to begin.
-
At this point of time, you should be able to see something like this in the output window:
-
In order to allow for the firmware to be uploaded, the RESET pin of the ESP-01 chip should be connected to GND only for a short interval of time. Thus, when you see the above output, wait for a short interval (approx. 1s) and then disconnect the RESET pin from GND.
-
Wait for the program to connect to the chip, until you see something like this: This indicates that the firmware flashing has begun.
-
Wait for the flashing to complete until you see something like this: This indicates that the firmware has been flashed successfully to the ESP-01 chip !
With the firmware successfully flashed onto the ESP-01 chip, the next step is to flash the appropriate firmware onto the PSLab board to enable communication over the UART2 bus.
The firmware for the board is available here.
You can follow the same steps as indicated in the firmware repository to flash firmware to the PSLab board.
After flashing the firmware to the board, plug in the ESP-01 chip to the header on the board and you are good to go !