Lego NXT IRSeeker2

The Lego Mindstorms NXT IRSeeker2 sensor can be used to detect an infra-red beacon or signal or ball and may be connected to a PICAXE using an I2C bus and controlled by appropriate PICAXE I2C commands.

LEGO and MINDSTORMS are registered trademarks of the LEGO Group. I2C is a registered trademark of Philips Semiconductors Corporation.

Related Commands:

Print Page




Using the Hitechnic NXT IRSeeker V2

This is a sample program for the Hitechnic NXT IRSeeker V2 (part NSK1042) using the AXE216 i2c Explorer Kit with a PICAXE-20X2. Please remember IRSeeker V2 requires 9V power on wire 1 of the NXT jack plug.
' **** Tested using a Hitechnic robocup ball (version RCJ-05) ****

Code Example:
#picaxe 20x2

; **** AXE216 i2c Experimenter Board Setup ****
; J1	External Power	Fitted (4.5V)
; J2	SCL Pullup		Not fitted (pullup is in sensor)
; J3	SDA Pullup		Not fitted (pullup is in sensor)
; H2	9V Power		Fitted (9V)

symbol ac_direction = b10
symbol sensor1_ac   = b11
symbol sensor2_ac   = b12
symbol sensor3_ac   = b13
symbol sensor4_ac   = b14
symbol sensor5_ac   = b15

; Wires on NXT jack plug.
; Wire colours may vary. Pin 1 is always end nearest latch.
; 1 White	+9V
; 2 Black	0V
; 3 Red		0V
; 4 Green	V+ (4.5V or 5V)
; 5 Yellow	SCL
; 6 Blue	SDA
; Do not use i2c pullup resistor - already provided within sensor.

init:	; Slave address of IRSeeker2 is $10
	hi2csetup i2cmaster, $10, i2cslow, i2cbyte

	; Optional configuration of IRSEEKER2
 	hi2cout $41,($00)  	; AC mode (1200 Hz) 	RCJ-05 Ball switch pos. D 
 	;hi2cout $41,($01) 	; AC mode (600 Hz) 	RCJ-05 Ball switch pos. C
 	;hi2cout $41,($02) 	; DC mode 		RCJ-05 Ball switch pos. B
 	pause 100

main:	; read values from IRSeeker

	hi2cin $49,(ac_direction,  sensor1_ac, sensor2_ac, sensor3_ac, sensor4_ac, sensor5_ac)	
	debug			; debug display
	pause 1000		; wait 1 second then loop
	goto main
Copy Code Submit an Example

Create Module

Lego Mindstorm NXT sensors can be connected using two generic terminal block create modules to carry the SDA and SCL signals of the I2C bus.

Bill of Materials

Lego NXT Compatible socket CON070 1 Buy Now
PP3 Battery Clip BAT016 1 Buy Now


No Image Selected

Submit Your Own Code!

You must be logged in to submit code examples. Login now.