Home » Grade » How to make an infrared sensor with printable housing compatible with LEGO pieces?

Login with your Social Account

How to make an infrared sensor with printable housing compatible with LEGO pieces?


Discover how to make an infrared sensor CNY70 support compatible with LEGO (bricks) pieces to be able to insert it in your robot.

A housing has been designed with OpenScad for CNY70 infrared sensor compatible with LEGO (bricks) pieces:


The source code of the file OpenScan and the STL files to print it with a 3D printer, you can find them here:

3D printing:

Download the STL file and print it.

(Suggested) printing parameters:

Height of layer (mm): 0.3

The parecedes thickness (mm): 0.8

Upper and bottom part thickness (mm): 4.2 (very important, but break the top cylinders)

Filling: 15%

(Mm/s) printing speed: 30

Without brackets

Without platform accession


All the components shown below in an image.


As we can see in the picture, from left to right we will need:

  • A 220Ω resistance.
  • A 47KΩ resistance.
  • Two wires of different colors.
  • Heat-shrink plastic.
  • Sensor CNY70
  • Three-pin male connector.
  • Printed top of bracket.
  • Print in 3D.

The first step would be to place the heat-shrink plastic and solder wires and resistance to the CNY70 according to the connection diagram shown below.


You should obtain something like this:


Secondly, we put the cables through the hole in the sensor CNY70 and lift them up with the help a pliers or a screwdriver, then solder the three pin connector, as shown in the following image.



After entering three-pin connector into the slot already you have finished the sensor housing. On the top of the sensor, we have also designed a cover, as shown in the resulting images.



%d bloggers like this: