Using the FindBall NXT with an NXT Jan 08, 2014

FindBall NXT Example NXT Robot

This is the first of four posts that will demonstrate using the FindBall NXT (or FindBall Open) with a LEGO® NXT, a LEGO® EV3, an NXT and RobotC, and an Arduino. This post covers how to use the FindBall with the LEGO MINDSTORMS NXT software. The FindBall NXT is also fully compatible with an EV3 and the LEGO MINDSTORMS EV3 software. To use it on an EV3, just use the EV3 ultrasonic block that is available for download.

To demonstrate the FindBall NXT, we built and programmed an NXT to chase the standard RoboCup Junior (RCJ-05) soccer ball in RCJ pulsed mode (Mode A). To keep it simple, the program is the bare minimum and there are a number of changes we can think of that would make it faster and smoother.

The Robot

The robot used in testing is the very common Tribot design (in the picture above, Motor A is on the left and Motor C is on the right). The FindBall NXT (connected to port S1) is attached using a very simple T-beam structure: three beams and 4 pegs.

The Software

NXT-G Software Example of FindBall NXT Chaser (screenshot)

To utilise the FindBall NXT, simply use the default Ultrasonic sensor block. Where the block would normally measure the distance in centimetres, it will return a number between 0 and 5. A reading of 0 indicates that no ball (40kHz IR source) can be found, while a reading of 1 to 5 indicates the sensor that has the best view of the ball, with sensor 3 in the centre. A reading of 255 indicates a connection error and generally means the cable is not fully connected to either the NXT or FindBall NXT.

For debugging purposes, we used Laurens Valk's DisplayNumber block to output the current sensor reading to the screen.

The algorithm behind the software is quite simple: it is basically three cascading switch blocks that follow the logic:

  • If the sensor is 0, stop; else:
    • If the sensor is less than or equal to 2, turn right; else
      • If the sensor is greater than or equal to 4, turn left; else
        • Go forward as the sensor must be 3.

You can also download the full program.

The Result

The following video shows the program at work - it can very accurately track and follow the ball.

We also tested the exact same program outdoors during the sunniest part of the day to test its capabilities. As you can see in the short video below, the sensor is capable of working in direct sunlight but is not as effective as when it is indoors or even in shade.

More extensive testing and a longer demo video were planned, however they were cancelled because the temperature in the test area reached over 45°C while we were there.

The temperature reaches over 45°C while testing