Skip to content

cycu767/smart-chain-oiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Motorcycle Chain Oiler (ESP8266)

DIY smart motorcycle chain oiler based on ESP8266 (Wemos D1 Mini) with web configuration and optional GPS-based speed detection.

The project was created for personal use, tested in real conditions, and is shared as open-source for anyone who wants to build their own reliable, configurable chain lubrication system. A few of these are running in the wild (I'm quite proud of that).


Project status

Project is no longer actively developed

The system is fully functional and proven in daily use, but development has stopped as I switched to a motorcycle with a shaft drive.

Bug fixes or small improvements may still happen, but no new major features are planned.


Features

Core functionality

  • Configurable oil pump control (relay or MOSFET)
  • Adjustable oiling ON / OFF timing
  • Priming mode (oil system filling)
  • Cycle-based oiling logic
  • Persistent configuration stored in EEPROM

Connectivity & configuration

  • Built-in WiFi Access Point
  • Static web interface for configuration
  • Optional automatic WiFi shutdown after a defined time
  • Custom WiFi SSID and password
  • Minimal dynamic content for maximum stability

Advanced versions

  • v3 – OLED display support
  • v4 – GPS module support:
    • Speed-based oiling logic
    • Satellite status detection

Why mostly static web UI?

The web interface is intentionally mostly static.

Only a few values are dynamically updated on the main page:

  • time to next oiling cycle, sat count, speed
  • time to WiFi access point shutdown

This significantly reduces ESP8266 load and improves long-term reliability — the controller focuses on pump control, not serving HTML.


Hardware

Required components

(community-tested list)

  • Oil pump - DellOrto DL12306
  • Sumitomo 6189-0031 pump connector
  • Oil reservoir - LINK
  • Oil/fuel hose (pump ↔ reservoir)
  • Superseal connectors - LINK
  • Fuse holder
  • Wiring (0.25 mm² is sufficient)

Controller & electronics

  • Wemos D1 Mini (ESP8266) - LINK
  • Relay - LINK
  • MOSFET FR120N - LINK
  • Power supply - LINK

Optional

  • GPS module (e.g. NEO-6M) - LINK
  • GPS antenna - LINK
  • Antenna connector - LINK
  • OLED display (SSD1306, 0.96 inch, IIC Serial, 4pin, 128X64)- LINK
  • Custom oil nozzle / mount - LINK

System diagram

flowchart LR
  PWR["12V after ignition"]
  PWR -->|12V| DCDC["DC/DC buck 12-24V to 5V"]
  PWR -->|12V| DRV["Relay / MOSFET driver"]

  DCDC -->|5V| ESP["Wemos D1 mini (ESP8266)"]
  ESP -->|GPIO| DRV
  DRV -->|12V| PUMP["Oil pump"]

  User -->|WiFi, WEB BROWSER| ESP
  ESP -->|UART| GPS["GPS module NEO-6M"]
  ESP -->|I2C| OLED["OLED display (optional)"]
Loading

Pinout & connections

Default pin assignment for ESP8266 (Wemos D1 mini)
(as used in the current V4 firmware).

Pump control

  • D1 (GPIO5) → Relay / MOSFET (oil pump)
    • HIGH → pump ON
    • LOW → pump OFF

GPS module (optional, v4)

  • D6 (GPIO12) → GPS TX
  • D5 (GPIO14) → GPS RX
  • Implemented using SoftwareSerial
  • Tested with NEO-6M
  • Power:
    • 5V
    • GND

OLED display (optional, v3+)

  • D3 (GPIO0) → SDA
  • D2 (GPIO4) → SCL
  • Interface: I2C
  • Supported controllers:
    • SSD1306 (128×64)

Power & ground

  • 5V → GPS / OLED
  • GND → common ground

Pin assignments are defined in firmware
and can be adjusted if needed.

See source code for details:
ESP8266_SmartChainOilerV4.ino

Note: D3 (GPIO0) affects ESP8266 boot mode.
Make sure the OLED does not pull D3 LOW during startup.


Physical construction

The controller is built as a compact "pancake-style" PCB stack.

Relay shield used as MOSFET carrier

Although the oil pump is switched using a MOSFET, a relay shield PCB is still present.

The mechanical relay itself is removed. The relay PCB is reused as a carrier board for the MOSFET and power wiring. The MOSFET gate is driven through the original relay control circuitry on the shield, which is connected to the ESP8266 GPIO pin.

From the firmware perspective, nothing changes: the pump is still controlled using a single GPIO output.

This approach was chosen for practical reasons:

  • the relay shield was already part of the hardware stack
  • it provides a robust PCB with proper power routing
  • it keeps the construction compact

Using a MOSFET directly from GPIO would also work. This design simply reuses existing hardware in a clean and mechanically stable way.


Interface

Home & status

Home screen Home screen (GPS)

System configuration

System config

Priming

Start priming Priming status Stop priming

GPS logic

GPS thresholds

Access Point settings

AP settings


Reliability

The controller was tested running continuously for several years on a few motorcycles without issues.

Timing logic, EEPROM persistence and WiFi stability proved reliable in long-term use.


Photos & media

  • Installation photos

  • Short demo videos

https://imgur.com/T2jU9Hk


Flashing & programming

The firmware is built for Wemos D1 Mini (ESP8266 / Lolin compatible).

You can flash the firmware either:

  • directly from Arduino IDE
  • or by using the generated .bin file with esptool.py

Example (command line)

Below is an example command generated by Arduino IDE.
Adjust paths, COM port and usernames to your system.

python3 upload.py \
  --chip esp8266 \
  --port COM3 \
  --baud 921600 \
  erase_flash \
  write_flash 0x0 ESP8266_SmartChainOiler.ino.bin

First boot & WiFi access

After flashing, give the device a few seconds to boot.

WiFi Access Point

  • SSID: ESP-****** (generated from device ID)
  • Password: none on first boot

The firmware uses a captive portal:

  • connect to the WiFi network
  • open any page or go directly to:

DNS redirection is used to speed up access to the web UI
(may not work in 100% of cases).

Initial configuration (important)

On first boot EEPROM is empty.

  1. Go to System Config → click Save
  2. Go to AP Settings → clear fields → Save
  3. Refresh page if it hangs (rare, but possible)

After that, configure values as desired.

⚠️ Setting AP auto-off time too low may lock you out of the UI
(setting 0 does not disable AP).


Version history (high level)

  • v1–v2 – Basic oiling logic + WiFi
  • v3 – OLED display support
  • v4 – GPS-based speed detection

Future plans

None planned at the moment.

The project is published for:

  • learning
  • inspiration
  • reuse
  • modification

Feel free to fork, refactor, or modularize it.


License

License MIT.


Credits

Inspired by community projects and discussions on
https://africatwin.com.pl

About

DIY smart motorcycle chain oiler based on ESP8266 with GPS-based speed detection and configurable oiling logic.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors