I have built machine powered by an Arduino running a couple of Step Motors. I am now adding an IR sensor the the machine. For connecting the step motors i have found pretty good guides on the internet on how to connect them to get the Arduino to control them. With this addional IR sensor added i am entering uncharted territory. So my question is how to read this data sheet for the IR sensor TCRT5000 and get an understanding on how to connect the piece to existing project (which output go to ground, 5V and to the controller?)

Here is the data sheet for the product i am planning on adding to my existing project. http://www.vishay.com/docs/83760/tcrt5000.pdf

How do you work when connecting new unknown products to your existing projects? Do you read that sheet and just know how to connect it, or do you use some kind of program to write a "blue print" of how to connect it?

Like this sheet on how to connect a bipolar step to its driver and to the arduino: enter image description here

It's a nice blueprint to use for a beginner on how to connect the different pieces together. Do you make your own version of that for a piece you are adding before actually start soldering and connecting it?

  • 3
    \$\begingroup\$ +1 to counter the fly-by downvote. The question is valid enough, and one that many newcomers face. \$\endgroup\$ Apr 23 '13 at 10:40
  • \$\begingroup\$ Thanks. I have tried to write a thorough question, please comment on what i can improve instead of down voting. Is it too broad? I really want to learn how to connect new devices to my projects without just buying from the ardino beginner sites \$\endgroup\$
    – bogen
    Apr 23 '13 at 10:44

You are asking multiple things, not just how to understand how the part works, but also how to implement it into your project.

The first is how the part works (reading the datasheet). It varies on the part. Some are simpler than others, and you can implement a given part without having to understand everything in the sheet. For instance, your sensor, is pretty simple. It is basically an IR LED, and a Transistor in one package. Except the transistor is triggered by the Led (or IR reflections) instead of a base pin. You can get that from the internal diagram and the description on Page 1. Since the part is simply enough, there is no "recommended" or "reference" design, a led and transistor are that basic. Give the LED it's forward current and voltage, it shines, and if it reflects of something, the Transistor senses it, and the transistor is turned on proportionately to how much it senses.

Next, is how to implement it into your design. Again, it varies based on what hardware you have, what you actually want to do with it, and your code. Generally speaking, you have to decide your goal, before you add it in. For the IR sensor, do you want to control the motor directly with it? Do you want the Arduino to control the motor based on the sensor? Do you want the sensor to control something else? Or even simpler, do you want the machine to follow a line, or avoid collisions, or speed up when it sees something? Once you define that, it's easier to figure out how you should connect it.

And, being a beginner, not know HOW you should connect it to something else, but knowing how it works (datasheet) and what you want to do, you google. Since you are using a simple part, in a common design (a robot), and you are using an Arduino, you can find tons of help on it.

Last, the blue print. Commonly, it is called a Schematic. A schematic is a logic diagram of how things should be connected. Not physically, but logically. A blueprint is more of a wiring diagram, a circuit board layout. (There is some overlap, and there are hybrids [Fritzing is one, for breadboard layouts]). For the most part, there is no software that will automatically make a schematic for you. You have to build it yourself, based on the information you have on the parts you are using, which is where Datasheets and Pinouts come in. You have to have some understanding of what parts you need, how they interact, and what symbols mean what. But the devil is in the detail. The bigger parts are easier to add in, it's all the small passive parts that are needed that are harder to understand.

In a general case, if you want to use the sensor as, well, a sensor for the Arduino to act on, you would need to connect it like this:

enter image description here

This gives an inverted logic. When the Transistor (in the sensor) is off, not conducting, the Output is held HIGH because of R2. When the sensor sees IR from the led, it starts conducting, and Output starts to go low. The output would be connected to a analog in pin on the Arduino. You would read the state of the pin, and based on your code, do X if the Pin is Y or under Y or Over Y or between Y and Z, etc.

Here is an example of a similar sensor being used with an arduino.

  • \$\begingroup\$ Switching Q1 and R2 around should give positive logic. \$\endgroup\$ Apr 25 '13 at 7:13
  • \$\begingroup\$ Passerby that last link looks very suspicious. You better check it because I keep getting redirected to random websites. \$\endgroup\$
    – Bradman175
    Jun 13 '16 at 23:56
  • 1
    \$\begingroup\$ @Bradman175 dead link, the domain got taken over. Damn cyber squatters. Thanks \$\endgroup\$
    – Passerby
    Jun 13 '16 at 23:58

There are two parts that need connecting to your MCU, an infra red LED and a photo-transistor.

The LED has a maximum rated continuous forward current rating of 60mA so I would operate it below this figure at 40mA. According to figure 4 it will need about 1.2V across it to achieve 40mA so then you can calculate a resistor from (say) 5V. The resistor will have 3.8V across it and permit 40mA therefore its resistance is 95ohms. This is in series with the LED and together they are connected across your 5V supply. But you may decide to run at 10mA forward current - see below.

Then there are a bunch of graphs and values in tables that tell you how to calculate the collector current of the sensor based on distance from a reflective surface. The upshot of this that at a reflective distance of 12mm, expect the sensor's collector current to be about 1mA when the LED is powered with a forward current of 10mA.

Based on what I've seen I'd connect the emitter of the sensor to ground and put a 3k3 resistor between collector and 5V. Then I'd wire the sensor to an analogue input on your arduino and do some trials to see what you get in terms of signals versus reflecting distance.


Its a nice blueprint to use for a beginner on how to connect the different pieces together. Do you make your own version of that for a piece you are adding before actually start soldering and connecting it?

Yes, definitely. Always do a circuit diagram or schematic before building a design, even if it's just a quick sketch in pencil on the back of an envelope. There are circuit diagram creation programs, but they don't really provide any assistance to beginners. (There will be lots of design assistance features in the higher end programs, but you have to know what they mean).

As to where the design itself comes from, the circuit diagrams in datasheets are a good starting point. There will also be manufacturer "reference designs" or "app notes", some of which you can just implement directly or with small modifications or accessories.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.