Skip to the content
PCBKitNew board
2 layers43 × 34.3 mmEspway, the printed circuit board in 3D

Segway-like robot implemented on ESP8266

Size
43 × 34.3 mm
Copper layers
2
Thickness
1.6 mm
Parts
37
Nets
30
Pads
116
Tracks, vias
285, 16
Pours
12
Routed
Yes
KiCad
KiCad 4
Created
24 Jul 2016
Updated
11 Nov 2021

Overview

Espway is an open-source printed circuit board by espway, from the espway/espway repository on GitHub, published under the LGPL-3.0 licence. It is a 2-layer board of 43 × 34.3 mm with 37 parts on 30 nets, routed with 285 tracks and 16 vias.

It is built around the ESP-12E, DRV8835DSS and LM1117-3.3, with the LSM6DS3 among its other parts. Its parts include 15 resistors, 7 capacitors, 4 ICs, 3 connectors and 1 diode. It belongs with the robots and motor control boards and the ESP8266 boards of this library.

Main components

4

README

README.md

ESPway

A segway-like balancing two-wheel robot built on ESP8266. It is controlled over WiFi via a HTML/JS GUI and a WebSocket. This is a work in progress. The firmware is meant to run on a WEMOS D1 mini or a similar board.

NOTE for existing users: the Arduino version of this code is deprecated and will not receive the newest improvements from the main branch. However, the Arduino branch will remain in this repo. If you'd like to have something improved or fixed there, please open an issue or preferably a pull request.

Getting started

The firmware is built on the esp-open-rtos project which is included as a submodule in this repo.

For building the firmware, a Linux host is recommended. For other platforms, there is a Docker image one can use. The docker-run script in this repository contains the command that's required to download the image and run commands in the container. It should work fine on macOS hosts. For Windows hosts, I still recommend installing Linux in a virtual machine and installing the tools there.

Installing the tools and building

NOTE: if you intend to use Docker, you only have to install esptool, git and make on your host. Please see below for further Docker instructions.

Using the Docker image

First, install Docker.

Building the firmware using the supplied Docker image is easy. Instead of running make parallel, just run ./docker-run make parallel in the root folder of the repo. The command supplied to the script will be run in the Docker container, and the image will be automatically downloaded.

Flashing the image differs, though, and for this you'll need make on your host. Instead of

text
make flash ESPPORT=/dev/ttyUSBx

(/dev/ttyUSBx being the ESP's serial port) run

text
make flash-only ESPPORT=/dev/ttyUSBx

in your host shell. The separate flash-only target is needed because the flash target would try to build the firmware. In the future, it is intended to provide a separate Python script for flashing, lifting the need for make on host.

TODO: docker-compose configuration file for even easier usage

Installing the tools manually (not recommended, not guaranteed to work)

WARNING: As of currently, the compiler installed by this method seems to have issues compiling the code. Thus this method is not recommended. Please see above for the Docker-based toolchain instead.

Install these packages:

  • git (from your package manager)
  • xtensa-lx106-elf toolchain. You can use esp-open-sdk to build it, see the instructions in the esp-open-rtos repo.
  • esptool (pip install -U esptool). Please do not use the outdated version pulled by esp-open-sdk.
  • tcc, nodejs and npm are currently required due to the frontend code, although I'm investigating how to relax this dependency.

Clone this repo (recursive cloning to get also esp-open-rtos and its submodules):

text
git clone --recursive https://github.com/flannelhead/espway.git

Enter the directory and build the firmware:

text
make parallel

The parallel target does a clean build with 5 parallel worker threads to make it faster.

Plug your ESP8266 module in via USB and flash the firmware:

text
make flash

The default port is /dev/ttyUSB0. If you need to change this, use

text
make flash ESPPORT=/dev/ttyUSBx

Supported browsers

Please use the latest Firefox or Chrome if possible. The HTML/JS UI uses some recent JavaScript features which might not be supported by older browsers. However if you encounter any issues on e.g. Safari, don't hesitate to file them in the issue tracker.

Schematic & BOM

There is a PCB design and schematic in the schematic folder which has been tested and is ready to use. There, MPU6050 has been replaced by LSM6DS3 and L293D by DRV8835 for better performance.

Meanwhile, you can still build an ESPway using breakout boards available from the usual sources. A rough bill of materials for this is listed below:

  • (not including PCB, connectors, wire etc. materials)
  • WEMOS D1 Mini board
  • GY-521 (MPU6050 breakout board)
  • L293D motor driver IC
  • 2x 6V 300rpm metal gear motor (search for "12ga 300rpm" or "n20 300rpm"), these should be $3-5 per piece
  • 2x WS2812B neopixels for eyes and showing current state
  • AMS1117 5V regulator
  • 5x 100n ceramic capacitors
  • 2x 1000u 10V electrolytic capacitor
  • 470 ohm resistor
  • 10 kohm resistor
  • 680 kohm resistor

To use the old hardware config and schematic, you'll have to edit src/espway_config.h before compilation. See that file for notes.

See the schematic-old folder for the schematic. It is drawn with KiCad and there's a rendered PDF in the repo.

The new schematic in schematic folder uses components from kicad-ESP8266 by J. Dunmire, licensed under CC-BY-SA 4.0. The schematic is also licensed under CC-BY-SA 4.0.

Developing the frontend

The HTML/JS frontend uses Webpack as the build system. You will need NodeJS and NPM (the package manager) to build the frontend pages. It does jobs like bundling the JavaScript modules together, minifying and transpiling the ES2015 code for older browsers, compiling Riot tags, minifying/autoprefixing CSS etc.

After you've cloned this repo, run npm install in the root folder to install the package dependencies. There are two commands specified in package.json which run Webpack:

  • npm run serve start a web server which serves the static HTML files in the frontend/output directory. It also watches for changes in the source files in frontend/src and automatically rebuilds and reloads them. Use this while hacking on the frontend. TODO: Currently this doesn't see changes to HTML files, though.
  • npm run build produces a production build of the frontend JS/CSS bundles. Use this before uploading your work to the ESP8266.

License and acknowledgements

The project is licensed under LGPLv3.

The project uses esp-open-rtos which is licensed under the BSD 3-clause license. It also has some components which have different licenses. Read more about them in the esp-open-rtos README.

Parts

37
QtyValueFootprintReferences
710kResistors_SMD:R_0603R1, R2, R4, R7, R8, R9, R12
5100nCapacitors_SMD:C_0603C1, C3, C5, C6, C7
4100Resistors_SMD:R_0603R3, R5, R6, R15
22k2Resistors_SMD:R_0603R13, R14
2CONN_01X02Wire_Connections_Bridges:WireConnection_1.00mmDrillJ1, J2
1100uCapacitors_SMD:CP_Elec_6.3x5.8C4
1330Resistors_SMD:R_0603R10
14.8V (4*AAA NiMH)Wire_Connections_Bridges:WireConnection_1.20mmDrillBT1
1470uCapacitors_SMD:CP_Elec_8x10C2
182kResistors_SMD:R_0603R11
1Conn_01x05_MalePin_Headers:Pin_Header_Angled_1x05_Pitch2.54mmJ3
1DRV8835espway-modules:WSON-12U3
1ESP-12EESP8266:ESP-12E_SMDU2
1Ferrite_BeadInductors_SMD:L_0603L1
1LEDLEDs:LED_0603D1
1LM1117-3.3TO_SOT_Packages_SMD:SOT-223U1
1LSM6DS3espway-modules:LGA-14LU4
1SW_PushButtons_Switches_SMD:SW_SPST_KMR2SW1

The 33 most common of 37 parts.

Questions

How big is the Espway PCB?

It measures 43 × 34.3 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Espway use?

37 parts, built around the ESP-12E, DRV8835DSS, LM1117-3.3 and LSM6DS3. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Espway KiCad files?

From the espway/espway repository on GitHub, at the commit this page was made from: the board is schematic/espway.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Espway design in my own project?

Its repository publishes it under the LGPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

Similar boards

  • 2 layers51.8 × 58.5 mmBalancebot, the printed circuit board in 3D

    Balancebot

    bullestock/balancebot

    Segway robot controlled by a Wii Balance Board

    33 parts1
  • 2 layers87.9 × 78.1 mmSneak100 main board v2, the printed circuit board in 3D

    Sneak100 main board v2

    Eryk-Mozdzen/minisumo-sneak100

    Autonomous minisumo robot

    144 parts4
  • 2 layers96.9 × 61.6 mmCcb, the printed circuit board in 3D

    Ccb

    omelia-iliffe/creature-control-board

    Use this circuit board to create your own creatures!

    90 parts4MIT
  • 2 layers33.7 × 97.8 mmHAN ESP TSS721, the printed circuit board in 3D

    HAN ESP TSS721

    UtilitechAS/amsreader-firmware

    ESP8266 and ESP32 compatible firmware to read, interpret and publish data to MQTT from smart electrical meters, both DLMS and DSMR is supported

    29 parts470
  • 2 layers47 × 37.5 mmC64-wifimodem, the printed circuit board in 3D

    C64-wifimodem

    DrZingo/c64-wifimodem

    Source code for my c64-wifimodem

    27 parts23GPL-3.0
  • 2 layers60 × 40 mmForcegauge, the printed circuit board in 3D

    Forcegauge

    szbeni/forcegauge

    Traning for climbing. Load cell with HX711 and real time plotting,

    77 parts18GPL-3.0
  • 4 layers110 × 55 mmPhloppy 0, the printed circuit board in 3D

    Phloppy 0

    piotr-wiszowaty/phloppy_0

    Commodore Amiga floppy drive emulator

    85 parts12GPL-3.0