NXT reading speed

Discussion specific to the intelligent brick, sensors, motors, and more.
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

Re: NXT reading speed

Post by aswin0 »

mattallen37 wrote:If you use the fast mode (exclusive to the later versions of the EFW), I think the bus runs at about 30kbps instead of 9.6kbps.

The analog values are updated at 300Hz.

For I2C, I think you would need 400kbps in order to get readings every 0.1ms, and even then you would be really pushing it. Even 1ms read intervals is probably not possible. Based on testing I have done, it seems that using fast mode with the EFW, the read time is like 2 to 3ms.
Might I ask why you would need such speeds? There are not much sensors that can update so fast. There Is no use in querying a sensor faster than it updates nor faster then you can process it.
My blog: nxttime.wordpress.com
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT reading speed

Post by mattallen37 »

He wanted to read something like a TSOP (IR receiver) through an I2C IO expander. In that case, you would need to have super high speed updates.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
floppi
Posts: 48
Joined: 25 Jul 2012, 22:55

Re: NXT reading speed

Post by floppi »

I finally prefer buying an arduino one, i wil buy another one later if really i need.

I thought of something else : Is it possible to use A pcf8574 to make a bit-banged rs232 emulation at 9600bps ?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT reading speed

Post by mattallen37 »

floppi wrote:I finally prefer buying an arduino one, i wil buy another one later if really i need.

I thought of something else : Is it possible to use A pcf8574 to make a bit-banged rs232 emulation at 9600bps ?
An Arduino one? Do you mean Uno? "Uno" in Spanish means one, but "Uno" is also the name of an Arduino.

Possibly, but you would need super fast I2C to make that work (like maybe 400kbps).

UART with an Arduino is easy, but it's TTL levels, not RS232. You would need a MAX232 (or similar) IC to make the signals RS232 levels.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
floppi
Posts: 48
Joined: 25 Jul 2012, 22:55

Re: NXT reading speed

Post by floppi »

yes, i was speaking of an arduino uno ( translating to english permanently causes me to make this error :lol: )

Concerning RS232, the idea was to try with the NXT using this ( charge pump ) :

Image

essentially for the fun, because there is less of rs232 peripheral. ( a mouse ?)

at 2400bps ?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT reading speed

Post by mattallen37 »

If half duplex is fine, then you can use the RS485 UART.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
floppi
Posts: 48
Joined: 25 Jul 2012, 22:55

Re: NXT reading speed

Post by floppi »

The arduino has been shipped to me, just for the week-end......

My wife will not be happy :lol:
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: NXT reading speed

Post by gloomyandy »

If what you need is access to analogue data then you can use the A/D ports on the AT91. Basically you make use of one of the NXT sensor port digital pins as an analogue input (see the Lego hardware doc for the details). This is what is used by the Lego Color sensor. I'm not sure if the standard or enhanced firmware allows you to switch the pins into A/D mode and access to the resulting values. certainly leJOS does (our Lego color sensor driver is written in Java and runs as standard user code). Using this interface you can sample the analogue values very fast. If you setup the hardware correctly you can basically sample the A/D values using hardware, and once you do this obtaining a value is essentially the same as reading a memory address. In leJOS we have the hardware sample rate set to 4MHz, which is faster then a leJOS program can actually make a call to read a new value and do anything useful with it.

Having said all of that, for your application it probably makes more sense to go the route you are currently going and have an additional microcontroller do all of the low level stuff...

Andy
floppi
Posts: 48
Joined: 25 Jul 2012, 22:55

Re: NXT reading speed

Post by floppi »

So,

NXT, Arduino and PCF8591 on I2C bus works well. ( thanks to mattallen37 ! )

Arduino is used to

- have a 1024bit analog input ( more precise than NXT ) to detect resistive value of conductive foam.
- manage IR LED to drive Lego PF motor.
- manage PCF8591 to add more analog input. ( sound detector, photoresistor, motion detector )

So the the NXT will be quiet to drive his ultrasonic sensor and motors.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT reading speed

Post by mattallen37 »

You mean 10 bit? A 10 bit number is a number between 0 and 1023. The NXT and Arduino both have 10 bit ADCs (although the analog inputs on the NXT have permanent 10k pullup resistors).

How are you controlling the IR LED? I wrote an Arduino library for that as well, in case you're interested.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 21 guests