How to Build LEGO®-compatible Robotic Bat

A flapping-wing robotic bat with Arduino, 3D printed, and LEGO®-compatible parts
How to Build LEGO®-compatible Robotic Bat


Bats use their forelimbs as flapping wings. They are the only mammals capable of true flight. Bats have been one of the symbols of Halloween. It is believed that witches worshipped horned figures with wings, possibly bats. Although bats have a creepy reputation, they have been widely used as Halloween decorations. In this tutorial, a flapping-wing robotic bat has been made that can be used as part of a Halloween decoration. The general view of the robotic bat is shown in Fig. A.

The current bat is made of some LEGO®-compatible parts, an Arduino board, a motor driver, an off-the-shelf DC gear motor, two red LEDs, a PIR motion detector sensor, and 3D printed parts. The red LEDs resemble scary eyes for the bat. Sensitivity to motion is another feature that has been added to the bat. When an object or a person passes nearby, the bat starts flapping its wings. 

LEGO®-compatible robotic Bat created by Tart Robotics
Fig. A – General view of the robotic bat

In this tutorial, we will make the body structure and the wing mechanisms of the bat using LEGO®-compatible parts. However, the wings are designed and 3D printed. Then, a DC gear motor drives the crank mechanism of the bat to flap its wings (Figs. B and C). Since an Arduino Nano onboard is used, we can attach a diverse set of sensors and modules to the project. This enables us to get the most creative and let our imagination go limitless.

A crank mechanism for the flapping wings
Fig. B – A crank mechanism for the flapping wings

As a creative decoration for Halloween season, we can make our robotic bat scare people off by flapping its wings whenever a person passes by using a PIR motion detection module (Fig. C). The PIR motion detectors are similar to the ones used in automatic hallway lamps. Thanks to the open-source nature of the Arduino board that allows such developments.

Create robotic Bat with a DC motor and a motion detector
Fig. C – PIR motion detector

For more sophisticated applications, an Arduino NANO board is added to the bat to significantly increase the expandability and programming elements of the project (Fig. D). As you know, various add-on shields can be added to any Arduino board to expand the project’s capabilities.

Use open-source platforms such as Arduino to build LEGO®-compatible Bat
Fig. D - An Arduino Nano board

For instance, the Arduino board allows us to add two super flux red LEDs to the bat so that they can be turned on whenever the bat detects any motion nearby (Fig. E). These features enable us to make our projects fun and interactive.

LEGO®-compatible Bat - General view
Fig. E – The Red LEDs of the robotic bat

What materials do you need to build a Hexapod robot?

Electronic and electromechanical components
Fig. F - Electronic and electromechanical components
  1. 1x Arduino Nano
  2. 1x PIR sensor
  3. 1x Mini Switch
  4. Jumper wires
  5. 1x Breadboard, Mini Size
  6. 2x RED LEDs
  7. 1x Power Jack, Barrel Type
LEGO®-compatible components, DC gear motors, and custom 3D printed parts
Fig. G - LEGO®-compatible components, DC gear motors, and custom 3D printed parts
  1. Frame, 5x7 module
  2. TT Gear Motor
  3. 3D Printed Gear Motor Housing
  4. 3D Printed Lego-compatible Coupling
  5. Gear, 40-tooth
  6. M3 x 25 Machine Screw
  7. M3 x 10 Machine Screw
  8. Axle, 12-module
  9. Axle, 6-module
  10. Axle, 3-module
  11. Beam, 3-module
  12. Beam, 5-module
  13. Beam, 7-module
  14. Angular beam, 3x5 module
  15. Beam with crosshole, 2-module
  16. Gear, 24-tooth
  17. Gear, 8-tooth
  18. Axle connector with axle hole
  19. Connector peg, 2-module
  20. Connector peg with the axle, 2-module
  21. Bushing, module
  22. Axle, 2-module
  23. Connector peg with friction, 2-module
  24. Bushing, 1-module

How to use building blocks to assemble the robot?

Let’s start off by assembling the body structure and wing mechanisms of the bat. The body structure holds everything together including the gears, wings, and electronics. Prepare the Lego-compatible pieces according to Fig. G, and follow the step-by-step video tutorial below.

What 3D printed parts do you need?

In order to hold the DC gear motor in place and make a proper connection to the LEGO®-compatible pieces, we have used custom-designed, LEGO®-compatible, 3D printed motor housings, and shaft couplings (Fig. H). The wings are specially designed and 3D printed to give a proper outlook to the bat (Fig. I). Download and print out the motor housingscouplings, wings-1, and wing-2. Then prepare the required Lego-compatible parts from Fig. G, and follow the step-by-step mechanical assembly tutorial.

Fig. H - 3D printed LEGO®-compatible DC gear motor coupling and housing
Fig. I - 3D printed LEGO®-compatible compatible wings

Electronics and wiring

Prepare your screwdriver and soldering iron and carefully follow the video instructions below. Make sure you properly implement the schematic circuit diagram shown in Fig. J, so you don't end up toasting your Arduino board and motor driver.

Fig. J - Schematic diagram of the robotic bat circuit

Programming your DIY robot

You can pick up LEGO®-compatible pieces and let your imagination go limitless. Of course, coding is also the part that you can have lots of fun and be the most creative. You can go to Arduino IDE and write your own code to tell Dracula what to do. But for now, let's start with this code.

#define PIR 2        // PIR motion sensor
#define EYES A1   // LEDs
#define WINGS 3 // DC motor

void setup() {
pinMode(PIR, INPUT);

void loop() {
if (digitalRead(PIR)) {
analogWrite(EYES, 255);
analogWrite(WINGS, 180);
} else {
digitalWrite(EYES, 0);
digitalWrite(WINGS, LOW);

void blink() {
digitalWrite(EYES, HIGH);
digitalWrite(EYES, LOW);

You are all set. Your robot is ready to go.