Arduino TCRT5000 Distance Sensor

TCRT5000As a project for the Ottawa Arduino Challenge – TCRT5000 i decided to use my sensor to measure the distance between the end of an arm and some object.  The basic concept was to design a machine which would maintain a consistent distance from an obejct.  I only spent a few evenings on the project but I think I was successful in completing what I set out to accomplish.  I had a few other ideas so maybe I will try them too, but for now, this will be my submission.


Reference Material


If you are looking for help using the TCRT5000 for your Arduino check out my Introduction page over here.


Design Process


Using my favourite 3D CAD software I threw together a simple machine based on the TCRT5000 sensor riding on the bottom of the arm and a Micro 9G Servo which I had lying in the parts bin waiting for a project.   After a few hours in design mode I was ready for the fabrication.  One of the awesome things about owning a 3D printer and a Laser Cutter is that you can go from imagination to reality is such a short period of time.  After picking out some scrap pieces of hardboard from the junk pile I flicked the power switch and a few minutes later I was ready for glue it together and installing the components.  In total this part of the process maybe took half an hour of fiddling around.  I am still fascinated by this every time I make something!…


Sample Code


Next was coding.  Below is a very simple sketch I came up with to accomplish my mission.



Here are the files you can use if you would like to reproduce this project.

TCRT5000_position_sensor (Arduino Sketch)

TCRT5000 Layout (PDF File for Laser Cutter)


Photos and Videos


And finally, here is some video and photos of the project.




  1. Hello, I’m Eduardo from Brazil.

    Congratulations, a day there in the future (maybe next life, incarnation) be able to do what you do.

Leave a Reply to Eduardo castellani Cancel reply

Your email address will not be published. Required fields are marked *