ANY-maze Help > I/O devices supported by ANY-maze > Legacy I/O devices > The ANY-maze interface (AMi) > The AMi ports > The AMi General Purpose I/O ports > Connecting photobeams to the GPIO ports

Connecting photobeams to the GPIO ports

Introduction

The easiest way to connect a photobeam to AMi is to use one of our AMi specific 'photobeam devices'. Nevertheless, that's not to say that you can't connect other photobeams; you can, and they'll benefit from AMi's intelligent photobeam features.

  
 Connecting a photobeam to a GPIO port 
 Configuring a GPIO port for use with a photobeam 
 AMi's intelligent photobeam features  

Connecting a photobeam to a GPIO port

The AMi GPIO ports have been designed with photobeams in mind, and to connect one is very easy - you simply have to connect the emitter to pins 1 and 2 and the detector to pins 3 and 4 - see figure 1 below.

  

  

Figure 1. A photobeam connected to an AMi GPIO port.

A photobeam emitter is usually an infra-red LED and this is the type of emitter that works with AMi. As can be seen in figure 2, you should connect the cathode of the LED to pin 1 and the anode to pin 2. If you connect the LED backwards it won't be damaged, it just won't work, so if you're not sure how to connect it, try one way and then try the other. A 150 ohm current-limiting resistor is built into AMi - see figure 2.

A photobeam detector is usually an infra-red photo-transistor, or an infra-red photo-diode; AMi is designed to work with a photo-transistor. You should connect the collector of the photo-transistor to pin 3 and the emitter to pin 4. Within AMi, the collector is connected to 5V via a 15K resistor and the emitter is tied to GND. When infra-red light falls on the device, it conducts and the voltage at the collector drops from 5V towards 0V - AMi detects this voltage drop. See figure 2.

Like for the photobeam emitter, connecting the detector the wrong way round won't damage it; it just won't work - so if you're not sure which way round to connect it, try one way and then try the other.

  

  

Figure 2. The photobeam control circuit inside AMi. This also shows the correct connections for the photobeam emitter (LED) and photobeam detector (photo-transistor).

 

By the way, the specific characteristics of the LED and photo-transistor you use are not very important to AMi (although different devices will create beams with different ranges). However, you should use devices which are spectrally matched; that's to say the photo-transistor should have its peak sensitivity at the same wavelength as the peak emission wavelength of the LED.

Configuring a GPIO port for use with a photobeam

Before you can actually use a photobeam, you need to configure the GPIO port to which it is connected as a 'photobeam port'. You can do this using the General Purpose I/O page of the AMi configuration window.

AMi's intelligent photobeam features

AMi includes some intelligent features which eliminate common problems with photobeams.

 AMi 'polls' the photobeams connected to it one at a time. This means that each emitter is switched on, the detector is 'read' and the emitter is then switched off. This process is repeated for each connected beam. The advantage of this approach is that it eliminates cross-beam interference, where the light from the emitter of one beam interferes with another beam - see figure 3. 
 Depending on the specific devices used, AMi photobeams can work at long ranges (up to 200cm or beyond). 
 Beams are relatively immune to ambient infra-red light, unless this saturates the photo-transistor. The only problem with high ambient infra-red is that it will decrease the range at which the beam will work. 
 The specific characteristics of the LED and photo-transistor are not important to AMi as it will adapt to the devices used (although the range will vary).  

  

  

Figure 3. Although the object is breaking beam '2', the light from beam '1' also reaches the beam '2' detector, so the beam break won't be registered. AMi overcomes this cross-beam interference by switching the beams on one at a time, so with just beam '2' switched on the beam will register as broken.

 

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T1164