How to build ESPway
17 steps to build ESPway, with the source documents.
ESPway is a two-wheel balancing Segway-like robot based on the ESP8266, controlled over WiFi through an HTML/JS GUI and WebSocket. The repository provides firmware build and flashing instructions, a KiCad PCB design and schematic, and a rough bill of materials.
Buy parts
- Obtain the tested PCB design
Use the tested, ready-to-use PCB design and schematic in the `schematic` folder. This version replaces MPU6050 with LSM6DS3 and L293D with DRV8835.
- Gather the ESPway components
You can also build an ESPway with breakout boards from usual sources; the listed components exclude the PCB, connectors, wire, and other materials.
Print and make
- Build and export the model in OpenSCAD
Build the model with F6, then export it as STL with File->Export...->Export as STL....
Software
- Clone the KiCad ESP8266 Library
Create `~/kicad/libraries/` on Linux, enter the directory, and clone the archive.
- Add the Component Library
In eeschema, open Preferences→Component Libraries→Add and add `ESP8266.lib`.
- Add the Footprint Library
In pcbnew, open Preferences→Footprint Libraries Wizard and add `ESP8266.pretty`.
- Add the ESPLIB library path
In kicad:Preferences->Configure Paths->Add, set the name to ESPLIB and enter a full path such as /home/<your_login_name>/kicad/libraries/kicad-ESP8266.
- Convert the STL to binary format
Run meshconv to convert the ASCII STL produced by OpenSCAD into a binary file.
- Import the binary STL into Wings3D
Open Wings3D and import FILENAME.stl as a StereoLithography Binary File (*.stl).
- Assign colors to the model
Assign colors to the imported model in Wings3D.
- Export VRML for KiCad
Export the model as VRML 2.0 File (*.wrl) for use in KiCad.
- Scale the model to the footprint
Adjust the model in kicad:Footprint Editor:Edit->Edit Properties->3D Settings; for the ESP-12, the Shape Scale X, Y, and Z values are all 0.393700.
- Install Host Build Tools
If you intend to use Docker, install only `esptool`, `git`, and `make` on the host.
- Install Docker
Install Docker first. The firmware can be built with the Docker image supplied in the repository.
- Build Firmware in Docker
Run `./docker-run make parallel` in the repository root. The script runs the command in the container and automatically downloads the image.
- Flash Firmware from the Host
Run `make flash-only ESPPORT=/dev/ttyUSBx` in the host shell, replacing the serial port with the ESP's actual port. Use the separate `flash-only` target so the host's `flash` target does not try to build the firmware again.
- Edit the old hardware configuration
If using the old hardware configuration and schematic, edit `src/espway_config.h` before compilation; that file contains the notes.