Real time bluetooth communication between PC and NXT?

Post your NXJ projects, project ideas, etc here!

Moderators: roger, imaqine, 99jonathan

New User
Posts: 1
Joined: Tue Feb 12, 2008 5:53 pm

Real time bluetooth communication between PC and NXT?

Postby horgh » Sat Feb 16, 2008 9:31 am

I'm starting a project for my master thesis. What I need is communicating between PC and NXT over bluetooth. This should happen in real time. I have a model of surroundings running on PC, and this model should change to respond what Lego robot senses.


Explonation for the image:

1. User writes code to control the robot. User maybe knows there is an obstagle, and tries to make
the robot to turn before crashing to it.
2. Program is run -> Robot crashes to the obstagle.
3. The robot sends information about what happened to the computer.
4. Computer changes the model to respond the real world situation.
5. New code is sent to the robot.
6. Robot turns in the right place, avoids the collision and has learnt something about the surroundings.

Now I'd need some technical information on how to do it? Is it even possible? What I need to do?

Thank you for your interest towards my project if you reached this point.

leJOS Team Member
Posts: 949
Joined: Mon Feb 05, 2007 1:27 pm

Postby lawrie » Sat Feb 16, 2008 11:27 pm

This is all quite possible.

You need some form of data logger on your PC to record the collision. For example you program could use a Pilot class to execute movement commands and a touch sensor to record a collision. After a collision, the robot could stop and record its position.

When the program stops for any reason, you should send the log back to the PC over Bluetooth.

You could possibly use lejos.util.Datalogger or base your own data logging on it.

You would probably be better having a program on the NXT that responds to commands send over Bluetooth, and change the commands that you send when you learn about the environment, rather than compiling and uploading a new program.

It should be an interesting project.

User avatar
Active User
Posts: 81
Joined: Tue Oct 16, 2007 7:28 pm
Location: Prague

Postby PatrickLismore » Thu Feb 21, 2008 9:14 pm

definintly check out the "samples" folder contained with in Lejos and Icommand there are some very useful programs, that you can build upon for your project.

New User
Posts: 2
Joined: Sun Nov 01, 2009 9:40 am

Postby kjhertz » Sun Nov 01, 2009 10:19 am

Your thesis might be done already but I had a similar idea but I will not try making a model of the environment.

My idea is to write code for an exploring robot basically as it would look if used directly on the NXT brick. But instead I intend to install a real-time communicating protocol on the NXT brick and run the program on my PC having all the signals to/from sensors and motors take the extra way over the bluetooth connection.

User avatar
New User
Posts: 23
Joined: Thu Mar 13, 2008 2:36 pm

Postby BHCluster » Thu Jan 28, 2010 5:55 pm

Hi there
I did my thesis on the same subject and it is posted here on the forum ( It is worth a look and if you have any questions just ask.
Hope it helps.
leJOS (on NXT)
Installation and Setup Guide
Application Manual

Return to “NXJ Projects”

Who is online

Users browsing this forum: No registered users and 0 guests