Materials

Micro:bit

Crickit

Infrared sensor

Jumper wires x 3 M/F

Tools

None

Difficulty

Mechanical:  Easy

Coding and Electrical:  Easy

Construction:  Easy

Infrared (IR) sensors sense objects by shining a little IR light and looking for the reflection.  If it sees the reflection it will send a signal.  That signal can be digital (on or off) or analogue (a level between 0 and 1024).  A micro controller is used to read those signals and make decision.  It can be used to sense motion, see lines, and detect objects.   

 

The TCRT5000 is an infrared reflective sensor.  It contains both the IR light and the IR receiver.  It can be used to sense objects or follow a line

The TCRT5000 IR sensor has 4 pins. 

VCC is power (3.3v-5v)
GND is ground
DO is Digital out
AO is analogue out

The TCRT5000 connects to the Signal I/O header on the Crickit controller

3.3v connects to VCC
GND connects to GND
Signal Connects to DO or AO depending on the application.

The code for the IR sensor is simple.  The biggest decision you need to make it if you are using the digital or analogue output.  You then use a “If, Then” statement.