Skip to content

hunsalz/tracked-racer

Repository files navigation

Smart LEGO® Tracked Racer

Build Status License

Control your LEGO® Technic 42065 RC Tracked Racer with your Smartphone instead of using the included RC.

Features

  • Use a Progressive Web App as controller. Add it without further installation to your homescreen.
  • Use Web standard communication with WebSockets
  • Use cheap hardware components

Hardware listing

  • 42065 RC Tracked Racer
  • A LEGO® Power Functions extension wire [8886]
  • Amica NodeMCU ESP8266 - Important note: Not all ESP8266 development boards are compatible with the offered motor shields. Especially the sizing of the LoLin NodeMCU V3 doesn't fit together.
  • ESP8266 NodeMcu V2 Motor Shield Board
  • An elastic band to tie up NodeMCU and MotorShield the easy way with LEGO® bricks
  • A bunch of wires

Pictures of hardware assembling

Plain LEGO® Technic 42065 chassis:

LEGO® Technic 42065 chassis

Assembled ESP8266 + Motorshield + LEGO® parts:

Assembled ESP8266 + Motorshield + LEGO® motors & battery pack

Details of ESP8266 + Motorshield + LEGO® parts:

Details of ESP8266 + Motorshield + LEGO® parts

You find further details of wiring LEGO® Power Functions for example here.

TODO further details

Controller in Html5 & Css3

I tried various controller versions with the idea of using motion control abilities of my smartphone to control the vehicle:

Technically motion control works perfectly. - But in practise it was very unhandy for controlling the vehicle.

Finally the winner looks plain simpler:

controller

Build and run

Build Web-App with Polymer 3.0

Prerequisition: Polymer CLI

  1. Install all dependencies - Go to folder tracked-racer-app:
$ polymer install
  1. Test app locally in your browser.
$ polymer serve --open

Note: By design this app runs locally on ESP8266 and depends on a WebSocket served by the WebServer of the ESP. For production adjust the WS endpoint.

  1. Prepare for production
$ polymer build
  1. Upload app to ESP8266

Finally upload app from ESP8266/data/www folder to your ESP8266. Go to Arduino IDE Tools > ESP8266 Sketch Data Upload

Note: Close Serial Monitor of Arduino IDE before uploading data. Otherwise upload will interrupt.

Compile & upload C++ code to ESP8266

Load sketch ESP8266.ino from ESP8266 folder in Arduino IDE.

Verify dependencies:

You can manage your additional includes by Arduino IDE Sketch > Include Library > Manage Libraries or you checkout dependencies yourself by git clone in your library folder of your Arduino sketchbook location.

Using git allows you to easily update all libraries at once:

ls | xargs -I{} git -C {} pull

With all dependencies provided the code should compile and is ready for upload.

  1. Browse to https://esp8266.local/ to load the app.