Introduction: DIY Phone Controlled LEGO® Bat Buggy
With some 3D printed parts and a few cheap components, you can build small, phone controlled LEGO vehicles.
For project this I will be using:
- an ESP32 microcontroller (Adafruit Feather ESP32 or a TTGO equivalent of this)
- 2 x N20 geared motors
- 1 x 18650 lithium battery
- 2 x Pololu DRV8835 motor drivers (although only one is required, the second is for future expansion)
- a custom PCB to hold the DRV8835 motor drivers
- several 3D printed parts (I don't have a 3D printer - so I used 3DHubs for this service)
- LEGO - Technic tracks and a few other pieces
This is an open source build. All the software, electric hardware and 3D printed parts are available for you to download/modify/use/etc.
LEGO®is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site.
Step 1: The Electronics
I've had a custom PCB printed as a "carrier" for the DRV8835 motor drivers. You could just use wires instead of this, however it wouldn't be as neat. I used PCBWAY to do the PCB manufacturing.
Linked here are the Gerber files if you want to have your own PCBs printed, or the Eagle files if you want to modify the design!
Step 2: The Motors
I am using to "N20" geared motors. You can easily find these on EBay/AliExpress, etc. The models I'm using are 6v, 300rpm, with 10mm shafts.
The motor housing and axle adapter were 3D printed. Attached you can find the STL files. I used 3DHubs.com to print these (printed at 100um).
Step 3: The Battery Holder
Step 4: The Software
The ESP32 is running a web server. This serves a page that allows you to send input controls back to the ESP32 via a WebSocket (this way it will be low latency). The web page will handle multi-touch or mouse input.
You can download the source code for the project here.
Step 5: The Build
Now all the components are working, it's time for the fun part - using your imagination and building a vehicle / robot.
The driver carrier can hold up to 4 DRV8835's which means a total of 8 DC Motors could be driven, or 4 Stepper motors, or a combination of these...