https://github.com/oltdaniel/webserial-protobuf-example
example of commuication with protocolbuffers between an ESP32 and Browser using WebSerial
https://github.com/oltdaniel/webserial-protobuf-example
esp32 protobuf webserial
Last synced: 9 months ago
JSON representation
example of commuication with protocolbuffers between an ESP32 and Browser using WebSerial
- Host: GitHub
- URL: https://github.com/oltdaniel/webserial-protobuf-example
- Owner: oltdaniel
- License: mit
- Created: 2024-05-03T14:59:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-03T15:27:15.000Z (over 1 year ago)
- Last Synced: 2024-05-03T18:20:53.766Z (over 1 year ago)
- Topics: esp32, protobuf, webserial
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> **NOTE**: This project is just a small example to prove this is possible. The code in this repo was mostly written in a single afternoon with the motivation of "get this somehow working". Maybe I'll rewrite it some day for a much cleaner version with better abstraction.
# WebSerial Protocolbuffer example
Sending protcolbuffers between the browser and an ESP32 via WebSerial.
## Preview
| | |
|-|-|
|
|
|
## Components
This project uses the following software:
- [nanopb](https://github.com/nanopb/nanopb) for using protocolbuffers on the esp32 within the arduino framework using some glue from [eric-wieser/nanopb-arduino](https://github.com/eric-wieser/nanopb-arduino).
- [protobuf.js](https://github.com/protobufjs/protobuf.js) to use protocolbuffers in the web application interface.
- [Web Serial API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API) to get both the ESP32 and Web Interface talking via Serial. This is only supported on chrome-based browsers (last check: 2024-05-03).
- [Protocol Buffers](https://protobuf.dev/) as the base idea of protocol to make this communication.
## Getting started
### Requirements
- [PlatformIO](https://platformio.org/)
- [Node.js](https://nodejs.org)
- [WEMOS S2 Mini or similar](https://www.wemos.cc/en/latest/s2/s2_mini.html)
### Install
```bash
git clone https://github.com/oltdaniel/webserial-protobuf-example.git
cd webserial-protobuf-example
```
#### Program the ESP32 Board with the firmware
> **NOTE** The boards need to supported USB OTG.
Open the repository in VSCode and flash the current project. All dependencies will be downloaded automatically.
#### Prepare and start the web interface
Steps to get started with the project:
1. Open the `web` directory of this repo.
2. Start the dev server with `yarn dev`.
Steps to compile the new proto file:
1. Install all dependencies using `yarn`.
2. Compile the protobuffer file using `yarn proto:build`.
## License
[MIT License](./LICENSE)