Wednesday, March 10, 2010

Solved One of Many Problems

One MAJOR issue with programming MARVIN is NXT to NXT communications. I am putting six NXTs on this next version, so you can see where the issue is at. RobotC allows only one to one communications, while NXT-G allows up to four to communicate with one being the master so the slaves can't communicate directly. I think I have simultaneously solved both problems.

Enter the light sensor. Imagine six light sensors facing each other in a circle inside a dark box. Now imagine one of the sensors sending out a short stream of blinks in a code. The other sensors will pick up the light emitted from the sending sensor. It works, and it works well (so far)! The light doesn't turn on and off as quickly as the LED, but I can get a single blink on and off in less than 50 ms. So in a second, I can send a stream of blinks 20 blinks long. If you use a binary system like I have, you can send an elaborate coded message in a pretty short time. It doesn't compare with the speed of Bluetooth, but with this system, I could possibly leave the Bluetooth function unused. I like that thought.

And possibly the best part of the setup is that I don't have a master and a slave, each NXT can equally send and receive messages! Sweet! This has even got me thinking about throwing my other two RCXs in the picture, but I would likely use them purely as slaves. I have no idea what I would have them doing.

The possibilities are ENDLESS!


  1. I hope you're building the three laws of robotics into this thing or you might be in trouble later.

  2. Chris,

    Is there a reason you are not using RS485?

    - Xander

  3. I take no responsibility for what the robot does after he is built...(world domination...bwaaa ha ha ha ha ha!)

    Xander, yes, there is a good reason why..I don't know how. But you know me, I am always up for a good lesson. (cough cough hint hint)

  4. A thought--maybe use LeJOS? (It's an NXT firmware that incorporates a JVM; you program it in Java.) That provides a pretty complete and open source API to the NXT functions; it might well be possible to connect the NXTs using cords in their sensor ports, though you'd have to largely write the code to do so (maybe by bastardizing the I2C API). The downside, of course, is that you have to rewrite your existing code in Java.