Creepy Crawly Cockroach

by littleBits

Published on April 23, 2014

Through a combination of LEGO and littleBits, we were able to create a super smart cockroach that reacts to its environment just like a real one would. It is able to navigate tricky spaces and it scurries when it is exposed to light. When it finds a dark place to hide, it lays low and stays put. 

How it works:

Navigation - The two bend sensors act as sensing antennas to help the cockroach navigate its surroundings. When the cockroach approaches a wall, the closest bend sensor will be activated. This will cause the opposite wheel to stop spinning due to the inverter before the dc motor, steering the cockroach away from the wall.

Shadow Seeking - The cockroach has two light triggers. The light trigger is set on light mode, so when each of the sensors sees light, the wheels spin. When a light trigger sees darkness, it's corresponding wheel stops spinning, making it so the cockroach turns toward the darkness. If both light sensors are in the darkness, the cockroach stops moving completely.

How To Make It


Start with building the circuit. Look at the circuit diagram to see how to set it up (https://littlebits-production.s3.amazonaws.com/uploads/supporting_file/asset/212/cockroach_circuit.p...). Set the light triggers to light mode.


Make a cockroach out of Lego blocks. The design of your cockroach is totally up to your imagination, but we have some tips that will be helpful to get your cockroach working properly: Firstly, this cockroach robot makes turns by stopping a wheel from spinning on one of the sides. We recommend that you have three wheels rather than four in order to help with the steering. Secondly, the wider the distance between two wheels, the bigger a circle it makes when it turns. This makes it difficult to evade a wall without hitting it. However, if the body is too small and narrow, there will not be enough room for all the bits to sit on the body. Our cockroach is about 4 inches wide.


Place the antennas on your cockroach. For this project, the orientation of the Bits Modules is quite important. The left antenna (bend sensor) affects the right wheel and the right antenna affects the left wheel. The bend sensors should be located at the front of the cockroach to act as antennas and sense any obstacles. The bend sensors should also be flipped upside-down because they are only triggered when they bend one way. Do some tests with your design and find the appropriate position and orientation for them.


Lay the rest of the circuit on the top of the cockroach (except for the DC motors). Do not forget that left bend sensor is followed by right inverter/light sensor/DC motor and right bend sensor is followed by left inverter/light sensor/DC motor. To attach the Bits Modules to Lego, we used a custom 3d-printed part, but you can use a double-sided tape like 3M VHB. 3M VHB tape gives very strong bond and very clean surface after removal. Glue dots are another option.


Add Lego wheels to your DC motors using the motorMate. The motorMate fits a Lego-sized axle, and then you just need to add the wheels. Attach the DC motors to the bottom of your cockroach’s body. We used another special accessory (in development and coming soon!), but again, you can use VHB. The DC motors should be located somewhere in the middle of the body, and you will want to make sure to change their direction mode so that both motors rotate towards the front of your cockroach.


Add a transparent lego part at the tip of the long led to make a pilot light.


Turn the power on and let the cockroach go! It may evade walls and any obstacles on its way and goes toward shade until it takes rest under dark place like under the sofa.

Related Projects

Spinning Replicator

The Spinning Replicator is a copy machine. It can scan an illustration and draw a copy of it without any kind of programming, just...


A DC motor with a button controls this paper lumberjack, with a small appearance from Lego. As you flip the switch on, press the b...

The Bedouin Firetruck

Creating something that moves... an emergency vehicle!