Lego color sensor api for osek? Any datasheet available?

Discussion specific to the intelligent brick, sensors, motors, and more.
Post Reply
noeyewar
Posts: 12
Joined: 30 Oct 2010, 15:51

Lego color sensor api for osek? Any datasheet available?

Post by noeyewar »

Hi
one of the other students would like to use the lego color sensor for a nxt-osek project. However a api does not seam to be available. Anyone knowing of a third-part api for this sensor?

My first thought was, what the heck. I will make it myself! (has never tried that before), but after been through both google and lego's website i cannot find a datasheet for this sensor. Is there anyone who can provide me with a link? (i guess i need information regarding i2c)

Thanks in advance
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: Lego color sensor api for osek? Any datasheet available?

Post by gloomyandy »

Hi,
The Lego color sensor does not use i2c, nor as far as I know is there any data sheet available. It is a rather odd sensor using a combination of a bit banged serial protocol on the digital I/O lines and being the only sensor I know of that uses the AT91 A/D input to allow high speed reading of the analogue input... I implemented the leJOS support based on the code in the Lego firmware, so you could always take a look at that. The source for the leJOS code is here (sorry it is a little complex due to the way we had to bury it as part of a the sensor port class to allow remote access, via LCP to it)....
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
The code you are interested in starts around line 200 and is the ColorSensorClass...

Good luck!

Andy
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Lego color sensor api for osek? Any datasheet available?

Post by mattallen37 »

The lego color sensor is not I2C, but rather it uses a protocol that lego designed specifically for it. I have no info on it, but I just know that it isn't I2C. If it was, then the registers would likely be very easy to figure out how to use. If you misspoke, and you are talking about one of the HiTechnic color sensors, then those ARE I2C, and you can find all the I2C info on the HT website.

Edit: sorry for some repeat information, it looks like Andy beat me by a minute.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
noeyewar
Posts: 12
Joined: 30 Oct 2010, 15:51

Re: Lego color sensor api for osek? Any datasheet available?

Post by noeyewar »

Thank you very much for the great replies.
gloomyandy wrote:Hi,
The Lego color sensor does not use i2c, nor as far as I know is there any data sheet available. It is a rather odd sensor using a combination of a bit banged serial protocol on the digital I/O lines and being the only sensor I know of that uses the AT91 A/D input to allow high speed reading of the analogue input... I implemented the leJOS support based on the code in the Lego firmware, so you could always take a look at that. The source for the leJOS code is here (sorry it is a little complex due to the way we had to bury it as part of a the sensor port class to allow remote access, via LCP to it)....
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
The code you are interested in starts around line 200 and is the ColorSensorClass...

Good luck!

Andy
I took a look at the code and must admit that I will be needing way more than just luck to get anything to work :shock: I assumed it was based on I2C and it seamed quite achievable to work with. I leave him to find a solution on his own.
But thanks for the replies anyway.
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests