Robin Newman’s Lego© Mindstorms© Page A beginner’s journey 9

A kleekbots robot to sort coloured balls

This project explores the use of the kleekbots system which allows the remote control of Lego NXT robots via the internet.

THe robot in question is based on the coloursorter in project 4, with two differences. First, the colour sensor and associated mounting pieces are removed and replaced with an iPhone 4 camera. Secondly, the programs use to drive the robot is split into seven modules named k1, k2, . . k8 (no k5!) which are controlled by the kleekbots system.

To build the project, first build the project 4 coloursorter using these instructions. (You can try out this model and get fuller details from Page 7 on this site). Then go through the iphonemount instructions, which remove the colour sensor and build a cradle to hold the iPhone. This cradle is designed so that it can be built together with the colour sorter robot using only parts from a single 8547 Lego set.

If you have loaded the software for project 4, delete it from the NXT brick and instead, download the file kleekbots.zip which contains the programs you need. unzip the file and you should see seven files named k1loader, k2, k3, k4, k6, k7 and k8

To keep this in a separate area start your Lego Mindstorms program and create a new profile called kleekbot (using the manage profile command on the edit menu). A folder called kleekbot should be created, which will be located inside your LEGO Creations folder, at the location LEGO Creations\MINDSTORMS Projects\Profiles\kleekbot. Copy the seven files here, and then return to the Lego Mindstorms program. Select the new profile kleekbot from the popup list at the top of the screen, if you have not already done so, and then use the file menu to load in the seven programs one by one. Note the program k1loader will create the program k1 and also load in the three MyBlocks programs used by the other programs.

You need to compile and download ALL SEVEN programs to your NXT brick. If you do it in the following order you can test each program in turn with the following sequence:

  • Select k7 and press the Download and Run Arrow on the Mindstorms Program. You won't see anything happen but a datafile will be created on the NXT brick
  • Select k6 and press the Download and Run Arrow. The gate motor on the bot should close the bottom gate rod
  • Select k1 and press the Download and Run Arrow. The bot should say blue, move one position to the left and then rotate the gate (to release a ball)
  • Select k2 and press the Download and Run Arrow. The bot should say green, move one further position to the left and then rotate the gate (to release a ball)
  • Select k3 and press the Download and Run Arrow. The bot should say yellow, move one further position to the left and then rotate the gate (to release a ball)
  • Select k4 and press the Download and Run Arrow. The bot should say red, move one further position to the left and then rotate the gate (to release a ball)
  • Select k8 and press the Download and Run Arrow. The bot should say no object detected and rotate the gate and move back to the initial position
  • All being well you are now ready to connect up the kleekbots system.The iPhone uses a program called ipCam which can be downloaded from the Apps Store. It is currently GBP 1.49 to purchase, and lets you view the camera output remotely via a wifi connection on a web browser. Beware, it does flatten your battery fairly quickly. You can sign up and connect to the kleekbots site at www.kleekbots.com You will need at least the Apprentice Account. Connect up your NXT brick according to their instructions. You can use either USB, or (better) Bluetooth connection to the brick. Select the appropriate AnyBot connection. Start the ipCam app on your iPhone (use an Android with appropriate software if you wish, although you may have to modify the cradle to suit) and place it on the cradle with the lens at the top looking downwards. Select a suitable ip address as detailed on the kleekbots page, and switch to the control page and try and run a sequence. There is a movie on youtube showing the bot in action on this link

    If you build the project let me know how you get on at email robin dot newman at gmail dot com